gate: AskUserQuestion hook asks the daemon, via rt gate fork-check - #391
Merged
Merged
Conversation
… resolver Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 49 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 85 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (18)
Comment |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ssion Pane ids are reused and a dead pane's gate stays open, so the pane rule now skips gone or dead-pane gates, requires the nudge session to match, and counts form gates on any subject. Parked counts for the launch subject only; cheap rules run before the run DB walk; the hook entry gets a 10s timeout. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The pane rule matches the nudge session on either the hook payload's id or CLAUDE_CODE_SESSION_ID (the one gate ask stamps), and the session rule resolves both. A pane-attention gate never allows a form under any rule. The dead-pane delivery check is dropped: no open row carries a delivery outcome. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
What broke
A pipeline pane ran
rt gate ask, gotpresentation: "form", and could never show the form.gate-fork.shkept its own idea of "this pane's gate": an exact match on the launch subject, then a grep for arun:gate whoseorigin.worktreeequals the cwd. The daemon had filed the gate underrun:<id>(the session's run), and that run records no worktree, so both branches missed and the hook denied. Its deny text also told the agent to backgroundrt gate waitwhatever the presentation was, so the agent parked on a form gate.What changed
gate:fork-check. Rules, cheapest first: an open or parked gate on the launch subject; an open form gate on any subject asked from this pane, with executor notgoneand a nudge session matching the caller's hook or env session id; an openrun:gate for this worktree; an open gate on the subjectgate:ask's own resolver gives either session. No rule counts apane-attentiongate. Anything else is a deny.rt gate fork-check(the hook endpoint). It reads Claude Code's hook stdin (session_id,cwd),HERDR_PANE_IDandRT_GATE_SUBJECT, and prints the hook JSON. A daemon that is down, or too old to know the verb, gets an allow, same as before.gate-fork.shnow only drains stdin, allows whenrtis missing or gives no verdict, and passes the payload tort gate fork-check. The tray bundle copies it at build time, as before.rt gate ask, then act on the presentation. form: ask it here with AskUserQuestion (now allowed). wait: backgroundrt gate wait <id>.gate_askMCP tool description gives the same form/wait split instead of always saying to backgroundrt gate wait.Tests
gate-fork-check-handler.test.ts: the real case (a form gate asked from this pane with no worktree allows); explicit-subject form gates allow; a stale pane id (executor gone) and a reused pane id under another session deny; differing hook and env session ids still match; wait gates and pane-attention gates (on the launch subject, a worktree run subject, or the resolved subject) deny; thepanecolumn fallback; launch subject open or parked allows; a parked resolved run subject denies; cheap rules never walk run DBs.gate-fork-check-cli.test.ts: payload building, degraded allows, and the deny text.gate-fork-hook.test.ts: rewritten for the thin script (stdin hand-off, 256 KB payload, rt missing, rt errors, old-rt usage text, empty output).gate-fork-check-cli.test.ts: real daemon, compiled binary and the shipped script. Pane rule: the asking pane and session allow, so does a hook session id that differs from the env id gate ask stamped; another pane or the same pane under another session deny. Session rule:rt runs run-startplus a subject-lessrt gate ask, then a relaunched pane on that session allows.agent-hooks.test.tspins the hook's 10s timeout;gate-wrappers.test.tscovers thegateForkCheckwrapper.lib/mcp/__tests__/tools.test.ts: checks thegate_askdescription's form/wait split.tsc, full unit suite (9144 pass, 0 fail), gate e2e files,docs:check,picker:check,repo-purity.sh.🤖 Generated with Claude Code