Skip to content

THI-422: Allow matches Bash prompts that show "This command requires approval" - #52

Merged
tdody merged 5 commits into
mainfrom
feature/notify-approval-row
Oct 30, 2026
Merged

tdody merged 5 commits into
mainfrom
feature/notify-approval-row

Conversation

@tdody

@tdody tdody commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #40 (THI-422), found during the hand checks. It replaces #51: same change, with the branch now on origin and the review's four fixes added.

For some Bash commands (python3 -c …), Claude Code 2.1.280 adds a row under the description, This command requires approval, at indent 1. dialog_matches hashed it as part of the command block, so the digest never equalled the hook's key and every Allow on such a prompt answered 409. That failed safe, but those prompts couldn't be allowed.

The change. dialog_matches skips that exact row, and only that row, when it sits at the end of the block and shallower than the command (_TRAILING_CHROME):

  • any other shallow row there still stays in the block, so unknown chrome fails closed;
  • the same text above the description, or at the command's indent, is part of the request.

The block's bounds are two _is_shallow rules: drop the leading Tip rows, then drop known trailing rows.

Tests:

  • a new real capture, tests/fixtures/permission_dialogs/bash_requires_approval.txt, added to every list of real captures: parse, own key, no other key, the hook's own key, parse_pane reading it as needs-input, and Allow through POST /api/pane/permission;
  • negative cases: ⚠ Sandbox disabled in that position fails; the known text above the description, or at indent 3, is part of the command;
  • mutation checks: with the skip disabled, the route test and 3 others fail; with the row skipped anywhere in the block, the end-only test fails.

Docs: the 2b spec's Bash matching rule names the skipped row, and its "Facts checked" list records it.

Assumption left open: the match is on the row's exact text. If Claude Code rewords it, Allow on those prompts answers 409 again (fails closed), and the new wording needs adding to _TRAILING_CHROME.

pytest 2031 · bin/check clean.

🤖 Generated with Claude Code

tdody and others added 5 commits October 30, 2026 11:24
…, not the command, so Allow matches python3 -c prompts (THI-422)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… arithmetic; the docstring says where it starts and ends (THI-422)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ays in the block, pinning the end-only skip (THI-422)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…requires approval" capture (THI-422)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s approval" row, and the facts list records the row (THI-422)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@tdody
tdody merged commit 2c4b640 into main Oct 30, 2026
2 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.

1 participant