Skip to content

fix(claude-tty): show the text Claude writes above a question before the question - #158

Merged
sleeyax merged 3 commits into
sleeyax:mainfrom
DoctorJacoby:fix/claude-tty-question-text
Oct 21, 2026
Merged

sleeyax merged 3 commits into
sleeyax:mainfrom
DoctorJacoby:fix/claude-tty-question-text

Conversation

@DoctorJacoby

Copy link
Copy Markdown
Contributor

What happened

In Auto mode, the text Claude writes just before an AskUserQuestion didn't show in Paseo until after the question was answered. The card showed the question alone, with nothing to explain it. Example: "Post the six drafted replies?" with the drafts it refers to missing until after you answer.

Claude Code holds the whole assistant message back from the transcript until every PreToolUse hook has returned, but only in Auto mode. The adapter raised the question card from inside its PreToolUse hook and kept that hook open until someone answered. Its transcript drain before the card ran correctly, but the text wasn't in the file yet.

Measured against Claude Code 2.1.306, with a PreToolUse hook that sleeps 25 seconds and a prompt asking for three sentences followed by a question:

  • Auto mode: the text and the tool_use were written 25 seconds after they were created, right when the hook returned.
  • Auto mode with no hook, and Default mode with the hook: both were written immediately.

In a live session on the provider, the transcript still had nothing of the message four minutes after the card went up.

What this does

  • handlePreToolUse lets an AskUserQuestion through with {} and raises no card. It still records the call, so the PermissionRequest that follows is matched to it.
  • Claude then raises a PermissionRequest for the question. handlePermissionRequest already handled questions as the fallback for a killed PreToolUse hook: it drains the transcript, raises the same card under the same <tool_use_id>-questions id (the one the plugin files answers under), and answers with the answers as updatedInput. That path is now the only one for questions.
  • ExitPlanMode stays on PreToolUse.

Before relying on the PermissionRequest path, I checked it directly against Claude Code 2.1.306, with a PermissionRequest hook that waits and then answers. In Default, Accept Edits, Plan, Bypass Permissions and Auto, on Haiku and on Opus:

  • the hook fired;
  • the text was in the transcript before the hook answered;
  • Claude accepted the answers from updatedInput.

The Auto-mode classifier never refused a question. That refusal was the reason for answering from PreToolUse in d1a0c16, but there it followed a killed hook.

While the card is up, Claude now shows its own question dialog in the PTY instead of a "running PreToolUse hooks" spinner. DialogWatcher already ignores the screen while interactions.pending is set, the same as for ordinary permission prompts.

Tests

  • New test: a question's PreToolUse returns {} without asking anybody, and the PermissionRequest after it raises the card under the call's own id.
  • The question tests now run PreToolUse then PermissionRequest and expect the PermissionRequest response shape.
  • The killed-hook card-reuse test now uses a plan, which still goes through that path.
  • delivers the assistant text before an interactive hook prompts now writes the text after PreToolUse returns and before PermissionRequest, which is the order Claude uses in Auto mode.

On this branch: claude-tty-acp 253 pass, 0 fail; claude-tty 125 pass, 3 skipped (no PASEO_SERVER_DIST), 0 fail; typecheck clean.

Verified live: an Auto-mode session on a dev install of this branch had the text in its timeline while the question card was open, and the answer given through paseo permit allow --input reached Claude.

🤖 Generated with Claude Code

DoctorJacoby and others added 3 commits October 21, 2026 14:58
…the question

In Auto mode Claude Code keeps the whole assistant message out of the transcript until every PreToolUse hook has returned.
The adapter raised the card for an `AskUserQuestion` from that hook and held it until somebody answered, so Paseo showed the question without the text that explains it, and the text arrived only after the answer.
In the other modes Claude writes the message right away, which is why this only happened in Auto mode.

PreToolUse now lets a question through without a card.
Claude then raises a PermissionRequest for it in every mode, which already answered questions the same way as a fallback: it drains the transcript, raises the same card under the same id, and answers with the answers as `updatedInput`.
Plan approval stays on PreToolUse.

Measured against Claude Code 2.1.306 with a hook that sleeps for 25 seconds.
In Auto mode the text and the question were written to the transcript when the hook returned, 25 seconds after they were made; with no hook, or in Default mode, they were written at once.
With the question on PermissionRequest instead, the text was written before the hook fired in Default, Accept Edits, Plan, Bypass Permissions and Auto, on Haiku and Opus, and Claude took the hook's answers every time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… asks it now

The test raised its card from PreToolUse, which no longer opens one for a
question. It now sends PreToolUse and then the PermissionRequest that
carries the card, and reads the PermissionRequest's decision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sleeyax
sleeyax merged commit 4e62a73 into sleeyax:main Oct 21, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
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.

2 participants