Skip to content

fix(tui): recover footer state after stale run final#64843

Closed
briandevans wants to merge 1 commit intoopenclaw:mainfrom
briandevans:codex/fix-tui-stale-streaming-indicator
Closed

fix(tui): recover footer state after stale run final#64843
briandevans wants to merge 1 commit intoopenclaw:mainfrom
briandevans:codex/fix-tui-stale-streaming-indicator

Conversation

@briandevans
Copy link
Copy Markdown
Contributor

Summary

Closes #64825.

A non-local chat final could leave the TUI footer stuck in streaming when activeChatRunId had gone stale, because finalizeRun() only settled the footer when the finishing run was still marked active. This lets external final events recover the footer once no tracked runs remain, and adds a regression test that preserves the existing local-run defer behavior from #53115.

Validation

  • pnpm exec vitest run src/tui/tui-event-handlers.test.ts src/tui/tui-session-actions.test.ts
  • pnpm exec oxlint src/tui/tui-event-handlers.ts src/tui/tui-event-handlers.test.ts

pnpm check still fails on main with the existing repo-wide 442-error oxlint baseline, unchanged by this PR.

@briandevans briandevans force-pushed the codex/fix-tui-stale-streaming-indicator branch from 2e5f80f to 13dc55e Compare April 11, 2026 14:53
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 11, 2026

Greptile Summary

This PR fixes a bug where the TUI footer could get stuck in streaming after a non-local chat final arrived when activeChatRunId was already stale (pointed to a run that never had events in the current sessionRuns). The fix adds an allowStaleFooterRecovery optional flag to finalizeRun() — when set (for non-local runs), and when no tracked runs remain in sessionRuns after the finalized run is removed, the footer is force-recovered by nulling activeChatRunId and calling setActivityStatus. Two regression tests for the prior #53115 local-run-defer behavior are also added.

Confidence Score: 5/5

Safe to merge — targeted, well-tested fix with no P0/P1 issues found.

The sessionRuns.size === 0 check correctly evaluates after noteFinalizedRun removes the current run, so it reflects 'no other runs remain.' The concurrent-run test (line 505) still passes because a truly concurrent run keeps sessionRuns.size > 0. The allowStaleFooterRecovery: !isLocalRun guard preserves the existing #53115 defer behavior for local runs. All edge cases appear covered by the new and existing tests.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(tui): recover footer state after sta..." | Re-trigger Greptile

@briandevans
Copy link
Copy Markdown
Contributor Author

Closing this because the remaining blocker is an unrelated CI timeout, not a contained issue in the TUI change itself. I tried the low-cost recovery path first, but rerunning the failed workflow requires repository admin rights, so this is not something I can cleanly fix from the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI stuck on 'streaming' indicator after run completes — finalizeRun() doesn't transition UI when wasActiveRun is false

1 participant