Repository navigation
fix(models): restore missing picker choices after startup - #139848
Conversation
Initialize cold inventory through its existing owner, preserve explicit refresh after reload, and retain prepared facts through browse deadlines. Apply CLI-runtime availability to prepared channel auth while preserving unprepared setup hints and explicit account restrictions. Fixes #139498 and #139499. Reported by @goslingmanagment.
|
🦞👀 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. |
|
Ready to land the repair for #139498 and #139499. Cold inventory demand uses the existing owner queue; channel availability honors prepared CLI authentication; bounded fallback retains current owner facts; explicit refresh remains forced after compatible reloads. Validation on
Focused command: node scripts/run-vitest.mjs src/agents/prepared-model-runtime.scoped-refresh.test.ts src/agents/prepared-model-catalog.test.ts src/agents/prepared-model-runtime.startup-static.test.ts src/agents/prepared-model-runtime.reload-auth.test.ts src/agents/model-provider-auth.test.ts src/agents/model-catalog-browse.test.ts src/gateway/server-methods/models-list-result.cli-runtime-availability.test.ts src/auto-reply/reply/commands-models.catalog-recovery.test.ts src/auto-reply/reply/commands-models.test.ts src/commands/model-picker.test.tsReal Gateway boundary command: node scripts/run-vitest.mjs run --config test/vitest/vitest.e2e.config.ts test/e2e/qa-lab/runtime/telegram-model-picker-prepared-gateway.e2e.test.ts -t 'initializes unrestricted|lists native CLI-bound'The external Telegram Bot API, Ollama endpoint, and CLI auth-status process are simulated; no live Telegram/Claude account or Windows execution is claimed. Full cold runtime builds and task-owned fixture cleanup completed. Existing channel session-account-context propagation remains a separate documented follow-up. CI passed, including the required |
|
@clawsweeper review The PR body contains final before/after proof, exact-source real Gateway observations, and passing CI for the current head. Both independent-review findings were reproduced and addressed. Please review this revision for the native landing gate. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: blocked before merge. Reviewed September 6, 2026, 2:47 AM ET / 06:47 UTC. ClawSweeper reviewWhat this changesThe PR initializes model inventory on first browse after startup and preserves prepared CLI authentication and configured choices through slow catalog discovery. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful, bounded repair: fetched main still contains both reported failure paths, and the broader draft does not supersede it. No blocking correctness defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway prepares model inventory and authentication facts for model pickers. Gateway requests and channel commands use those facts to decide which providers and models to display. flowchart TD
A[Gateway startup] --> B[Prepared catalog and authentication]
C[Model browse request] --> D{Inventory initialized?}
D -->|No| E[Existing discovery owner]
E --> B
D -->|Yes| B
B --> F[Model visibility and runtime readiness]
F --> G[Gateway and channel pickers]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +33, Tests +444, Docs +8. Total +485 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep model browsing consistent through the existing catalog lifecycle and shared runtime-readiness rules, without adding configuration or duplicating discovery. Do we have a high-confidence way to reproduce the issue? Yes, from source: a static startup catalog is not auth-stale, so ordinary reads never initialize discovery; channel availability also omits the existing CLI projection. No runtime reproduction was executed during this review. Is this the best way to solve the issue? Yes. The patch repairs the existing owners, preserves passive prepared reads and account restrictions, and adds targeted cold-start, reload, timeout, and channel-boundary coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f6045c45be24. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
@clawsweeper re-review The PR body now records the missing listed-owner evidence: @steipete explicitly directed this repair and is a live-verified active maintainer of |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* refactor(models): centralize runtime-aware availability Follow up #139848 with one shared runtime-auth evaluator for Gateway, CLI, and prepared channel pickers. Preserve provider-only setup hints and required-account auth. The original picker regressions were reported by @goslingmanagment in #139498 and #139499. * fix(types): declare runtime auth evaluator receiver-free
…39848) Initialize cold inventory through its existing owner, preserve explicit refresh after reload, and retain prepared facts through browse deadlines. Apply CLI-runtime availability to prepared channel auth while preserving unprepared setup hints and explicit account restrictions. Fixes openclaw#139498 and openclaw#139499. Reported by @goslingmanagment.
) * refactor(models): centralize runtime-aware availability Follow up openclaw#139848 with one shared runtime-auth evaluator for Gateway, CLI, and prepared channel pickers. Preserve provider-only setup hints and required-account auth. The original picker regressions were reported by @goslingmanagment in openclaw#139498 and openclaw#139499. * fix(types): declare runtime auth evaluator receiver-free
…ason (#166338) ## What Problem This Solves Claude Code is installed but logged out, and onboarding has pinned the `anthropic/*` models to the `claude-cli` runtime. In that state the Control UI chat picker shows only the default model. It is disabled, has no reason, and the header says "No models available". The other 9 pinned models disappear, so a non-technical user cannot tell what is wrong or how to fix it. ## Root cause and provenance There are two causes. Both were reproduced live on an isolated Gateway, with debug logging that has since been removed. 1. **The login reason is held back until the full catalog finishes.** `evaluateCliRuntimeModelAuthAvailability` only reports `missing-auth` once `preparedSyntheticAuthComplete` is true. That gate came from #134463 (84e8133), and it exists for a good reason. The full-catalog worker finds direct CLI routes *after* startup, so their login has not been checked yet. In the words of #134463: "the full-catalog worker prepared synthetic auth only for providers present in the configured startup scope". The gate is too broad for runtimes the config already names. Preparation already checks their login at startup: `collectPreparedModelRuntimeProviderIds` adds every configured harness runtime to the startup provider scope, and `prepared-model-runtime.facts.ts` checks the synthetic auth of that scope. Meanwhile the picker never asks for a full refresh ("Opening the picker reuses prepared catalog facts; explicit Refresh owns discovery", per docs/concepts/models.md). Live logging showed the catalog stayed incomplete, with `anthropic` and `claude-cli` missing from inventory, until someone ran an explicit `refresh`. So the startup check had already returned "logged out", but the picker never displayed it. 2. **Configured rows are hidden when they are not signed in.** With an allow-any policy, the configured view lists only inline provider rows, rows that are signed in, and the default and fallbacks. Each `agents.defaults.models` key is in `configuredKeys` and is tagged `configured`, but it was only listed while signed in. This is a side effect of #110888 (09a64f7). That change made the `models` map metadata only. Before it, any entry turned the map into a closed allowlist, and allowlisted rows always showed. #113594 also promised that "nobody's pinned model disappears". Earlier decisions are kept: - The per-model `claude-cli` pins (#82546, #84374) are kept, and so is Doctor's canonicalization. - #134463 still applies to routes found later and to runtimes that are not configured: their availability stays unknown until the full catalog arrives. - #166305's 60-second login recheck is unchanged. After `claude auth login`, the rows still turn available without a restart. ## Fix - `src/agents/model-auth-availability.cli-runtime.ts`: a configured runtime with no prepared runtime auth mode now gets `missing-auth` even before the full catalog arrives. "Configured" is decided by the same `collectPreparedModelRuntimeProviderIds` set that startup checks, computed once per resolver and only on this path. The CLI-runtime evaluator moved here from `model-auth-availability.ts` unchanged, because the line-cap ratchet does not allow that file to grow (-108 lines there). - `src/agents/model-catalog-visibility.ts`: configured refs now stay in the default and configured views, shown as unavailable, until their login or key comes back. This uses the same `configuredKeys` that already keeps deprecated configured rows visible. - Control UI: if the picker has no usable model and a Claude CLI row reports `missing-auth`, the empty-state label becomes "Claude Code isn't ready. If signed out, run claude auth login." instead of "No models available". "Manage models" stays next to it. The copy is conditional on purpose. `missing-auth` on a Claude CLI row also covers a disabled or denied anthropic plugin and a missing personal-account pin, so an already signed-in user can see it. The reason enum (`missing-auth` | `auth-failed` | `cooldown`) is closed and shared with the Swift and Kotlin clients, and no existing value fits a disabled plugin, so this PR keeps the protocol unchanged and words the hint to stay true in every `missing-auth` case. `claude auth login` is the command OpenClaw's own hints already use (`oauth-refresh-failure.ts`, `doctor-claude-cli.ts`, `extensions/anthropic/auth.runtime.ts`). `claude setup-token` makes an API token for the Anthropic provider; it does not log in the CLI runtime. - Channel `/models` (`commands-models-menu.ts`): for Claude CLI rows reporting `missing-auth`, the recovery line now uses the same wording as the picker hint ("If Claude Code is signed out, run claude auth login on the Gateway host, or choose another model.") instead of `/login anthropic`. Other routes are unchanged. - `docs/concepts/models.md`: documents that configured models stay listed as unavailable, and adds the Claude Code login line. No new config keys and no protocol changes: the existing `missing-auth` value is reused. ## Evidence Isolated Gateway on this Mac with state, config and `CLAUDE_CONFIG_DIR` under /tmp. The config is the one written by the real `openclaw onboard --non-interactive --auth-choice anthropic-cli`. The logged-out state is a fresh, empty `CLAUDE_CONFIG_DIR` (`claude auth status` → `loggedIn: false`). The logged-in run uses a wrapper that answers only `claude auth status` with `loggedIn: true`. No real Claude login was touched. Screenshots retaken on the final head (36b263f) and on origin/main (2c620bb), each from its own isolated Gateway: | | Logged out | Logged in | |---|---|---| | origin/main |  |  | | this branch |  |  | Picker contents (search "Claude"): - **origin/main, logged out:** "No models available"; one `anthropic/*` row (the default), no reason. - **This branch, logged out:** "Claude Code isn't ready. If signed out, run claude auth login."; all 10 pinned `anthropic/*` rows listed with "Sign-in needed". - **Logged in:** no empty-state label, and the same 23 picker rows in the same order on both heads. ### Telegram Test Server (`/models anthropic`) Ran the repository's Telegram userbot runner on the Telegram Test Server with a Convex-leased bot and QA user (`run-mock-sut-user-e2e.mjs --dm --scenario`). The runner starts a fresh Gateway from each checkout's build. The config patch adds two configured `anthropic/*` models pinned to `claude-cli` and enables the anthropic plugin. `CLAUDE_CONFIG_DIR` points at an empty directory, so Claude Code is logged out. The QA user sends `/models anthropic` at 1 s and again at 40 s, after startup discovery. `/models` is a native command, so no model turn runs; the only mock-provider rows are two `/` readiness probes. | | 1 s | 40 s | |---|---|---| | origin/main `2c620bbfe84c` | "anthropic: checking models…" | "Unknown provider: anthropic … Available providers: • openai". The configured Claude CLI models are gone. | | this branch `45dce1142171` | "Models (anthropic) — 0 of 2 available … anthropic: Sign-in needed. If Claude Code is signed out, run claude auth login on the Gateway host, or choose another model." Buttons: `…needed — Claude CLI · claude-opus-4-7`, `…eded — Claude CLI · claude-sonnet-4-6`, `<< Back`. | Same reply and buttons. | The `…` at the start of the button labels comes from Telegram's existing button-length truncation; this PR does not touch it. `models.list {view: "configured"}`, logged out, no refresh: - **origin/main:** 1 `anthropic/*` row (the default), `available: false`, no reason. - **This branch:** all 10 pinned `anthropic/*` rows, `available: false`, `unavailableReason: "missing-auth"`. - **Logged in:** the configured-view rows, runtimes and availability on this branch are identical to the origin/main capture of the same config. The duplicate `claude-cli/*` rows in the screenshots are the existing twins; #166311 removes them. ## Tests - `models-list-result.cli-runtime-availability.test.ts`, new case: an onboarding-shaped config, Claude logged out, catalog incomplete, configured view, run through the real `buildModelsListResult`. Every pinned row is listed with `missing-auth`, and the unpinned API row stays hidden. It fails on origin/main for both causes (rows missing, no reason). - `models.test.ts`: the existing table row for "logged out, catalog incomplete" now expects `missing-auth`, because the runtime is configured. It fails on origin/main. - `chat-model-catalog-state.test.ts`: the real `renderChatModelPicker`, given a `missing-auth` Claude CLI row, renders exactly the conditional Claude Code hint (the same row a signed-in user gets when the anthropic plugin is disabled, which `models-list-result.cli-runtime-availability.test.ts` already covers on the producer side). Other providers keep "No models available". It fails on origin/main (`expected 'No models available'`). - `commands-models.catalog-recovery.test.ts` and `commands-models.test.ts` go through the real `/models` handler, which reads the same projection as the picker. A CLI-bound configured model is now listed in every auth state. It is marked "Sign-in needed" unless its prepared native login is present and its plugin is enabled. Its recovery line reads "If Claude Code is signed out, run claude auth login on the Gateway host, or choose another model." instead of `/login anthropic`, which can't fix a Claude Code login or a disabled plugin. A logged-out configured Claude CLI default now gets that recovery line instead of "Connection not confirmed". The #139848 rule still holds: with only an API key, the bound row shows "Sign-in needed" and is not available. - Wall time with `pnpm test <file> --maxWorkers=1`: 35 s, 37 s and 3 s. The new gateway case takes 325 ms. No timers and no new fixtures. - Also run: affected suites (`model-catalog*`, `model-auth-availability*`, `model-selection*`, `server-methods/models*`, `commands/models`, the chat picker UI and new-session), all passing. `node scripts/check-changed.mjs` exits 0 (tsgo core and UI, lint, import cycles, line-cap ratchet, i18n). ## Bounded cost - No new processes, probes, network calls or catalog work. The existing startup `claude auth status` check and #166305's 60-second recheck are unchanged. - The configured-runtime set is built at most once per auth resolver, which is one per `models.list` read. It is built only when a CLI-runtime row has no prepared login, and it is a pure walk over the config's model refs. - Visibility adds one `Set.has` per catalog row. The UI adds one `.some()` over picker options per render. - Picker size is bounded by configured refs: at most the number of models the user authored, and they were already listed while signed in. ## User impact A logged-out Claude Code user sees every configured Claude model, greyed with "Sign-in needed", and a header that names the command to run. Once `claude auth login` succeeds, the rows turn available on the next read after #166305's recheck. Configured models for other providers that have lost their key now also stay listed as unavailable instead of disappearing. The channel `/models` command shows the same rows marked "Sign-in needed", and Claude CLI rows get the conditional `claude auth login` recovery line. The logged-in picker is unchanged. ## LOC vs origin/main Production +182/-118. The moved evaluator accounts for +147/-112 and is unchanged apart from the configured-runtime check, so the behaviour change itself is about +35. Tests +82/-12. Docs +3/-1. Co-authored-by: Ayaan Zaidi <[email protected]>
…ason (openclaw#166338) ## What Problem This Solves Claude Code is installed but logged out, and onboarding has pinned the `anthropic/*` models to the `claude-cli` runtime. In that state the Control UI chat picker shows only the default model. It is disabled, has no reason, and the header says "No models available". The other 9 pinned models disappear, so a non-technical user cannot tell what is wrong or how to fix it. ## Root cause and provenance There are two causes. Both were reproduced live on an isolated Gateway, with debug logging that has since been removed. 1. **The login reason is held back until the full catalog finishes.** `evaluateCliRuntimeModelAuthAvailability` only reports `missing-auth` once `preparedSyntheticAuthComplete` is true. That gate came from openclaw#134463 (47f0122), and it exists for a good reason. The full-catalog worker finds direct CLI routes *after* startup, so their login has not been checked yet. In the words of openclaw#134463: "the full-catalog worker prepared synthetic auth only for providers present in the configured startup scope". The gate is too broad for runtimes the config already names. Preparation already checks their login at startup: `collectPreparedModelRuntimeProviderIds` adds every configured harness runtime to the startup provider scope, and `prepared-model-runtime.facts.ts` checks the synthetic auth of that scope. Meanwhile the picker never asks for a full refresh ("Opening the picker reuses prepared catalog facts; explicit Refresh owns discovery", per docs/concepts/models.md). Live logging showed the catalog stayed incomplete, with `anthropic` and `claude-cli` missing from inventory, until someone ran an explicit `refresh`. So the startup check had already returned "logged out", but the picker never displayed it. 2. **Configured rows are hidden when they are not signed in.** With an allow-any policy, the configured view lists only inline provider rows, rows that are signed in, and the default and fallbacks. Each `agents.defaults.models` key is in `configuredKeys` and is tagged `configured`, but it was only listed while signed in. This is a side effect of openclaw#110888 (69e799e). That change made the `models` map metadata only. Before it, any entry turned the map into a closed allowlist, and allowlisted rows always showed. openclaw#113594 also promised that "nobody's pinned model disappears". Earlier decisions are kept: - The per-model `claude-cli` pins (openclaw#82546, openclaw#84374) are kept, and so is Doctor's canonicalization. - openclaw#134463 still applies to routes found later and to runtimes that are not configured: their availability stays unknown until the full catalog arrives. - openclaw#166305's 60-second login recheck is unchanged. After `claude auth login`, the rows still turn available without a restart. ## Fix - `src/agents/model-auth-availability.cli-runtime.ts`: a configured runtime with no prepared runtime auth mode now gets `missing-auth` even before the full catalog arrives. "Configured" is decided by the same `collectPreparedModelRuntimeProviderIds` set that startup checks, computed once per resolver and only on this path. The CLI-runtime evaluator moved here from `model-auth-availability.ts` unchanged, because the line-cap ratchet does not allow that file to grow (-108 lines there). - `src/agents/model-catalog-visibility.ts`: configured refs now stay in the default and configured views, shown as unavailable, until their login or key comes back. This uses the same `configuredKeys` that already keeps deprecated configured rows visible. - Control UI: if the picker has no usable model and a Claude CLI row reports `missing-auth`, the empty-state label becomes "Claude Code isn't ready. If signed out, run claude auth login." instead of "No models available". "Manage models" stays next to it. The copy is conditional on purpose. `missing-auth` on a Claude CLI row also covers a disabled or denied anthropic plugin and a missing personal-account pin, so an already signed-in user can see it. The reason enum (`missing-auth` | `auth-failed` | `cooldown`) is closed and shared with the Swift and Kotlin clients, and no existing value fits a disabled plugin, so this PR keeps the protocol unchanged and words the hint to stay true in every `missing-auth` case. `claude auth login` is the command OpenClaw's own hints already use (`oauth-refresh-failure.ts`, `doctor-claude-cli.ts`, `extensions/anthropic/auth.runtime.ts`). `claude setup-token` makes an API token for the Anthropic provider; it does not log in the CLI runtime. - Channel `/models` (`commands-models-menu.ts`): for Claude CLI rows reporting `missing-auth`, the recovery line now uses the same wording as the picker hint ("If Claude Code is signed out, run claude auth login on the Gateway host, or choose another model.") instead of `/login anthropic`. Other routes are unchanged. - `docs/concepts/models.md`: documents that configured models stay listed as unavailable, and adds the Claude Code login line. No new config keys and no protocol changes: the existing `missing-auth` value is reused. ## Evidence Isolated Gateway on this Mac with state, config and `CLAUDE_CONFIG_DIR` under /tmp. The config is the one written by the real `openclaw onboard --non-interactive --auth-choice anthropic-cli`. The logged-out state is a fresh, empty `CLAUDE_CONFIG_DIR` (`claude auth status` → `loggedIn: false`). The logged-in run uses a wrapper that answers only `claude auth status` with `loggedIn: true`. No real Claude login was touched. Screenshots retaken on the final head (36b263f) and on origin/main (b7dc0bc), each from its own isolated Gateway: | | Logged out | Logged in | |---|---|---| | origin/main |  |  | | this branch |  |  | Picker contents (search "Claude"): - **origin/main, logged out:** "No models available"; one `anthropic/*` row (the default), no reason. - **This branch, logged out:** "Claude Code isn't ready. If signed out, run claude auth login."; all 10 pinned `anthropic/*` rows listed with "Sign-in needed". - **Logged in:** no empty-state label, and the same 23 picker rows in the same order on both heads. ### Telegram Test Server (`/models anthropic`) Ran the repository's Telegram userbot runner on the Telegram Test Server with a Convex-leased bot and QA user (`run-mock-sut-user-e2e.mjs --dm --scenario`). The runner starts a fresh Gateway from each checkout's build. The config patch adds two configured `anthropic/*` models pinned to `claude-cli` and enables the anthropic plugin. `CLAUDE_CONFIG_DIR` points at an empty directory, so Claude Code is logged out. The QA user sends `/models anthropic` at 1 s and again at 40 s, after startup discovery. `/models` is a native command, so no model turn runs; the only mock-provider rows are two `/` readiness probes. | | 1 s | 40 s | |---|---|---| | origin/main `b7dc0bc0fda3` | "anthropic: checking models…" | "Unknown provider: anthropic … Available providers: • openai". The configured Claude CLI models are gone. | | this branch `45dce1142171` | "Models (anthropic) — 0 of 2 available … anthropic: Sign-in needed. If Claude Code is signed out, run claude auth login on the Gateway host, or choose another model." Buttons: `…needed — Claude CLI · claude-opus-4-7`, `…eded — Claude CLI · claude-sonnet-4-6`, `<< Back`. | Same reply and buttons. | The `…` at the start of the button labels comes from Telegram's existing button-length truncation; this PR does not touch it. `models.list {view: "configured"}`, logged out, no refresh: - **origin/main:** 1 `anthropic/*` row (the default), `available: false`, no reason. - **This branch:** all 10 pinned `anthropic/*` rows, `available: false`, `unavailableReason: "missing-auth"`. - **Logged in:** the configured-view rows, runtimes and availability on this branch are identical to the origin/main capture of the same config. The duplicate `claude-cli/*` rows in the screenshots are the existing twins; openclaw#166311 removes them. ## Tests - `models-list-result.cli-runtime-availability.test.ts`, new case: an onboarding-shaped config, Claude logged out, catalog incomplete, configured view, run through the real `buildModelsListResult`. Every pinned row is listed with `missing-auth`, and the unpinned API row stays hidden. It fails on origin/main for both causes (rows missing, no reason). - `models.test.ts`: the existing table row for "logged out, catalog incomplete" now expects `missing-auth`, because the runtime is configured. It fails on origin/main. - `chat-model-catalog-state.test.ts`: the real `renderChatModelPicker`, given a `missing-auth` Claude CLI row, renders exactly the conditional Claude Code hint (the same row a signed-in user gets when the anthropic plugin is disabled, which `models-list-result.cli-runtime-availability.test.ts` already covers on the producer side). Other providers keep "No models available". It fails on origin/main (`expected 'No models available'`). - `commands-models.catalog-recovery.test.ts` and `commands-models.test.ts` go through the real `/models` handler, which reads the same projection as the picker. A CLI-bound configured model is now listed in every auth state. It is marked "Sign-in needed" unless its prepared native login is present and its plugin is enabled. Its recovery line reads "If Claude Code is signed out, run claude auth login on the Gateway host, or choose another model." instead of `/login anthropic`, which can't fix a Claude Code login or a disabled plugin. A logged-out configured Claude CLI default now gets that recovery line instead of "Connection not confirmed". The openclaw#139848 rule still holds: with only an API key, the bound row shows "Sign-in needed" and is not available. - Wall time with `pnpm test <file> --maxWorkers=1`: 35 s, 37 s and 3 s. The new gateway case takes 325 ms. No timers and no new fixtures. - Also run: affected suites (`model-catalog*`, `model-auth-availability*`, `model-selection*`, `server-methods/models*`, `commands/models`, the chat picker UI and new-session), all passing. `node scripts/check-changed.mjs` exits 0 (tsgo core and UI, lint, import cycles, line-cap ratchet, i18n). ## Bounded cost - No new processes, probes, network calls or catalog work. The existing startup `claude auth status` check and openclaw#166305's 60-second recheck are unchanged. - The configured-runtime set is built at most once per auth resolver, which is one per `models.list` read. It is built only when a CLI-runtime row has no prepared login, and it is a pure walk over the config's model refs. - Visibility adds one `Set.has` per catalog row. The UI adds one `.some()` over picker options per render. - Picker size is bounded by configured refs: at most the number of models the user authored, and they were already listed while signed in. ## User impact A logged-out Claude Code user sees every configured Claude model, greyed with "Sign-in needed", and a header that names the command to run. Once `claude auth login` succeeds, the rows turn available on the next read after openclaw#166305's recheck. Configured models for other providers that have lost their key now also stay listed as unavailable instead of disappearing. The channel `/models` command shows the same rows marked "Sign-in needed", and Claude CLI rows get the conditional `claude auth login` recovery line. The logged-in picker is unchanged. ## LOC vs origin/main Production +182/-118. The moved evaluator accounts for +147/-112 and is unchanged apart from the configured-runtime check, so the behaviour change itself is about +35. Tests +82/-12. Docs +3/-1. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #139498
Closes #139499
What Problem This Solves
Fixes an issue where model pickers stayed on configured-only choices after a Gateway restart until another client explicitly refreshed the inventory. Channel pickers also omitted configured models routed through an authenticated CLI, even when Gateway model listing recognized their availability.
Reported by @goslingmanagment.
Why This Change Was Made
Ordinary inventory demand now initializes an undiscovered catalog through its existing lifecycle owner. The same queue, generation checks, and paired catalog/auth publication remain responsible for discovery. Explicit refresh still queries providers after compatible reloads, even when retained inventory first needs native-harness projection. Startup, prepared-only reads, and turn preparation remain passive.
Prepared channel auth evaluation now uses the existing CLI-runtime projection, preserving disabled-plugin and selected-account restrictions. Unprepared setup hints retain their existing provider-only behavior. When discovery exceeds the existing browse deadline, channel rendering retains the current prepared owner instead of dropping its configured rows and auth facts.
This is a bounded repair to current behavior, separate from the broader model-surface work in draft #136257. There are no new configuration options, dependencies, database changes, or protocol changes.
User Impact
After restart, ordinary browsing converges to the discovered inventory without opening another client or requesting an explicit refresh. Configured CLI-bound choices remain visible when the prepared native runtime is ready, including while discovery continues. A provider API key does not substitute for that runtime's native login.
Evidence
Observed results from the final real-Gateway harness:
{ "scenariosPassed": 2, "initialNativeProviderButton": "anthropic (2)", "nativeSelectableModels": [ "claude-haiku-4-5", "claude-sonnet-4-6" ], "gatewayNativeModelsAvailable": true, "nativeAuthStatusCalls": 2, "initialDiscoveryRequests": 3, "discoveryAttemptsDuringReuse": 0, "requestsAfterExplicitRefresh": 4 }anthropic (2)menu and Haiku/Sonnet selection buttons. The final exact-source rerun after the explicit-refresh correction also passed both scenarios. The native case observes startup readiness withpreparedOnly: true, then exercises the first cold/modelsmenu and callback without warming full discovery.The separate existing channel session-account-context propagation gap is not addressed here: this PR does not claim end-to-end channel account-selection parity. Model execution retains its own account and authorization checks.
Runtime proof used Node 26.8.1/pnpm 12.3.4 on macOS arm64, base
b3bdf3e11da5671dac9b6033edd49673c129f511plus the four-file candidate. Production/test postimages match this commit. The initial package-bootstrap timeout is excluded from behavior proof; final fixtures run the existing built-Gateway path with synthetic external boundaries.CI passed on the reviewed head, including the required
openclaw/ci-gate.Owner involvement
This repair was explicitly directed by @steipete, the PR author and an active maintainer of the listed authentication owner team,
openclaw/openclaw-secops. Live GitHub verification on 2026-09-06 viaGET /orgs/openclaw/teams/openclaw-secops/memberships/steipetereturned{"state":"active","role":"maintainer"}. This establishes the listed-owner involvement requested in the ClawSweeper review; no ownership policy or enforced GitHub approval requirement is changed.Additional remote validation
The prepared head
0171ed498cb764d189712a3b2ba3c70dea0dacecwas independently validated on Blacksmith Testbox. Its changed runtime and E2E fixture postimages match landed commit48f76a5c11193086b1ec2b7abe408aac34214812, whose ancestry on main was verified. These runs completed after the independent landing.b3bdf3e11da5671dac9b6033edd49673c129f511, with only the candidate E2E fixturetbx_01m1tq88j2m393641cg1ev21zh0171ed498cb764d189712a3b2ba3c70dea0dacectbx_01m1tq6a1rzdv6903fnwqjzyyxBoth sources passed
pnpm buildand harness-owned QA runtime preparation, followed by:node scripts/run-vitest.mjs \ test/e2e/qa-lab/runtime/telegram-model-picker-prepared-gateway.e2e.test.ts \ -t 'initializes unrestricted|lists native CLI-bound'Sanitized behavior transcript:
A separate built-CLI check stopped and restarted each Gateway with the same isolated state. At both startup and restart, baseline ordinary
models.listomitted the two synthetic Ollama rows untilrefresh: true; the candidate returned both before refresh. This supplemental check proves membership only: its rows were deliberately unavailable, and native readiness is established by the Telegram E2E above.The Gateway/plugin/channel paths were real; the external Telegram Bot API, Ollama endpoint, and Claude CLI auth-status executable were synthetic. All state, homes, workspaces, and free loopback ports were isolated. No live inference or Telegram Test Server execution is claimed: the remote hosts had no authenticated Convex CLI or broker pair. Both leases were stopped and independently reported
completed; Gateway logs showed clean shutdowns.Fresh independent branch review found no actionable P0–P2 findings.
git diff --numstattotals: production +56/-23 (+33), tests +495/-51 (+444), docs +8/-0. Production growth restores missing cold-inventory initialization and deadline recovery while applying the existing runtime-auth decision to channel browsing; no second catalog or auth policy is introduced.