Repository navigation
fix(hooks): advise results no longer carry permissionDecision allow - #519
abhiishek-sharma wants to merge 1 commit into
Conversation
toCanonical() emitted permissionDecision allow for advise results, which auto-approves the tool call in the IDEs that honor it, and sets permission allow on Cursor. Emit additionalContext only, leaving the decision to the IDE's normal permission flow, as the Codex adapter already does. Update the tests that pinned allow and add a toCanonical regression test. Fixes griddynamics#486 Signed-off-by: Abhishek Sharma <abhisheksharmaa1404@gmail.com>
|
@abhiishek-sharma thank you for this. One open problem: we cannot show that the advisory still reaches the model once the decision is removed. Why it matters: Evidence: the repo contracts do not cover this case for pre-tool events.
Please show how the advisory reaches the model on these IDEs without a decision, or explain why it is safe as is. One example of evidence: a live run where a repeated read makes read-once return context only, and the model quotes it. Separately, |
Fixes #486
What was wrong
toCanonical()insrc/hooks/src/runtime/run-hook.tsreturnedpermissionDecision: 'allow'for everyadviseresult.adviseis meant as a non-blocking notice, but theallowdecision means auto-approve (skips the permission prompt; see the hooks docs underdocs/hooks/), and Copilot's contract says to omit the decision for normal flow. So a heads-up fromdangerous-actions(for example a credential-file write) orread-onceapproved the tool call. Cursor gotpermission: allowtoo. Only the Codex adapter already dropped it.What changed
toCanonical(): theadvisebranch now returnsadditionalContextonly, with nopermissionDecision. This applies to every IDE and to both PreToolUse and PostToolUse advise results.denyandallowresults are unchanged.allowon advise output (dangerous-actions, read-once, md-file-advisory, lint-format-advisory, and the per-IDE e2e read-once tests) to expect nopermissionDecision/permission.tests/to-canonical.test.ts: checks the canonical shape of an advise result, and that the formatted output for the Copilot, Cursor and Codex adapters and the default one contains noallowdecision.Tests
Run in
src/hooks:npm test(tsc, bundle build, vitest): 36 files passed, 1 skipped; 1514 tests passed, 0 failed.npx tsc --noEmit: no errors (also part ofnpm test).run-hook.tsreverted): 37 tests failed, including the 4 new ones, so the tests fail without the change.Not run: no separate lint step exists in
src/hooks; no IDE was run live, the e2e tests feed recorded payloads through the real hook runner. I did not bump a version, sincesrc/hooks/package.jsonhas none.