Skip to content

perf(ui): trust startup metadata and damp catalog polling - #114837

Merged
steipete merged 4 commits into
mainfrom
perf/session-open-lean
Jul 28, 2026
Merged

steipete merged 4 commits into
mainfrom
perf/session-open-lean

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Two Control UI inefficiencies around session loading (team.openclaw.ai production evidence):

  1. Opening a session fired chat.startup (avg 437ms) AND chat.metadata (avg 441ms) in parallel — but chat.startup already computes and ships the same metadata (buildChatStartupMetadataResult), and the client discarded whichever response arrived second. The redundant call could even trigger full catalog discovery server-side (no preloadedOnly).
  2. The sidebar catalog poll drops to its fast 5s cadence whenever a JSON.stringify diff of the whole payload changes — and rows carry updatedAt/recencyAt, so any activity on any listed external session pinned every client at 5s (a 6× poll amplifier). Presence/focus/visibility/hostUpdated triggers also fired independent refreshes on foregrounding.

Why This Change Was Made

Production perf campaign on session loading: one whole ~440ms request per session open was pure waste, and the poll amplifier multiplied the (separately expensive) catalog cost.

User Impact

Faster session opens and materially fewer catalog polls; no protocol or response-shape changes:

  • Complete startup-shipped metadata → no chat.metadata request; partial metadata → a scoped gap-fill for missing fields only; absent metadata (startup's 25ms catalog budget missed or full discovery required) → immediate chat.metadata so the model picker/commands never sit empty.
  • The changed-signal now compares material identity (sorted catalog/host/session identities, labels, connectivity/errors, session name/status/archive) and ignores ordering plus bare updatedAt/recencyAt ticks; genuinely new/removed rows still hit the 5s cadence.
  • Presence, focus, visibility, and host-update bursts coalesce into the existing 50ms activation debounce.

Evidence

  • 487 UI tests green, including new regressions: no chat.metadata when startup metadata is complete; immediate gap-fill on omitted metadata; updatedAt-only diffs keep the 30s cadence while identity changes drop to 5s; presence+focus burst produces one refresh.
  • UI production/test typechecks on Blacksmith Testbox (run 30318477709); oxlint, format, max-lines ratchet, git diff --check clean.
  • Codex autoreview: zero accepted findings.

@steipete
steipete marked this pull request as ready for review July 28, 2026 01:01
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Jul 28, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 28, 2026
@clawsweeper

clawsweeper Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 12:07 AM ET / 04:07 UTC.

ClawSweeper review

What this changes

This PR reuses metadata returned by the Control UI’s initial chat startup request, fills only missing metadata afterward, and prevents timestamp-only catalog updates or foregrounding bursts from forcing rapid sidebar polling.

Merge readiness

⛔ Blocked until real behavior proof is added - 4 items remain

Keep this PR open. The supplied diff and regression coverage support the intended Control UI performance change, but the PR still lacks inspectable after-fix runtime evidence and carries the protected maintainer label, so it needs a human merge review after a redacted real-session proof is posted.

Priority: P2
Reviewed head: 0d342c2abaff218b4d0511b1d42b0fe8975538fe

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation and focused regression tests look coherent from the supplied diff, but missing inspectable real behavior proof remains a merge gate.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR body reports production observations and automated validation, but no inspectable after-fix recording, request trace, terminal output, linked artifact, or redacted runtime log was supplied. Add redacted live evidence before merge; after updating the body, a fresh ClawSweeper review should trigger automatically, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports production observations and automated validation, but no inspectable after-fix recording, request trace, terminal output, linked artifact, or redacted runtime log was supplied. Add redacted live evidence before merge; after updating the body, a fresh ClawSweeper review should trigger automatically, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Startup metadata reuse: The proposed chat refresh path applies metadata from the startup response and only requests additional metadata for missing command or model fields, while retaining a fallback path for incomplete startup results.
Catalog cadence coverage: The branch adds focused sidebar tests for timestamp-only session changes retaining the stable cadence and for coalescing presence plus focus refresh triggers.
Prior proof gate remains unresolved: The latest completed ClawSweeper review recorded that the PR had automated checks but no inspectable after-fix Control UI or Gateway evidence; the supplied current body still provides test and Testbox claims rather than a viewable runtime trace, recording, artifact, or log.
Findings None None.
Security None None.

How this fits together

The Control UI opens a chat by requesting startup data from the Gateway, which can include the model and command metadata used by the composer. Separately, the sidebar polls Gateway session catalogs; this change decides when refreshes are needed and how quickly the next poll should occur.

flowchart LR
  A[User opens chat] --> B[Control UI startup request]
  B --> C[Gateway chat startup response]
  C --> D[Startup metadata applied]
  D --> E[Scoped metadata gap fill]
  F[Presence or focus events] --> G[Catalog refresh debounce]
  G --> H[Session catalog poll cadence]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports production observations and automated validation, but no inspectable after-fix recording, request trace, terminal output, linked artifact, or redacted runtime log was supplied. Add redacted live evidence before merge; after updating the body, a fresh ClawSweeper review should trigger automatically, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P2) - The claimed production improvement is not yet backed by inspectable after-fix evidence showing the live startup request sequence, scoped fallback behavior, and catalog refresh cadence.
  • Resolve merge risk (P1) - The protected maintainer label means a human must decide whether the performance tradeoff and the 25 ms optional-catalog budget are acceptable for the supported Control UI workflow.
  • Complete next step (P2) - A contributor-provided real-behavior proof and protected-label human review are required; there is no narrow code repair for ClawSweeper to apply automatically.
Agent review details

Security

None.

PR surface

Source +93, Tests +66. Total +159 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 9 212 119 +93
Tests 3 124 58 +66
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 336 177 +159

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/app-sidebar-session-catalog-live.ts, serialized state: ui/src/components/session-data-controller-catalog.ts, unknown-data-model-change: ui/src/components/session-data-controller-catalog.ts, unknown-data-model-change: ui/src/components/session-data-controller.ts, vector/embedding metadata: ui/src/e2e/chat-composer-redesign.e2e.test.ts, vector/embedding metadata: ui/src/e2e/chat-flow.e2e.test.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Post a redacted real Control UI/Gateway trace or recording that demonstrates complete-startup reuse, incomplete-startup gap fill, and stable polling under timestamp-only activity; then have the assigned reviewer assess the timeout and fallback behavior against a real session.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Post a redacted real Control UI/Gateway trace or recording that demonstrates complete-startup reuse, incomplete-startup gap fill, and stable polling under timestamp-only activity; then have the assigned reviewer assess the timeout and fallback behavior against a real session.

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

No high-confidence live reproduction is available in the supplied evidence. The redundant request and cadence decisions are source-reproducible from the branch and its focused tests, but the reported production timings and after-fix behavior need an inspectable runtime trace.

Is this the best way to solve the issue?

Yes, conditionally. Reusing complete startup metadata and preserving a scoped fallback is a narrower solution than adding a parallel request, but the real UI behavior and timeout tradeoff should be demonstrated before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 021e1457e807.

Labels

Label justifications:

  • P2: This is a bounded Control UI performance and responsiveness change with no demonstrated data-loss, security, crash-loop, or user-blocking impact.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports production observations and automated validation, but no inspectable after-fix recording, request trace, terminal output, linked artifact, or redacted runtime log was supplied. Add redacted live evidence before merge; after updating the body, a fresh ClawSweeper review should trigger automatically, or a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Startup metadata reuse: The proposed chat refresh path applies metadata from the startup response and only requests additional metadata for missing command or model fields, while retaining a fallback path for incomplete startup results. (ui/src/pages/chat/chat-state-refresh.ts:309, 0d342c2abaff)
  • Catalog cadence coverage: The branch adds focused sidebar tests for timestamp-only session changes retaining the stable cadence and for coalescing presence plus focus refresh triggers. (ui/src/test-helpers/app-sidebar-cases/catalog-live-state.ts:28, 0d342c2abaff)
  • Prior proof gate remains unresolved: The latest completed ClawSweeper review recorded that the PR had automated checks but no inspectable after-fix Control UI or Gateway evidence; the supplied current body still provides test and Testbox claims rather than a viewable runtime trace, recording, artifact, or log. (a68180eeb232)
  • Protected human-review signal: The supplied live PR context includes the protected maintainer label and an assignment, so this cleanup workflow must not auto-close or automate the merge decision. (0d342c2abaff)

Likely related people:

  • steipete: The supplied branch history attributes the four commits that refine startup metadata handling, catalog refresh behavior, and follow-up regressions to this contributor; current-main ownership history was not available in the read-only inspection environment. (role: recent area contributor; confidence: low; commits: 39727519fa6d, a68180eeb232, 0d342c2abaff; files: ui/src/pages/chat/chat-state-refresh.ts, ui/src/components/app-sidebar-session-catalog-live.ts, ui/src/components/session-data-controller.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted live Control UI or Gateway trace showing that complete startup metadata avoids chat.metadata, incomplete metadata performs one scoped gap fill, and timestamp-only catalog changes retain the slower cadence.
  • Have the assigned reviewer confirm the 25 ms optional catalog budget and fallback behavior against that trace.

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 (2 earlier review cycles)
  • reviewed 2026-07-28T01:10:04.176Z sha 709c0f5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-28T01:57:15.022Z sha a68180e :: needs real behavior proof before merge. :: none

@steipete steipete self-assigned this Jul 28, 2026
@steipete
steipete merged commit 9dddddb into main Jul 28, 2026
121 of 123 checks passed
@steipete
steipete deleted the perf/session-open-lean branch July 28, 2026 04:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 28, 2026
…14837)

* perf(ui): trust startup metadata and damp catalog polling

* chore(ui): de-export internal catalog refresh helpers

* fix(ui): keep agent-scoped composer models fresh across pane switches

* fix(ui): keep first-turn sends working while startup loading is pending
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 gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant