Repository navigation
Clear Needs input when Claude moves past a prompt answered in the terminal - #14942
teamleaderleo wants to merge 8 commits into
Conversation
Claude shows its own permission prompt while the PermissionRequest hook waits on the Feed, and it lets that hook run on after the user answers in the terminal. The Feed wait, card, and sidebar Needs input overlay then stay up next to Running until the hook's deadline. These tests fail until Claude's next hook retires the answered request. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
All contributors have signed the CLA ✍️ ✅ |
Claude shows its permission prompt while the PermissionRequest hook waits on the Feed and lets the hook run on after the user answers in the terminal, so the Feed wait, card, and Needs input overlay stayed up beside Running until the ~120 s deadline. When the Feed accepts Claude's next tool call (for a prompt on a tool that never runs beside another), or the end of that agent's turn or session, it now retires the request: the hook returns neutral output, the card expires, and the overlay and banner clear. Work is matched by agent: PreToolUse telemetry now carries agent_id (also kept in the compact queued-hook fallback), and a subagent's prompts use their own request ID rather than agent_id as their journal identity so a resolved prompt no longer marks that subagent's later prompts stale. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A prompting tool can wait while a concurrency-safe sibling runs, so a later tool call only proves the answer when either call is one Claude never runs beside another (Edit, Write, MultiEdit, NotebookEdit), or the prompt is a Bash, question, or plan, which prompt alone in practice. The tool call that raised a request is now consumed once instead of matched by content, so the next edit of the same file retires an answered Edit prompt. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
CI failure attributionCI passes on Written by |
cancelNotification is file-private to FeedCoordinator.swift, so the retirement calls the existing invalidateSemanticRequest instead of a moved copy. Its snapshot already excludes replied and timed-out requests, and a racing reply's journal entry and notification clear are idempotent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Drops this branch's CHANGELOG.md line: release notes now come from the PR's Changelog section (#14934). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Closing as superseded by #15170, which fixes the same stale "Needs input" overlay after a Claude permission prompt is answered in the terminal: a later same-session, same-agent Claude hook retires the pending Feed decision, so the overlay and card clear without waiting for the hook timeout. Any remaining edge cases from this draft (per-tool sibling rules, subagent journal identity) can be raised on #15170. |
Summary
After you answer a Claude Code permission prompt in the terminal, the sidebar kept showing "Needs input" next to "Running" for up to two minutes, and the Feed card for that prompt stayed actionable. The Feed now retires the prompt as soon as Claude's hooks show it moved on, so only "Running" remains.
Why it lingered. Claude shows its permission prompt as soon as the
PermissionRequesthook starts, and when the user answers in the terminal it neither kills nor signals the hook. With Claude Code 2.1.283, aPermissionRequesthook that sleeps 60 s ran to completion after the prompt was answered, whilePostToolUseand the next tool call went ahead. cmux's hook (cmux hooks feed --source claude) therefore stays parked inFeedCoordinator.ingestBlockingWithOutcomeuntil its ~120 s deadline, and the Feed-owned overlaycmux.feed.attention:claude_codeonly clears when that wait ends. Claude's nextPreToolUsesets the agent's ownclaude_codeslot back to Running, so both rows show.What changes. When the Feed accepts a later Claude hook from the same session and the same agent (main agent, or one subagent by
agent_id), it retires that agent's pending decisions through the existing invalidation path: the hook returns neutral output, the card expires, the overlay and its banner clear, and a tool call journals the request as resolved.PreToolUseretires a prompt when either tool is one Claude never runs beside another (Edit, Write, MultiEdit, NotebookEdit), or the prompt is a Bash, AskUserQuestion or ExitPlanMode prompt, which come alone in practice. A prompt on a concurrency-safe tool (Read, WebFetch, MCP reads) can wait while a sibling runs, so a sibling call does not retire it. A read-only Bash can run beside read-only siblings, so a sibling that starts while its prompt waits retires it early; the agent's own status slot already flips to Running in that case.Stop,UserPromptSubmit,SubagentStop) retires any of its prompts;SessionEndretires every prompt in the session.PreToolUseFeed telemetry now carriesagent_id(also kept in the compact queued-hook fallback), so a background subagent's work can't clear the main agent's prompt.agent_id, so resolving one prompt no longer marks that subagent's later prompts stale.Only
claudeis affected; other agents' Feed decisions are unchanged.Related: #14493 picks one row per panel by timestamp. On its own it would show only "Needs input" after the answer, because an unchanged
Runningvalue keeps its first timestamp; with this change the overlay is gone by then, so the two compose (#14493 covers the seconds before Claude's own notification during a real wait).Testing
cmuxTests/FeedDecisionAnsweredInTerminalTests.swift), red first: on the test-only commit e57362d the changed-suites app-host lane ran it andclaudeResumingWorkRetiresPendingPermissionAndNeedsInputfailed with the overlay still "Needs input", the lifecycle still.needsInput, the request still awaiting and the card not expired (job,RATCHET_NEW_FAILURE). The subagent guard test passed there.AgentHookDeliveryQueueTestsand the Claude hook suites) (job); macOS compile admission and CLI product tests passed. EarlierCLI product testsfailures were owned-mini capacity refusals at "Set up runner" ("the gui token is taken"), not test runs.scripts/ci/guards-local.sh(Linux group, 66 steps) passed on the merge with main. No local app build (not allowed on this machine).Dogfood
Fleet build:
pr-14942-needs-input-v3, job61602660edd7ae93240ba10aon 077b878 (done on cmuxs-Mac-mini, artifactsha256:dff79251f829fd7aebd79eceda9a4fde0d3a68c79bcd9fc4a3a982a91e9e186f; later heads only merge main). Built with--backend-mode localbecausecmux-dev-backend-1doesn't resolve from the submitting Mac, sopublish-hqrefuses the artifact; the change doesn't touch backend paths. Baseline for the old behavior:pr-14942-needs-input-base-v1, job370b8dac484c2be78c2914cf(test-only commit e57362d, artifactsha256:f901b81b…).Not yet run: GUI dogfood on a fleet Mac is blocked from this session. Checks still to run, in a terminal of the tagged app (
cmux DEV pr-14942-needs-input-v3), with a realclaude(or the replay script below, which runs the exact hook commands fromcmux hooks claude inject-settingsin Claude's order):touch /tmp/x). When the prompt shows, the sidebar row shows Needs input. Answer1in the terminal. Expect the row to drop Needs input within a second of Claude's next tool call, leaving only Running; the Feed card shows expired.Reads, one outside the project. While that prompt waits, the sibling read must not clear Needs input.pr-14942-needs-input-base-v1; Needs input stays next to Running until about two minutes after the prompt appeared.Replay script
Changelog
Fixed: After you answer a Claude Code permission prompt in the terminal, the sidebar drops Needs input as soon as Claude moves on instead of showing it next to Running for up to two minutes, and the Feed card for that prompt expires
Checklist
🤖 Generated with Claude Code