Skip to content

fix(chat): show the observed local model during responses - #148756

Merged
obviyus merged 3 commits into
mainfrom
bugloop/executing-model-local-display
Sep 15, 2026
Merged

obviyus merged 3 commits into
mainfrom
bugloop/executing-model-local-display

Conversation

@obviyus

@obviyus obviyus commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

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 After: executing fallback during response

Executing fallback after refresh

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.

Production changes: +401 lines

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

Part 1 of #146115 by @ekinnee; the worker/native half stays in #146115

Erick Kinnee and others added 3 commits September 15, 2026 09:08
Local portion of #146115.

(cherry picked from commit 7843ecd)
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.
@clawsweeper

clawsweeper Bot commented Sep 15, 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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 15, 2026, 12:43 AM ET / 04:43 UTC (Revision 2).

ClawSweeper review

What this changes

Shows 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
Reviewed head: d409805d2a18f5c248b10c689be3e74ca1b97981

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with directly relevant visual proof and useful lifecycle coverage; no blocking code defect was identified.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The described real Gateway and served-browser fallback scenario exercises the changed ingress-to-composer path; inspected screenshots directly show the corrected label during generation and after refresh.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The described real Gateway and served-browser fallback scenario exercises the changed ingress-to-composer path; inspected screenshots directly show the corrected label during generation and after refresh.
Evidence reviewed 10 items Verified introduced scope: Reviewed the pinned merge-base-to-head changes. Raw test-merge metadata confirms the pinned base followed by the exact PR head as parents, and its comparison with that base contains the introduced paths rather than unrelated endpoint drift.
Current main still needs the fix: At fetched main, the run projection has no observed-model index, message ingress records usage without publishing model observations, and the composer falls back to the selected model.
Latest supplied release check: The supplied v2026.9.4 release revision also lacks the model-observation publisher in message ingress; no shipped implementation of this fix was established.
Findings None None.
Security None None.

How this fits together

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

Before merge

  • Complete next step (P2) - Confirm that the inspected before/after screenshots rendered in the originating chat; the PR already embeds the reviewed images.
Agent review details

Security

None.

PR surface

Source +401, Tests +924. Total +1325 across 36 files.

View PR surface stats
Area Files Added Removed Net
Source 21 519 118 +401
Tests 15 1000 76 +924
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 36 1519 194 +1325

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #144837
Summary: This PR addresses the canonical report's local-execution path; the broader open PR retains worker/native work.

Members:

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

Technical review

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

Labels

Label justifications:

  • P2: Repairs misleading model attribution during local responses without changing model selection or execution policy.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The described real Gateway and served-browser fallback scenario exercises the changed ingress-to-composer path; inspected screenshots directly show the corrected label during generation and after refresh.
  • proof: sufficient: Contributor real behavior proof is sufficient. The described real Gateway and served-browser fallback scenario exercises the changed ingress-to-composer path; inspected screenshots directly show the corrected label during generation and after refresh.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The described real Gateway and served-browser fallback scenario exercises the changed ingress-to-composer path; inspected screenshots directly show the corrected label during generation and after refresh.

Evidence

What I checked:

  • Verified introduced scope: Reviewed the pinned merge-base-to-head changes. Raw test-merge metadata confirms the pinned base followed by the exact PR head as parents, and its comparison with that base contains the introduced paths rather than unrelated endpoint drift. (093781793245)
  • Current main still needs the fix: At fetched main, the run projection has no observed-model index, message ingress records usage without publishing model observations, and the composer falls back to the selected model. (src/infra/agent-run-projection.ts:13, 47664a29e9fb)
  • Latest supplied release check: The supplied v2026.9.4 release revision also lacks the model-observation publisher in message ingress; no shipped implementation of this fix was established. (src/agents/embedded-agent-subscribe.model-state.ts:60, 3a9d69db306c)
  • Observation ownership and retirement: Event enrichment checks the captured context and lifecycle before recording model observations. Candidate completion clears the observation in finally, and regression coverage exercises replacement, rotation, hidden runs, queued siblings, and agent/session isolation. (src/infra/agent-events.ts:243, d409805d2a18)
  • Cache upgrade compatibility: The existing roster reader and writer share volatile-field stripping. The changed test checks new writes and an older stored record, removing transient model observations while retaining the saved provider/model; no database schema migration is introduced. (ui/src/lib/sessions/session-roster-cache.test.ts:150, d409805d2a18)
  • Inspected real visual evidence: Inspected all three prepared primary-PR screenshots from the media manifest. They show Configured primary before the fix, Executing fallback during generation afterward, and Executing fallback after refresh. The captured PR body describes an isolated real Gateway, served browser, and held loopback-provider fallback; these images are embedded in that body. (d409805d2a18)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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.

  • Confirm the required before/after screenshot delivery in the originating chat.

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 (1 earlier review cycle)
  • reviewed 2026-09-15T04:11:24.004Z sha d409805 :: blocked before merge. :: none

@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 148756
head: d409805
scope: owner-review

@obviyus
obviyus marked this pull request as ready for review September 15, 2026 04:36
@obviyus
obviyus merged commit 33aee1b into main Sep 15, 2026
281 of 282 checks passed
@obviyus
obviyus deleted the bugloop/executing-model-local-display branch September 15, 2026 04:58
@obviyus

obviyus commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

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.

  • Bug: The composer named the saved primary while a local fallback generated the response.
  • Fix: The existing run owner records the observed model for session reads and the composer.
Before After
Saved primary label during fallback execution Observed fallback label during execution and after refresh; saved picker choice retained

obviyus added a commit that referenced this pull request Sep 15, 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 #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](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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant