Skip to content

Fix/user message selection and stdin deadlock - #47

Closed
a1dake wants to merge 2 commits into
Natfii:masterfrom
a1dake:fix/user-message-selection-and-stdin-deadlock
Closed

Fix/user message selection and stdin deadlock#47
a1dake wants to merge 2 commits into
Natfii:masterfrom
a1dake:fix/user-message-selection-and-stdin-deadlock

Conversation

@a1dake

@a1dake a1dake commented Jul 21, 2026

Copy link
Copy Markdown

No description provided.

a1dake added 2 commits July 21, 2026 12:49
The Formatted/Plain Text toggle only made Claude's replies selectable
(bSelectionMode was gated with `!bIsUser`); user messages stayed a
plain, non-selectable STextBlock. Give user messages the same
formatted/selectable SWidgetSwitcher pattern already used by
SMarkdownWidget, and drop the `!bIsUser` gate so the toggle applies to
both sides of the conversation.
Multi-turn conversations froze after the first reply, showing "No
output from Claude for Ns" with no tool calls ever reaching the
Agent SDK.

Root cause: ExecuteProcess() wrote the entire stdin payload (system
prompt + conversation history) to the child's stdin pipe *before*
starting to read its stdout. Windows anonymous pipes have a small
fixed buffer (~4KB). Turn 1 has no history yet, so its payload fits
in one write. From turn 2 on, the prompt carries the accumulated
history and reliably exceeds the buffer: WritePipe blocks waiting for
the child to drain stdin, while the child blocks writing its own
early stdout (e.g. the "system" init NDJSON event) because nothing is
reading it yet — a classic two-way pipe deadlock that only the
silence watchdog ever notices.

Fix: write stdin on a background thread (Async(EAsyncExecution::Thread))
so it runs concurrently with ReadProcessOutput(), letting both pipe
directions drain in parallel instead of serially.
@a1dake a1dake closed this Aug 5, 2026
@a1dake
a1dake deleted the fix/user-message-selection-and-stdin-deadlock branch August 5, 2026 18:01
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.

1 participant