You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(host-service): exercise session scan limits with small directories - #9665
Two tests created and removed 7,000 directories to reach the Claude and Codex session search limits. Pass a small limit through each store for the tests and exercise the incomplete-search result on real directories. Normal callers still use 5,000 and 2,000 respectively.
How I tested it
On this branch, macOS arm64 with Bun 1.4.3 and TERM=dumb: from packages/host-service, bun test src/terminal-agents/harness-sessions/claude.test.ts src/terminal-agents/harness-sessions/codex.test.ts — 17 pass, 0 fail.
Lint and typecheck passed on the combined verification checkout
Allow maintainer edits
Signed CLA
Summary by cubic
Makes the session-scan-limit tests pass a small cap through each store so they no longer create thousands of directories to trigger the incomplete-search result.
The Claude and Codex tests now exercise their scan caps with just a few real directories instead of creating 7,000. Production callers keep the existing 5,000 and 2,000 defaults.
Written for commit 68e091a. Summary will update on new commits.
Summary by CodeRabbit
Improvements
Session checks can now limit how many project directories they scan, helping keep lookups bounded in large directory trees.
When a scan reaches its limit, the result distinguishes an incomplete search from a complete search that found no session.
No actionable comments were generated in the recent review.
Walkthrough
Claude and Codex session searches now accept an optional per-call directory limit. Each search uses that limit to decide whether a miss is complete. Tests exercise capped searches through the session stores.
Changes: Harness session search limits
Layer / File(s)
Summary
Pass scan limits through session searches packages/host-service/src/terminal-agents/harness-sessions/claude.ts, packages/host-service/src/terminal-agents/harness-sessions/claude.test.ts, packages/host-service/src/terminal-agents/harness-sessions/codex.ts, packages/host-service/src/terminal-agents/harness-sessions/codex.test.ts
Claude and Codex search functions use an optional per-call limit instead of relying only on the fixed cap. Their stores forward the limit. Tests call the stores with explicit caps and check incomplete searches.
This change lets the Claude and Codex session searches take a per-call directory limit and makes their tests lighter. Normal callers keep the existing limits, so the risk of merging is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title uses conventional commit format and names the main change: tests now exercise session scan limits with small directory counts. The changeset adds a per-call directory limit to the Claude and…
Description check
The description covers the what and why, and it gives concrete testing steps with results. The title checklist item is ticked, but the description does not link an issue and does not include screensho…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title uses conventional commit format and names the main change: tests now exercise session scan limits with small directory counts. The changeset adds a per-call directory limit to the Claude and Codex session stores and rewrites the tests to use it, so the title matches the primary change.
Full details: Description check
Explanation
The description covers the what and why, and it gives concrete testing steps with results. The title checklist item is ticked, but the description does not link an issue and does not include screenshots. Screenshots are not needed here because the change is test-only and not user-visible. The description says lint and typecheck passed only on a combined checkout, not on this branch alone, so the reviewer must rely on that claim. The template's sections are all present and filled in.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Two tests created and removed 7,000 directories to reach the Claude and Codex session search limits. Pass a small limit through each store for the tests and exercise the incomplete-search result on real directories. Normal callers still use 5,000 and 2,000 respectively.
How I tested it
bun test src/terminal-agents/harness-sessions/claude.test.ts src/terminal-agents/harness-sessions/codex.test.ts— 17 pass, 0 fail.Checklist
Summary by cubic
Makes the session-scan-limit tests pass a small cap through each store so they no longer create thousands of directories to trigger the incomplete-search result.
The Claude and Codex tests now exercise their scan caps with just a few real directories instead of creating 7,000. Production callers keep the existing 5,000 and 2,000 defaults.
Written for commit 68e091a. Summary will update on new commits.
Summary by CodeRabbit