fix(tui): rearm streaming watchdog on tool events and reset state on reconnect#69125
fix(tui): rearm streaming watchdog on tool events and reset state on reconnect#69125kagura-agent wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes two related bugs in the TUI's streaming-status handling: rearming the streaming watchdog on tool events (to prevent false idle during long tool calls), and clearing stale run state on WebSocket reconnect (to prevent permanently stuck The changes are minimal, targeted, and correctly scoped — the watchdog rearm is only triggered when Confidence Score: 5/5Safe to merge — fixes two real bugs with no regressions introduced. Both fixes are correct and tightly scoped. The watchdog rearm on tool events correctly guards with No files require special attention. Reviews (1): Last reviewed commit: "fix(tui): rearm streaming watchdog on to..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db44b4b15e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| wasDisconnected = false; | ||
| // On reconnect, clear stale run state so we don't stay stuck in 'streaming'. | ||
| if (reconnected) { | ||
| state.activeChatRunId = null; |
There was a problem hiding this comment.
Preserve active run tracking across reconnect
Clearing state.activeChatRunId unconditionally on reconnect can drop a legitimately in-flight run after a transient disconnect. In that case, if the backend resumes with only agent/tool events (no fresh chat delta), handleAgentEvent never reclaims the run as active, so abortActive (in createSessionActions) reports "no active run" and watchdog re-arming for tool events is skipped because isActiveRun stays false. This leaves the UI in idle while work is still running and prevents user abort until/unless another chat event rebinds the run.
Useful? React with 👍 / 👎.
|
Closing this PR — my automated contribution workflow had a rate-limiting bug that submitted too many PRs at once. Sorry for the noise! I'll re-submit if the fix is still needed after my other open PRs are reviewed/merged. |
Fixes #69081
Two related bugs in the TUI's streaming-status handling:
Bug 1 — False idle during tool calls: The streaming watchdog only rearmed on chat
deltaevents, not tool events. Long tool calls (>30s) without chat deltas triggered a false idle status. Fixed by rearming the watchdog inhandleAgentEventwhen a tool event arrives for the active run.Bug 2 — Stuck streaming after reconnect: On WebSocket reconnect,
activeChatRunIdand watchdog state were not cleared, so if thefinalevent was lost during disconnect, the TUI stayed instreamingforever. Fixed by clearingactiveChatRunId, callingclearStreamingWatchdog(), and setting status toidlebeforeloadHistory()on reconnect.All 243 TUI tests pass.