[WRONG BRANCH] fix(cursor): bound output guard reasoning quarantine - #347
[WRONG BRANCH] fix(cursor): bound output guard reasoning quarantine#347luvs01 wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 327635678e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (guardHeldBytes <= CURSOR_OUTPUT_GUARD_MAX_HOLD_BYTES) return true; | ||
| echoSniffer?.finish(); | ||
| routingCommentarySniffer?.finish(); | ||
| releaseGuardHeld(); |
There was a problem hiding this comment.
Inspect cap-crossing text before disarming the quarantine
When retained reasoning leaves guardHeldBytes just below 8 KiB and the next first text_delta both crosses the cap and begins with [Tool Result] or matching routing-failure commentary, this branch settles both sniffers and emits the held events before the caller feeds that text to them. The invalid marker therefore reaches the client and sets emittedOutput, preventing the corrective retry even though nothing had escaped before this delta; evaluate a cap-crossing text event with the active sniffers before deciding to flush and disarm.
AGENTS.md reference: src/AGENTS.md:L17-L19
Useful? React with 👍 / 👎.
Motivation
thinking_deltaevents so an attacker or compromised provider cannot exhaust process memory during tool-result continuations.Description
CURSOR_OUTPUT_GUARD_MAX_HOLD_BYTESand reuse it in the envelope sniffers (src/adapters/cursor/envelope-echo.ts).createCursorAdapterby addingguardHeldBytes,guardEncoder, andholdGuardEvent(event)so reasoning frames contribute to the same 8 KiB cap and trigger a flush/disarm when exceeded (src/adapters/cursor.ts).echoSniffer?.finish()/routingCommentarySniffer?.finish()andreleaseGuardHeld()to flush and disarm the quarantine so held events are emitted instead of growing unbounded.tests/cursor-envelope-echo-retry.test.ts).Testing
bun test tests/cursor-envelope-echo-retry.test.tsand they passed (all tests in that file passed).bun run typecheckandbun run privacy:scan, both succeeded.bun run test); repository-wide integration/Lab tests showed unrelated environment-dependent failures (sandbox proxy env checks, some long integration timeouts and CLI help differences) and therefore are outside the scope of this focused fix.Codex Task