mu-9bri/mu-b20l solo: chronological queued-prompt commits + tracked finalize (no more stutter)#491
Merged
Merged
Conversation
added 2 commits
July 14, 2026 15:30
…s text around tool calls Every assistant text preceding a tool call rendered twice: once above the ● marker, once between it and the ⎿ result. The event log shows one canonical text block per message — pure render artifact. The wire orders text_delta… → tool_call_started → assistant_text_finalized, so at finalize time the trailing item is the ToolCall; the finalize arm only replaced items.last_mut() when it was Text and otherwise APPENDED the canonical text after the tool marker. Turn now tracks the in-flight streamed item by index (streaming_text_ix / streaming_thinking_ix): deltas extend the tracked item, finalize swaps it for the canonical text and ends tracking, and a finalize whose invocation streamed nothing pushes a fresh item instead of clobbering an earlier invocation's already-canonical one. Applied to both the text and thinking channels; order-independent.
…ion above its answer A prompt queued mid-turn was committed BELOW the whole finished turn, so the part of the turn that answered it rendered above the question (observed with a prompt typed during a blocking dialogue_poll: the in-turn answer sat above the prompt it answered). PendingInterjection now captures the live main turn's item count at queue time (splice_at). On a finished main turn, the commit interleaves chronologically per plan_splice_commit: turn items before the splice, the prompt block (keeping its queued-while-responding label), then the items that answered it as a follow-on assistant block. Bridge-gap prompts (no live turn at queue time) keep the legacy after-the-turn position, and turns with no spliced prompts keep the single-block commit path (with its finalize-mismatch diagnostic) byte-for-byte. Settlement bookkeeping is unchanged: the interleaved path returns the same unsettled still-owed ids as the drain-all path (mu-z9ol).
sahuagin
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two transcript-fidelity fixes from live operation (sessions
64dcebc762f83eb9), fixing mu-b20l and mu-9bri.mu-b20l — assistant text duplicated around every tool call ("the stutter")
Every text preceding a tool call rendered twice: above the
●marker and again between it and the⎿result. The event log shows one canonical text block per message — pure render artifact. The wire orderstext_delta…→tool_call_started→assistant_text_finalized, so at finalize time the trailing item is the ToolCall; the old last-item-only check appended the canonical text instead of replacing the streamed item.Turnnow tracks the in-flight streamed item by index (streaming_text_ix/streaming_thinking_ix): deltas extend the tracked item, finalize swaps it for the canonical text and ends tracking, and a finalize whose invocation streamed nothing pushes fresh instead of clobbering an earlier invocation's already-canonical item. Applied to both text and thinking channels; order-independent.mu-9bri — queued prompts commit in chronological position
A prompt queued mid-turn committed below the whole finished turn, so the part of the turn that answered it rendered above the question (observed with a prompt typed during a blocking
dialogue_poll).PendingInterjectionnow captures the live turn's item count at queue time, and the commit interleaves perplan_splice_commit: items before the splice → the prompt (keeping its queued-while-responding label) → the items that answered it.Deliberate granularity: the item boundary is authorship-correct, not an approximation — deltas still streaming into the in-flight item come from a provider call that never saw the prompt (absorption injects it at the next
InvokeLlm), so the answer necessarily begins in a later item. Bridge-gap prompts (no live turn at queue time) resolve to the next spliced prompt's position when one follows — a panel round-3 finding, fixed and pinned in tests — and to the legacy after-the-turn position otherwise. Turns with no spliced prompts keep the single-block commit path byte-for-byte. Settlement bookkeeping (mu-z9ol receipts) is unchanged.Verification
just cigreen.Gate
just ci-aipr: first panel escalated with gpt-5.5 holding a mixed-case planner objection; the objection was correct, got fixed (the[None, Some(k)]resolution above) and pinned in tests, and the re-gate converged unanimous approve in 1 round.🤖 Generated with Claude Code
https://claude.ai/code/session_01REB3QZvP3arA2cLMVRgYam