Skip to content

fix: state ctx_search throttle thresholds as absolute call numbers#920

Open
uwuclxdy wants to merge 1 commit into
mksglu:nextfrom
uwuclxdy:fix/throttle-soft-cap-wording
Open

fix: state ctx_search throttle thresholds as absolute call numbers#920
uwuclxdy wants to merge 1 commit into
mksglu:nextfrom
uwuclxdy:fix/throttle-soft-cap-wording

Conversation

@uwuclxdy

@uwuclxdy uwuclxdy commented Jul 5, 2026

Copy link
Copy Markdown

What / Why / How

Root cause: the pre-soft-cap ctx_search throttle line printed > Throttle: call #${searchCallCount}/${SEARCH_BLOCK_AFTER} in this window. ${softCapRemaining} call(s) before soft cap. That mixes two different limits in one sentence. The #N/8 denominator is the hard-block cap (SEARCH_BLOCK_AFTER), while "before soft cap" counts down to SEARCH_MAX_RESULTS_AFTER (default 3). Since the soft cap engages at searchCallCount >= SEARCH_MAX_RESULTS_AFTER, call #3 is already truncated, so on call #1 the old text read "2 call(s) before soft cap" and reported one more full-result call than actually remained.

Fix: state both thresholds as absolute call numbers and drop the ambiguous countdown. On call #1 with defaults the line now reads > Throttle: search call #1 this window. Soft cap (fewer results/query) at call #3, hard block at #8. Prefer ctx_search(queries: [...]) array form; it counts as one call. The now-unused softCapRemaining local is removed. The at/after-soft-cap branch is left unchanged.

Affected platforms

  • Claude Code
  • Cursor
  • VS Code Copilot (GitHub Copilot)
  • JetBrains Copilot
  • Gemini CLI
  • Qwen Code
  • OpenCode
  • KiloCode
  • Codex CLI
  • OpenClaw (Pi Agent)
  • Pi
  • Kiro
  • Antigravity
  • Zed
  • All platforms

Test plan

  • npx tsc -b --noEmit clean.
  • npx vitest run tests/core/server.test.ts green (499 tests). The source-text assertion in ctx_search progressive throttle observability that pinned the old wording was updated to the absolute-threshold phrasing.

Checklist

  • Tests added/updated (TDD: red → green)
  • npm test passes
  • npm run typecheck passes
  • Docs updated if needed (README, platform-support.md)
  • No Windows path regressions (forward slashes only)
  • Targets next branch (unless hotfix)
Cross-platform notes

Our CI runs on Ubuntu, macOS, and Windows.

  • If touching file paths, verify forward-slash normalization on Windows
  • If touching hook paths, verify no backslash separators
  • Use path.join() / path.resolve(), never hardcode / separators
  • Use event-based stdin reading — readFileSync(0) breaks on Windows
  • Use os.tmpdir(), never hardcode /tmp

The pre-soft-cap throttle line read `call #N/8 ... M call(s) before soft cap`,
which mixed the hard-block denominator (8) with a countdown to the soft cap
(3) and overcounted the remaining full-result calls by one. Report the soft
cap and hard block as absolute call numbers so both limits are unambiguous.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant