Repository navigation
fix(chat): report worker and native executing models - #146115
Conversation
|
🦞👀 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. |
5bfa9e2 to
d5b998c
Compare
|
Codex review: needs real behavior proof before merge. Reviewed September 15, 2026, 11:28 AM ET / 15:28 UTC (Revision 20). ClawSweeper reviewWhat this changesReports worker and native Codex executing models through existing lifecycle events so chat labels can follow execution without changing the saved model choice. Merge readiness⛔ Blocked before merge - 2 items remain This remains useful: the merged local-display fix explicitly deferred worker/native attribution, and current main still lacks it. No actionable patch defect was found; the previous native execution proof gap remains unresolved. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway observes worker inference, while the Codex plugin observes native execution. Both feed the run registry, whose model projection supplies session reads and chat labels. flowchart LR
A[Worker provider stream] --> C[Gateway model observation]
B[Native Codex events] --> D[Codex adapter]
C --> E[Current run registry]
D --> E
E --> F[Session reads and events]
F --> G[Chat executing model label]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +37, Tests +499. Total +536 across 11 files. View PR surface stats
Review metrics
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 one run-registry projection for observed execution across local, worker, and native paths while preserving saved model preferences. Do we have a high-confidence way to reproduce the issue? Yes: current main lacks worker/native lifecycle model observations, and the supplied real worker captures show the resulting pending label during a held reroute. This review did not execute a reproduction. Is this the best way to solve the issue? Yes: publishing observations at the existing Gateway and native adapter boundaries avoids a second state owner or worker protocol extension. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 87ed5d24eca4. 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 (19 earlier review cycles; latest 8 shown)
|
d5b998c to
0ce24f5
Compare
0ce24f5 to
13c8b1d
Compare
13c8b1d to
c1e4f66
Compare
1456c8f to
7843ecd
Compare
## 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. | 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 `dfb175fdae927e14435e95eb8a39952945c0d1d1`. 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 #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 #146115 by @ekinnee; the worker/native half stays in #146115 Co-authored-by: Erick Kinnee <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
|
Part 1 landed as #148756, carrying @ekinnee's local model-display work from this PR. It shows the observed local model during a response and after refresh while the picker keeps the saved choice. The worker/native half stays open here. The worker payload extension awaits the owner's protocol decision. |
|
landpr-approve-admin-merge |
|
landpr-approve-unrelated-red |
|
Thanks @ekinnee for both parts! Proof: A real worker response shows the executing model during a reroute and after refresh. Local runs, session isolation, and run-end clearing pass. Native behavior passes through the registered adapter with a deterministic connection; a live native provider was not run.
|
…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]>
|
Evidence: OpenClaw executing-model display proof Moved here from a one-off gist so the proof lives on this PR.
|







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.
Full captures
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.
Production scope and validation commands
Growth accepted under the owner's standing acceptance (2026-09-15).
inference-runtime.tsrun-attempt-lifecycle-controller.tsevent-projector-events.tsrun-attempt-active-turn.ts