tui: add debug-flag duplicate-widget diagnostics for issue #426 - #660
Closed
SHYXIN wants to merge 1 commit into
Closed
tui: add debug-flag duplicate-widget diagnostics for issue #426#660SHYXIN wants to merge 1 commit into
SHYXIN wants to merge 1 commit into
Conversation
…e#426 TranscriptView._redraw now takes a 'reason' labeling the trigger (window_shift, state_update, append_page_to_latest, append_overscan_shift, structured_finalization). When TAU_DEBUG_TRANSCRIPT_DUP is set, a post-refresh check logs a WARNING whenever two or more visible widgets wrap the same canonical ChatItem (by id(item)), recording window bounds, item/role/widget details, the active streaming item id, and the trigger stack. Serves issue huggingface#426's diagnostics ask (assert/log duplicate assistant rendering and capture the preceding trigger). No behavior change unless the env var is set.
Author
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.
What
Implements the temporary diagnostics suggested in issue #426 (assistant response rendered twice in a long TUI transcript). This is Path A — instrumentation only, no behavior change. It does not fix the underlying race (that is Path B, deferred per the issue's "keep open for additional reports" guidance).
Why
#426 reports a duplicate assistant row in sessions exceeding the 200-item mounted window, with structured (thinking + text) finalization. The durable JSONL and event pipeline contain a single copy, so the symptom is presentation-only. The issue's "Suggested next steps" ask for temporary diagnostics that:
ChatItem/ mounted-widget identities, transcript window bounds, and active streaming widget identityChanges
TranscriptView._redraw()now takes areasonargument labeling the trigger:window_shift,state_update,append_page_to_latest,append_overscan_shift,structured_finalization.TAU_DEBUG_TRANSCRIPT_DUP=1(read once at import). When set, a post-refresh check (_schedule_duplicate_diagnostic) inspects the mounted children and logs aWARNINGontau.tui.transcript_dupwhenever two or more visible widgets wrap the same canonicalChatItem(byid(item)), recording window bounds, item/role/widget details, the active streaming item id, and the trigger stack.WARNINGis also written to a file; the path is printed at launch:[tau] transcript duplicate diagnostics enabled -> <temp>/tau_transcript_dup.logdev-notes/transcript-duplicate-diagnostics.mddocumenting the diagnostic and how to use it.How to use
In normal operation the logger stays silent (no false positives). If a duplicate is observed, capture the full warning (including
reason) and attach it to #426.Verification
ruffclean,mypyclean.main), not caused by this change.Note
This keeps the issue open for real-world reports. If async pruning is confirmed as the cause from collected logs, a serialized/awaited DOM reconciliation (Path B) can follow without conflicting with this instrumentation.