Skip to content

fix(ui): show chat before startup metadata finishes - #128652

Merged
steipete merged 3 commits into
mainfrom
steipete/festive-lehmann-ca2bde
Aug 24, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/festive-lehmann-ca2bde

Conversation

@steipete

@steipete steipete commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Related: #114693

What Problem This Solves

Fixes an issue where users opening or refreshing a chat could remain behind the loading skeleton even after the transcript was available, because optional model metadata and the agent roster still had to finish first.

A live team-session baseline showed chat.startup taking 1.53–3.68s and the transcript becoming visible 4.26–7.59s after navigation. The startup response also owned agent-roster data that already has a canonical agents.list owner.

Why This Change Was Made

Chat startup now keeps transcript/session state on the critical path while treating neutral model metadata as optional prepared data. Sessions with an explicit auth-profile override still wait for their authoritative session-specific projection so model context and thinking controls remain correct.

Agent-roster hydration moves back to agents.list, which now preserves per-agent model/thinking projections and reuses one successful roster per connection. The obsolete bundled-roster/adoption path and startup all-agent projection are removed.

The short session-URL resolution waterfall and the independently reproduced Control UI asset-preparation 503 are separate owner boundaries and are intentionally not hidden in this patch.

User Impact

For ordinary sessions, chat history can render as soon as it is available even while optional model controls and agent metadata continue hydrating. Users no longer stare at a transcript skeleton because unrelated startup metadata is refreshing.

Auth-profile-overridden sessions retain their existing authoritative behavior. Agent switchers also retain agent-specific thinking capabilities rather than inheriting one shared catalog.

Production LOC: +105/-189 (net -84). Tests/test support: +454/-258 (net +196).

Evidence

  • Real isolated Gateway built from this branch, loopback-only state, five browser reloads:
    • four warm chat.startup runs: 286–384ms; one cold outlier: 1.15s
    • server history_page: 0.30–0.92ms
    • server neutral startup_projection: 0.09–0.17ms
    • one agents.list and one message subscription per empty dev session
  • Deterministic browser proof holds agents.list and chat.metadata unresolved while the transcript appears and the loading skeleton disappears.
  • Focused Vitest: 363 Gateway tests, 468 Control UI unit tests, 7 Chromium E2E tests.
  • node scripts/check-changed.mjs
  • pnpm build
  • git diff --check
  • Exact-head CI also exposed two pre-existing Control UI E2E ownership races. This PR now waits on the exact config-save request rather than a short count poll, preserves explicit all-agent scope across roster publication, and coalesces identical managed session-list demand. The failing files and exact shards pass repeatedly after the repairs.
  • Fresh structured autoreview after each final behavior change: no accepted/actionable findings.
  • AI-assisted implementation; maintainer reviewed the architecture, diff, tests, and live behavior directly.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 09:54
@steipete

Copy link
Copy Markdown
Contributor Author

Visual proof from the deterministic Control UI/Gateway harness:

  • Before: the transcript remains behind the loading skeleton while startup is pending.
  • After: the transcript is visible while agents.list and chat.metadata are deliberately still unresolved; the composer continues to show model hydration in progress.

Real isolated-Gateway proof on this exact head also completed with five browser reloads: four warm chat.startup runs took 286–384ms (one cold outlier at 1.15s), and Gateway timeline spans measured the neutral startup projection at 0.09–0.17ms.

Before: chat transcript loading skeleton

After: transcript visible while optional metadata continues loading

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 7:41 AM ET / 11:41 UTC.

ClawSweeper review

What this changes

The PR lets Control UI render chat history before optional model metadata and the agent roster complete, while moving roster hydration to agents.list.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for maintainer review: the patch cleanly separates transcript rendering from roster hydration, but retiring the startup roster payload needs an explicit compatibility decision and exact-head CI completion.

Priority: P2
Reviewed head: 613f3008b2f8f4bff70eb7c190e47d4841d6bc66
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused owner-boundary coverage and a net-negative production change; compatibility confirmation and exact-head CI remain merge gates.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the provided visual proof could not be independently fetched because network DNS was unavailable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the provided visual proof could not be independently fetched because network DNS was unavailable.
Evidence reviewed 6 items Transcript and metadata separation: The startup handler returns the history payload without an agent roster and only includes metadata when a prepared projection is available.
Prepared metadata owner: Metadata refresh precomputes neutral projections before publishing a generation; neutral startup reads return no metadata during replacement rather than waiting for it.
UI ownership and regression coverage: The UI starts history first and hydrates the canonical roster afterward; the E2E test holds both roster and metadata requests while asserting the transcript becomes visible.
Findings None None.
Security None None.

Live Verification

Command: pnpm test ui/src/e2e/chat-flow.session-start.e2e.test.ts

Result: PASS (completed)

pnpm test ui/src/e2e/chat-flow.session-start.e2e.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128652-eUqwYn/target$ pnpm test ui/src/e2e/chat-flow.session-start.e2e.test.ts
$ node --import tsx scripts/test-projects.mts ui/src/e2e/chat-flow.session-start.e2e.test.ts
[test] starting test/vitest/vitest.ui-e2e.config.ts
[test] preflight test/vitest/vitest.ui-e2e.config.ts
pnpm test ui/src/e2e/chat-flow.session-start.e2e.test.ts
[ui-e2e] Using system Chromium at /usr/bin/chromium-browser.
Downloading FFmpeg (playwright ffmpeg v1011) from https://cdn.playwright.dev/dbazure/download/playwright/builds/ffmpeg/1011/ffmpeg-linux.zip
|                                                                                |   0% of 2.3 MiB
|■■■■■■■■                                                                        |  10% of 2.3 MiB
|■■■■■■■■■■■■■■■■                                                                |  20% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■                                                        |  30% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                                |  40% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                        |  50% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                                |  60% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                        |  70% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■                |  80% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■        |  90% of 2.3 MiB
|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 100% of 2.3 MiB
FFmpeg (playwright ffmpeg v1011) downloaded to /tmp/clawsweeper-live-proof-128652-eUqwYn/profile/cache/ms-playwright/ffmpeg-1011

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128652-eUqwYn/target

 ✓  ui-e2e  ui/src/e2e/chat-flow.session-start.e2e.test.ts (3 tests) 16870ms
     ✓ opens a git-backed agent draft from the sidebar new-session action  5500ms
     ✓ waits for configured inference before sending the first chat turn  1787ms
     ✓ paints startup history while canonical roster and metadata requests remain pending  1296ms

 Test Files  1 passed (1)
      Tests  3 passed (3)
   Start at  11:42:34
   Duration  27.52s (transform 530ms, setup 129ms, import 957ms, tests 16.87s, environment 0ms)

[test] passed 1 Vitest shard in 34.18s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128652-eUqwYn/target$ pnpm test ui/src/e2e/chat-flow.session-start.e2e.test.ts
















Assertions:

  • PASS expect_output: paints startup history while canonical roster and metadata requests remain pending

How this fits together

Control UI starts a chat through Gateway history RPCs, then hydrates model controls and agent selection. The change keeps transcript history on the fast path and moves roster ownership to the dedicated roster RPC.

flowchart LR
  UI[Control UI chat] --> Startup[Chat startup]
  Startup --> History[Transcript history]
  History --> Render[Visible transcript]
  UI --> Roster[Agent roster request]
  Startup --> Metadata[Optional model metadata]
  Roster --> Controls[Agent controls]
  Metadata --> Controls
Loading

Decision needed

Question Recommendation
Should ordinary chat.startup continue supplying an agent roster for external Gateway clients, or is agents.list the sole supported roster contract? Treat roster as agents.list-owned: Confirm the startup roster was not a supported external contract and keep the performance-oriented removal.

Why: The checked-in first-party clients use agents.list, but the retired startup field was observable on the wire and external consumer expectations cannot be established from this checkout.

Before merge

  • Resolve merge risk (P1) - Removing the previously emitted agentsList startup payload could affect external Gateway clients that treated the undocumented field as stable; first-party native clients use agents.list, but external-client usage was not observable locally.
  • Resolve merge risk (P1) - Current-main source and live GitHub reads were unavailable because the promisor remote and GitHub DNS could not be reached; exact-head CI remains in progress.
  • Complete next step (P2) - A maintainer must decide the external protocol status of the removed startup roster; there is no narrow automated repair without that direction.
Agent review details

Security

None.

PR surface

Source -105, Tests +217. Total +112 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 14 105 210 -105
Tests 14 454 237 +217
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 28 559 447 +112

Review metrics

Metric Value Why it matters
Production versus test LOC production +105/-189 (net -84); tests/test support +454/-258 (net +196) The bug fix deletes more runtime code than it adds while expanding boundary and E2E coverage for ordering races.
Roster ownership 1 startup payload field removed; 1 canonical roster RPC retained This ownership change is the relevant compatibility surface for Gateway clients.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/server-methods/sessions-read.test.ts, serialized state: src/gateway/session-utils-store.ts, serialized state: src/gateway/session-utils.test.ts, serialized state: ui/src/lib/sessions/index-list.test.ts, serialized state: ui/src/lib/sessions/session-roster-refresh.ts, unknown-data-model-change: src/gateway/server-methods/chat-metadata-runtime.test.ts, and 10 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm the canonical roster contract (recommended)
    Treat agents.list as the sole roster API only after the responsible owner confirms external startup-payload compatibility.
  2. Keep a deprecated startup roster
    Preserve the roster payload temporarily if external clients are expected to consume it, with explicit retirement coverage.

Technical review

Best possible solution:

Confirm that ordinary chat.startup roster data is not a supported external protocol contract, then land the canonical agents.list ownership split after exact-head CI passes.

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

Yes, at source level: the focused Control UI E2E holds agents.list and chat.metadata pending while requiring the transcript to render. It was not executed because this review is read-only.

Is this the best way to solve the issue?

Unclear: the UI/Gateway split is the clean owner-boundary solution, but whether the removed startup roster is an external protocol contract requires maintainer direction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0d840c0fce11.

Labels

Label justifications:

  • P2: The change improves Control UI startup responsiveness but has no evidenced data-loss, security, or availability emergency.
  • merge-risk: 🚨 compatibility: The branch retires an observable roster field from ordinary startup responses, which may affect external Gateway consumers.
  • 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: This is maintainer-authored work, so the external-contributor proof gate does not apply; the provided visual proof could not be independently fetched because network DNS was unavailable.

Evidence

What I checked:

Likely related people:

  • steipete: Current-head blame and recent history place Peter Steinberger on the chat-history and Control UI startup surfaces. (role: recent Gateway and Control UI contributor; confidence: high; commits: 613f3008b2f8, f5125a7e56; files: src/gateway/server-methods/chat-history-handler.ts, ui/src/pages/chat/chat-pane-context.ts)

Rank-up moves

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

  • Confirm whether ordinary startup roster data is an external Gateway protocol contract.
  • Wait for exact-head CI to complete successfully.

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 (3 earlier review cycles)
  • reviewed 2026-08-24T10:04:56.255Z sha 376b2c4 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T10:47:52.388Z sha 376b2c4 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T11:08:06.514Z sha 195b09a :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 24, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 24, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 24, 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

Copy link
Copy Markdown
Contributor Author

Land-ready verification for exact head 613f3008b2f8f4bff70eb7c190e47d4841d6bc66:

  • Exact-head CI: green — https://github.com/openclaw/openclaw/actions/runs/32722675219
  • Focused Gateway/UI proof: 363 Gateway tests, 468 Control UI unit tests, and 7 Chromium startup/agent-scope E2E tests.
  • Real isolated Gateway: five browser reloads; four warm chat.startup runs at 286–384ms (one cold outlier 1.15s); neutral startup projection 0.09–0.17ms in Gateway timeline spans.
  • Deterministic visual proof: transcript renders while agents.list and chat.metadata remain unresolved; before/after images are attached above.
  • Repository gates: node scripts/check-changed.mjs, pnpm build, git diff --check, and fresh autoreview all clean.
  • CI repair proof: config-safe-write.e2e.test.ts passed 11 consecutive runs plus its exact shard; dashboards-list-demand.e2e.test.ts passed 10 consecutive runs plus its exact shard after preserving explicit all-agent scope and coalescing identical managed-list demand.

Known boundary: sessions with an explicit auth-profile override intentionally still wait for the authoritative session-specific model projection. Removing that wait requires a separate session-scoped metadata contract; this PR does not weaken those model/context/thinking semantics.

Production LOC: +105/-189 (net -84). Tests/test support: +454/-258.

@steipete
steipete merged commit ad760c9 into main Aug 24, 2026
248 checks passed
@steipete
steipete deleted the steipete/festive-lehmann-ca2bde branch August 24, 2026 12:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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