Skip to content

fix(cursor): emit preToolUse allow JSON under failClosed (2.5.66) - #745

Merged
leandrodamascena merged 2 commits into
awslabs:v2from
szsunyuan:fix/cursor-pretooluse-allow-json
Aug 12, 2026
Merged

fix(cursor): emit preToolUse allow JSON under failClosed (2.5.66)#745
leandrodamascena merged 2 commits into
awslabs:v2from
szsunyuan:fix/cursor-pretooluse-allow-json

Conversation

@szsunyuan

Copy link
Copy Markdown

Fixes #743

Summary

Cursor IDE blocks every tool call on the AI-DLC Cursor harness because
preToolUse is failClosed: true and the adapter allow path returns
exit 0 with empty stdout. Empty stdout is invalid JSON; the IDE denies.
Cursor CLI (agent) treats the same silence as allow, so #661's
CLI-only live verification missed this.

Changes

  • harness/cursor/hooks/aidlc-cursor-adapter.ts guards: write
    {"permission":"allow"} on both allow returns (Task spawn and
    post-guard loop). Deny JSON and failClosed: true are unchanged.
  • t276 asserts allow stdout is that JSON on captured guards allow
    paths; deny / malformed input still deny.
  • docs/guide/harnesses/cursor.md documents the allow|deny JSON
    contract (empty stdout is an IDE deny).
  • Regenerated dist/ via bun scripts/package.ts (not hand-edited).
  • Version 2.5.66 (README badge + CHANGELOG). #731 already claimed
    2.5.65.

User experience

Before: Cursor IDE: Hook "bun .cursor/hooks/aidlc-cursor-adapter.ts guards" returned no output on 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 rerun
bun dist/cursor/install.ts /path/to/project.

Checklist

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Test Plan

  • bun scripts/package.ts --check
  • bun test tests/unit/t276-cursor-adapter.test.ts
  • bun test tests/unit/t68-version-changelog-sync.test.ts
  • bun tests/run-tests.ts --smoke --unit (t276/t68 green; t248 and
    t255 failed in isolation on this machine and are untouched by this
    diff)
  • Live Cursor IDE 3.15.6: installed dist/cursor/ into
    /tmp/aidlc-cursor-verify; Read of AGENTS.md was allowed;
    bun .cursor/tools/aidlc-state.ts approve was denied by the
    state-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.

szsunyuan and others added 2 commits August 13, 2026 00:48
…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 leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@leandrodamascena
leandrodamascena merged commit cbf3f30 into awslabs:v2 Aug 12, 2026
5 checks passed
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.

[Bug]: Cursor IDE failClosed preToolUse blocks all tools (empty allow stdout)

2 participants