Skip to content

fix(ui): keep new-session model availability truthful - #119462

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/fix-new-session-model-metadata-truth
Aug 5, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:codex/fix-new-session-model-metadata-truth

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where users starting a new Control UI session could see a
plausible one-model picker when chat.metadata timed out or failed, even
though model availability was unknown and the Gateway catalog contained more
models.

Why This Change Was Made

The new-session model control now owns an explicit metadata state machine for
loading, refreshing, ready, empty, and error states. It preserves a successful
same-agent catalog during refresh, clears it at agent/owner boundaries,
coalesces equivalent in-flight loads, and keeps configured preferences without
presenting them as fetched availability.

The chat.metadata RPC contract and Gateway metadata ownership are unchanged.

User Impact

The model picker now reports loading and failure states truthfully, offers a
compact retry action, keeps valid stale results during same-agent refresh, and
recovers to the complete catalog after metadata becomes available.

Evidence

AI-assisted: Codex.

  • Red browser proof on canonical base
    50c7444edf4be40a075d3689bec8fd5b676c2843: an actual Gateway response
    containing three models was delayed beyond the browser timeout, and the UI
    rendered one selectable configured-default model.
  • Green browser proof at
    94e5bb8d207e4452619c27b7839f0cc838f590ff: the same delayed three-model
    response rendered Models unavailable with zero options; retry issued one
    second request and rendered all three models. Desktop and mobile screenshots
    and a raw browser recording were captured.
  • Focused Vitest: 51 passed across
    ui/src/lib/chat/model-select-state.test.ts and
    ui/src/pages/new-session/model-control.test.ts.
  • Focused Playwright: 6 passed in
    ui/src/e2e/new-session-page.catalog-reconnect.e2e.test.ts.
  • Changed-surface gate passed formatting, i18n verification, core/UI
    typechecks, dead-export scans, and lint.
  • Final autoreview: clean, no accepted/actionable findings; TruffleHog clean.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Aug 5, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Crabbox visual proof

Base/red SHA: 50c7444edf4be40a075d3689bec8fd5b676c2843
Head/green proof SHA: 94e5bb8d207e4452619c27b7839f0cc838f590ff
Final branch head: 47dcbb57ddf958ac4804d4405f82b5ac035a1455 (identical stable patch ID; later canonical movement was unrelated)

Base: Blacksmith Testbox tbx_01kz7xdf4z3d1480qqrf2mdbwg, run 30970629933.
Head: Blacksmith Testbox tbx_01kz8011xnh9addq3ebm6bq65z, run 30972852721.

Base MP4 SHA-256: 1943c70b21e658249ce94df72338fae54bf051ad26e6aa7a2f1fd028594e3630
Head MP4 SHA-256: 41a6a7678a360b0a88b53af2cbb51ce201c9e87656247d3da02492f0b11ac1ac

The MP4s are deterministic H.264 conversions of the raw Playwright recordings.

Base/red recording

reproduction.mp4

Head/green recording

fix.mp4

Base/red timeout

Desktop:
base-timeout-desktop

Mobile:
base-timeout-mobile

Head/green timeout

Desktop:
head-timeout-desktop

Mobile:
head-timeout-mobile

Head/green recovered catalog

Desktop:
head-recovered-desktop

Mobile:
head-recovered-mobile

@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 Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 1:03 AM ET / 05:03 UTC.

ClawSweeper review

What this changes

The PR makes the new-session model picker distinguish loading, failed, empty, and refreshed Gateway model catalogs instead of presenting configured defaults as verified options.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review: current main still turns an unknown new-session catalog into a selectable configured/default model, while this PR adds the missing catalog-state ownership and has no blocking source finding.

Priority: P2
Reviewed head: 47dcbb57ddf958ac4804d4405f82b5ac035a1455
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a coherent owner-boundary repair, focused regression coverage, green supplied CI context, and no blocking review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the linked red/green browser evidence remains useful supporting context.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the linked red/green browser evidence remains useful supporting context.
Evidence reviewed 6 items Current-main defect: The new-session control clears its catalog before every metadata request and after errors; the shared picker then synthesizes the configured/default model into the empty catalog as a selectable option.
Gateway contract: Gateway metadata treats configured model-list failure as an unavailable RPC result, while successful responses carry the agent-scoped model list; an error is not evidence of an empty catalog.
Scoped repair: The branch records snapshot presence and request state at the new-session lifecycle owner, and enables catalog-only options only for that managed picker; ordinary chat retains its existing fallback behavior.
Findings None None.
Security None None.

How this fits together

The Control UI requests agent-scoped model metadata from the Gateway before a new session starts. The new-session picker consumes that catalog to show selectable models and passes the chosen model into session creation.

flowchart LR
  A[New session] --> B[Gateway metadata request]
  B --> C{Catalog result}
  C -->|Models returned| D[Available model picker]
  C -->|Timeout or error| E[Unavailable state and retry]
  E --> B
Loading

Decision needed

Question Recommendation
Should the Control UI owner approve making an initial metadata failure non-selectable while retaining a successful same-agent snapshot during refresh? Approve the state-owner fix: Merge the scoped new-session state machine, which prevents unknown availability from appearing selectable and preserves known same-agent results during refresh.

Why: The PR is member-authored and maintainer-labeled, so this workflow must leave the final user-visible failure-state decision to a maintainer despite a clean source review.

Before merge

  • Complete next step (P2) - A Control UI maintainer must make the explicit final merge judgment for this member-authored, maintainer-labeled PR; no mechanical repair is indicated.
Agent review details

Security

None.

PR surface

Source +298, Tests +381. Total +679 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 441 143 +298
Tests 3 381 0 +381
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 822 143 +679

Review metrics

Metric Value Why it matters
Production versus test delta production +441/-143; tests +381/-0 The net production growth is justified by replacing implicit task state with an explicit owner-boundary state machine for loading, stale snapshots, errors, retries, and agent changes.

Stored data model

Persistent data-model change detected: vector/embedding metadata: ui/src/e2e/new-session-page.catalog-reconnect.e2e.test.ts, vector/embedding metadata: ui/src/pages/new-session/model-control.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land the lifecycle-owned catalog-state fix after Control UI owner approval, while preserving the existing-session picker’s intentionally separate fallback behavior.

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

Yes — source-reproducible with high confidence: current main clears the metadata catalog, synthesizes a configured/default model into its empty options, and leaves that picker selectable. The submitted comment also supplies a matching delayed-metadata browser scenario.

Is this the best way to solve the issue?

Yes — this is the best fix: availability state belongs to the new-session metadata lifecycle owner, not a renderer-only guard. Changing the shared picker globally would regress existing-session behavior that deliberately supports fallback options.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 75ef5aebecb8.

Labels

Label changes:

  • add P2: This fixes a bounded but user-visible Control UI model-selection defect without evidence of data loss, security impact, or runtime unavailability.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the linked red/green browser evidence remains useful supporting context.

Label justifications:

  • P2: This fixes a bounded but user-visible Control UI model-selection defect without evidence of data loss, security impact, or runtime unavailability.
  • 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 author is a repository member, so the external-contributor proof gate does not apply; the linked red/green browser evidence remains useful supporting context.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Current blame attributes the central new-session control and picker state lines to a recent area commit. (role: recent area contributor; confidence: medium; commits: 8f2850d83e90; files: ui/src/pages/new-session/model-control.ts, ui/src/lib/chat/model-select-state.ts, ui/src/pages/chat/components/chat-model-controls.ts)
  • Peter Steinberger: History shows repeated Control UI model-picker and new-session refactors in the affected ownership path. (role: historical feature contributor; confidence: medium; commits: c41ca078a6a3, 1e3192c0b47b; files: ui/src/pages/new-session/model-control.ts, ui/src/pages/chat/components/chat-model-controls.ts)
  • fuller-stack-dev: The author also appears in earlier merged history for the new-session model-selection surface, beyond this proposed branch. (role: prior feature contributor; confidence: medium; commits: 01a7f4fb3fc0; files: ui/src/pages/new-session/model-control.ts, ui/src/lib/chat/model-select-state.ts)

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.

@fuller-stack-dev fuller-stack-dev self-assigned this Aug 5, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 4b7a989 into openclaw:main Aug 5, 2026
107 of 112 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the codex/fix-new-session-model-metadata-truth branch August 5, 2026 05:12
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
obviyus added a commit that referenced this pull request Sep 25, 2026
#157832)

## What Problem This Solves

New Session and command palette model search independently own catalog request cancellation, refresh subscriptions, and failure state, making their read policies drift as model discovery changes.

## User Impact

No intentional user-visible change: previously fetched New Session choices remain selectable during a background refresh; a truly cold scope does not fabricate choices from configured defaults. Model search remains independent of slower command categories.

## Why This Change Was Made

This consolidation is an explicitly maintainer-requested deliverable for model-picker freshness: establish one web-client catalog read policy, starting with New Session and the command palette, without reversing truthful cold-catalog behavior. The scope intentionally remains behavior-preserving after baseline proof showed the warm picker already works.

A shared reader beside the existing model-catalog store now owns each view's request and subscription lifetime. The existing cache remains the sole display-data owner; connection/scope retirement, Gateway invalidations and model snapshot publications retain their existing semantics. New Session keeps its account-preview and preference-restoration rules, while the palette keeps its independent search-category lifecycle.

This preserves the cold-catalog decision in #119462 and the independent model search behavior in #151022. Baseline browser proof already showed retained rows during a held refresh, so this PR does not claim to fix a warm-picker loading regression.

No config, schema, protocol, Gateway startup, persistent catalog state, or plugin-loading changes. No migration is required.

Follow-ups deliberately outside this PR: migrate chat-state-refresh, chat-command-executor, Agents settings, Automations, Config, Search, model-providers/load, model-providers/catalog-discovery, model-setup/native-model-setup, and chat-metadata-store to the shared reader where their lifetimes fit.

## Evidence

- Built Control UI with the mocked Gateway in Chromium: baseline and candidate retain fetched rows during a held refresh, including desktop/mobile remount revalidation. Both preserve the cold loading state without exposing the configured default as an option.
- Added the standing held-refresh scenario: select a different fetched model without resolving models.list; the selected label changes and the picker remains nonbusy. It passed on the original base and candidate (candidate: 1.31 s scenario), confirming this is behavior-preserving consolidation rather than a new warm-picker fix.
- New Session and palette component coverage: 175 tests passed across nine files (8.67 s Vitest / 10.02 s command wall). Covers independent model results while another category is pending, recovery through another view's publication, invalidation/retry, stale owners, account previews, and preference restoration.
- Replaced two update-notification-count waits with observable model-state waits; no behavior assertion was removed.
- Complete New Session model-catalog and palette-first-open browser files: 19/19 passed against the built candidate (34.40 s Vitest / 36.19 s command wall).
- Initial CI [run 36086860473](https://github.com/openclaw/openclaw/actions/runs/36086860473) identified two PR-owned static issues and unrelated upstream Madge cycles. The static issues and upstream cycles are resolved on the final candidate.
- Static corrections at `06b184e08d2f` remove the palette's now-redundant optional checks/Boolean conversion and reflow the New Session promise chain. Palette and account/metadata lifecycle coverage passed again: 83/83 tests (12.02 s Vitest / 17.95 s command wall).
- Final candidate `dcf448e5e112` includes upstream import-cycle repairs `818b0092d2e` and `af545bf3b6a`. Exact-head [CI run 36093827970](https://github.com/openclaw/openclaw/actions/runs/36093827970) is green, and hosted ClawSweeper review is `ready` with no findings.
- Rebuilt and replayed both browser files after merging those repairs: 19/19 passed (34.43 s Vitest / 36.29 s command wall).

### Before and after

Synthetic fixtures; `models.list` remains held in each pictured state.

| State | Before | After |
| --- | --- | --- |
| Fetched models remain selectable during refresh | ![Before: Retained two selected during held refresh](https://github.com/user-attachments/assets/60bd71ab-9493-4adb-b40d-b568c298e681) | ![After: Retained two selected during held refresh](https://github.com/user-attachments/assets/59bda5ad-2de9-4179-b4e7-517ea18876e7) |
| Cold scope does not invent model options | ![Before: Cold catalog loading without fabricated model](https://github.com/user-attachments/assets/e4061c2b-184d-46ed-9f39-412478db829e) | ![After: Cold catalog loading without fabricated model](https://github.com/user-attachments/assets/57e50b53-8c73-4dc3-8b1f-a4bb5217d0ce) |

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
openclaw#157832)

## What Problem This Solves

New Session and command palette model search independently own catalog request cancellation, refresh subscriptions, and failure state, making their read policies drift as model discovery changes.

## User Impact

No intentional user-visible change: previously fetched New Session choices remain selectable during a background refresh; a truly cold scope does not fabricate choices from configured defaults. Model search remains independent of slower command categories.

## Why This Change Was Made

This consolidation is an explicitly maintainer-requested deliverable for model-picker freshness: establish one web-client catalog read policy, starting with New Session and the command palette, without reversing truthful cold-catalog behavior. The scope intentionally remains behavior-preserving after baseline proof showed the warm picker already works.

A shared reader beside the existing model-catalog store now owns each view's request and subscription lifetime. The existing cache remains the sole display-data owner; connection/scope retirement, Gateway invalidations and model snapshot publications retain their existing semantics. New Session keeps its account-preview and preference-restoration rules, while the palette keeps its independent search-category lifecycle.

This preserves the cold-catalog decision in openclaw#119462 and the independent model search behavior in openclaw#151022. Baseline browser proof already showed retained rows during a held refresh, so this PR does not claim to fix a warm-picker loading regression.

No config, schema, protocol, Gateway startup, persistent catalog state, or plugin-loading changes. No migration is required.

Follow-ups deliberately outside this PR: migrate chat-state-refresh, chat-command-executor, Agents settings, Automations, Config, Search, model-providers/load, model-providers/catalog-discovery, model-setup/native-model-setup, and chat-metadata-store to the shared reader where their lifetimes fit.

## Evidence

- Built Control UI with the mocked Gateway in Chromium: baseline and candidate retain fetched rows during a held refresh, including desktop/mobile remount revalidation. Both preserve the cold loading state without exposing the configured default as an option.
- Added the standing held-refresh scenario: select a different fetched model without resolving models.list; the selected label changes and the picker remains nonbusy. It passed on the original base and candidate (candidate: 1.31 s scenario), confirming this is behavior-preserving consolidation rather than a new warm-picker fix.
- New Session and palette component coverage: 175 tests passed across nine files (8.67 s Vitest / 10.02 s command wall). Covers independent model results while another category is pending, recovery through another view's publication, invalidation/retry, stale owners, account previews, and preference restoration.
- Replaced two update-notification-count waits with observable model-state waits; no behavior assertion was removed.
- Complete New Session model-catalog and palette-first-open browser files: 19/19 passed against the built candidate (34.40 s Vitest / 36.19 s command wall).
- Initial CI [run 36086860473](https://github.com/openclaw/openclaw/actions/runs/36086860473) identified two PR-owned static issues and unrelated upstream Madge cycles. The static issues and upstream cycles are resolved on the final candidate.
- Static corrections at `06b184e08d2f` remove the palette's now-redundant optional checks/Boolean conversion and reflow the New Session promise chain. Palette and account/metadata lifecycle coverage passed again: 83/83 tests (12.02 s Vitest / 17.95 s command wall).
- Final candidate `dcf448e5e112` includes upstream import-cycle repairs `f0a975a559c` and `f943dccb29e`. Exact-head [CI run 36093827970](https://github.com/openclaw/openclaw/actions/runs/36093827970) is green, and hosted ClawSweeper review is `ready` with no findings.
- Rebuilt and replayed both browser files after merging those repairs: 19/19 passed (34.43 s Vitest / 36.29 s command wall).

### Before and after

Synthetic fixtures; `models.list` remains held in each pictured state.

| State | Before | After |
| --- | --- | --- |
| Fetched models remain selectable during refresh | ![Before: Retained two selected during held refresh](https://github.com/user-attachments/assets/60bd71ab-9493-4adb-b40d-b568c298e681) | ![After: Retained two selected during held refresh](https://github.com/user-attachments/assets/59bda5ad-2de9-4179-b4e7-517ea18876e7) |
| Cold scope does not invent model options | ![Before: Cold catalog loading without fabricated model](https://github.com/user-attachments/assets/e4061c2b-184d-46ed-9f39-412478db829e) | ![After: Cold catalog loading without fabricated model](https://github.com/user-attachments/assets/57e50b53-8c73-4dc3-8b1f-a4bb5217d0ce) |

Co-authored-by: Ayaan Zaidi <[email protected]>
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: L 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