fix(tui): show loading status during hatch initialization (#74385)#75120
fix(tui): show loading status during hatch initialization (#74385)#75120ottodeng wants to merge 6 commits into
Conversation
…4385) The local TUI showed `local ready | idle` while still awaiting refreshAgents() and loadHistory() during the Terminal hatch flow, making the bot look stuck for up to a minute before the first hatch auto-message could even start. Reuse the existing busy-state machinery to surface initialization work to the user; idle is restored once history loads (or the auto-message takes over the loader). Fixes openclaw#74385
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. from source inspection: Terminal Hatch launches the local TUI, current main sets ready before awaited agent/session/history work completes, and the busy renderer excludes initialization. I did not run a live Hatch session in this read-only review. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land a narrow TUI Do we have a high-confidence way to reproduce the issue? Yes, from source inspection: Terminal Hatch launches the local TUI, current main sets ready before awaited agent/session/history work completes, and the busy renderer excludes initialization. I did not run a live Hatch session in this read-only review. Is this the best way to solve the issue? No, not as submitted. Reusing the existing busy-loader path is the right narrow fix, but this branch must preserve the current startup-error Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a6aa48350b7e. |
|
Addressed clawsweeper [P3]: added a TUI changelog entry under Unreleased Fixes referencing #74385. Pushed in latest commit. |
…state # Conflicts: # CHANGELOG.md # src/tui/tui.ts
|
Closing as stale — merge conflict unresolved for 14+ days and no maintainer follow-up. Freeing the PR slot. (Auto-managed by hermes-eason) |
What
Surfaces a busy
initializingactivity status while the TUI runs its post-connectrefreshAgents()+loadHistory()work, instead of showinglocal ready | idlefor up to a minute before the first hatch auto-message can even fire.Fixes #74385.
Why
On
openclaw onboard→ "Hatch in Terminal", the TUI previously transitioned toidlethe moment the local runtime came up, then silently spent up to ~60s loading agents and chat history before the auto-message could start. The status line claimed the bot was idle the whole time, so users assumed the launch had hung.clawsweeper's triage on the issue traced this tosrc/tui/tui.ts:1073—client.onConnectedsets the connection status but doesn't set any activity status while the awaited initialization work runs, even though the existing busy-state machinery atsrc/tui/tui.ts:597already renders a loader forsending|waiting|streaming|running.How
busyStatesset insrc/tui/tui.tsto an exportedisBusyActivityStatus()helper plus a namedINITIALIZATION_ACTIVITY_STATUS = "initializing"constant. The existing loader render path (renderStatus,startStatusTimer) now treats"initializing"as busy with no other changes — same spinner, same elapsed counter.client.onConnected, setactivityStatus = "initializing"immediately aftersetConnectionStatus(...), before awaitingrefreshAgents()/loadHistory().sendMessage()flips the status intosending→waitingas today, so the loader stays continuous from boot through the first model response. If no auto-message is configured, the post-init block restoresidleonce history loads — but only if the status is stillinitializing, so we don't clobber a state that an event handler already updated. Errors restore idle the same way before rethrowing.Coverage
Acceptance-criteria test suites from the issue (124 tests, all green):
pnpm exec oxfmt --checkclean on the files listed in the issue acceptance criteria (setup.finalize.ts,tui.ts,tui-command-handlers.ts,tui-event-handlers.ts,tui-session-actions.ts,embedded-backend.ts).pnpm exec oxlintreports 0 warnings / 0 errors on touched files.New
describe("isBusyActivityStatus", ...)block asserts:INITIALIZATION_ACTIVITY_STATUS === "initializing"and the helper treats it as busy (the [Bug]: Stuck and ultra slow during Hatch (terminal mode) - took a minute to come back up #74385 regression guard).sending,waiting,streaming,running) still match.idle, unknown strings, and pairing-related statuses are not busy.Risk
Low. The change is additive: one extra entry in the busy set, and one extra status transition during connect. No public API surface, no config schema change, no impact on remote/headless flows. Existing send → wait → stream cycles take exactly the same path as before.
Out of scope
This PR only addresses the missing busy state during the post-connect init block. The underlying duration of
loadHistory()/refreshAgents()themselves (which can still legitimately take a long time on large workspaces) is a separate concern.