Skip to content

fix(ui): recover sessions and dashboards after prolonged outages - #115654

Merged
steipete merged 11 commits into
mainfrom
codex/control-ui-stress-reconnect-lifecycle
Jul 29, 2026
Merged

steipete merged 11 commits into
mainfrom
codex/control-ui-stress-reconnect-lifecycle

Conversation

@steipete

@steipete steipete commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes issues where people using the Control UI could see apparently connected but permanently stalled sessions, receive stale dashboard events after reconnect, retain session actions after the Gateway revoked their catalog, continue retrying offline dashboard requests, or keep expired pairing QR codes and timers alive across split panes. Also fixes a real-browser media-cache regression test that could fail when concurrent image downloads completed in a different order.

Why This Change Was Made

Stress testing against an exact main revision exposed lifecycle failures missed by ordinary reconnect scenarios. Keep heartbeat recovery and safe timer bounds in the browser Gateway owner, stop delivery when an event retires its connection or subscription, preserve legitimate long-running requests, pause automatic dashboard retries while preserving one explicit user refresh, revoke catalogs only after an authoritative replacement hello, and reuse the existing shared media-resource owner for pairing-QR expiry instead of maintaining a separate timer registry. The real-browser mocked Gateway now emits and cleans up its advertised heartbeat, and the media-cache proof identifies the actual asynchronously created least-recently-used image.

The full merge-gate proof also uncovered a generated-asset infrastructure failure. Make changed-file lint planning discover generated browser assets from each plugin's existing manifest and leave those assets to the authoritative bundled-asset check; continue linting every changed plugin source. Regenerate the committed browser runtime from its canonical entry point. The latest rebase deliberately drops the superseded matrix-evidence workaround now that main owns that code.

User Impact

Chat, Workboard, session sidebars, and pairing flows recover reliably from silent disconnects and prolonged outages. Disconnected dashboards stop consuming background requests without losing explicit refreshes, split panes expire QR codes together, stale or unauthorized catalog actions disappear without clearing valid sessions during a transient reconnect, and real-browser image-cache coverage no longer depends on concurrent download order.

Evidence

  • Pinned clean baseline: 9c118dd38f5424d826c99413d3e48e919f3aa449.
  • Real remote Chromium baseline: 106 browser test files, 371 passing tests, 688.57 seconds.
  • Failing-before proof on unchanged production for stale-event fan-out, half-open browser heartbeats, revoked catalog ownership, split-pane QR expiry/disposal, and offline dashboard retry storms.
  • Final remote gateway proof: 4 files, 66 passing tests, including listener replacement, subscriptions, WebSocket handshake, watchdog, and safe timeout bounds.
  • Final remote UI proof: 11 files, 518 passing tests, including catalog ownership, heartbeat overflow, split-pane QR disposal, offline board backoff, coalesced manual refresh, MCP, sidebar, and Workboard coverage.
  • Real Chromium media-cache soak: 3 consecutive passes, 9 browser tests per pass, including 65 concurrent managed-image downloads, deterministic LRU eviction, Blob URL revocation, and authenticated refetch.
  • Exact-head remote tooling regressions: 2 files, 167 passing tests, including manifest-declared generated-only and mixed source/generated lint planning and preserved matrix evidence validation.
  • Exact-head remote plugin-ownership regression: 1 file, 11 passing tests, including the core-to-plugin boundary that previously blocked build-artifacts.
  • Exact-head generated-runtime check: pnpm plugins:assets:check passes against every committed bundled plugin asset.
  • Full pre-rebase source proof: pnpm check:changed passes formatting, all owner typechecks, targeted lint, dead-export scans, plugin boundaries, import cycles, runtime policy, and declaration contracts.
  • Full pre-rebase production build: pnpm build passes bundled assets, all 146 public plugin SDK exports, the packaged Control UI, all 682 precompressed UI sidecars, and the Control UI performance budget.
  • Prolonged real Chromium soak before the latest main rebase: 5 consecutive passing runs; 8 end-to-end files and 35 tests per run, 175 passing browser tests total, covering Gateway/session reconnect, dashboards, revoked catalogs, sidebar recovery, attachments, plan replay, 65 concurrent images, Blob revocation, LRU eviction, and authenticated refetch.
  • Complete pre-rebase Blacksmith Testbox run: 21 minutes; exit 0.
  • Latest exact-head Blacksmith Testbox proof after rebasing: regenerated assets, 167 tooling tests, 11 plugin-boundary tests, 66 Gateway tests, 518 UI tests, and a fresh real Chromium run of all 8 reconnect/media files and 35 tests; exit 0.
  • Landing blocker on concurrently updated main: check-test-types reports an unused matrix-validator import; check-dependencies reports the unused CodeModeFailurePhase export in agent-runtime code; checks-node-compact-small-1 reports a QA workflow test expecting 60 minutes although the workflow now specifies 90. These are outside the Control UI change and are not bypassed or silently fixed in this PR.
  • Independently reviewed; each actionable lifecycle and timer finding was fixed and covered by regressions.
  • AI-assisted.

Final extended stress proof

  • Reviewed and proven exact head: 2e04d862c18eefcc0792ede13784c61c363ec833.
  • Full exact-head remote changed-code gate: passed, including all core, Control UI, plugin, script, and test typechecks; formatting, targeted and fallback lint, generated browser assets, security, ownership, dependency, and dead-export checks.
  • Full exact-head production build: passed, including all 146 public plugin SDK exports, all 682 finalized Control UI sidecars, and the Control UI performance budget.
  • Real Chromium long soak: 10 consecutive successful rounds; 12 browser test files and 44 tests per round; 440 passing browser tests across three successful checkpointed Testbox runs. Covers Gateway/session reconnect, dashboard retry recovery, device tokens, catalog replacement, sidebar/session switching, attachment lifecycle, plan replay, 65-image cache pressure and Blob cleanup, approval recovery, mount recovery, locale/offline retry, and external catalogs.
  • Explicit workspace security and unchanged env ratchet: 519/519, with OPENCLAW_DISABLE_ explicitly denied and workspace plugin controls still fail-closed.
  • Fresh full-branch autoreview: clean; no actionable findings.
  • GitHub exact-head required CI and repository-native hosted maintainer prepare gate: passed.
  • ClawSweeper current-main rank-up: maintainer review and prepare refreshed origin/main; the exact reviewed/tested head is intentionally frozen rather than repeatedly rebased while main moves. The native merge workflow rechecks the latest mainline, merge conflicts, head identity, and required checks immediately before landing.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete marked this pull request as ready for review July 29, 2026 06:08
@steipete
steipete force-pushed the codex/control-ui-stress-reconnect-lifecycle branch from d3acbcb to 5c07d88 Compare July 29, 2026 06:35
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 29, 2026
@steipete
steipete force-pushed the codex/control-ui-stress-reconnect-lifecycle branch 2 times, most recently from 23f87b3 to ac73a8b Compare July 29, 2026 07:38
@steipete
steipete force-pushed the codex/control-ui-stress-reconnect-lifecycle branch from ac73a8b to bf656dd Compare July 29, 2026 12:29
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 29, 2026
@clawsweeper

clawsweeper Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 9:20 AM ET / 13:20 UTC.

ClawSweeper review

What this changes

Repairs Control UI recovery after long Gateway outages by bounding browser connection timers, retiring stale listeners and catalog data, pausing offline dashboard retries, releasing detached chat subscriptions, and sharing pairing-QR expiry ownership; it also updates generated-asset lint planning and browser-runtime output.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

This PR remains necessary: it adds bounded reconnect, event-delivery, catalog, dashboard, subscription, and pairing-QR lifecycle handling that is present on the proposed branch, not shown as merged into current main. The supplied real Chromium and Testbox evidence is strong, but the branch is behind main and required checks are still in progress, so it needs an exact-merge-result maintainer review before landing.

Likely related people: steipete is the visible lifecycle contributor on this branch, but current-main ownership could not be independently established in this read-only review.

Priority: P1
Reviewed head: 2e04d862c18eefcc0792ede13784c61c363ec833
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong real-behavior evidence and focused regression coverage support the repair, while the wide lifecycle surface still needs refreshed current-main validation.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies after-fix remote Testbox and real Chromium evidence for the reconnect and media behaviors, including repeated browser-soak coverage; final merge-result validation is still required because the branch is behind main.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies after-fix remote Testbox and real Chromium evidence for the reconnect and media behaviors, including repeated browser-soak coverage; final merge-result validation is still required because the branch is behind main.
Evidence reviewed 4 items Gateway lifecycle implementation: The proposed branch adds owned event-listener subscriptions and connect-timeout helpers, then uses them in the protocol client to prevent stale frames and timers from surviving connection retirement.
Control UI recovery coverage: The proposed branch adds Gateway browser tests for advertised-heartbeat watchdog behavior and safe timer bounds, plus UI tests for reconnecting catalogs, pausing dashboard retries, chat subscription disposal, and shared pairing-QR expiry.
After-fix behavior proof: The PR body reports an exact-head Blacksmith Testbox run covering generated assets, tooling, plugin boundaries, Gateway tests, UI tests, and a fresh real Chromium reconnect/media run; it also documents failing-before scenarios against pinned baseline 9c118dd.
Findings None None.
Security None None.

How this fits together

The browser Gateway client turns a WebSocket connection and Gateway events into Control UI state for chat, session catalogs, dashboards, and pairing flows. This PR changes the lifecycle boundaries between transport reconnects, event subscribers, and UI-owned timers so disconnected or replaced resources do not continue affecting visible state.

flowchart LR
  A[Gateway WebSocket] --> B[Browser Gateway client]
  B --> C[Handshake and heartbeat lifecycle]
  B --> D[Event subscription delivery]
  C --> E[Control UI connection state]
  D --> F[Session catalog and chat panes]
  E --> G[Dashboard refresh behavior]
  F --> H[Visible recovered UI]
  G --> H
Loading

Decision needed

Question Recommendation
After the branch is refreshed against current main, should maintainers accept this broad Control UI and Gateway lifecycle repair as one landing unit? Refresh and land as one lifecycle repair: Rebase onto current main, require the merge-result checks to pass, and land the coordinated transport and UI lifecycle changes together.

Why: The patch spans shared browser transport behavior, multiple Control UI state owners, generated browser output, and check planning; the maintainer label and pending exact-merge validation require an explicit maintainer acceptance decision.

Before merge

  • Resolve merge risk (P1) - The branch is behind current main; the supplied exact-head proof should be refreshed against the actual merge result before landing.
  • Resolve merge risk (P1) - Several required checks remain in progress, so current CI has not yet independently confirmed the final GitHub merge candidate.
  • Complete next step (P2) - Await a maintainer review of the coordinated lifecycle scope after the branch is refreshed and the current merge-result checks complete; the maintainer label rules out automated cleanup or repair routing.
Agent review details

Security

None.

PR surface

Source +253, Tests +850, Other +28. Total +1131 across 32 files.

View PR surface stats
Area Files Added Removed Net
Source 19 387 134 +253
Tests 12 869 19 +850
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 37 9 +28
Total 32 1293 162 +1131

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: packages/gateway-client/src/client.watchdog.test.ts, serialized state: packages/gateway-client/src/protocol-client.handshake.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or merge-update the branch, retain the bounded lifecycle ownership and regression coverage, then land only after the exact merge-result checks confirm the same reconnect and UI recovery behavior.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or merge-update the branch, retain the bounded lifecycle ownership and regression coverage, then land only after the exact merge-result checks confirm the same reconnect and UI recovery behavior.

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

Yes, with medium confidence: the PR documents a pinned failing baseline and focused reconnect, heartbeat, catalog, retry, and timer scenarios, but this read-only review did not independently execute them against current main.

Is this the best way to solve the issue?

Yes, provisionally: the patch places transport timing and event retirement in the shared browser Gateway owner while leaving dashboard, catalog, chat, and media-specific recovery in their UI owners; the remaining question is whether maintainers want its broad landing scope kept together.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8ec4a059fc69.

Labels

Label justifications:

  • P1: A prolonged Gateway outage can leave real users with apparently connected but permanently stalled Control UI sessions and dashboards.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies after-fix remote Testbox and real Chromium evidence for the reconnect and media behaviors, including repeated browser-soak coverage; final merge-result validation is still required because the branch is behind main.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix remote Testbox and real Chromium evidence for the reconnect and media behaviors, including repeated browser-soak coverage; final merge-result validation is still required because the branch is behind main.

Evidence

What I checked:

  • Gateway lifecycle implementation: The proposed branch adds owned event-listener subscriptions and connect-timeout helpers, then uses them in the protocol client to prevent stale frames and timers from surviving connection retirement. (packages/gateway-client/src/protocol-client.ts:1, 2e04d862c18e)
  • Control UI recovery coverage: The proposed branch adds Gateway browser tests for advertised-heartbeat watchdog behavior and safe timer bounds, plus UI tests for reconnecting catalogs, pausing dashboard retries, chat subscription disposal, and shared pairing-QR expiry. (ui/src/api/gateway.node.test.ts:633, 2e04d862c18e)
  • After-fix behavior proof: The PR body reports an exact-head Blacksmith Testbox run covering generated assets, tooling, plugin boundaries, Gateway tests, UI tests, and a fresh real Chromium reconnect/media run; it also documents failing-before scenarios against pinned baseline 9c118dd. (2e04d862c18e)
  • Merge-state evidence: GitHub context reports the PR as cleanly mergeable but behind current main, with the required-check set incomplete. That does not disprove the patch, but it prevents treating branch-level proof as proof of the current merge result. (8ec4a059fc69)

Likely related people:

  • steipete: Authored the branch's Gateway-client, Control UI lifecycle, test, generated-runtime, and lint-planning commits; current-main ownership was not independently recoverable from the read-only inspection environment. (role: current lifecycle contributor; confidence: low; commits: cf5258a746aa, bf656ddd15e5, 2e04d862c18e; files: packages/gateway-client/src/protocol-client.ts, ui/src/api/gateway.ts, ui/src/lib/board/gateway-provider.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and let the required exact-merge-result checks finish before landing.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-29T12:55:52.868Z sha f1b3b62 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit fde4658 into main Jul 29, 2026
129 checks passed
@steipete
steipete deleted the codex/control-ui-stress-reconnect-lifecycle branch July 29, 2026 14:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
…nclaw#115654)

* fix(ui): recover long-running sessions and dashboards

* fix(ui): expose browser-safe gateway timers

* refactor(ui): keep browser timer surface minimal

* refactor(gateway): extract pending request state

* fix(ci): refresh browser runtime and format baseline

* fix(ci): exclude generated plugin outputs from targeted lint

* fix(ui): bound long-running connection and pane lifecycles

* refactor(ui): split long-running lifecycle regression coverage

* fix(ui): bound long-running media and lint ownership

* fix(security): preserve explicit workspace disable denylist

* fix(ci): preserve plugin manifest fallback lint
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 P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant