Skip to content

fix(ui): stop repeated background metadata reads across chat panes - #146685

Merged
steipete merged 15 commits into
mainfrom
codex/chat-metadata-observation
Sep 13, 2026
Merged

steipete merged 15 commits into
mainfrom
codex/chat-metadata-observation

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #146410

What Problem This Solves

Hidden retained chats keep issuing command and model reads after shared metadata changes. With three retained chats and only one shown, one event starts three request pairs on main.

User Impact

Visible chats share the required metadata work; hidden chats catch up when shown. Repeated invalidations coalesce behind pending work, while explicit model recovery, startup commands, and scoped session facts remain available. A session update during a cold model read no longer leaves the picker blank. No configuration or migration is required.

Why This Change Was Made

The metadata coordinator observes presentation demand and waits for the existing command and model request owners, then rechecks scope and visibility before dispatch. Main's command queues (#146810) and raw model transport lanes (#146953) retain dispatch, deadlines, cancellation, publication, and connection retirement. Canonical cache notifications retire automatic attempts after expiry, refresh, eviction, or connection changes. Metadata bulk invalidation and listener delivery live in the existing lazy client store. The shell synchronously delegates to it without loading request code. Model settlement and subscription setup also stay with the lazy model store; notifications reuse prepared scope keys and eviction runs only at publication. Session events invalidate model projections immediately, while metadata-specific qualification runs inside the existing lazy store so ordinary messages skip the full metadata parser.

CI also exposed a Vite preview-fixture race during service-worker build replacement. The preview owner now pauses admission, drains responses and file streams, swaps or restores the directory, and resumes waiting requests. The real-Vite publication test runs in the existing standalone E2E process lane, with its routing inventory updated.

Evidence

The unchanged retained-pane browser cases fail on pinned main 8d37c8a52ff2c4de202d2c7d3f20f06737741997 and pass on the integrated candidate:

Event with three retained panes, two hidden Main Updated
config.changed 3 metadata + 3 model reads 1 + 1
chat.metadata.changed 3 metadata + 3 model reads 1 + 1

Validation includes 863 focused owner/provider/chunking tests and all 17 mounted metadata/skill-library cases. These exercise hidden and remounted chats, held transports, donated snapshots, both settlement orders, queued command adoption, failed-attempt sharing, and explicit recovery. Shell regressions reproduce cold-load loss after a model-only session event, cover automatic/explicit/picker recovery and replacement failures, and ensure two panes share an accepted expired snapshot without another request.

The complete original 30-file gate and final five-file integration gate pass. Fresh full-diff review through P2 found no actionable issues. Main's startup grouping from #147110 is integrated through normal history; this PR changes no budget files. The controlled build against main 8d424f82171e28d474db1904afef669c9d7ec991 passes at 355,071 bytes gzip across seven startup requests, below even the earlier 355,719-byte limit. CSS remains 46,117 bytes with zero growth. All 17 browser cases and the 566-test workflow guard file pass again after that main integration. Exact-head CI completed successfully for a199cbd00915de5db72337f00fc87d4fc2c35a05, including the required openclaw/ci-gate.

The seven publication/service-worker cases and 47 routing/sharding checks passed before the final metadata-only edits. The single routing-inventory repair independently reproduced red and passed its complete 566-test owner with two unchanged skips. A complete local UI run with Vitest's supported process pool finished in 156 seconds: 19,418 passed, two browser interaction failures independently reproduced on unmodified main, and one skip. Default shared-thread validation on macOS encountered a native FSEvents finalization problem; that is a local execution limitation, and hosted CI retains its normal configuration.

These synthetic results prove reduced duplicate RPCs, not final production page latency. The inspected captures preserve the same synthetic visible state; RPC assertions establish the request reduction.

Original synthetic state Updated synthetic state
Original synthetic chat after a metadata event Updated synthetic chat after a metadata event

@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 docs Improvements or additions to documentation app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 03:14
@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, 12:42 PM ET / 16:42 UTC (Revision 17).

ClawSweeper review

What this changes

The Control UI shares metadata refreshes across visible chat panes, defers hidden panes, recovers interrupted model reads, and coordinates build replacement in browser-test fixtures.

Merge readiness

✅ Ready for maintainer review

This remains a useful, distinct fix beyond the merged request-queue work. No actionable correctness or security defect was found in the pinned patch.

Priority: P2
Reviewed head: a199cbd00915de5db72337f00fc87d4fc2c35a05

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with meaningful lifecycle and browser coverage, preserved request ownership, and no actionable review findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this maintainer-authored PR. Supplied mounted-browser assertions exercise metadata admission and report reduced RPC counts; inspected screenshots show preserved visible state, not network or production-latency proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this maintainer-authored PR. Supplied mounted-browser assertions exercise metadata admission and report reduced RPC counts; inspected screenshots show preserved visible state, not network or production-latency proof.
Evidence reviewed 8 items Current main still needs presentation-aware refresh: Main's metadata invalidation callback calls refreshChatMetadata for every subscribed pane, and that function has no presentation check. The merged queues therefore do not implement this PR's central hidden-pane behavior.
Shared admission preserves existing request owners: The coordinator waits for command requests and model transport settlement, rechecks active consumers, and delegates dispatch to the existing stores. These are OpenClaw Gateway RPC contracts; the changed path does not depend on a Codex harness contract.
Scoped publication and recovery: Bindings retain client, connection epoch, agent, session, and request-generation checks. Automatic refreshes respect visibility; explicit picker recovery remains available and consumes accepted cache results.
Findings None None.
Security None None.

How this fits together

Chat panes consume command and model metadata from the Gateway. The browser's shared stores coordinate these reads and publish scoped results to chat controls without replacing conversation state.

flowchart TD
  A[Gateway change events] --> B[Shared metadata store]
  C[Pane and document visibility] --> B
  B --> D{Visible demand?}
  D -->|No| E[Defer until presented]
  E --> C
  D -->|Yes| F[Existing command and model queues]
  F --> G[Current scoped chat controls]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +409, Tests +1763, Docs +2. Total +2174 across 30 files.

View PR surface stats
Area Files Added Removed Net
Source 11 541 132 +409
Tests 18 1862 99 +1763
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 30 2405 231 +2174

Review metrics

Metric Value Why it matters
Production versus validation growth Net production +409 lines; tests and test support +1,763 lines Production growth has a stated purpose: shared presentation-aware admission and recovery around existing request owners.

Technical review

Best possible solution:

Keep presentation demand in the shared metadata owner while the existing command and model stores retain transport scheduling, cancellation, and publication.

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

Yes, from source: retain three chats, show one, and emit a shared metadata-change event; current main refreshes all subscribed panes. The supplied browser regression reports this failure, but this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. The patch extends the existing metadata owner, preserves the merged transport queues, and centralizes session-event invalidation without adding settings or a parallel request implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This addresses unnecessary background Gateway reads and model-control recovery with a bounded Control UI 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 ordinary external-contributor proof gate does not apply to this maintainer-authored PR. Supplied mounted-browser assertions exercise metadata admission and report reduced RPC counts; inspected screenshots show preserved visible state, not network or production-latency proof.

Evidence

What I checked:

  • Current main still needs presentation-aware refresh: Main's metadata invalidation callback calls refreshChatMetadata for every subscribed pane, and that function has no presentation check. The merged queues therefore do not implement this PR's central hidden-pane behavior. (ui/src/pages/chat/chat-state-refresh.ts:169, b076a15e5103)
  • Shared admission preserves existing request owners: The coordinator waits for command requests and model transport settlement, rechecks active consumers, and delegates dispatch to the existing stores. These are OpenClaw Gateway RPC contracts; the changed path does not depend on a Codex harness contract. (ui/src/lib/chat/chat-metadata-store.ts:393, a199cbd00915)
  • Scoped publication and recovery: Bindings retain client, connection epoch, agent, session, and request-generation checks. Automatic refreshes respect visibility; explicit picker recovery remains available and consumes accepted cache results. (ui/src/pages/chat/chat-state-refresh.ts:220, a199cbd00915)
  • Browser regression coverage and inspected captures: The complete supplied body reports unchanged browser cases reducing three metadata/model request pairs to one after either shared invalidation event. Inspected downloaded before/after images preserve the synthetic draft and updated model label; they do not display network diagnostics or prove deployed latency. The committed browser cases assert request counts, activation catch-up, split-pane sharing, and startup settlement. (ui/src/e2e/chat-metadata-observation.e2e.test.ts:164, a199cbd00915)
  • Preview replacement is test infrastructure: The fixture pauses new responses, drains active responses and file streams, replaces or restores the served directory, and resumes waiting requests. Its real-Vite test covers completion, cancellation, and rollback; no production updater or persisted user-data format changes. (ui/src/test-helpers/control-ui-e2e-build-publication.ts:78, a199cbd00915)
  • Main-history routing: Main history identifies Peter Steinberger's recent command/model queue work and Ayaan Zaidi's earlier direct catalog and prepared-catalog work. This supports routing candidates, not source-line introduction attribution. (ui/src/lib/model-catalog-store.ts, b076a15e5103)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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 (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-13T08:55:02.481Z sha fdf05dc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T09:38:23.828Z sha fdf05dc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T10:09:37.590Z sha fdf05dc :: blocked before merge. :: none
  • reviewed 2026-09-13T11:44:18.705Z sha 4a073b0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T12:02:23.814Z sha a68b44e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T13:45:17.461Z sha 1590f39 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T15:32:31.011Z sha ca8558c :: blocked before merge. :: none
  • reviewed 2026-09-13T15:58:39.418Z sha ca8558c :: needs maintainer review before merge. :: none

@steipete
steipete requested a review from a team as a code owner September 13, 2026 04:12
@steipete
steipete force-pushed the codex/chat-metadata-observation branch from b91d7f5 to 21f5329 Compare September 13, 2026 05:22
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 13, 2026
Share automatic metadata and model catalog refresh generations across panes and defer hidden views until presented. Preserve startup snapshots, in-flight settlement, and explicit retries while coalescing invalidations.

Validated with 317 focused unit tests, 18 mocked Chromium scenarios, targeted owner regressions, full changed-file checks, UI test types, unchanged bundle budgets, and a clean independent review.
Keep startup catalog delivery and command metadata independent across early and late presentation changes. Let the current catalog result enable the picker while command metadata is pending, and route integration proof through the application shell owner.

Validation: 673 unit/integration tests; cold and visibility browser regressions; ordered account-snapshot proof; real-Gateway palette recovery; full changed-file and UI test type checks; unchanged bundle budget; clean independent review through P2. Earlier broad local account-picker timeouts remain unattributed and were not hidden by timeout or assertion changes.
Raw bounding-box replay could hit the adjacent Manage row after popup placement moved. Hover the retained More row, verify pointer targeting, then send one mouse down/up pair while preserving all disabled, request-count, navigation, and keyboard assertions.

Proven with the original 13-test-order failure trace, which delivered the second click to Manage, followed by all 13 tests passing. UI test types, changed-file checks, and independent review through P2 pass.
Keep an inactive startup command fallback behind its predecessor's transport
settlement. Reobserve waiting demand through the same admission owner, and
fence inherited catalog work with its creation revision so invalidation cannot
publish an old catalog as current. Same-generation visibility return and
explicit refresh remain immediate.

Honor writer-owned pending state during explicit synchronous metadata error
retry after the publication-owner integration.

Validation: 53 metadata/catalog tests, 94 chat/app-host entrypoint cases,
14 metadata browser scenarios, UI test types, full changed-file checks, and
independent full-diff review through P2. Startup gzip is 354949 bytes under the
unchanged 355719-byte limit. Both hidden invalidation/remount regressions fail
before the repair and pass afterward.
@steipete
steipete force-pushed the codex/chat-metadata-observation branch from 1d35ba4 to 77354b3 Compare September 13, 2026 07:30
Move the complete managed worktree test family into the existing agents-tools graph. Preserve all canonical roots, graph identities, stripe assignments, compiler concurrency, and the existing 700-root target and 720-root cap.
Use the canonical createDeferred helper in the two remaining sidebar scope tests after the shared helper export was retired. Preserve the existing scope-replacement assertions.
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 13, 2026
Merge current main while retaining its command scheduling and scoped session reconciliation. Coalesce automatic catalog refreshes across retained panes, preserve transport settlement barriers, and recover omitted startup commands without duplicating catalog reads.
Let visible command demand adopt the existing queued publication through the command owner while preserving transport settlement barriers. Keep the skill activation request bound intact and repair catalog and hydration test fixtures exposed by CI.
Preserve the canonical catalog queue and caller deadlines while automatic metadata demand waits on its raw settlement receipts. Retain scoped invalidation and presentation ownership, and make preview build replacement drain its active response streams.
Include the landed reclamation-memory fixture repair from #147028. The 27 owned performance and test-infrastructure files remain identical to the reviewed candidate.
Merge the current CI baseline while preserving the command and model
request owners. Keep bulk metadata invalidation, listeners, and consumer
setup in their lazy stores, reuse prepared scope keys, and trim catalogs
only where publication grows them.

Preserve cold catalog demand when an ordinary session event retires a
pending automatic, explicit, or picker read. Display accepted expired
snapshots across shared panes without retrying, and report replacement
failures once. Include the standalone E2E publication inventory repair.
Merge the current CI baseline and use the shared startup grouping from
#147110. Preserve immediate model invalidation for session events while
the existing lazy client store qualifies command metadata changes.
Ordinary messages skip the full metadata parser.
Bring in #147110 through normal main history and preserve the reviewed
metadata source. Retain main's CI workflow fixture environment updates.
@steipete
steipete merged commit 80e086f into main Sep 13, 2026
162 of 163 checks passed
@steipete
steipete deleted the codex/chat-metadata-observation branch September 13, 2026 16:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…penclaw#146685)

* fix(ui): stop repeated background metadata reads across chat panes

Share automatic metadata and model catalog refresh generations across panes and defer hidden views until presented. Preserve startup snapshots, in-flight settlement, and explicit retries while coalescing invalidations.

Validated with 317 focused unit tests, 18 mocked Chromium scenarios, targeted owner regressions, full changed-file checks, UI test types, unchanged bundle budgets, and a clean independent review.

* fix(ui): preserve chat readiness during shared metadata refreshes

Keep startup catalog delivery and command metadata independent across early and late presentation changes. Let the current catalog result enable the picker while command metadata is pending, and route integration proof through the application shell owner.

Validation: 673 unit/integration tests; cold and visibility browser regressions; ordered account-snapshot proof; real-Gateway palette recovery; full changed-file and UI test type checks; unchanged bundle budget; clean independent review through P2. Earlier broad local account-picker timeouts remain unattributed and were not hidden by timeout or assertion changes.

* test(ui): target pending account rows before pointer clicks

Raw bounding-box replay could hit the adjacent Manage row after popup placement moved. Hover the retained More row, verify pointer targeting, then send one mouse down/up pair while preserving all disabled, request-count, navigation, and keyboard assertions.

Proven with the original 13-test-order failure trace, which delivered the second click to Manage, followed by all 13 tests passing. UI test types, changed-file checks, and independent review through P2 pass.

* fix(ui): preserve metadata startup settlement across visibility changes

Keep an inactive startup command fallback behind its predecessor's transport
settlement. Reobserve waiting demand through the same admission owner, and
fence inherited catalog work with its creation revision so invalidation cannot
publish an old catalog as current. Same-generation visibility return and
explicit refresh remain immediate.

Honor writer-owned pending state during explicit synchronous metadata error
retry after the publication-owner integration.

Validation: 53 metadata/catalog tests, 94 chat/app-host entrypoint cases,
14 metadata browser scenarios, UI test types, full changed-file checks, and
independent full-diff review through P2. Startup gzip is 354949 bytes under the
unchanged 355719-byte limit. Both hidden invalidation/remount regressions fail
before the repair and pass afterward.

* fix(ci): restore agent test graph headroom

Move the complete managed worktree test family into the existing agents-tools graph. Preserve all canonical roots, graph identities, stripe assignments, compiler concurrency, and the existing 700-root target and 720-root cap.

* fix(test): complete sidebar deferred helper migration

Use the canonical createDeferred helper in the two remaining sidebar scope tests after the shared helper export was retired. Preserve the existing scope-replacement assertions.

* test(ui): close file previews through their hosted tabs

* fix(ui): retain queued metadata publication during invalidation

Let visible command demand adopt the existing queued publication through the command owner while preserving transport settlement barriers. Keep the skill activation request bound intact and repair catalog and hydration test fixtures exposed by CI.
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 docs Improvements or additions to documentation gateway Gateway runtime 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: 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