Skip to content

fix(ui): release reply previews when connections retire - #145907

Merged
steipete merged 3 commits into
mainfrom
codex/perf20-reply-preview-retirement
Sep 18, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/perf20-reply-preview-retirement

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #145906

What Problem This Solves

Control UI panes retained fetched reply-preview payloads after their Gateway connection retired or the pane disconnected, even though those payloads could no longer be used.

User Impact

Obsolete preview objects can be collected as soon as their connection or pane lifetime ends. Reply navigation, unavailable-message feedback, and reconnect recovery keep their existing behavior. This fixes object retention; it does not claim a measured allocation, RSS, or timing improvement.

Why This Change Was Made

Clear the existing reply-preview owner's map at both connection-generation retirement boundaries. Keep successful responses and failed attempts cached across viewport resets and hide/show changes, with the existing 256-entry bound and stale-response guards.

Evidence

The two reachability regressions fail on the original source through the actual connection-retirement and pane-disconnection callbacks. They verify that an unowned control can be collected while the obsolete cached payload remains reachable; the fix releases that payload before any refetch.

Final head 6dad1726711b248d23900ca5859b6caf49a9b17d integrates main at 2ef09f01deba518303f6f92ec32f0fb148d10753:

  • All 40 focused unit cases passed: 22 retained-presentation, nine history/reply-navigation, and nine transcript/reply cases.
  • All five existing bundled mocked-Gateway browser recovery cases passed. These checks cover the UI boundary; they are not live-provider proof.
  • All mapped checks passed, including core and UI typechecks, formatting, three unused-export scans, and lint.
  • Fresh independent review through P2 found no actionable findings. The later main integration preserved the exact six-file patch and every supplied review-context source.

The first mapped run encountered the pre-existing duplicate declaration fixed by #151417. Incorporating that existing main repair made the full check pass; this PR adds no separate fix for it. Hosted CI and the required hosted review are refreshed for this final head before landing.

Before and after

These historical synthetic captures of the unavailable-source case are byte-identical: the same feedback and usable draft remain visible. They demonstrate unchanged presentation, while the lifecycle tests establish object release. Both images were inspected and verified rendering in the originating task and this PR.

Before After
Before: unavailable reply source After: unavailable reply source

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check could not safely complete for this revision.

ClawSweeper will not retry this unchanged revision.

Next step: No contributor action is requested. Maintainers should inspect the linked workflow run.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 10:56
@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. P2 Normal backlog priority with limited blast radius. 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 18, 2026, 3:59 AM ET / 07:59 UTC (Revision 2).

ClawSweeper review

What this changes

The Control UI releases cached reply previews when a Gateway connection retires or a chat pane disconnects, with regression coverage for object collection and cache reuse.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main, and this review found no actionable patch defects. The linked issue remains open pending this PR.

Priority: P2
Reviewed head: 6dad1726711b248d23900ca5859b6caf49a9b17d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful collection regressions and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal lifetime fix is exempt from external-contributor proof requirements. Callback-level collection tests support the changed cache owner; reported mocked-Gateway recovery checks and the inspected screenshot support unchanged presentation, not live memory measurements.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored internal lifetime fix is exempt from external-contributor proof requirements. Callback-level collection tests support the changed cache owner; reported mocked-Gateway recovery checks and the inspected screenshot support unchanged presentation, not live memory measurements.
Evidence reviewed 9 items Pinned patch and lifecycle coverage: The independently inspected base-to-head diff matches the supplied introduction evidence. Cache retirement is added immediately after generation advancement in both lifecycle callbacks; the existing owner implements retirement with Map.clear().
Current main still needs cleanup: Current main retains the pane-owned map and its 256-entry bound without a retirement clear. Its connection and pane callbacks advance the generation without releasing these entries.
Released implementation: The same owner in v2026.9.4 retains cached payloads without a retirement clear; the requested cleanup is not present in that release.
Findings None None.
Security None None.

How this fits together

Chat panes fetch unloaded reply-source messages from the Gateway and cache them for preview rendering. Connection and pane lifecycle callbacks determine when those cached objects become obsolete.

flowchart TD
  A[Reply preview requested] --> B[Pane preview cache]
  B --> C[Gateway message lookup]
  C --> D[Check connection and request ownership]
  D --> B
  B --> E[Render reply preview]
  F[Connection retires or pane disconnects] --> G[Clear preview cache]
  G --> B
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +6, Tests +57. Total +63 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 6 0 +6
Tests 3 57 0 +57
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 63 0 +63

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #145906
Summary: This PR is the candidate implementation for the linked reply-preview lifetime issue.

Members:

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

Technical review

Best possible solution:

Keep preview lifetime cleanup in the existing cache owner while preserving same-connection reuse and stale-response rejection.

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

Yes, from source: fetch a preview, retain its pane, then retire the connection; current main invalidates reads but retains the payload in its map. The supplied regressions exercise this path, but were not rerun during this read-only review.

Is this the best way to solve the issue?

Yes. Clearing the existing map at both generation-retirement boundaries is a narrow repair that preserves the established cache and request-ownership contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This fixes bounded obsolete-object retention in Control UI panes without evidence of an urgent availability failure.
  • 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 maintainer-authored internal lifetime fix is exempt from external-contributor proof requirements. Callback-level collection tests support the changed cache owner; reported mocked-Gateway recovery checks and the inspected screenshot support unchanged presentation, not live memory measurements.

Evidence

What I checked:

  • Pinned patch and lifecycle coverage: The independently inspected base-to-head diff matches the supplied introduction evidence. Cache retirement is added immediately after generation advancement in both lifecycle callbacks; the existing owner implements retirement with Map.clear(). (ui/src/pages/chat/chat-pane-reply-navigation.ts:124, 6dad1726711b)
  • Current main still needs cleanup: Current main retains the pane-owned map and its 256-entry bound without a retirement clear. Its connection and pane callbacks advance the generation without releasing these entries. (ui/src/pages/chat/chat-pane-reply-navigation.ts:18, 526477da9bc6)
  • Released implementation: The same owner in v2026.9.4 retains cached payloads without a retirement clear; the requested cleanup is not present in that release. (ui/src/pages/chat/chat-pane-reply-navigation.ts:15, 3a9d69db306c)
  • Async completion and cache compatibility: Successful responses must still pass current-connection and exact-attempt checks before entering the cache. Viewport reset clears navigation state but preserves cached successes and failed attempts; the new retirement calls do not change that behavior. (ui/src/pages/chat/chat-pane-reply-navigation.ts:80, 6dad1726711b)
  • Meaningful retention regressions: Two parameterized cases exercise actual connection-retirement and pane-disconnection callbacks, check independently unowned controls are collected, and verify cached payload collection before refetch. They also preserve cache reuse across viewport reset and hide/show. The captured PR body reports 40 focused cases and five mocked-Gateway browser cases passing; this read-only review did not execute tests. (ui/src/pages/chat/chat-pane-retained-presentation.test.ts:52, 6dad1726711b)
  • Inspected visual evidence: The prepared image linked in both before/after columns visibly shows unavailable-source feedback and a usable draft. As the captured body explicitly states, this historical synthetic image demonstrates presentation only, not object collection.

Likely related people:

  • steipete: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-13T20:44:40.567Z sha 5c8c260 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review current head 6dad1726711b248d23900ca5859b6caf49a9b17d after integration with current main. The reply-preview lifetime fix is unchanged; focused unit tests, all five browser recovery cases, and mapped checks pass.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit 7f73161 into main Sep 18, 2026
158 checks passed
@steipete
steipete deleted the codex/perf20-reply-preview-retirement branch September 18, 2026 08:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
Punchcard-Session: ember-river-harbor-t4

* commit 'fdbb2455ac991202051904501438f690d22a0701': (21 commits)
  fix(qa): restore Telegram skill integration checks (#151632)
  test(e2e): follow published plugin convergence restarts (#151607)
  perf(tasks): skip unnecessary maintenance record copies (#151578)
  refactor: simplify Gateway session-name precedence (#147984)
  fix(ui): keep suggested task launches in the background (#151611)
  fix(agents): preserve subagent progress across repeated restarts (#151450)
  fix(diagnostics): scale memory growth pressure to the heap limit (#151355)
  fix(ui): release reply previews when connections retire (#145907)
  fix(ui): disable skeleton shimmers when motion is reduced (#151314)
  fix(gateway): reduce worker overhead with large session stores (#149700)
  improve: defer unused work during Gateway startup (#151547)
  improve: reduce transcript freshness-check overhead (#151606)
  fix(ui): keep Home from appearing twice in the sidebar (#151401)
  improve(gateway): reduce allocations during large session refreshes (#151565)
  improve: reduce temporary allocations for long provider requests (#151603)
  fix: keep Gateway responsive and preserve completions during SQLite contention (#151594)
  fix(models): renew successful empty provider catalogs (#151580)
  fix: reveal preserved chat branches after rewind and resend (#151598)
  perf(outbound): skip inert plain-text preparation scans (#149829)
  improve(ui): make toast feedback compact and recovery readable (#151575)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 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 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.

Retired Control UI connections retain obsolete reply previews

1 participant