test(host-service): exercise session scan limits with small directories

PR
2h ago
+36-22

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

  • 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.
  • This patch was also part of the combined macOS verification for #9625: all 30 repository test tasks passed in one uncached run, with default workers and timeouts. Repo-wide lint and typecheck passed on that combined checkout.

Checklist

  • Conventional PR title
  • 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.

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.