Repository navigation
fix(connector): put the hard prompts bypass mode still raises on a card, and name what a waiting terminal waits on (release 0.3.8) - #967
Conversation
…rd, and name what a waiting terminal waits on (release 0.3.8) A Claude Code session in bypassPermissions mode was skipped by the approval hooks entirely, on the premise that such a session is unwatched. The prompts that still appear in that mode (a safety check such as an rm -rf on a possibly empty variable path, and AskUserQuestion) block the session until someone answers, and reached no phone: the owner got only the "waiting for you in a terminal" notice a minute later, with a bare "permission prompt". Measured with Claude Code 2.1.332 in a terminal: both raise PermissionRequest in bypass mode, and Claude Code honours the hook's allow, deny and chosen answer for them, including the safety check (classifierApprovable: false). So in bypass mode the hook now forwards the request to the card path with the usual buttons. dontAsk, claude -p, a session the connector runs, the opt-out and CLAUDE_CODE_SESSION_ATTENDED=0 are left alone as before, and so is Codex in bypass mode (unmeasured). The connector also reports waiting_on with a waiting conversation: the tool call it waits on as a card says it, read from the end of its transcript with credentials masked. Claw's notice names it and says Claude Code's reasons in the owner's language. Signed-off-by: zoroyihan7 <Yihan.Wang@amd.com>
… and show what a machine reported as characters Review findings on the first commit: - pending-tool: a later call of a run that had finished (a read) hid an earlier one that was still asking, so waiting_on was left out. The calls without a result are now collected across the newest run (several are named, oldest first, at most three), since a call without a result may also be running, not asking. - terminal-waits: the notice quoted what the machine reported (waiting_on, and likewise its name, the agent, the title and the reason) with only backticks removed, so a value such as "[Confirm](https://x)" became a link in the owner's chat. All of them go through inertMd now, as the other cards that quote machine text do. Signed-off-by: zoroyihan7 <Yihan.Wang@amd.com>
weilei0120
left a comment
There was a problem hiding this comment.
No blocking findings.
Read: connector/src/approval-skip.ts (neverAsksIn, skipReason), approval-hook.ts (how agent is passed), approvals.ts (ask() unattended-mode check, toolTitle re-export, sessionRules), tool-title.ts, pending-tool.ts (pendingToolsOfTail, pendingToolsIn, titleOf, waitingOn), attach.ts (describe → pendingCall, heartbeat summary, cleanTitle, fitResumable), claw remote-agents/terminal-waits.ts (terminalWaitText, sweep query), assistant/inert-md.ts, and the Claw protocol's capabilities check (resumable items are stored unchanged, so waiting_on passes). No other user of the removed UNATTENDED_MODES or the old toolTitle(PermissionEvent) signature in connector, claw or personal-agent; Codex bypass is still skipped both in the hook and in the broker.
Ran: connector npm ci, npm run typecheck (ok); tsx --test test/approval-unattended.test.ts test/pending-tool.test.ts test/cli.test.ts 83/83 pass; test/attach.test.ts test/approvals.test.ts 149/150, the one failure is a pid-namespace assertion of this sandbox ("linux::pid:[…]"), unrelated to the change. claw npm ci && npm run build ok; remote-agents-terminal-wait-text.test.ts 5/5 pass; remote-agents-terminal-waits.test.ts skipped here (no DATABASE_URL), CI ran it green with Postgres.
Second pass (independent reviewer over the whole diff) checked heartbeat validation, removed exports, whether a bypass-mode card can change the session mode (it cannot: only session-scoped allow rules), and transcript parsing; it added only the non-blocking truncation note below.
Non-blocking suggestions and open questions
connector/src/attach.ts:1142:cleanTitlecuts the joinedwaitingOnstring to MAX_TITLE (80), so with a first command longer than ~75 characters the second and third calls and the+N morecount are dropped, and Claw's WAITING_ON_MAX (100) never applies. The README/CHANGELOG say several calls are joined by;. Consider truncating each title before joining (or a larger cap for this field).
Reviewed by Clawy on behalf of weilei0120 (requested by Wang, Yihan), run 9fc284904459
Problem
A Claude Code session in
bypassPermissionsmode (--dangerously-skip-permissions) was skipped by the approval hooks entirely (UNATTENDED_MODES), on the premise that such a session is unwatched. A few prompts still appear in that mode, and they block the session until someone answers: a safety check (anrm -rfon a variable path that may be empty,circuitBreaker: "dangerousRemoval",classifierApprovable: false) andAskUserQuestion. They reached no phone. The owner got only the "waiting for you in a terminal" notice a minute later, with a bare "permission prompt". In one real bypass-mode session 1 of 198 permission decisions was such a prompt: rare, but each one stops the session.Measured (Claude Code 2.1.332, real terminal in tmux, a PermissionRequest hook that logs its stdin and answers on demand)
PermissionRequestraised in bypass moderm -rf $VAR/*,$VARset outside the command)permission_mode: "bypassPermissions",permission_suggestions: [], dialog shown at the same timeAskUserQuestionupdatedInput.answershonoured: "Which color? -> Blue"Also measured: Claude Code blocks the safety-check dialog itself after about two minutes ("to avoid holding up an unattended session"; no
PermissionDeniedevent, the turn ends andStopfollows). A question dialog has no such timer. A plainrm -rf /literal/pathand an in-commandD=...; rm -rf $D/*raise nothing in bypass mode.End to end with this change: the built
approval-hook.jsunder a real Claude Code in bypass mode, the realApprovalBrokerbehind the socket. The safety check became a card (Run: rm -rf $VICTIM/*, buttons Yes / No / No, and stop), Yes ran the command, No denied it with the phone's message, the question's answer reached Claude Code, an answer typed at the terminal first withdrew the card, and the card was withdrawn when the turn ended after Claude Code's own two-minute block.Change
dontAsk,claude -p, a session the connector runs,CLAW_APPROVAL_HOOKS=offandCLAUDE_CODE_SESSION_ATTENDED=0are unchanged. Codex keeps skipping bypass mode: its hard prompts there were not measured. The broker's own check (approvals.ts) follows the same rule.waiting_on, the tool calls it has no result for as a card says them (Run: rm -rf $VICTIM/*,Edit src/main.ts,Question: Which color?; several joined by;, at most three named), read from the end of its transcript (Claude Code writes the call before it asks; measured). Calls of a run are answered in any order and one without a result may be running rather than asking, so all of them are named. Credentials are masked like every title. Claude Code's own registry only says "permission prompt".waiting_on; then the reason alone is said. Everything the notice quotes from a machine (its name, the agent, the title, the reason, the calls) now goes throughinertMd, so[Confirm](https://x)is shown as characters and not as a link.toolTitlemoved toconnector/src/tool-title.tsso the card and the notice use one wording. Connector 0.3.8, CHANGELOG, README.Tests
Written first and failed before the change:
approval-unattended.test.ts(6 of 23 red),pending-tool.test.ts(module missing; after review the out-of-order case returned nothing with the first version), thewaiting_onheartbeat case inattach.test.ts,remote-agents-terminal-wait-text.test.ts(5 of 5 red at first, 2 red against the pre-review source), and T1, T10, T11, T12 ofremote-agents-terminal-waits.test.tsagainst a real Postgres (4 of 12 red with the old source). All green after: the whole connector suite (1013 tests), the Claw terminal-wait suites on a real Postgres (18), typecheck, the lint scripts,check-pack, and the public scans. CI is green.Notes
waiting_oncarries command text to Claw for every waiting terminal, as titles already do; the opt-outCLAW_APPROVAL_HOOKS=offis per process and cannot be seen from the connector.