Skip to content

fix(ui): keep prefetched chats ready during unrelated session updates - #137947

Merged
steipete merged 5 commits into
mainfrom
codex/team-prefetch-20260904
Sep 4, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/team-prefetch-20260904

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Opening a recently prefetched chat could show a loading skeleton when an unrelated session updated the sidebar while history was loading. The UI discarded usable history and could fetch it again after the prefetch cooldown.

Why This Change Was Made

The prefetch publication owner now carries the existing connection scope, captured session history and snapshot-cache generation instead of treating the entire roster revision as authority. One check validates every row sharing the snapshot key and requires the captured history to survive, so an unchanged alias cannot hide replacement, reset, newer activity or an active run. Owned synchronous hydration and cursor-reset writes renew only their cache claim. The separate activity scan is removed.

Production changes add 79/remove 51 lines (net 28); tests and test support add 349/remove 4 (net 345). The distinct connection, row and cache claims are necessary to retain useful work while fencing stale publication. Existing chat-page fixtures now use the canonical session capability and deterministic disposal. No configuration, dependency, protocol or stored representation changes.

User Impact

Unrelated session updates no longer discard a valid prefetch: the cached conversation can appear immediately while fresh startup is pending. Deletion, replacement, reconnect, profile or cache invalidation, newer history and active runs still retire stale work.

Evidence

The original unchanged-session regression failed before the repair. Additional alias failures drove coverage for replacement, conflicting aliases and deletion leaving an older alias. The final 85 owner/fixture tests and full 20-check changed gate passed on 5b24721; all eight feature postimages and relevant owner/dependency bindings are unchanged on 97dc940.

Fresh proof on 97dc940 includes both Prefetch Chromium cases and the inherited widget/bootstrap case against the built UI with a synthetic Gateway, plus an independent P2 review with no actionable findings. The canonical candidate/base performance comparison passed at 349,001 startup JavaScript bytes, below the original 350,141-byte limit, with 8 requests, 43,900 bytes of CSS and 804 finalized sidecars verified. No assertions, timeouts or budgets were changed. Earlier CI 33905005327 used the older base and failed the inherited widget-navigation and startup-bundle checks; the candidate incorporates the already-landed #137342 repairs.

Current native main 2b1fb550 has identical eight feature preimages and qualified caller/build boundaries. The proof above measures 97dc940, not a future merged tree or production Gateway latency. Exact-head CI 33907845658 and native landing remain separate gates.

Before: opening the chat shows a loading skeleton while fresh startup is held

After: the prefetched report is visible while fresh startup is held

The captures show the original synthetic scenario before the alias refinement; the scenario is unchanged, and the later refinement has separate regression coverage. The fresh Chromium runs above verify the final composition.

A separate follow-up remains for global/main snapshot-key normalization versus canonical conversation routing. This change fences prefetch publication without changing cache keys or routing.

@clawsweeper

clawsweeper Bot commented Sep 4, 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 4, 2026
@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 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 2:56 PM ET / 18:56 UTC.

ClawSweeper review

What this changes

The PR keeps prefetched Control UI chat history usable after unrelated sidebar session updates while rejecting results stale from connection, session, or cache changes.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: current main still invalidates this prefetch on any roster revision, while the PR replaces that with scoped connection, row, and cache validity checks. No actionable introduced defect was found; the maintainer-owned PR remains subject to its exact-head CI gate.

Priority: P2
Reviewed head: 97dc94044f6811d9c4432f33a43a3f1afa76d0c8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a well-scoped owner-boundary repair with meaningful regression coverage; exact-head CI remains the normal merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: The PR is maintainer-authored, so the external-contributor proof gate does not apply; its submitted Chromium mock-Gateway scenario is supplemental evidence for the changed Control UI path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The PR is maintainer-authored, so the external-contributor proof gate does not apply; its submitted Chromium mock-Gateway scenario is supplemental evidence for the changed Control UI path.
Evidence reviewed 6 items Introduced owner-boundary repair: The branch composes the session/candidate check with a cache read scope, rechecks after async history requests, and only permits publication when every row sharing the canonical snapshot key remains compatible.
Current-main gap: Current main retains the older whole-list-revision validity predicate; its prefetch and snapshot-store blobs equal the PR base and differ from the PR head, so the requested behavior is not already implemented.
Existing lifecycle contract: The controller captures the existing SessionCapability connection scope, and the session owner creates and exposes that lifecycle contract; this is not a parallel connection authority.
Findings None None.
Security None None.

How this fits together

The Control UI prefetches recent Gateway chat transcripts into a local snapshot cache. Opening a chat can render that cache while fresh history loads, so the prefetcher must retain valid data without publishing stale data.

flowchart LR
  Gateway[Gateway session roster] --> Prefetch[Background transcript prefetch]
  Connection[Connection lifecycle] --> Validity[Scoped validity checks]
  Cache[Snapshot cache generation] --> Validity
  Prefetch --> Validity
  Sidebar[Unrelated sidebar refresh] --> Validity
  Validity --> Chat[Opened chat renders cached history]
Loading

Decision needed

Question Recommendation
Should the assigned Control UI owner accept this maintainer-owned repair once the exact-head checks finish successfully? Merge after green CI: Accept the owner-boundary repair after the current exact-head required checks complete successfully.

Why: The PR has a protected maintainer label and changes cache-publication behavior, so automated cleanup must not close or land it without explicit maintainer handling.

Before merge

  • Resolve merge risk (P1) - The bug fix adds 28 net production lines of asynchronous ownership logic. The distinct connection, row, and cache claims appear necessary; no net-neutral owner-boundary refactor was found without restoring the broad invalidation this PR removes.
  • Resolve merge risk (P1) - The exact PR-head required checks are still incomplete, so merge readiness is not yet established despite the focused source review.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +28, Tests +345. Total +373 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 2 79 51 +28
Tests 6 349 4 +345
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 428 55 +373

Review metrics

Metric Value Why it matters
Production versus test delta production +28; tests and test support +345 The production growth encodes three distinct async ownership facts; the substantially larger test delta exercises their invalidation boundaries.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the separate connection, row, and cache-generation ownership claims, then merge only after the exact-head CI gate is green.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the separate connection, row, and cache-generation ownership claims, then merge only after the exact-head CI gate is green.

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

Yes, source-reproducible: current main retires a held prefetch when any canonical roster revision changes, and the submitted browser test models an unrelated row update during that request. This read-only review did not execute the scenario.

Is this the best way to solve the issue?

Yes: the session capability owns connection lifecycle, the snapshot store owns cache invalidation, and per-key row checks replace the overly broad roster revision at the publication boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2b1fb5508ace.

Labels

Label justifications:

  • P2: This is a bounded Control UI chat-history readiness repair with no demonstrated broader outage or data-loss impact.
  • 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 PR is maintainer-authored, so the external-contributor proof gate does not apply; its submitted Chromium mock-Gateway scenario is supplemental evidence for the changed Control UI path.

Evidence

What I checked:

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 (4 earlier review cycles)
  • reviewed 2026-09-04T05:38:51.257Z sha 7e64b12 :: blocked before merge. :: none
  • reviewed 2026-09-04T06:13:30.834Z sha 5a5eff8 :: blocked before merge. :: none
  • reviewed 2026-09-04T14:56:37.378Z sha 3bb525f :: blocked before merge. :: none
  • reviewed 2026-09-04T18:44:46.090Z sha 5b24721 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 4, 2026
@steipete steipete self-assigned this Sep 4, 2026
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

The remaining maintainer decision is resolved: retain the producer-owned connection, session-row and cache-generation checks. The net 33 production lines carry independent ownership facts that the old whole-roster revision conflated, and remove the separate activity scan. No additional state, setting, protocol or dependency is introduced.

The final source matches the reviewed proof hashes. CI run 33842918991, attempt 2, and its aggregate gate are successful on exact 5a5eff8a. Its earlier runner-acquisition cancellation and successful targeted rerun remain infrastructure history, not a waived source assertion.

Current-main qualification also covers the merged roster refresh repair: different-agent events are filtered earlier, while necessary same-agent and unscoped refreshes still reach this path. The two fixes complement each other. Retained Chromium evidence uses the built UI with a synthetic Gateway; it is not a new production latency measurement. The existing broader global/main snapshot-key routing follow-up remains separate.

Merge current main into the existing prefetch repair while retaining
serial background requests and visible transcript priority.
@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 4, 2026
Merge current main into the existing prefetch branch while preserving
its ancestry. Reuse the canonical test session capability so chat-page
fixtures supply the current agent-selection owner and retain disposal.

The unchanged attachment-handoff test reproduced the missing selection
before this fixture repair; 85 owner and page-fixture tests and both
Chromium prefetch cases pass on the merged tree.
Merge current main to include the landed strict-widget bootstrap and
lazy provider-settings copy repairs. Keep all eight prefetch PR files
byte-identical to the reviewed version and preserve branch ancestry.

The existing widget sandbox case and both prefetch Chromium cases pass
on the combined tree. Fresh independent P2 review has no findings.
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

The current maintainer decision is resolved: retain the separate connection, candidate-row and cache-generation claims. The final production delta is +28 lines; those facts replace the incorrect whole-roster invalidation and the separate activity scan. No new configuration, dependency, protocol or persisted representation is introduced.

CI 33907845658 completed successfully on exact 97dc94044f6811d9c4432f33a43a3f1afa76d0c8, including the aggregate gate. Fresh built-UI Chromium covers both Prefetch flows and the formerly failing widget/bootstrap case. The canonical bundle check passed at 349,001 bytes under the original 350,141-byte limit. The original older-base CI failures remain recorded; no assertions or budgets were relaxed.

The PR body now reflects the final source, current proof and limitations. Earlier focused tests are reused through unchanged source bindings; synthetic browser evidence is not production latency proof. The broader global/main snapshot-key routing follow-up remains separate.

@steipete
steipete merged commit b116434 into main Sep 4, 2026
134 checks passed
@steipete
steipete deleted the codex/team-prefetch-20260904 branch September 4, 2026 19:26
@steipete

steipete commented Sep 4, 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 5, 2026
…openclaw#137947)

* fix(ui): keep prefetched chats ready during unrelated session updates

* test(ui): use session lifecycle in chat page fixtures
steipete added a commit that referenced this pull request Oct 15, 2026
* refactor(ui): consolidate page rendering and trim speculative recovery

Reuse the canonical retained Lit-content owner for the composer, resolve
New Session defaults through one owner, filter palette choices once, and
render stacked/total usage bars through one rectangle path. Supported
rendering, features, authorization and both migration paths remain intact.
Remove duplicate warm-prefetch alias-clock validation and the debug panel's
within-animation remeasurement/retargeting; keep their existing owners.

Best-effort tradeoffs accepted:
- Remove the companion post-rejoin history barrier from #125107. The
  synthetic initial-read/rejoin timing window has no cited human incident;
  a racing row appears on the next refresh/reopen/reconnect. Keep stable
  IDs, durable history, live wizard state and ambiguous-turn non-replay.
- Remove old-Gateway system.info error classification from #114971. Core
  methods already share version and advertisement/read admission (#160982);
  unexpected unknown-method errors now remain visible and retry normally.
- Remove warm-prefetch alias-clock comparisons from #137947's synthetic
  scenario. An unopened cached transcript may lag; foreground open still
  revalidates its cursor and retains account/identity/deletion ownership.
- Remove debug body-size retargeting from #162315's synthetic E2E. A size
  change within the 160ms animation settles at finish; ordinary animation,
  reduced motion, drag/resize and same-mode continuity stay. Remove unused
  reconnect() left by the completed #170758 Solid cutover.

Net production reduction: 181 lines; remove 107 mechanism-only test lines.
Focused retained page/owner tests: 216 passed; synthetic capture: 1 passed.
Expanded/minimized Debug frames are byte-identical before/after, inspected
and synthetic. No changelog, schema, protocol, dependency or config change.

* refactor(ui): consolidate sidebar and overlay presentation

Use reactive JSX props for sidebar adapters, share rendered-ancestry observation
between tooltips and hovercards, and consolidate picker placement and fixed menu
rows. Keep the Lit/Solid shipping paths, DOM classes, text, authorization, focus,
resource handling, and asynchronous overlay animation generations unchanged.

Best-effort tradeoffs accepted:
- Same-call show/hide listeners replacing or disconnecting their overlay no
  longer have intent-token fencing; the next ordinary request reconciles state.
- Reopening from a native-close callback no longer triggers compensating reopen;
  the accepted close wins until a later ordinary user request.
- Recursive self-retirement from a hide callback has no separate retirement
  protocol; ordinary disposal and descendant retirement are retained.
- Children created during the parent's native-close callback receive no second
  late-child sweep; normal descendants retire before native mutation.

These removed mechanisms came from synthetic callback cases in #169128, with
no cited human actual-use incident. Preserve ordinary veto and browser input
behavior; remove only the tests that pin the retired synchronous protocols.

* refactor(ui): retain getter calls for new-session links

* test(ui): align companion rejoin request expectation

* refactor(ui): retain main overlay behavior after inconclusive replays

* refactor(ui): retain main agent switcher after inconclusive replay

Drop the agent-menu avatar/property cleanup after the WebKit scroll case failed in bundle CI but passed focused replays at both head and main. Preserve main's implementation under the coordinator's conservative-cut rule; do not claim the browser failure repaired.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…72582)

* refactor(ui): consolidate page rendering and trim speculative recovery

Reuse the canonical retained Lit-content owner for the composer, resolve
New Session defaults through one owner, filter palette choices once, and
render stacked/total usage bars through one rectangle path. Supported
rendering, features, authorization and both migration paths remain intact.
Remove duplicate warm-prefetch alias-clock validation and the debug panel's
within-animation remeasurement/retargeting; keep their existing owners.

Best-effort tradeoffs accepted:
- Remove the companion post-rejoin history barrier from openclaw#125107. The
  synthetic initial-read/rejoin timing window has no cited human incident;
  a racing row appears on the next refresh/reopen/reconnect. Keep stable
  IDs, durable history, live wizard state and ambiguous-turn non-replay.
- Remove old-Gateway system.info error classification from openclaw#114971. Core
  methods already share version and advertisement/read admission (openclaw#160982);
  unexpected unknown-method errors now remain visible and retry normally.
- Remove warm-prefetch alias-clock comparisons from openclaw#137947's synthetic
  scenario. An unopened cached transcript may lag; foreground open still
  revalidates its cursor and retains account/identity/deletion ownership.
- Remove debug body-size retargeting from openclaw#162315's synthetic E2E. A size
  change within the 160ms animation settles at finish; ordinary animation,
  reduced motion, drag/resize and same-mode continuity stay. Remove unused
  reconnect() left by the completed openclaw#170758 Solid cutover.

Net production reduction: 181 lines; remove 107 mechanism-only test lines.
Focused retained page/owner tests: 216 passed; synthetic capture: 1 passed.
Expanded/minimized Debug frames are byte-identical before/after, inspected
and synthetic. No changelog, schema, protocol, dependency or config change.

* refactor(ui): consolidate sidebar and overlay presentation

Use reactive JSX props for sidebar adapters, share rendered-ancestry observation
between tooltips and hovercards, and consolidate picker placement and fixed menu
rows. Keep the Lit/Solid shipping paths, DOM classes, text, authorization, focus,
resource handling, and asynchronous overlay animation generations unchanged.

Best-effort tradeoffs accepted:
- Same-call show/hide listeners replacing or disconnecting their overlay no
  longer have intent-token fencing; the next ordinary request reconciles state.
- Reopening from a native-close callback no longer triggers compensating reopen;
  the accepted close wins until a later ordinary user request.
- Recursive self-retirement from a hide callback has no separate retirement
  protocol; ordinary disposal and descendant retirement are retained.
- Children created during the parent's native-close callback receive no second
  late-child sweep; normal descendants retire before native mutation.

These removed mechanisms came from synthetic callback cases in openclaw#169128, with
no cited human actual-use incident. Preserve ordinary veto and browser input
behavior; remove only the tests that pin the retired synchronous protocols.

* refactor(ui): retain getter calls for new-session links

* test(ui): align companion rejoin request expectation

* refactor(ui): retain main overlay behavior after inconclusive replays

* refactor(ui): retain main agent switcher after inconclusive replay

Drop the agent-menu avatar/property cleanup after the WebKit scroll case failed in bundle CI but passed focused replays at both head and main. Preserve main's implementation under the coordinator's conservative-cut rule; do not claim the browser failure repaired.
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.

1 participant