fix(cursor): emit preToolUse allow JSON under failClosed (2.5.66) - #745
Merged
leandrodamascena merged 2 commits intoAug 12, 2026
Merged
Conversation
…t block (2.5.66) Empty allow stdout is invalid JSON. Cursor IDE with failClosed: true denies every tool; Cursor CLI treats the same silence as allow. Co-authored-by: Cursor <cursoragent@cursor.com>
The first commit covered the two writeAllow() sites via tests 4/5/16. Tests 7, 17, 20, and 21 also capture those same allow returns; assert the Cursor PreToolUse contract there too so a reviewer cannot treat the helper migration as incomplete. Co-authored-by: Cursor <cursoragent@cursor.com>
leandrodamascena
force-pushed
the
fix/cursor-pretooluse-allow-json
branch
from
August 12, 2026 23:49
ae030c4 to
3561e6c
Compare
leandrodamascena
approved these changes
Aug 12, 2026
leandrodamascena
left a comment
Contributor
There was a problem hiding this comment.
Approved at 3561e6c7. I rebased the branch onto the latest v2, preserved the existing release entries, rebumped this fix to 2.5.69, and regenerated all seven distribution trees.
The implementation correctly emits {"permission":"allow"} on every successful Cursor preToolUse guard path while preserving fail-closed denial behavior. Package parity, typecheck, and the focused adapter/version suites all pass (33/33). The PR is now mergeable; we're waiting for CI.
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.
Fixes #743
Summary
Cursor IDE blocks every tool call on the AI-DLC Cursor harness because
preToolUseisfailClosed: trueand the adapter allow path returnsexit 0 with empty stdout. Empty stdout is invalid JSON; the IDE denies.
Cursor CLI (
agent) treats the same silence as allow, so #661'sCLI-only live verification missed this.
Changes
harness/cursor/hooks/aidlc-cursor-adapter.tsguards: write{"permission":"allow"}on both allow returns (Task spawn andpost-guard loop). Deny JSON and
failClosed: trueare unchanged.paths; deny / malformed input still deny.
docs/guide/harnesses/cursor.mddocuments the allow|deny JSONcontract (empty stdout is an IDE deny).
dist/viabun scripts/package.ts(not hand-edited).2.5.66(README badge + CHANGELOG).#731already claimed2.5.65.User experience
Before: Cursor IDE:
Hook "bun .cursor/hooks/aidlc-cursor-adapter.ts guards" returned no outputon every tool. CLI: tools run.After: IDE and CLI both allow when the guards allow. Deny still
blocks with
{"permission":"deny","agent_message":...}.Upgrade: refresh
dist/cursor/and rerunbun dist/cursor/install.ts /path/to/project.Checklist
Test Plan
bun scripts/package.ts --checkbun test tests/unit/t276-cursor-adapter.test.tsbun test tests/unit/t68-version-changelog-sync.test.tsbun tests/run-tests.ts --smoke --unit(t276/t68 green; t248 andt255 failed in isolation on this machine and are untouched by this
diff)
dist/cursor/into/tmp/aidlc-cursor-verify; Read ofAGENTS.mdwas allowed;bun .cursor/tools/aidlc-state.ts approvewas denied by thestate-transition guard
Acknowledgment
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of the
project license.