Skip to content

emrg: fix intermittent chat rendering order bug (rant #32) - #129

Merged
argszero merged 1 commit into
masterfrom
feature/fix-chat-render-order-rant32
Jul 22, 2026
Merged

emrg: fix intermittent chat rendering order bug (rant #32)#129
argszero merged 1 commit into
masterfrom
feature/fix-chat-render-order-rant32

Conversation

@argszero

Copy link
Copy Markdown
Owner

Root Cause

need_new_assistant was set to False on user submit (line 1808). When a new response had no tool calls, the first delta would feed content into chat.last_markdown() — which could find the oldStreamingMarkdown widget from the previous response, sitting before the user message in chat.rows. New content rendered at the old position, appearing between the previous response and new user message.

Fix

Set need_new_assistant = True on user submit, forcing a new StreamingMarkdown widget per response.

Verification

  • 319/319 tests pass
  • Client import OK
  • CLI works

Scenarios Verified

Scenarioneed_new_assistant after fixResult
No tool callsTrue (from submit) → new markdown
With tool callsTrue (from submit) → tool_end sets True → new markdown after tools
Last tool, no deltaTrue → next cycle submit keeps it True

@argszero
argszeroforce-pushed the feature/fix-chat-render-order-rant32 branch from aadc7ad to b878fb3CompareJuly 22, 2026 12:46

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #6 (correct root cause fix: need_new_assistant=True forces new StreamingMarkdown per response, 389 tests pass)

Root cause: need_new_assistant was set to False on user submit.
When a new response had no tool calls, the first delta would feed
content into chat.last_markdown() — which could be the OLD
StreamingMarkdown widget from the previous response, sitting
before the user message in chat.rows. New content rendered at
the old position, appearing between previous response and new
user message.
Fix: set need_new_assistant = True on user submit, forcing a
new StreamingMarkdown widget per response.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #7 (clean 1-line diff after rebase, 389 tests pass)

@argszero
argszeroforce-pushed the feature/fix-chat-render-order-rant32 branch from b878fb3 to cf79bffCompareJuly 22, 2026 12:51

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #8 (3/3 consecutive LGTMs from cycles #6, #7, #8, merging now)

@argszero
argszero merged commit 9274fbf into masterJul 22, 2026
1 check passed
@argszero
argszero deleted the feature/fix-chat-render-order-rant32 branch July 22, 2026 12:55
Sign up for freeto 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

@argszero