fix(cursor): native adapter hardening - #101
Merged
Merged
Conversation
- Plugin-root discovery with explicit precedence (CURSOR_PLUGIN_ROOT -> CLAUDE_PLUGIN_ROOT -> cwd marker) and stderr diagnostic on miss. - Project cwd precedence incl. CURSOR_PROJECT_DIR/CLAUDE_PROJECT_DIR. - Canonical payload projection for scope dispatchers (tool_name, cwd, tool_input string->object). - `MCP:<tool>` canonicalization via a closed server table. - Doc-cache gate reachable on beforeMCPExecution (cursor-only guard). - Per-event native response schemas + exhaustive renderer. - additional_context 10,000-char cap + session-level budget ledger keyed session|event|generation|tool_use_id, fail-open, idempotent truncation. - 23 provenance-labelled fixtures + byte-level stdout tests. - Test hygiene: tmp cwd/HOME, env restore, hex-free nonce for a pre-existing flake.
Reproduced the CI failure: with HOME=tmp (dedicated per harness id) and no
planted root doc as a positive witness, a bare CI $HOME has neither doc, so
an empty additional_context was legitimate and JSON.parse("") threw
"Unexpected EOF" on cursor-context-budget.test.ts:156. The test now asserts
status===0 and stdout empty-or-valid-JSON instead of assuming non-empty
JSON, and checks the registry in the isolated HOME.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
CURSOR_PLUGIN_ROOT->CLAUDE_PLUGIN_ROOT-> cwd marker) and a stderr diagnostic on miss; project cwd precedence now honorsCURSOR_PROJECT_DIR/CLAUDE_PROJECT_DIR.tool_name,cwd,tool_inputstring->object) andMCP:<tool>canonicalization via a closed server table.beforeMCPExecution(cursor-only guard); per-event native response schemas + exhaustive renderer;additional_context10,000-char cap with a session-level budget ledger (keyedsession|event|generation|tool_use_id, fail-open, idempotent truncation).Changes
src/adapters/cursor/{context,normalize,respond,native-response}.ts(modified), newsrc/adapters/cursor/{plugin-root,native-schemas,context-limit,context-budget}.ts+interfaces/context-budget.ts.src/runtime/handle.ts,src/runtime/lifecycle/rules-root.ts,src/runtime/lifecycle/aipilot/dispatch-aipilot.ts,src/runtime/lifecycle/failure-lesson.ts— branches guarded byid === "cursor".test/fixtures/cursor/**(23 fixtures + README).CHANGELOG.md+package.jsonbumped to 0.1.92 (separate commit).Test plan
tsccleanBreaking changes
None