Skip to content

fix(ui): release closed chat panes after queued updates - #147240

Merged
vincentkoc merged 2 commits into
mainfrom
perf-heap-first-20260913
Sep 13, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
perf-heap-first-20260913

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes retained chat panes after repeated session-cache eviction or split-pane closure when a queued update runs after disconnect.

User Impact

Closed and evicted panes can release their progress-card subscriptions instead of remaining reachable from the application store. Reconnecting a pane restores one subscription.

Why This Change Was Made

Lit can flush an already queued update after disconnectedCallback. The progress-card controller now tracks its connection lifecycle, matching the existing subscriptions controller, so that late update cannot reacquire a released store listener.

Credit: @vyctorbrzezowski's production fix in 698d838, from #144755. This is a narrow extraction because the source PR is an unrelated unmerged feature stack, and its regression depends on a component absent from main. The original PR and its parents remain untouched. The production hunk is preserved with one lifecycle-invariant comment; the regression uses a real Lit host on main.

Evidence

  • Before-fix paired heap graphs traced retired panes through progress-card store listeners after cache eviction and split closure. The history-image case exposed the same owner root.
  • The real-Lit queued-update regression fails on the unguarded base in both target-present and target-absent cases and passes with the guard. All 46 focused controller, history, store, and sibling tests pass on Node 24.19 with the corrected history-fixture overlay; all three changed-file hashes match the final head.
  • Independently reviewed same-renderer heap pairs at 844c9f4eaefec1a2159ecb2b512a95caf6bef529 retain zero retired split-pane or media-pane markers. The three expected cached pane owners stay at three; the live history-image owner and Blob stay at one. These replay the same scenarios and runtime as the original a891c3fb955e129f3baf109b62d5d30a4492ce01 capture across different source freezes; the focused RED/GREEN regression supplies the direct causal control.
  • Independent lifecycle review and fresh autoreview found no actionable issues. Production: +11/-1 lines; tests: +72 lines. The positive production delta enforces the controller's connection ownership invariant.
  • Exact-head hosted CI passed: https://github.com/openclaw/openclaw/actions/runs/34773492407. Native preparation passed, and the latest exact-head ClawSweeper review has no actionable findings or remaining rank-up moves.

Heap proof covers lifecycle retention. It does not establish deployed Team behavior, end-to-end latency, native GPU memory improvement, or a verified total-process RSS cap.

Track the progress-card controller connection lifecycle so queued Lit updates cannot reacquire a store subscription after disconnect. Reconnect the same host once and preserve normal gateway ownership.

Adapts the production fix from 698d838 with a main-compatible real Lit regression.

Co-authored-by: vyctorbrzezowski <[email protected]>
@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 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: S maintainer Maintainer-authored PR labels Sep 13, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 17:50
Initialize the progress-card controller before direct update hooks, matching its existing disconnect cleanup and preserving the no-request-before-history assertions.
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 2:12 PM ET / 18:12 UTC.

ClawSweeper review

What this changes

The PR prevents queued UI updates from restoring progress-card subscriptions after a chat pane closes and adds disconnect/reconnect regression coverage.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary on current main and v2026.9.4, and no actionable patch defect was found. The related Workboard stack remains unmerged; this focused, member-authored PR should remain open.

Priority: P2
Reviewed head: 844c9f4eaefec1a2159ecb2b512a95caf6bef529

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful lifecycle regression coverage and no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its Lit-host regression exercises controller disconnection with a mocked Gateway; reported heap diagnosis supports the problem, while final after-fix heap replays remain pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from the external-contributor proof gate. Its Lit-host regression exercises controller disconnection with a mocked Gateway; reported heap diagnosis supports the problem, while final after-fix heap replays remain pending.
Evidence reviewed 9 items Introduced lifecycle repair: The complete pinned introduction delta changes only the controller and two tests. Connection enables synchronization; disconnection disables it before releasing the store, preventing subsequent queued updates from subscribing again.
Current main still needs the repair: Fetched main retains unconditional synchronization in hostUpdate after hostDisconnected releases the store.
Latest release check: The v2026.9.4 controller also synchronizes unconditionally during updates; this lifecycle guard is not present in that release.
Findings None None.
Security None None.

How this fits together

Control UI chat panes and dashboard widgets subscribe to a shared progress-card store fed by Gateway requests and events. The controller ties each view’s subscriptions to its connection lifecycle so removed views can be released.

flowchart LR
  A[Chat pane or dashboard widget] --> B[Connection lifecycle]
  B --> C{View connected?}
  C -->|Yes| D[Progress-card subscriptions]
  E[Gateway requests and events] --> D
  D --> F[Progress display]
  C -->|No| G[Release subscriptions]
  G --> H[Ignore queued updates]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +10, Tests +72. Total +82 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 11 1 +10
Tests 2 72 0 +72
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 83 1 +82

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +10 lines; tests +72 lines The production growth enforces connection ownership, while the tests cover the queued-disconnect failure and reconnect behavior.

Technical review

Best possible solution:

Keep subscription acquisition and release under the existing controller’s connection lifecycle, preserving one subscription on reconnect.

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

Yes, source establishes a clear path: queue an update on a connected host, remove it, then flush the update; current main can reacquire the released listener. The PR reports a failing-base regression, but this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. The guard repairs the subscription owner directly, follows the existing sibling lifecycle pattern, and preserves reconnect behavior without introducing configuration or another store.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 667069055284.

Labels

Label changes:

  • add P2: This is a bounded Control UI memory-retention repair with no demonstrated urgent outage.
  • 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: The member-authored PR is exempt from the external-contributor proof gate. Its Lit-host regression exercises controller disconnection with a mocked Gateway; reported heap diagnosis supports the problem, while final after-fix heap replays remain pending.

Label justifications:

  • P2: This is a bounded Control UI memory-retention repair with no demonstrated urgent outage.
  • 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: The member-authored PR is exempt from the external-contributor proof gate. Its Lit-host regression exercises controller disconnection with a mocked Gateway; reported heap diagnosis supports the problem, while final after-fix heap replays remain pending.

Evidence

What I checked:

  • Introduced lifecycle repair: The complete pinned introduction delta changes only the controller and two tests. Connection enables synchronization; disconnection disables it before releasing the store, preventing subsequent queued updates from subscribing again. (ui/src/components/session-progress-card-controller.ts:51, 844c9f4eaefe)
  • Current main still needs the repair: Fetched main retains unconditional synchronization in hostUpdate after hostDisconnected releases the store. (ui/src/components/session-progress-card-controller.ts:50, 667069055284)
  • Latest release check: The v2026.9.4 controller also synchronizes unconditionally during updates; this lifecycle guard is not present in that release. (ui/src/components/session-progress-card-controller.ts:50, 3a9d69db306c)
  • Existing lifecycle pattern and store ownership: SubscriptionsController already guards updates with connection state. The progress-card store retains view callbacks and watch owners, and detaches Gateway listeners once both sets are empty; the proposed fix preserves that existing ownership model. (ui/src/lit/subscriptions-controller.ts:70, 844c9f4eaefe)
  • Focused regression coverage: The new test mounts a real Lit host, queues an update, removes it, awaits the pending update, and checks that Gateway subscriptions remain released across two connection cycles, with and without a session target. The history fixture now explicitly connects its manually driven controller without weakening assertions. (ui/src/components/session-progress-card-controller.test.ts:46, 844c9f4eaefe)
  • Dependency lifecycle corroboration: The changed controller imports Lit’s ReactiveController contract. Inspected upstream ReactiveElement source calls hostDisconnected without cancelling pending updates, and performUpdate invokes hostUpdate. This was upstream source inspection, not execution of the locked dependency version. (packages/reactive-element/src/reactive-element.ts)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • vyctorbrzezowski: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '28887b564210326174413d0d8ade72b38268d5f3': (1827 commits)
  fix(qa): bind coverage IDs to producer assertions (#144000)
  fix(linux): explain FreeBSD desktop setup prerequisites (#147211)
  fix(memory): split embedding batches rejected for an input array item cap (#139541)
  test: isolate timing metadata persistence from inherited settings (#147112)
  refactor(status): retire test-only helper publication (#147071)
  improve: reduce workspace agent lookup work for large fleets (#147144)
  refactor(macos): share connect credential selection (#144214)
  fix(plugins): restore Slack onboarding after core updates (#147109)
  refactor: share ANSI compatibility matching (#146998)
  fix(test): settle Models catalog before picker open (#147215)
  test(ui): reuse panel tab drag fixture (#147250)
  fix(install): use system Node for FreeBSD CLI setup (#147204)
  fix(cli): explain MCP probes with no enabled servers (#147216)
  docs: require UI screenshots in chat and PR (#147263)
  docs(skills): clarify remote gog OAuth setup for Gateway hosts (#145945)
  test: replace idle account catalog waits with synchronization (#147228)
  feat(qa): preserve maturity decision context (#147219)
  feat(macos): clarify agent activity in native chat (#147197)
  fix(runtime): complete Bun compatibility follow-ups (#147085)
  fix(ui): release closed chat panes after queued updates (#147240)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
)

* fix(ui): release closed chat panes after queued updates

Track the progress-card controller connection lifecycle so queued Lit updates cannot reacquire a store subscription after disconnect. Reconnect the same host once and preserve normal gateway ownership.

Adapts the production fix from 698d838 with a main-compatible real Lit regression.

Co-authored-by: vyctorbrzezowski <[email protected]>

* test(ui): connect the progress history fixture lifecycle

Initialize the progress-card controller before direct update hooks, matching its existing disconnect cleanup and preserving the no-request-before-history assertions.

---------

Co-authored-by: vyctorbrzezowski <[email protected]>
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: S 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