fix(webui): clear stale 'Reasoning...' indicator before large-chat re-render - #1803
Open
Zenetusken wants to merge 1 commit into
Open
fix(webui): clear stale 'Reasoning...' indicator before large-chat re-render#1803Zenetusken wants to merge 1 commit into
Zenetusken wants to merge 1 commit into
Conversation
After a WebSocket reconnect mid-turn, applySnapshot sequenced the cheap agent-state updates (progress indicator, paused flag, notifications) behind 'await setMessages(...)'. On large chats the re-render can take a very long time, so a stale 'A0: Reasoning...' indicator persisted after the agent had actually finished — the Web UI appeared to still be working while the CLI (cheap render, fresh connection) correctly reported completion. Apply updateProgress, notificationStore.updateFromPoll and inputStore.paused before the render await. Log-version cursors intentionally stay behind the render so a failed render retries the same version on the next poll. Regression coverage pins the ordering in webui/index.js (discriminating: fails on pre-fix v2.8, passes with the fix).
Zenetusken
added a commit
to Zenetusken/agent-zero
that referenced
this pull request
Aug 2, 2026
…ion 1ef91c6, overlay 46998bdb2a27
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.
Problem
After a WebSocket reconnect mid-turn (e.g. container restart while a chat is open),
applySnapshotapplied the cheap agent-state fields afterawait setMessages(...):While disconnected the log version advances, so the reconnect snapshot always takes the heavy render path. On large chats (observed: 543 entries / 7.5 MB log) the re-render takes so long that the frontend shows a stale "A0: Reasoning..." progress indicator long after the agent has actually finished — the Web UI appears to still be working while other clients (CLI, fresh tabs) correctly report completion.
Root cause evidence
run_uithreads parked (py-spy dump), persisted log frozen with a finalresponseentry, message queue empty;log.progress_activeisfalsein every post-completion snapshot.extensions/python/reasoning_stream/_10_log_from_stream.py) and is never persisted; the stale display was purely frontend sequencing.Fix
Apply
updateProgress,notificationStore.updateFromPollandinputStore.pausedbefore the render await inapplySnapshot. Log-version cursors intentionally remain behind the render: ifsetMessagesthrows, the next poll retries the same log version instead of skipping it.Validation
tests/test_webui_snapshot_ordering.py(4 tests) pins the ordering — discriminating: 3 fail on pre-fix v2.8 code, all 4 pass with the fix; the cursor-ordering guard passes on both.node --check webui/index.jsclean.