Skip to content

fix(ui): keep Home context current after dock reconnection - #139059

Merged
steipete merged 2 commits into
mainfrom
codex/deslop-custodian-subscriptions
Sep 5, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/deslop-custodian-subscriptions

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #139054

Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.

What Problem This Solves

Repairs a latent lifecycle bug: after the same Home panel is detached and reattached with the same context, subsequent roster updates can leave its displayed working reference stale. Direct component and bundled-browser tests reproduce this sequence. An ordinary current UI action that triggers the same-node reattachment has not been established.

Why This Change Was Made

Home removed its context subscriptions on disconnect and restored them only when the context object changed. Reconnecting to the same context therefore left its listeners inactive. Home and both Ask OpenClaw presentations now use the existing subscription lifecycle controller, removing three duplicate store-subscription loops and the separate context cleanup path.

The conversation store remains the shared owner across the page and dock. The page still refreshes idle history once per subscription, and the dock still refreshes it only when shown. This removes 39 production lines; the existing regression tests grow by 18 lines. No configuration, database, or protocol changes.

User Impact

Reattached Home panels keep their working reference current, and all three presentations share the established subscription lifecycle owner. This is a latent lifecycle repair and deduplication under the maintainer cleanup request, with existing Home and Ask OpenClaw behavior covered by regression tests.

Evidence

Both directly exercised lifecycle regressions failed before the production change and pass after it:

  • The component test reattaches the same Home panel and refreshes the agent roster; the new workspace now replaces the old workspace.
  • The bundled Chromium flow reattaches the same dock, renames the current session through a Gateway event, verifies the sidebar and Home title agree, and sends a message containing the updated title.

Before the fix, component and browser tests reproduced stale displayed context after explicit DOM detachment/reattachment. Stale-send impact is source-backed inference because the send path consumes the same cached reference; no pre-fix stale send was observed. After the fix, the browser test also verifies that the next message carries the updated title. This is bundled Chromium proof with a synthetic Gateway WebSocket, not real-Gateway transport proof or an observed ordinary-user regression.

Before: Home retains the old workspace title

After: Home follows the renamed workspace

All 125 focused component, Custodian lifecycle, history, onboarding, nudge, transcript-status, alert-store, and subscription-controller tests pass. The five alert-store cases cover once-per-presentation delivery, rearming recurring incidents, listener updates, retired authority, and visible alerts without unavailable chat sends. All five bundled Home/Ask OpenClaw E2E scenarios pass, including saved workspace/dashboard layouts, palette opening, and history restoration after reload. Fresh Codex autoreview found no actionable P0–P2 findings. The declared Oxfmt 0.65.0 formatting check passes.

Focused verification commands
pnpm tsgo:ui
OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run ui/src/components/assistant-panel.test.ts ui/src/pages/custodian/custodian-page.test.ts ui/src/pages/custodian/custodian-page.history.test.ts ui/src/pages/custodian/custodian-page.channel-onboarding.test.ts ui/src/pages/custodian/custodian-page.nudges.test.ts ui/src/pages/custodian/custodian-page.session-lifecycle.test.ts ui/src/pages/custodian/custodian-transcript-status.test.ts ui/src/pages/custodian/custodian-alert-store.test.ts ui/src/lit/subscriptions-controller.test.ts
OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/assistant-panel-context.e2e.test.ts ui/src/e2e/custodian-panel-toggle.e2e.test.ts
OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/check-changed.mjs -- ui/src/components/assistant-panel.ts ui/src/pages/custodian/custodian-page.ts ui/src/pages/custodian/custodian-surface.ts ui/src/components/assistant-panel.test.ts ui/src/e2e/assistant-panel-context.e2e.test.ts
pnpm build

The native checkout now has its own frozen dependencies. Its pinned UI typecheck reproduced the three unread controller fields reported by review; replacing them with the existing constructor-registration pattern makes pnpm tsgo:ui pass. All 125 focused unit tests and five bundled-browser scenarios also pass after that correction. The full changed gate and complete build pass in that checkout. Fresh P2 autoreview of the complete candidate and a separate direct read-only review of the final pushed head are clean. CI run 33966375794 passed on the exact final head.

Validated final head: 9a1d2de908ccf22d88559c22826c032a521cabe0. The final ClawSweeper review explicitly resolves the constructor/type finding and reports no new actionable correctness findings. Its remaining reviewer-access questions are covered by direct maintainer inspection of the pinned Lit lifecycle source and the complete before/after captures. The existing uploaded after screenshot remains equivalent for the asserted renamed-context state.

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Sep 5, 2026
@steipete
steipete marked this pull request as ready for review September 5, 2026 11:54
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 5, 2026, 8:40 AM ET / 12:40 UTC.

ClawSweeper review

What this changes

Restores Home’s context updates after dock reconnection and consolidates subscription cleanup across Home and Ask OpenClaw.

Merge readiness

⛔ Blocked before merge - 2 items remain

The defect remains on current main, and the prior unused-field finding is resolved. No new actionable correctness defects were found.

Priority: P2
Reviewed head: 9a1d2de908ccf22d88559c22826c032a521cabe0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regressions and the prior finding resolved; reviewer access limits are recorded separately.
Proof confidence 🌊 off-meta tidepool Not applicable: Maintainer-authored PR: the ordinary contributor gate is exempt. The supplied report maps bundled Chromium reconnection and roster updates to refreshed Home text and the next chat.send payload; screenshots could not be opened because GitHub DNS failed, so they are not independently verified here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Maintainer-authored PR: the ordinary contributor gate is exempt. The supplied report maps bundled Chromium reconnection and roster updates to refreshed Home text and the next chat.send payload; screenshots could not be opened because GitHub DNS failed, so they are not independently verified here.
Evidence reviewed 10 items Current-main defect: Current main clears context listeners on disconnect at lines 113–114 but reinstalls them only when the context property changes at line 123; reconnecting the same element and context leaves those listeners absent.
Prior finding resolved: All three migrated components now register controllers in constructors without unread private fields, matching the existing chat-pane constructor pattern. Captured check-prod-types passed; no compiler or tests were run during this review.
Canonical lifecycle owner: The existing controller registers with its host, refreshes subscriptions on connection, clears source identity on disconnect, and rejects obsolete notifications. Its tests cover reconnect, source replacement, and cleanup failures.
Findings None None.
Security None None.

How this fits together

The Control UI’s Home dock builds a working reference from the selected page, session roster, and agent workspace. That reference appears beside the conversation and accompanies the next message.

flowchart LR
  A[Dock connects or disconnects] --> B[Subscription lifecycle controller]
  C[Session and agent updates] --> B
  B --> D[Rebuild working reference]
  D --> E[Home context display]
  D --> F[Next chat message]
Loading

Before merge

  • Resolve merge risk (P1) - Reviewer-side verification remains incomplete for Lit’s upstream lifecycle contract and the attached before/after screenshots because dependency source and network access were unavailable.
  • Complete next step (P2) - Complete reviewer-side inspection of the attached before/after screenshots and Lit lifecycle contract from an environment with access; no new contributor proof is requested.
Agent review details

Security

None.

PR surface

Source -39, Tests +18. Total -21 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 76 115 -39
Tests 2 20 2 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 96 117 -21

Review metrics

Metric Value Why it matters
Production versus test LOC Production net −39; tests net +18 The final patch absorbs the reconnect repair into an existing controller and removes duplicated lifecycle bookkeeping.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #139054
Summary: This PR is the candidate repair for the open companion issue’s same-context dock reconnect defect.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep subscription ownership in the existing lifecycle controller while preserving the shared conversation store, visibility-triggered history refresh, and bounded working reference.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep subscription ownership in the existing lifecycle controller while preserving the shared conversation store, visibility-triggered history refresh, and bounded working reference.

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

Yes: detach and reattach the same Home dock with an unchanged context, then update the session title or agent workspace. Current-main source establishes the missing resubscription; execution results are contributor-reported, not independently rerun here.

Is this the best way to solve the issue?

The shared controller is the best-supported repair: it handles reconnect and source replacement across all three presentations, whereas another manual reconnect branch would retain duplicate lifecycle logic. Direct upstream Lit verification remains unavailable.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5300e70956c7.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored PR: the ordinary contributor gate is exempt. The supplied report maps bundled Chromium reconnection and roster updates to refreshed Home text and the next chat.send payload; screenshots could not be opened because GitHub DNS failed, so they are not independently verified here.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Repairs stale displayed and sent working context after a bounded Control UI reconnect scenario.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored PR: the ordinary contributor gate is exempt. The supplied report maps bundled Chromium reconnection and roster updates to refreshed Home text and the next chat.send payload; screenshots could not be opened because GitHub DNS failed, so they are not independently verified here.

Evidence

What I checked:

  • Current-main defect: Current main clears context listeners on disconnect at lines 113–114 but reinstalls them only when the context property changes at line 123; reconnecting the same element and context leaves those listeners absent. (ui/src/components/assistant-panel.ts:123, 5300e70956c7)
  • Prior finding resolved: All three migrated components now register controllers in constructors without unread private fields, matching the existing chat-pane constructor pattern. Captured check-prod-types passed; no compiler or tests were run during this review. (ui/src/components/assistant-panel.ts:87, 9a1d2de908cc)
  • Canonical lifecycle owner: The existing controller registers with its host, refreshes subscriptions on connection, clears source identity on disconnect, and rejects obsolete notifications. Its tests cover reconnect, source replacement, and cleanup failures. (ui/src/lit/subscriptions-controller.ts:65, 9a1d2de908cc)
  • Behavioral regression coverage: The component regression reattaches the same panel before refreshing the agent workspace. The browser regression reattaches the dock, emits a session-title change, checks the rendered reference, and checks that exactly one chat.send contains the new title. (ui/src/e2e/assistant-panel-context.e2e.test.ts:151, 9a1d2de908cc)
  • Caller, consumer, and security boundary: The app shell supplies page facts to the dock; Home passes the formatted reference to its chat pane, and chat-send-submit appends it to new messages. Formatting remains bounded quoted reference data, with no authorization change or Codex runtime/protocol dependency. (ui/src/pages/chat/chat-work-context.ts:101, 9a1d2de908cc)
  • Sibling lifecycle preservation: Ask OpenClaw retains its shared conversation store, idle-refresh guard, alert deduplication, and send admission checks. Inspected history, session-lifecycle, alert-store, and panel-toggle tests cover these neighboring behaviors. (ui/src/pages/custodian/custodian-session-store.ts:180, 9a1d2de908cc)

Likely related people:

  • Peter Steinberger: Raw commit deb7faf adds ui/src/lit/subscriptions-controller.ts:67 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: deb7faf7b066; files: ui/src/lit/subscriptions-controller.ts)

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-09-05T12:03:23.375Z sha 9e36a95 :: needs changes before merge. :: [P2] Register controllers without unread private fields

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 5, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Final review and proof are complete for the final head. Exact-head CI run 33966375794 is successful.

The three unread controller fields identified by review are replaced with the existing constructor-registration pattern. Pinned pnpm tsgo:ui first reproduced the three TS6133 diagnostics and now passes. All 125 focused unit tests, five bundled Chromium scenarios, the complete changed gate, and full pnpm build pass on source bytes matching this final commit. The full build completed in 3m35.7s. Fresh P2 autoreview and the separate direct exact-head Codex review found no actionable P0–P2 findings.

The latest ClawSweeper review confirms the type finding is resolved and identifies no new correctness defect. Its remaining items concern reviewer access to the Lit source and screenshots. We directly inspected the pinned @lit/[email protected] context consumer and decorator, plus @lit/[email protected]: the host retains registered controllers, reconnect dispatches the context request, equal context assignment does not mark the property changed, and willUpdate precedes controller hostUpdate and rendering. Both full-frame captures were inspected, and the final-source capture shows the same corrected reference as the uploaded after image. The earlier constructor/typecheck/reconnect rank-up move is fully applied; the final comment adds no new rank-up item.

This remains a latent lifecycle repair and subscription deduplication. The test directly detaches and reattaches the same Home element with the same context; an ordinary current UI action that triggers that exact sequence has not been established. Chromium uses a synthetic Gateway WebSocket, not a real Gateway transport. Pre-fix evidence observes stale display; stale-send impact is source-backed inference through the same cached reference. The fixed browser test separately verifies the renamed title in the next outgoing message.

Production delta is −39 lines; tests +18. Shared conversation ownership, once-per-page-subscription idle refresh, visibility-triggered dock refresh, and alert deduplication remain intact. Full commands and before/after images are in the PR body. Ready for native prepare/merge validation.

@steipete
steipete merged commit 82d838e into main Sep 5, 2026
136 checks passed
@steipete
steipete deleted the codex/deslop-custodian-subscriptions branch September 5, 2026 13:20
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…139059)

* fix(ui): refresh Home context after dock reconnection

* fix(ui): register subscription controllers during construction
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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

Bug: Home workspace context stays stale after dock reconnection

1 participant