Repository navigation
perf(gateway): restore fast saved-session model picking - #166037
Conversation
Restore fast model picker reads after per-model authority checks multiplied session worker round trips. Project prepared auth facts synchronously and reuse the existing generation-owned projection cache for detached shared session selections. Keep personal accounts request-scoped and validate each request at admission and publication. Read runtime eligibility from current prepared readiness so cached choices recover after a native runtime becomes available. Cover bounded worker reads, concurrent preparation, saved selection changes, and readiness recovery.
Remove obsolete awaits from synchronous catalog consumers and dead request-authority assignments. Prune the obsolete mock-export exemption and the inherited unused voice-call constant export exposed by the full-tree gate.
|
🦞👀 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 October 6, 2026, 5:28 AM ET / 09:28 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR speeds saved-session model picking by reusing prepared catalog projections, evaluating prepared authentication facts synchronously, and refreshing runtime eligibility when cached choices are read. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Needs changes before merge - 3 items remain The performance repair remains useful and has convincing Gateway benchmark evidence. Two fixture failures remain in the pinned head; the body reports validated repairs awaiting publication. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway model catalog combines configured models, saved session selections, and prepared account and runtime facts. It returns model-picker choices after checking current session access. flowchart TD
A[Model picker request] --> B[Current session access]
B --> C[Saved selection facts]
C --> D[Generation catalog cache]
E[Prepared account and runtime facts] --> D
D --> F[Current publication check]
F --> G[Model and runtime choices]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +22, Tests +218, Docs +2, Other -1. Total +241 across 26 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep generation-owned catalog reuse and live publication checks, with regression fixtures synchronized to those boundaries. Do we have a high-confidence way to reproduce the issue? Yes for the pinned-head fixture failures: source and exact-head CI annotations identify both failing paths. The performance regression has supplied control and Gateway measurements; this review did not execute it. Is this the best way to solve the issue? Yes for the production approach: it reuses the existing generation cache and preserves request-owned publication authority. The remaining repair belongs in the two stale fixtures. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f997ec377556. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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)
|
Pause publication races at live session authority instead of catalog acquisition, assert typed rejection of retired projections, and shrink the obsolete timed-wait baseline.
) * perf(gateway): reuse saved-session model catalog projections Restore fast model picker reads after per-model authority checks multiplied session worker round trips. Project prepared auth facts synchronously and reuse the existing generation-owned projection cache for detached shared session selections. Keep personal accounts request-scoped and validate each request at admission and publication. Read runtime eligibility from current prepared readiness so cached choices recover after a native runtime becomes available. Cover bounded worker reads, concurrent preparation, saved selection changes, and readiness recovery. * fix(gateway): finish model catalog validation cleanup Remove obsolete awaits from synchronous catalog consumers and dead request-authority assignments. Prune the obsolete mock-export exemption and the inherited unused voice-call constant export exposed by the full-tree gate. * test(gateway): align catalog fixtures with prepared reads Pause publication races at live session authority instead of catalog acquisition, assert typed rejection of retired projections, and shrink the obsolete timed-wait baseline.
…e CLI sign-in unless sign-in seeded them (#167963) ## What Problem This Solves Fixes: after Claude CLI sign-in (`openclaw models auth login --provider anthropic --method cli`), any `anthropic/<id>` that sign-in did not seed fails with `No API key found for provider "anthropic" … missing-provider-auth`. This affects Claude models published after sign-in and IDs typed with `--model`, `/model` or `models set`, such as `anthropic/claude-haiku-4-5`. ## User Impact User impact: Claude-CLI-only users can type or pick any Claude model and it runs through Claude Code. The model picker still lists only models the Claude CLI catalog serves, so `claude-mythos-5` (direct API only) stays hidden. Users with an Anthropic API key and no Claude CLI sign-in keep the API route. Exact model entries that name another runtime still win. A session pinned to an Anthropic API-key account keeps that account's models, including `claude-mythos-5`, in its picker. Existing installs that signed in on an affected build get the new routing only after they rerun `openclaw models auth login --provider anthropic --method cli`. This PR adds no Doctor migration. User-authored `provider/*` wildcards for other CLI backends behave exactly as on `main`. For example, `google/*` → `google-gemini-cli` keeps the same picker rows, and its typed IDs run as before. The picker gate is keyed on the `anthropic/*` → `claude-cli` entry that sign-in writes. ## Why This Change Was Made Since #129052, Claude CLI sign-in persists no OpenClaw auth profile. At run time, `resolveCliRuntimeExecutionProvider` (src/agents/model-runtime-aliases.ts) found no runtime policy for unseeded IDs and no `claude-cli` profile it could alias. The turn then fell to the embedded Anthropic API path. An instrumented isolated Gateway on 58ba7ed showed `policy=undefined … viaAuthProfile=undefined` and then `useCliExecution=false`. - Sign-in (`extensions/anthropic/cli-migration.ts`) now also writes the existing, documented provider wildcard `agents.defaults.models["anthropic/*"] = { agentRuntime: { id: "claude-cli" } }`. It does not overwrite a wildcard that already names another runtime. - Catalog decisions (`src/agents/model-catalog-cli-wildcard.ts`, used by `model-catalog-decisions.ts`) mark a row unavailable, with no "sign in" reason, when all of these hold: native Claude CLI credentials supplied the availability (`evidence: "runtime"`), the row reaches `claude-cli` only through that sign-in wildcard, the Claude CLI catalog does not list it (bundled manifest plus published catalog), and it is not a configured row. Availability from a selected or pinned API account is never narrowed. Run-time routing is unchanged, so typed IDs still run. Production change: 3 lines in cli-migration.ts, 15 net lines in model-catalog-decisions.ts and a new 58-line module (about 45 code lines). No config keys, schema or SDK surface change. Provenance (f8b06fb, #166037): prepared catalog decisions keep saved account, model and runtime choices and their provenance. `createCliRuntimeModelAuthEvaluator` returns a pinned non-native account's own provider-auth result, and `evaluateNative` keeps host results for selected accounts. The wildcard gate now only narrows availability that came from native Claude CLI credentials, so a saved account choice keeps the models that account can use. ## Evidence Real proofs used the machine's existing native `claude` login, OpenClaw's real sign-in flow, isolated profiles and a loopback Gateway: - Before, on `main` 58ba7ed: `models set anthropic/claude-haiku-4-5` plus one turn failed with `missing-provider-auth`, and the instrumentation showed no CLI route. - After, on b35cc8e: the picker lists `available` rows that exactly match the 11 Claude CLI catalog IDs. `claude-mythos-5` and `claude-haiku-4-5` are not listed. - After: a turn typed with `--model anthropic/claude-haiku-4-5` returned `OK` with `runner=cli` and `winnerProvider=claude-cli`. - After: `models set anthropic/claude-haiku-4-5` plus a turn returned `OK` through `claude-cli`. - API-key control: on a profile with `paste-api-key` (key piped on stdin) and no Claude CLI sign-in, an `anthropic/claude-haiku-4-5` turn returned `OK` with `runner=embedded` and `winnerProvider=anthropic`. Mythos stays listed for API users, as on `main`. - Regressions: - `extensions/anthropic/cli-migration.test.ts`, including the registered non-interactive sign-in entry: 4 failures without the fix, 40/40 pass with it. - `src/agents/model-catalog-decisions.test.ts`: the Claude CLI wildcard test fails without the gate (`expected true to be false`). With the gate, it covers a listed row, an API-only row (unavailable, no reason), an exact pinned row, a configured typed row, an exact override to `openclaw`, and an unchanged `google/*` → `google-gemini-cli` row even when that backend lists its own rows. - Same test, selected-account case (added on 41f26e5): with the wildcard and a session pinned to an Anthropic API-key profile, `claude-mythos-5` is available with `selectedProfileId: "anthropic:work"` in both `evaluateEntry` and `evaluateNative`. With only native Claude CLI credentials it stays unavailable. On 651801e this fails (`expected { availability: false … } to match object { availability: true … }`). With the fix, 24/24 pass in the file, and `model-auth-availability.test.ts` plus `cli-migration.test.ts` pass. - New-model simulation on 651801e, in a throwaway worktree with `claude-fable-5` removed from local knowledge: both bundled manifest rows (`anthropic`, `claude-cli`), the `fable-5` alias, the model-catalog-core alias and the Claude CLI context alias. `models.catalogRefresh.url` pointed at a loopback copy of `catalog.openclaw.ai/models/v2/catalog.json`, served at first without `anthropic/claude-fable-5` and `claude-cli/claude-fable-5`. - Before: `models.list {view:"configured", refresh:true}` (the Control UI view) returned 10 Claude rows and no Fable 5 row. - I added both rows back only in the served copy, with a newer `generatedAt`, then ran `openclaw models refresh` and `models.list {refresh:true}`. The Gateway PID did not change. The first response was unchanged because adoption starts after that response. The next read listed `claude-cli/claude-fable-5` as available, but not `anthropic/claude-fable-5`. A Gateway restart gave the same rows, so the refresh lifecycle is not the cause. - Turns: `--model anthropic/claude-fable-5` returned `OK` on the same Gateway PID with `runner=cli`, `winnerProvider=claude-cli` and `winnerModel=claude-fable-5`. `--model claude-cli/claude-fable-5`, the row the picker shows, also returned `OK` through `claude-cli`. - Gates on 41f26e5: `node scripts/check-changed.mjs` exited 0. It ran the tsgo lanes, oxlint on core and the changed extension files, the full dead-export scan, format checks, ratchets and the import-cycle check. `pnpm exec oxlint --type-aware` on the changed files exited 0. Upgrade cell (published v2026.9.9 → this PR, disposable Docker container from the `scripts/e2e/Dockerfile` `bare` stage, candidate packed with `scripts/package-openclaw-for-docker.mjs` from 41f26e5, build `2026.9.9-41f26e5206fc`). `api.anthropic.com` resolved to loopback in the container, so the fake key never left it. npm `latest` is still 2026.9.9. - Existing state was written by the published CLI. It had a Claude CLI-style `agents.defaults.models` with three `anthropic/*` IDs on `claude-cli` and no wildcard, primary `anthropic/claude-opus-5-5`, and an `anthropic:work` API-key profile from `paste-api-key` with a fake key. Through the v2026.9.9 Gateway, `sessions.create` and then `sessions.patch {model:"anthropic/claude-sonnet-5@anthropic:work"}` saved this session selection: `providerOverride=anthropic, modelOverride=claude-sonnet-5, authProfileOverride=anthropic:work (user), agentRuntimeOverride=claude-cli`. - `openclaw update --tag file:<tgz> --no-restart --yes --json` exited 0 with `status: ok` and all steps at 0. The CLI now reports `OpenClaw 2026.9.9 (41f26e5)`. The updater's doctor, `openclaw doctor --non-interactive` and `config validate` passed (`valid: true`, no warnings). Doctor warnings matched the baseline: a plaintext gateway token in the fixture, loopback bind and no service manager. The saved session selection and `agents.defaults.models` read back identical to the pre-update values. - Claude CLI sign-in again, with the real `openclaw models auth login --provider anthropic --method cli --set-default` under a pty. It needs a TTY. Without a `claude` binary it stops with `Claude CLI is not authenticated on this host`. With a stub `claude` on `PATH` that only answers `auth status --json` with `{"loggedIn":true,"authMethod":"claude.ai"}` and `--version`, and never runs a model, it exited 0. That was the only stubbed part; the sign-in, config write and Gateway are the shipped code. After the first sign-in, `"anthropic/*": {agentRuntime:{id:"claude-cli"}}` was present once. A second sign-in left it present once. The three existing entries and the primary were unchanged, the session selection was identical after each sign-in, and `config validate` and doctor passed. - Candidate Gateway with the wildcard present: `models.list {sessionKey, view:"all", provider:"anthropic"}` for the session pinned to `anthropic:work` listed `claude-mythos-5` as `available: true`. `models.list {agentId:"main"}`, with no selected account, listed it as `available: false`, which is the accepted Claude CLI-first behavior. - Not covered: no real Claude Code turn ran in the cell. Real turns are in the evidence above. The update's package swap took 23 min on a loaded host; an earlier v2026.9.9 cell on the same host took 7–11 min for the whole update. No Telegram Test Server run. Gap: a Claude model that the published catalog adds later appears in the picker without a restart, but only as `claude-cli/<id>`, not `anthropic/<id>`. `anthropic` is a `refreshable` catalog provider, so its published rows appear only when live `/v1/models` discovery returns them, and that discovery needs an API key. The `src/agents/model-catalog.ts` guard says "Only live registry or refreshed rows may publish those provider models". `claude-cli` is `static`, so its published row appears. The sign-in wildcard gate only marks existing `anthropic` rows unavailable and never adds rows, so the `claude-cli` row has no `anthropic` twin to fold into. Both refs run through Claude Code. Showing `anthropic/<id>` would need a separate change to the refreshable-provider guard in `model-catalog.ts` or to the CLI twin collapse in `model-runtime-aliases.ts`. ## Merge danger Medium-low. The run-time change is config written only by Claude CLI sign-in. The picker change sits in shared catalog decisions, but it applies only when an agent's `anthropic/*` entry names `claude-cli` and the row is neither configured nor listed by the Claude CLI catalog. Co-authored-by: Ayaan Zaidi <[email protected]>
…e CLI sign-in unless sign-in seeded them (openclaw#167963) ## What Problem This Solves Fixes: after Claude CLI sign-in (`openclaw models auth login --provider anthropic --method cli`), any `anthropic/<id>` that sign-in did not seed fails with `No API key found for provider "anthropic" … missing-provider-auth`. This affects Claude models published after sign-in and IDs typed with `--model`, `/model` or `models set`, such as `anthropic/claude-haiku-4-5`. ## User Impact User impact: Claude-CLI-only users can type or pick any Claude model and it runs through Claude Code. The model picker still lists only models the Claude CLI catalog serves, so `claude-mythos-5` (direct API only) stays hidden. Users with an Anthropic API key and no Claude CLI sign-in keep the API route. Exact model entries that name another runtime still win. A session pinned to an Anthropic API-key account keeps that account's models, including `claude-mythos-5`, in its picker. Existing installs that signed in on an affected build get the new routing only after they rerun `openclaw models auth login --provider anthropic --method cli`. This PR adds no Doctor migration. User-authored `provider/*` wildcards for other CLI backends behave exactly as on `main`. For example, `google/*` → `google-gemini-cli` keeps the same picker rows, and its typed IDs run as before. The picker gate is keyed on the `anthropic/*` → `claude-cli` entry that sign-in writes. ## Why This Change Was Made Since openclaw#129052, Claude CLI sign-in persists no OpenClaw auth profile. At run time, `resolveCliRuntimeExecutionProvider` (src/agents/model-runtime-aliases.ts) found no runtime policy for unseeded IDs and no `claude-cli` profile it could alias. The turn then fell to the embedded Anthropic API path. An instrumented isolated Gateway on 35a9f60 showed `policy=undefined … viaAuthProfile=undefined` and then `useCliExecution=false`. - Sign-in (`extensions/anthropic/cli-migration.ts`) now also writes the existing, documented provider wildcard `agents.defaults.models["anthropic/*"] = { agentRuntime: { id: "claude-cli" } }`. It does not overwrite a wildcard that already names another runtime. - Catalog decisions (`src/agents/model-catalog-cli-wildcard.ts`, used by `model-catalog-decisions.ts`) mark a row unavailable, with no "sign in" reason, when all of these hold: native Claude CLI credentials supplied the availability (`evidence: "runtime"`), the row reaches `claude-cli` only through that sign-in wildcard, the Claude CLI catalog does not list it (bundled manifest plus published catalog), and it is not a configured row. Availability from a selected or pinned API account is never narrowed. Run-time routing is unchanged, so typed IDs still run. Production change: 3 lines in cli-migration.ts, 15 net lines in model-catalog-decisions.ts and a new 58-line module (about 45 code lines). No config keys, schema or SDK surface change. Provenance (f81245d, openclaw#166037): prepared catalog decisions keep saved account, model and runtime choices and their provenance. `createCliRuntimeModelAuthEvaluator` returns a pinned non-native account's own provider-auth result, and `evaluateNative` keeps host results for selected accounts. The wildcard gate now only narrows availability that came from native Claude CLI credentials, so a saved account choice keeps the models that account can use. ## Evidence Real proofs used the machine's existing native `claude` login, OpenClaw's real sign-in flow, isolated profiles and a loopback Gateway: - Before, on `main` 35a9f60: `models set anthropic/claude-haiku-4-5` plus one turn failed with `missing-provider-auth`, and the instrumentation showed no CLI route. - After, on b35cc8e: the picker lists `available` rows that exactly match the 11 Claude CLI catalog IDs. `claude-mythos-5` and `claude-haiku-4-5` are not listed. - After: a turn typed with `--model anthropic/claude-haiku-4-5` returned `OK` with `runner=cli` and `winnerProvider=claude-cli`. - After: `models set anthropic/claude-haiku-4-5` plus a turn returned `OK` through `claude-cli`. - API-key control: on a profile with `paste-api-key` (key piped on stdin) and no Claude CLI sign-in, an `anthropic/claude-haiku-4-5` turn returned `OK` with `runner=embedded` and `winnerProvider=anthropic`. Mythos stays listed for API users, as on `main`. - Regressions: - `extensions/anthropic/cli-migration.test.ts`, including the registered non-interactive sign-in entry: 4 failures without the fix, 40/40 pass with it. - `src/agents/model-catalog-decisions.test.ts`: the Claude CLI wildcard test fails without the gate (`expected true to be false`). With the gate, it covers a listed row, an API-only row (unavailable, no reason), an exact pinned row, a configured typed row, an exact override to `openclaw`, and an unchanged `google/*` → `google-gemini-cli` row even when that backend lists its own rows. - Same test, selected-account case (added on 41f26e5): with the wildcard and a session pinned to an Anthropic API-key profile, `claude-mythos-5` is available with `selectedProfileId: "anthropic:work"` in both `evaluateEntry` and `evaluateNative`. With only native Claude CLI credentials it stays unavailable. On 651801e this fails (`expected { availability: false … } to match object { availability: true … }`). With the fix, 24/24 pass in the file, and `model-auth-availability.test.ts` plus `cli-migration.test.ts` pass. - New-model simulation on 651801e, in a throwaway worktree with `claude-fable-5` removed from local knowledge: both bundled manifest rows (`anthropic`, `claude-cli`), the `fable-5` alias, the model-catalog-core alias and the Claude CLI context alias. `models.catalogRefresh.url` pointed at a loopback copy of `catalog.openclaw.ai/models/v2/catalog.json`, served at first without `anthropic/claude-fable-5` and `claude-cli/claude-fable-5`. - Before: `models.list {view:"configured", refresh:true}` (the Control UI view) returned 10 Claude rows and no Fable 5 row. - I added both rows back only in the served copy, with a newer `generatedAt`, then ran `openclaw models refresh` and `models.list {refresh:true}`. The Gateway PID did not change. The first response was unchanged because adoption starts after that response. The next read listed `claude-cli/claude-fable-5` as available, but not `anthropic/claude-fable-5`. A Gateway restart gave the same rows, so the refresh lifecycle is not the cause. - Turns: `--model anthropic/claude-fable-5` returned `OK` on the same Gateway PID with `runner=cli`, `winnerProvider=claude-cli` and `winnerModel=claude-fable-5`. `--model claude-cli/claude-fable-5`, the row the picker shows, also returned `OK` through `claude-cli`. - Gates on 41f26e5: `node scripts/check-changed.mjs` exited 0. It ran the tsgo lanes, oxlint on core and the changed extension files, the full dead-export scan, format checks, ratchets and the import-cycle check. `pnpm exec oxlint --type-aware` on the changed files exited 0. Upgrade cell (published v2026.9.9 → this PR, disposable Docker container from the `scripts/e2e/Dockerfile` `bare` stage, candidate packed with `scripts/package-openclaw-for-docker.mjs` from 41f26e5, build `2026.9.9-41f26e5206fc`). `api.anthropic.com` resolved to loopback in the container, so the fake key never left it. npm `latest` is still 2026.9.9. - Existing state was written by the published CLI. It had a Claude CLI-style `agents.defaults.models` with three `anthropic/*` IDs on `claude-cli` and no wildcard, primary `anthropic/claude-opus-5-5`, and an `anthropic:work` API-key profile from `paste-api-key` with a fake key. Through the v2026.9.9 Gateway, `sessions.create` and then `sessions.patch {model:"anthropic/claude-sonnet-5@anthropic:work"}` saved this session selection: `providerOverride=anthropic, modelOverride=claude-sonnet-5, authProfileOverride=anthropic:work (user), agentRuntimeOverride=claude-cli`. - `openclaw update --tag file:<tgz> --no-restart --yes --json` exited 0 with `status: ok` and all steps at 0. The CLI now reports `OpenClaw 2026.9.9 (41f26e5)`. The updater's doctor, `openclaw doctor --non-interactive` and `config validate` passed (`valid: true`, no warnings). Doctor warnings matched the baseline: a plaintext gateway token in the fixture, loopback bind and no service manager. The saved session selection and `agents.defaults.models` read back identical to the pre-update values. - Claude CLI sign-in again, with the real `openclaw models auth login --provider anthropic --method cli --set-default` under a pty. It needs a TTY. Without a `claude` binary it stops with `Claude CLI is not authenticated on this host`. With a stub `claude` on `PATH` that only answers `auth status --json` with `{"loggedIn":true,"authMethod":"claude.ai"}` and `--version`, and never runs a model, it exited 0. That was the only stubbed part; the sign-in, config write and Gateway are the shipped code. After the first sign-in, `"anthropic/*": {agentRuntime:{id:"claude-cli"}}` was present once. A second sign-in left it present once. The three existing entries and the primary were unchanged, the session selection was identical after each sign-in, and `config validate` and doctor passed. - Candidate Gateway with the wildcard present: `models.list {sessionKey, view:"all", provider:"anthropic"}` for the session pinned to `anthropic:work` listed `claude-mythos-5` as `available: true`. `models.list {agentId:"main"}`, with no selected account, listed it as `available: false`, which is the accepted Claude CLI-first behavior. - Not covered: no real Claude Code turn ran in the cell. Real turns are in the evidence above. The update's package swap took 23 min on a loaded host; an earlier v2026.9.9 cell on the same host took 7–11 min for the whole update. No Telegram Test Server run. Gap: a Claude model that the published catalog adds later appears in the picker without a restart, but only as `claude-cli/<id>`, not `anthropic/<id>`. `anthropic` is a `refreshable` catalog provider, so its published rows appear only when live `/v1/models` discovery returns them, and that discovery needs an API key. The `src/agents/model-catalog.ts` guard says "Only live registry or refreshed rows may publish those provider models". `claude-cli` is `static`, so its published row appears. The sign-in wildcard gate only marks existing `anthropic` rows unavailable and never adds rows, so the `claude-cli` row has no `anthropic` twin to fold into. Both refs run through Claude Code. Showing `anthropic/<id>` would need a separate change to the refreshable-provider guard in `model-catalog.ts` or to the CLI twin collapse in `model-runtime-aliases.ts`. ## Merge danger Medium-low. The run-time change is config written only by Claude CLI sign-in. The picker change sits in shared catalog decisions, but it applies only when an agent's `anthropic/*` entry names `claude-cli` and the row is neither configured nor listed by the Claude CLI catalog. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Saved-session model pickers became slow after e1cb2b3 (#165614) added awaited session-authority reads around each model/runtime decision. A production sample returned nine models and three runtime choices in 626 ms with a session key, versus 50 ms without one.
User Impact
Repeated saved-session reads reuse the prepared catalog projection while retaining current session checks at admission and publication. Saved account/model/runtime choices and provenance remain intact. Personal accounts and drafts keep their request-scoped revocation path; recovered native runtimes become selectable without discovery on each read. No configuration or storage migration is required.
Why This Change Was Made
Evaluate prepared auth facts synchronously, remove the per-entry Promise machinery, and extend the existing generation-owned, single-flight model-list cache to detached shared-session selections. Read runtime eligibility from current prepared readiness when publishing cached choices. Actual account discovery retains its own authorization checks.
Production TypeScript is +312/−290, net +22 lines. The necessary growth captures nine selection/provenance fields, excludes personal credentials, and carries cold-preparation authority without retaining the session object or live request. Those account-revocation and saved-selection contracts prevent reusing an unscoped key or caching the original scope. There is no new cache owner. A separately generated guard baseline removes one obsolete exemption (−1 tooling line). The gate also exposed an inherited unused voice-call constant export; removing that single
exportkeyword keeps its value and behavior unchanged and lets the repository-wide dead-export check pass.Evidence
Final head
1ac5d4e5247acb220ea233a4a41be5f5bd1af834passed CI run 37446216434: 54 successful jobs, zero failures, 530 s elapsed. Dependency review passed with no dependency changes. The existing auto-merge watcher merged this PR at 2026-10-06 10:04:22Z asf8b06fbb69b68e74e42224871514b84095126aa7; ancestry on main is verified. No manual merge, production restart, or deployment was performed.On Blacksmith Testbox (
openclaw-check), six persistent WebSocket clients read nine synthetic OpenAI models, three Codex runtime choices, and a saved shared-account pin. At application head3f39199ef7e1, 600 scoped requests measured 12.0 ms p50 / 27.3 ms p99; unscoped reads measured 5.3 / 16.4 ms. Provider discovery, native discovery, andpreparedModelCatalogtask deltas were zero during both windows. The scoped maximum was 68.6 ms. Combined fixture/Gateway/client/worker peak RSS was about 1.69 GiB, not a production-process memory measurement.The paired
4f6dfcb693d1control measured 14.1/166.7 ms p50/p99, versus 12.6/44.0 ms with the pre-rebase patch. The final confirmation above used a fresh lease after the readiness fix and a clean rebase. The independent handler regression reduced warmed session-authority acquisitions from 46 to 2, failed against the control, and passed after the repair. Catalog worker activity was already zero in the control: the measured regression was session-authority amplification.tbx_01m482za2gxtt6kp9zh7g1skwf, real source Gateway/worker lifecycle and persistent WebSockets; passed. Provider and native harness endpoints are synthetic; no live Codex app-server or inference is claimed.pnpm test src/gateway/server-methods/models.prepared.test.ts --maxWorkers=1: 24.46 s wall / 2.16 s test execution. Final CI completed 54 successful jobs in 530 s workflow wall time; per-file CI timing was not separately collected.tbx_01m480sfzyycnwt7ffh9g2z5vj. The final full-patch review has no actionable P0–P2 findings; rebase preserved every changed source file. The final six-file validation cleanup was also reviewed with no actionable P0–P2 findings.tbx_01m482za2gxtt6kp9zh7g1skwf:node scripts/check-changed.mjs --staged --base ca43d19197888f3d42237b4425f08a473779266fpassed all 27 core test type graphs (1,328.77 s), core types (51.63 s), graph boundaries (73.93 s), formatting, ratchets, dependency/plugin boundaries, and schema guards before stopping at the inherited unused export. After cleanup, targeted core/extension lint and the complete dead-export scan passed (280.8 s command time). The remaining planned script lint, native-schema, legacy-store, media, sidecar-loader, import-cycle, webhook-ordering, and pairing guards passed separately. This is completed check coverage across the original run and targeted repairs, not a claimed single uninterrupted gate exit 0.tbx_01m486jr6j0mncgttsjr812sm0, providerblacksmith-testbox, profileopenclaw-check: all six checks passed, 233.4 s total command time. Commands:pnpm lint:plugins:no-extension-test-core-imports;pnpm test:serial src/plugins/doctor-contract-declarations.test.ts src/plugins/doctor-contract-closure-guard.test.ts(6/6, 7 s);pnpm tsgo:extensions(58 s);pnpm tsgo:extensions:test(89 s);node scripts/run-vitest.mjs src/agents/model-catalog-decisions.test.ts(19/19, 30 s);node scripts/run-vitest.mjs src/gateway/server-methods/models.prepared.test.ts(2/2, 19 s). Both final leases were stopped after completion.The first PR CI run (
37440278843, head07871fc79f27) exposed two stale test assumptions. The connection/publication fixture waited for a catalog acquisition that cached reads now omit; its barriers now wrap the existing live session authority and preserve both stale-publication suppression and unrelated-session survival. The service-tier fixture deliberately read a retired projection and now expects the existing typed supersession rejection. An intermediate fixture probe exposed the independent one-second dispatcher response cache; removing its redundant warm-up restored the intended in-flight scenario. These repairs change tests only. Ontbx_01m487k233fsrhtys0cbs7kmzr,pnpm test src/gateway/server-methods/models-connect-publication.integration.test.ts --maxWorkers=1passed 1/1 (27.60 s command wall; 14.608 s test), andpnpm test src/gateway/server-methods/models-list-result.service-tiers.test.ts --maxWorkers=1passed 5/5 (22.62 s command wall). The final fixture review is clean at P0–P2. Staged validation passed across the native gate plus focused repairs: all 27 core test type graphs, core graph boundary, ratchets, targeted test lint, all 1,324 script lint inputs, coercion/deprecation guards, and all three export scans. The gate caught inferred generic return types and one shadowed test variable; explicitPromise<Awaited<T>>annotations and a spy rename resolved them. The timeout ratchet was regenerated to remove exactly one timed wait. These last changes are type/name/baseline-only; the passing behavioral proof remains valid. The final five-check lint/guard command completed in 173.7 s, and the lease was stopped.One existing raw-SQLite session fixture failed with
SQLITE_BUSYin a 159/160 gateway/account/security run. It bypasses the changed model-list path; its complete unchanged 89-test file-order replay passed ontbx_01m480sfzyycnwt7ffh9g2z5vj. This is non-reproduction, not a claimed fix.Historical deployment Gateways at
40592729and2983dfcfwere not launched and no full bisect was run; attribution uses the parent-relative source change, live scoped/unscoped sample, and reproducible control. Production was only read, with no restart or deployment. Production latency after deployment remains unmeasured.