Repository navigation
fix(chat): show the observed local model during responses - #148756
Conversation
Keep unobserved attempts pending, fence admission and steering observations, and remove transient model fields from the saved roster projection. Share the live-versus-completed session projection after hydration.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed September 15, 2026, 12:43 AM ET / 04:43 UTC (Revision 2). ClawSweeper reviewWhat this changesShows the model observed during local responses in WebChat, preserves the saved picker selection, and clears stale observations across attempts, refreshes, and cached session rows. Merge readiness⛔ Needs changes before merge - 1 item remains This remains a useful local-execution fix: current main lacks the observed-model flow, and no blocking introduced defect was found. The protected maintainer label also precludes cleanup closure. Priority: P2 Review scores
Verification
How this fits togetherLocal response events feed model observations into the existing run registry. Gateway session reads and events project those observations into WebChat while saved model selection remains separate. flowchart LR
A[Local response events] --> B[Current run registry]
C[Attempt completion] --> B
B --> D[Gateway session projection]
D --> E[WebChat model label]
D --> F[Refresh recovery]
G[Saved model choice] --> H[Picker selection]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +401, Tests +924. Total +1325 across 36 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep live model identity owned by the run registry, preserve saved selection, and retain worker/native attribution in the explicitly separated follow-up. Do we have a high-confidence way to reproduce the issue? Yes: a configured primary failing into a held local fallback exposes the mismatch, supported by current-main source and supplied before/after captures; this review did not execute that scenario. Is this the best way to solve the issue? Yes: projecting observations through the existing run owner addresses the display defect without changing selection policy, and the tests cover refresh, replacement, and older-cache recovery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 47664a29e9fb. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
landpr-approve-admin-merge |
|
Thanks @ekinnee for the local model-display work in #146115! Proof: A served browser and isolated Gateway showed the executing fallback during a held response and after refresh. The picker kept the saved primary choice, and active-run state cleared on completion.
|
The production fix adds 37 net lines; most changed lines add regression tests or move shared test setup. ## What Problem This Solves Worker and native responses can show the saved model or “Model pending” while another model is executing. Fixes #144837; follows #148756. ## Why This Change Was Made The Gateway inference owner and native adapter report observed models through the existing run registry. This state has one writer. The contributor's proposed worker emitter and protocol schema additions are removed. ekinnee's history and diagnosis are preserved; his UI/session work shipped in #148756. ## User Impact The label follows execution and survives refresh. The picker keeps its saved choice. Run completion clears live attribution. ## Evidence A real Gateway, worker, local test provider, and served browser reproduced the missing label on main. The candidate shows the rerouted model before and after reload. Local runs remain correct; session isolation and clearing pass. Native execution is proved through the registered adapter with a deterministic connection; a live native provider was not run. | Before | After | | --- | --- | |  |  |  [Full captures](https://gist.github.com/obviyus/c170e096a81a0e587a8cdc637bf7faf9) ## Compatibility No worker wire, schema, selection, or storage change. Older workers need no special case: the Gateway already sees the executing model before encoding existing frames. ## Consumers Existing session reads and chat controls consume the same registry projection. ## Invalidation Exact run and inference authority reject stale or foreign observations; existing settlement clears them. ## Tests 757 owner/sibling checks passed on the merge tree, plus test registration. Corrected fixtures pass on the final head. Production/test types, lint, formatting, architecture, and export checks pass. <details> <summary>Production scope and validation commands</summary> Growth accepted under the owner's standing acceptance (2026-09-15). | File | Net lines | Responsibility | | --- | ---: | --- | | `inference-runtime.ts` | +29 | Observed worker model, bound to current inference and run | | `run-attempt-lifecycle-controller.ts` | +4 | Native ready model | | `event-projector-events.ts` | +4 | Native provider reroute | | `run-attempt-active-turn.ts` | 0 | Passes ready-thread selection | ```sh node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-core.config.ts src/gateway/worker-environments/inference-runtime.test.ts src/gateway/worker-environments/inference-runtime.model.test.ts node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-codex-app-server-attempt-extra.config.ts extensions/codex/src/app-server/run-attempt.model-attribution.test.ts ``` </details> Co-authored-by: Erick Kinnee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
…48756) ## What Problem This Solves The composer can show the saved model while a local fallback is generating the response. This change carries the observed model from the existing run owner through session reads and the browser. Related: openclaw#144837. ## User Impact Local responses show the observed model before and after refresh. The picker keeps the saved choice. An unidentified turn shows **Model pending**. A new send cannot borrow the previous turn's label, and cached roster rows cannot revive an old execution. ## Why This Change Was Made The run registry is the single writer of live model identity. Local message observations supply the fact; session and browser projections consume it. Attempt completion clears live ownership. Saved model selection is unchanged. ## Evidence A real isolated Gateway and served browser used a loopback provider: primary rejected, fallback streamed and waited for release. Main showed **Configured primary**; this head showed **Executing fallback**, including after reload. Completion reported no active run; the picker still selected primary. | Before | After | | --- | --- | |  |  |  Fresh-merge owner/sibling suites: 1,265 tests passed; the final projection correction passed 205 focused tests on the updated merge. Browser suites: 12 tests passed. Production/test types, changed-file type-aware lint, formatting, architecture, assertion safety, export checks, and UI size comparison passed. Replacement-run, delayed model refinement, cross-session, stale-history/cache, and steering controls passed through the registered handlers, subscriber, and browser fixtures. The real browser recording covers the held local fallback and refresh sequence. ## Compatibility No worker wire payload, native adapter, stored schema, or selection-policy change. Completed fallback display remains intact. Worker/native attribution is deferred. ## Consumers Local message ingress, the existing run registry, Gateway session reads/events, composer controls, history recovery, and roster cache read/write use one observed-model flow. ## Invalidation Attempt settlement, run replacement, terminal delivery, session scope change, and roster hydration retire transient observations. Session lists refresh their projection after asynchronous hydration. This change spans the existing local run owner, session reads, and browser controls so the observed model survives refresh while the picker keeps the saved choice. The production changes add 401 net lines; the per-file ownership table and recorded growth acceptance remain below. When a local response is active, the label uses the model observed by that run. Before an observation arrives, it shows **Model pending**. After completion, the existing completed-fallback display remains available; it does not keep the run active. The tested merge contains the proposed head and main at `2eb2f4cd8262de88cd79cd9e3e81e8cb7de517d7`. The owner and sibling tests passed 1,265 cases. After the final scope-binding adjustment, 205 affected tests passed on merge `dea5daa8c2e43d384216b56d5c893eace2bd005d`. The browser tests passed 12 cases. The real browser captures show the local fallback before and after refresh. Replacement, delayed model refinement, cross-session isolation, and steering use automated handler and browser-fixture checks. Remote execution and native model attribution remain outside this change and stay in openclaw#146115. <details> <summary>Production changes: +401 lines</summary> Growth accepted under the owner's standing acceptance (2026-09-15). | File | Added | Removed | Net | | --- | ---: | ---: | ---: | | `src/agents/embedded-agent-runner/run-entry.ts` | 55 | 30 | +25 | | `src/agents/embedded-agent-subscribe.model-state.ts` | 36 | 1 | +35 | | `src/gateway/server-chat.ts` | 30 | 17 | +13 | | `src/gateway/server-methods/chat-send-admission.ts` | 3 | 4 | -1 | | `src/gateway/server-methods/session-active-runs.ts` | 1 | 1 | 0 | | `src/gateway/server-methods/sessions-read.ts` | 24 | 1 | +23 | | `src/gateway/session-utils-contracts.ts` | 2 | 0 | +2 | | `src/gateway/session-utils-row.ts` | 81 | 19 | +62 | | `src/infra/agent-events.ts` | 36 | 1 | +35 | | `src/infra/agent-run-projection.ts` | 55 | 2 | +53 | | `src/infra/agent-run-registry.ts` | 39 | 11 | +28 | | `src/infra/agent-run-registry.types.ts` | 4 | 0 | +4 | | `ui/src/i18n/locales/en-model-controls.ts` | 1 | 0 | +1 | | `ui/src/lib/sessions/session-roster-cache.reader.ts` | 2 | 0 | +2 | | `ui/src/pages/chat/chat-history-stream.ts` | 5 | 0 | +5 | | `ui/src/pages/chat/chat-pane-session-controls.ts` | 11 | 1 | +10 | | `ui/src/pages/chat/chat-state-events.ts` | 19 | 0 | +19 | | `ui/src/pages/chat/components/chat-model-controls.ts` | 50 | 12 | +38 | | `ui/src/pages/chat/components/chat-model-picker.ts` | 8 | 5 | +3 | | `ui/src/pages/chat/history-merge.ts` | 55 | 13 | +42 | | `ui/src/pages/chat/run-lifecycle.ts` | 2 | 0 | +2 | </details> Part 1 of openclaw#146115 by @ekinnee; the worker/native half stays in openclaw#146115 Co-authored-by: Erick Kinnee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
The production fix adds 37 net lines; most changed lines add regression tests or move shared test setup. ## What Problem This Solves Worker and native responses can show the saved model or “Model pending” while another model is executing. Fixes openclaw#144837; follows openclaw#148756. ## Why This Change Was Made The Gateway inference owner and native adapter report observed models through the existing run registry. This state has one writer. The contributor's proposed worker emitter and protocol schema additions are removed. ekinnee's history and diagnosis are preserved; his UI/session work shipped in openclaw#148756. ## User Impact The label follows execution and survives refresh. The picker keeps its saved choice. Run completion clears live attribution. ## Evidence A real Gateway, worker, local test provider, and served browser reproduced the missing label on main. The candidate shows the rerouted model before and after reload. Local runs remain correct; session isolation and clearing pass. Native execution is proved through the registered adapter with a deterministic connection; a live native provider was not run. | Before | After | | --- | --- | |  |  |  [Full captures](https://gist.github.com/obviyus/c170e096a81a0e587a8cdc637bf7faf9) ## Compatibility No worker wire, schema, selection, or storage change. Older workers need no special case: the Gateway already sees the executing model before encoding existing frames. ## Consumers Existing session reads and chat controls consume the same registry projection. ## Invalidation Exact run and inference authority reject stale or foreign observations; existing settlement clears them. ## Tests 757 owner/sibling checks passed on the merge tree, plus test registration. Corrected fixtures pass on the final head. Production/test types, lint, formatting, architecture, and export checks pass. <details> <summary>Production scope and validation commands</summary> Growth accepted under the owner's standing acceptance (2026-09-15). | File | Net lines | Responsibility | | --- | ---: | --- | | `inference-runtime.ts` | +29 | Observed worker model, bound to current inference and run | | `run-attempt-lifecycle-controller.ts` | +4 | Native ready model | | `event-projector-events.ts` | +4 | Native provider reroute | | `run-attempt-active-turn.ts` | 0 | Passes ready-thread selection | ```sh node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-core.config.ts src/gateway/worker-environments/inference-runtime.test.ts src/gateway/worker-environments/inference-runtime.model.test.ts node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-codex-app-server-attempt-extra.config.ts extensions/codex/src/app-server/run-attempt.model-attribution.test.ts ``` </details> Co-authored-by: Erick Kinnee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
The composer can show the saved model while a local fallback is generating the response. This change carries the observed model from the existing run owner through session reads and the browser.
Related: #144837.
User Impact
Local responses show the observed model before and after refresh. The picker keeps the saved choice. An unidentified turn shows Model pending. A new send cannot borrow the previous turn's label, and cached roster rows cannot revive an old execution.
Why This Change Was Made
The run registry is the single writer of live model identity. Local message observations supply the fact; session and browser projections consume it. Attempt completion clears live ownership. Saved model selection is unchanged.
Evidence
A real isolated Gateway and served browser used a loopback provider: primary rejected, fallback streamed and waited for release. Main showed Configured primary; this head showed Executing fallback, including after reload. Completion reported no active run; the picker still selected primary.
Fresh-merge owner/sibling suites: 1,265 tests passed; the final projection correction passed 205 focused tests on the updated merge. Browser suites: 12 tests passed. Production/test types, changed-file type-aware lint, formatting, architecture, assertion safety, export checks, and UI size comparison passed.
Replacement-run, delayed model refinement, cross-session, stale-history/cache, and steering controls passed through the registered handlers, subscriber, and browser fixtures. The real browser recording covers the held local fallback and refresh sequence.
Compatibility
No worker wire payload, native adapter, stored schema, or selection-policy change. Completed fallback display remains intact. Worker/native attribution is deferred.
Consumers
Local message ingress, the existing run registry, Gateway session reads/events, composer controls, history recovery, and roster cache read/write use one observed-model flow.
Invalidation
Attempt settlement, run replacement, terminal delivery, session scope change, and roster hydration retire transient observations. Session lists refresh their projection after asynchronous hydration.
This change spans the existing local run owner, session reads, and browser controls so the observed model survives refresh while the picker keeps the saved choice. The production changes add 401 net lines; the per-file ownership table and recorded growth acceptance remain below.
When a local response is active, the label uses the model observed by that run. Before an observation arrives, it shows Model pending. After completion, the existing completed-fallback display remains available; it does not keep the run active.
The tested merge contains the proposed head and main at
dfb175fdae927e14435e95eb8a39952945c0d1d1. The owner and sibling tests passed 1,265 cases. After the final scope-binding adjustment, 205 affected tests passed on mergedea5daa8c2e43d384216b56d5c893eace2bd005d. The browser tests passed 12 cases.The real browser captures show the local fallback before and after refresh. Replacement, delayed model refinement, cross-session isolation, and steering use automated handler and browser-fixture checks. Remote execution and native model attribution remain outside this change and stay in #146115.
Production changes: +401 lines
Growth accepted under the owner's standing acceptance (2026-09-15).
src/agents/embedded-agent-runner/run-entry.tssrc/agents/embedded-agent-subscribe.model-state.tssrc/gateway/server-chat.tssrc/gateway/server-methods/chat-send-admission.tssrc/gateway/server-methods/session-active-runs.tssrc/gateway/server-methods/sessions-read.tssrc/gateway/session-utils-contracts.tssrc/gateway/session-utils-row.tssrc/infra/agent-events.tssrc/infra/agent-run-projection.tssrc/infra/agent-run-registry.tssrc/infra/agent-run-registry.types.tsui/src/i18n/locales/en-model-controls.tsui/src/lib/sessions/session-roster-cache.reader.tsui/src/pages/chat/chat-history-stream.tsui/src/pages/chat/chat-pane-session-controls.tsui/src/pages/chat/chat-state-events.tsui/src/pages/chat/components/chat-model-controls.tsui/src/pages/chat/components/chat-model-picker.tsui/src/pages/chat/history-merge.tsui/src/pages/chat/run-lifecycle.tsPart 1 of #146115 by @ekinnee; the worker/native half stays in #146115