Skip to content

fix(tui): resolve undefined refresh_chrome in _on_stream exit-boundary replay#543

Open
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/tui-on-stream-refresh-chrome-f821
Open

fix(tui): resolve undefined refresh_chrome in _on_stream exit-boundary replay#543
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/tui-on-stream-refresh-chrome-f821

Conversation

@Kailigithub
Copy link
Copy Markdown
Contributor

Problem

In _on_stream(), the exit-boundary replay code path (lines 4770-4778) references refresh_chrome which is not a parameter of the method. This causes a NameError at runtime when:

  1. An exit-boundary replay starts a follow-up task before the original display queue emits its final done
  2. The old done event triggers the stale-task-id branch
  3. if refresh_chrome: evaluates an undefined name → NameError

The issue was introduced during the exit-boundary replay refactoring where refresh_chrome was referenced but the variable was only available as a parameter in _update_assistant(), not in _on_stream().

Fix

Since this code path already guards with if found and agent_id == self.current_id:, the sidebar/topbar refresh is always appropriate (we're updating the display for the active agent). Removed the undefined refresh_chrome conditional and made the chrome refresh unconditional within the current_id guard block.

Also fixed the indentation: the display update block was at the wrong level, causing the refresh_chrome reference to execute outside the agent_id == self.current_id guard.

Verification

  • ruff check frontends/tuiapp_v2.py --select F821 → All checks passed
  • python3 -m py_compile frontends/tuiapp_v2.py → No syntax errors

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