Skip to content

fix(chat): report worker and native executing models - #146115

Merged
obviyus merged 4 commits into
openclaw:mainfrom
ekinnee:codex/fix-144837-live-model
Sep 15, 2026
Merged

obviyus merged 4 commits into
openclaw:mainfrom
ekinnee:codex/fix-144837-live-model

Conversation

@ekinnee

@ekinnee ekinnee commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

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
Pending during reroute Executing reroute

Executing model after refresh

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).

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
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

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@ekinnee
ekinnee marked this pull request as ready for review September 12, 2026 15:34
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL labels Sep 12, 2026
@ekinnee
ekinnee force-pushed the codex/fix-144837-live-model branch from 5bfa9e2 to d5b998c Compare September 12, 2026 15:49
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 15, 2026, 11:28 AM ET / 15:28 UTC (Revision 20).

ClawSweeper review

What this changes

Reports 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
Reviewed head: 0f2b4aabe75f4a582bbe0bb8de473f1f510dcfc6

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused repair and regression coverage are sound, but native execution proof remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Worker proof is positive: inspected real Gateway/browser screenshots show the rerouted label before and after refresh. Native ready-model and reroute publication remain covered by a simulated app-server connection, leaving that distinct changed path without after-fix real-runtime evidence. 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 stronger real behavior proof before merge: Worker proof is positive: inspected real Gateway/browser screenshots show the rerouted label before and after refresh. Native ready-model and reroute publication remain covered by a simulated app-server connection, leaving that distinct changed path without after-fix real-runtime evidence. 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 9 items Worker observation and ownership checks: The executor captures the run context before model preparation, observes responseModel through stream checkpoints, checks inference liveness and session identity, and publishes through the existing context-bound event owner.
Existing single-writer projection: The event owner rejects replacement contexts before recording lifecycle model observations. The patch adds observations without changing provider authorization, worker payloads, persisted schemas, or saved preferences.
Current main still needs the remaining fix: Inspected the fetched main versions of the worker executor, native lifecycle controller, and native reroute projector; they lack these model publications. The supplied merged metadata and commit for #148756 explicitly defer worker/native attribution. That local fix has no containing tag in the inspected tag set; no released worker/native fix was established.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Worker proof is positive: inspected real Gateway/browser screenshots show the rerouted label before and after refresh. Native ready-model and reroute publication remain covered by a simulated app-server connection, leaving that distinct changed path without after-fix real-runtime evidence. 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.
  • Complete next step (P2) - Add after-fix native execution proof connecting the real Codex app-server model to the projected or displayed label. Terminal output or logs count; screenshots or recordings are preferred when they show the behavior. Redact credentials, private endpoints, and personal data, then update the PR body for automatic re-review; if it does not trigger, ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Source +37, Tests +499. Total +536 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 4 39 2 +37
Tests 7 842 343 +499
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 881 345 +536

Review metrics

Metric Value Why it matters
Production versus validation growth Production +37; tests/support +498; test configuration +1 net lines Production growth supplies missing observations through existing owners; most growth protects attribution and stale-run rejection.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #144837
Summary: This PR addresses the remaining worker/native portion of executing-model attribution after the local path landed separately.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label justifications:

  • P2: Corrects misleading executing-model labels for worker and native responses without changing inference selection.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Worker proof is positive: inspected real Gateway/browser screenshots show the rerouted label before and after refresh. Native ready-model and reroute publication remain covered by a simulated app-server connection, leaving that distinct changed path without after-fix real-runtime evidence. 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.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Worker proof is positive: inspected real Gateway/browser screenshots show the rerouted label before and after refresh. Native ready-model and reroute publication remain covered by a simulated app-server connection, leaving that distinct changed path without after-fix real-runtime evidence.

Evidence

What I checked:

  • Worker observation and ownership checks: The executor captures the run context before model preparation, observes responseModel through stream checkpoints, checks inference liveness and session identity, and publishes through the existing context-bound event owner. (src/gateway/worker-environments/inference-runtime.ts:657, 0f2b4aabe75f)
  • Existing single-writer projection: The event owner rejects replacement contexts before recording lifecycle model observations. The patch adds observations without changing provider authorization, worker payloads, persisted schemas, or saved preferences. (src/infra/agent-events.ts:270, 0f2b4aabe75f)
  • Current main still needs the remaining fix: Inspected the fetched main versions of the worker executor, native lifecycle controller, and native reroute projector; they lack these model publications. The supplied merged metadata and commit for fix(chat): show the observed local model during responses #148756 explicitly defer worker/native attribution. That local fix has no containing tag in the inspected tag set; no released worker/native fix was established. (extensions/codex/src/app-server/run-attempt-lifecycle-controller.ts:126, 87ed5d24eca4)
  • Positive worker screenshot proof: Inspected prepared proof-image-1.png through proof-image-3.png: the composer changes from Model pending to Executing reroute and retains that label after refresh. The captured PR body describes a real Gateway, worker, local provider, and served browser; the linked gist README corroborates that scenario. Proof link: fix(chat): report worker and native executing models #146115 (comment).
  • Native proof remains simulated: The registered-adapter test replaces CodexAppServerClient.start with a deterministic client harness and injects ready-model and reroute responses. This is useful regression coverage, but the captured body expressly says no live native provider was run. The prior review at this same head requested real native execution evidence; the later owner-review approval comment supplies no additional runtime proof or proof override. Captured context sourceRevision: e781de72102835ac6a274eb4cbce01f64a3e0e4461087a60b798b56a5b1df988. (extensions/codex/src/app-server/run-attempt.model-attribution.test.ts:162, 0f2b4aabe75f)
  • Affirmative Codex dependency boundary: The changed native projector consumes Codex model/rerouted notifications, and the lifecycle controller publishes the ready native thread model. The harness documentation identifies Codex app-server as the native execution owner, making direct dependency inspection applicable. (extensions/codex/src/app-server/event-projector-events.ts:297, 0f2b4aabe75f)

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Add redacted native execution output linking the real app-server model observation to the projected or displayed executing model.

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 (19 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-14T21:53:03.113Z sha ab6a664714d7ad29d1aa865c3a670a868f52f748 :: blocked before merge. :: none
  • reviewed 2026-09-14T22:11:21.147Z sha ab6a664714d7ad29d1aa865c3a670a868f52f748 :: blocked before merge. :: none
  • reviewed 2026-09-14T22:36:48.666Z sha ab6a664714d7ad29d1aa865c3a670a868f52f748 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T00:36:33.614Z sha 1456c8f238512e97293754c24a5564f62823cffd :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T01:03:09.772Z sha 7843ecd :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T01:30:38.918Z sha 7843ecd :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T14:20:04.834Z sha 7843ecd :: blocked before merge. :: none
  • reviewed 2026-09-15T14:56:07.132Z sha 0f2b4aa :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 12, 2026
@ekinnee
ekinnee force-pushed the codex/fix-144837-live-model branch from d5b998c to 0ce24f5 Compare September 12, 2026 22:43
@ekinnee
ekinnee force-pushed the codex/fix-144837-live-model branch from 0ce24f5 to 13c8b1d Compare September 12, 2026 22:51
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Sep 12, 2026
@ekinnee
ekinnee force-pushed the codex/fix-144837-live-model branch from 13c8b1d to c1e4f66 Compare September 12, 2026 23:15
@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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 12, 2026
@ekinnee
ekinnee force-pushed the codex/fix-144837-live-model branch from 1456c8f to 7843ecd Compare September 15, 2026 00:55
obviyus added a commit that referenced this pull request Sep 15, 2026
## 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 |
| --- | --- |
| ![Before: configured primary during fallback](https://gist.githubusercontent.com/obviyus/8d84dcc2d8ee419b234a445f4c840a3f/raw/b3c1cdf4ec2a52c7eff52f4a7cc84fc3cf8060c2/before.png) | ![After: executing fallback during response](https://gist.githubusercontent.com/obviyus/8d84dcc2d8ee419b234a445f4c840a3f/raw/b3c1cdf4ec2a52c7eff52f4a7cc84fc3cf8060c2/after.png) |

![Executing fallback after refresh](https://gist.githubusercontent.com/obviyus/8d84dcc2d8ee419b234a445f4c840a3f/raw/b3c1cdf4ec2a52c7eff52f4a7cc84fc3cf8060c2/refresh.png)

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]>
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

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.

@obviyus
obviyus marked this pull request as draft September 15, 2026 14:12
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 15, 2026
@openclaw-barnacle openclaw-barnacle Bot removed app: web-ui App: web-ui agents Agent runtime and tooling labels Sep 15, 2026
@obviyus obviyus changed the title fix: show the executing model while WebChat responds fix(chat): report worker and native executing models Sep 15, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-admin-merge
pr: 146115
head: 0f2b4aa
scope: owner-review

@obviyus
obviyus marked this pull request as ready for review September 15, 2026 15:23
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

landpr-approve-unrelated-red
pr: 146115
head: 0f2b4aa
run: 34988149142 attempt: 2
failed: checks-node-compact-large-4 job=104459732771 conclusion=failure
check: openclaw/ci-gate

@obviyus
obviyus merged commit 4d6b18b into openclaw:main Sep 15, 2026
472 of 476 checks passed
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

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.

  • Bug: The chat label showed the saved model or “Model pending” while another model was executing.
  • Fix: The Gateway inference owner and native adapter report the observed model through the existing run registry.
Before After
The label missed the executing model during a reroute. The label follows execution while the picker keeps its saved choice.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…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 |
| --- | --- |
| ![Before: configured primary during fallback](https://gist.githubusercontent.com/obviyus/8d84dcc2d8ee419b234a445f4c840a3f/raw/b3c1cdf4ec2a52c7eff52f4a7cc84fc3cf8060c2/before.png) | ![After: executing fallback during response](https://gist.githubusercontent.com/obviyus/8d84dcc2d8ee419b234a445f4c840a3f/raw/b3c1cdf4ec2a52c7eff52f4a7cc84fc3cf8060c2/after.png) |

![Executing fallback after refresh](https://gist.githubusercontent.com/obviyus/8d84dcc2d8ee419b234a445f4c840a3f/raw/b3c1cdf4ec2a52c7eff52f4a7cc84fc3cf8060c2/refresh.png)

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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
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 |
| --- | --- |
| ![Pending during reroute](https://gist.githubusercontent.com/obviyus/c170e096a81a0e587a8cdc637bf7faf9/raw/640d6b056d16f2a10f60fb79bd25a1b12602e2db/before-label.png) | ![Executing reroute](https://gist.githubusercontent.com/obviyus/c170e096a81a0e587a8cdc637bf7faf9/raw/dba43de3bcb8486a4e02eec94b5775e8f393d7d9/after-label.png) |

![Executing model after refresh](https://gist.githubusercontent.com/obviyus/c170e096a81a0e587a8cdc637bf7faf9/raw/b052fa8383150641c687de73316ce111e2a943a0/refresh-label.png)

[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]>
@obviyus

obviyus commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Evidence: OpenClaw executing-model display proof

Moved here from a one-off gist so the proof lives on this PR.

after-label

after

before-label

before

local-control

refresh-label

refresh

README.md

Executing model display

A real Gateway and worker use a local test provider that returns a different model while streaming. Before: Model pending. After: Executing reroute, including after refresh. The picker keeps primary selected. The local-run control remains correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

Webchat console shows configured model during response, not the active model

3 participants