Skip to content

Desktop: a prompt answered in the terminal is only retired while its chat tab is open #782

Closed

Description

@alexeyzimarev

Follow-up to #769 / #770.

Since #770, a pending AskUserQuestion (or any permission request) that the user answers in the terminal is withdrawn once the transcript shows the tool's tool_result: the Chat tab correlates the result's tool_use_id with the pending request and sends the resolve frame with decision withdraw, which the daemon settles as withdrawn / tool_settled and relays to the server.

The correlation lives in ChatTabViewModel, which only exists for the agent whose workspace is open. For every other agent:

  • the NEEDS YOU badge in the session rail and the pending count keep showing the stale request until that agent's tab is opened or the agent exits;
  • the daemon's broker keeps the request pending, so a resubscribe replays it, and the server's pending request is never closed either.

The daemon cannot see a terminal answer on its own: the PermissionRequest hook stays parked, and the plugin registers no PostToolUse hook, so no tool-completion event reaches it.

Options, roughly in order of cost:

  1. App-wide correlation. Move the transcript-result watch out of the chat tab into a service that tails the transcript of any agent with a pending request that carries a tool_use_id. It only has to run while something is pending, so the cost is bounded, and it clears the badge without opening the tab. Same wire path as today.
  2. Turn-end backstop in the daemon. A Stop hook fires when Claude's turn ends, and nothing can still be pending for that session at that point, so the hook could tell the bridge to withdraw the session's pending requests. Coarse (waits for the end of the turn) but app-independent, and it also closes the server side.
  3. Register PostToolUse and route a tool-completed notice with tool_use_id to the bridge. Precise and app-independent, at the cost of one loopback POST per tool call for hosted agents and a new hook in the plugin.

1 fixes the desktop symptom; 2 or 3 is what makes the daemon and the web UI agree without the desktop app being open.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions