Skip to content

Fix stale Control UI run status cleanup#81615

Merged
BunsDev merged 4 commits into
mainfrom
meow/reconcile-chat-run-status
May 14, 2026
Merged

Fix stale Control UI run status cleanup#81615
BunsDev merged 4 commits into
mainfrom
meow/reconcile-chat-run-status

Conversation

@BunsDev

@BunsDev BunsDev commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • centralize Control UI chat run cleanup for terminal events, reconnect hello, reset, and session-switch paths
  • clear stale compaction/fallback timers and cached session hasActiveRun state when a run is done or interrupted
  • add a compact composer run-status chip for in-progress, done, and interrupted states

Fixes #76874.
Fixes #64220.
Refs #71630.

Verification

  • git diff --check
  • PATH=/Users/buns/.nvm/versions/node/v24.13.0/bin:$PATH pnpm exec oxfmt --check --threads=1 CHANGELOG.md ui/src/styles/chat/layout.css ui/src/ui/app-chat.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/app-gateway.ts ui/src/ui/app-render.helpers.ts ui/src/ui/app-render.ts ui/src/ui/app-tool-stream.node.test.ts ui/src/ui/app-tool-stream.ts ui/src/ui/app-view-state.ts ui/src/ui/app.ts ui/src/ui/chat/run-controls.test.ts ui/src/ui/chat/run-lifecycle.ts ui/src/ui/chat/status-indicators.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/controllers/chat.ts ui/src/ui/controllers/sessions.test.ts ui/src/ui/controllers/sessions.ts ui/src/ui/views/chat.ts
  • PATH=/Users/buns/.nvm/versions/node/v24.13.0/bin:$PATH pnpm test ui/src/ui/app-tool-stream.node.test.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/controllers/sessions.test.ts ui/src/ui/app-chat.test.ts ui/src/ui/chat/run-controls.test.ts
  • Browser smoke before branch handoff: active simulated state showed Stop + In progress; completed simulated state showed Send + Done

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels May 14, 2026
@clawsweeper

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Summary
This PR centralizes Control UI chat run lifecycle cleanup, clears stale compaction/fallback/session run state, adds tests/CSS/changelog, and renders a compact composer run-status chip.

Reproducibility: yes. at source level. With chatRunId still set and the current session row updated to terminal through sessions.changed, the branch clears only the row flag while the render predicate still treats the local run as abortable.

Real behavior proof
Not applicable: The external-contributor proof gate does not apply to this member-authored maintainer-labeled PR; the body still reports a browser smoke with active and completed simulated states.

Next step before merge
There is one narrow source-level PR blocker that automation can repair by wiring the existing lifecycle reconciliation into the terminal sessions.changed path.

Security
Cleared: The diff is limited to Control UI TypeScript, CSS, tests, and changelog text with no dependency, workflow, secret-handling, install, build, or package-resolution changes.

Review findings

  • [P2] Reconcile local runs on terminal session updates — ui/src/ui/controllers/sessions.ts:332-333
Review details

Best possible solution:

Finish the shared lifecycle approach by reconciling local run state on terminal sessions.changed updates, then land with targeted unit coverage and exact-head browser proof.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level. With chatRunId still set and the current session row updated to terminal through sessions.changed, the branch clears only the row flag while the render predicate still treats the local run as abortable.

Is this the best way to solve the issue?

No, not yet. The shared cleanup helper is the right direction, but the incremental terminal session-update path must also reconcile local chatRunId so a missed chat terminal event cannot leave Stop/In progress stuck.

Full review comments:

  • [P2] Reconcile local runs on terminal session updates — ui/src/ui/controllers/sessions.ts:332-333
    This clears only the cached row. If the chat terminal event was missed, host.chatRunId remains set; the gateway returns after an applied sessions.changed event, so reconcileChatRunFromCurrentSessionRow never runs and hasAbortableSessionRun continues rendering Stop/In progress.
    Confidence: 0.86

Overall correctness: patch is incorrect
Overall confidence: 0.86

Acceptance criteria:

  • pnpm test ui/src/ui/app-gateway.sessions.node.test.ts ui/src/ui/controllers/sessions.test.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/app-chat.test.ts ui/src/ui/chat/run-controls.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md ui/src/styles/chat/layout.css ui/src/ui/app-chat.ts ui/src/ui/app-gateway.node.test.ts ui/src/ui/app-gateway.ts ui/src/ui/app-render.helpers.ts ui/src/ui/app-render.ts ui/src/ui/app-tool-stream.node.test.ts ui/src/ui/app-tool-stream.ts ui/src/ui/app-view-state.ts ui/src/ui/app.ts ui/src/ui/chat/run-controls.test.ts ui/src/ui/chat/run-lifecycle.ts ui/src/ui/chat/status-indicators.ts ui/src/ui/controllers/chat.test.ts ui/src/ui/controllers/chat.ts ui/src/ui/controllers/sessions.test.ts ui/src/ui/controllers/sessions.ts ui/src/ui/views/chat.ts
  • git diff --check
  • Browser smoke: active simulated state shows Stop + In progress; completed/interrupted terminal session update returns to Send and shows the expected status chip

What I checked:

  • Live PR context: GitHub API shows the PR is open, author association is MEMBER, and labels include app: web-ui, maintainer, and size: L; cleanup policy keeps it open for maintainer handling rather than closing it. (eedbd94b0461)
  • Prior review context: The existing ClawSweeper comment already identified the same narrow blocker: terminal sessions.changed updates clear the row flag but do not reconcile the local chat run id. (eedbd94b0461)
  • Current abort predicate: Current main renders Stop from hasAbortableSessionRun, which returns true immediately when chatRunId is set before consulting the cached session row. (ui/src/ui/app-chat.ts:105, 78eb92e62277)
  • PR helper exists for full session-list reloads: The PR adds reconcileChatRunFromCurrentSessionRow, and loadSessionsOnce calls it after replacing sessionsResult, so full list refreshes can clear stale local run state. (ui/src/ui/controllers/sessions.ts:455, eedbd94b0461)
  • Remaining PR gap: For incremental terminal session updates, the PR only forces hasActiveRun false on the cached row; it does not invoke the run reconciliation helper after mutating the current row. (ui/src/ui/controllers/sessions.ts:332, eedbd94b0461)
  • Gateway return path: On PR head, sessions.changed returns immediately when applySessionsChangedEvent reports applied, so an applied terminal update will not fall through to a full reload that would call the reconciliation helper. (ui/src/ui/app-gateway.ts:871, eedbd94b0461)

Likely related people:

  • BunsDev: GitHub path history shows recent Control UI session/run responsiveness work on app-chat.ts, app-gateway.ts, and controllers/sessions.ts, including commits that scoped chat session list refreshes and preserved Stop after reconnect. (role: recent area contributor; confidence: high; commits: 6b3cd9043ee6, 38456f5f03b1, 4532e5d85803; files: ui/src/ui/app-chat.ts, ui/src/ui/app-gateway.ts, ui/src/ui/controllers/sessions.ts)
  • steipete: Blame and GitHub path history show recent broad Control UI chat/session maintenance on the implicated predicate, session controller, and tool-stream indicator paths. (role: recent adjacent contributor; confidence: high; commits: 439e396262, cb088c81601e, 5550d0ecf5b8; files: ui/src/ui/app-chat.ts, ui/src/ui/controllers/sessions.ts, ui/src/ui/app-tool-stream.ts)
  • joshavant: Introduced model fallback lifecycle visibility in the WebUI status surface, which overlaps the fallback-status cleanup touched by this PR. (role: adjacent feature contributor; confidence: medium; commits: c2876b69fbf5; files: ui/src/ui/app-tool-stream.ts, ui/src/ui/chat/status-indicators.ts)
  • mpz4life: Recent path history includes compaction status lifecycle work in the same indicator surface that this PR makes stale-safe. (role: adjacent feature contributor; confidence: medium; commits: 7027dda8cdec; files: ui/src/ui/app-tool-stream.ts)

Remaining risk / open question:

  • I did not run the PR tests or browser smoke in this read-only review; the blocker is based on source inspection of the latest PR head.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 78eb92e62277.

Re-review progress:

@BunsDev BunsDev self-assigned this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: L

Projects

None yet

1 participant