Repository navigation
fix(models): isolate every per-provider catalog failure - #189059
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. What this changesThis PR isolates provider hook failures so healthy providers remain visible in the model catalog. Example: The static catalog hook serving family-plan throws while healthy supplies healthy-model.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a current catalog failure path and resolves both earlier review findings; no new actionable defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe prepared model runtime combines provider credentials, static catalogs, live discovery, and supplemental rows into snapshots consumed by models.list and model pickers. flowchart TD
A[Provider plugins] --> B[Credential preparation]
A --> C[Static and live catalogs]
A --> D[Catalog augmentation]
B --> E[Provider failure isolation]
C --> E
D --> E
E --> F[Prepared catalog publication]
F --> G[Models list and pickers]
Technical reviewBest possible solution: Use one provider-failure policy while preserving selected identities, existing inventory retention, and request-wide failure propagation. Do we have a high-confidence way to reproduce the issue? Current main allows generic synthetic-auth, static-catalog, and augmentation hook exceptions to escape catalog preparation; source inspection establishes the path without executing target code. Is this the best way to solve the issue? The shared classifier is a proportionate fix, and the extracted augmentation code preserves its existing SDK export and selection behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7bd53ff28f69. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +102, Tests +194, Other -1. Total +295 across 13 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)Reviewed October 31, 2026, 3:06 AM ET / 07:06 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed as 0588f51. Every per-provider catalog step (synthetic auth discovery, static catalog, catalog augment, live discovery) now uses one isolation rule: a failing provider becomes |
…189184) ## Problem A plugin-owned provider (`authScope: "plugin"`, for example TypeSafe) was missing from the model list on a live install, and its catalog refresh logged `Plugin-owned auth for provider "typesafe" is unavailable: live credential or no-auth evidence is missing` after nearly every Gateway start since Oct 28. Ambient credential discovery asked every synthetic-auth provider for a credential, including plugin-owned ones. A plugin-owned credential is instance-bound: `getPreparedPluginSecretInput` returns it only inside the owning plugin's Gateway request scope with live instance authority. The prepared model catalog worker builds ambient credentials in a worker thread (`prepared-model-catalog.worker.ts`), where that scope never exists, so the lookup always failed there. Where it did succeed on the main thread, the plugin's key went into the ambient credential map, which is a transferable discovery fact. `provider-runtime.ts` already forbids this for external synthetic auth: "Instance-owned credentials cannot become transferable worker bearer facts." Before #189059 this failure emptied the whole `models.list`. Since #189059 the provider is skipped, with a warning on every catalog build. ## Fix Ambient discovery skips providers whose auth scope is `plugin`, so it never calls their auth hook and never stores their key. The scope check runs inside the existing per-provider isolation (#189059), so an ownership lookup error (for example conflicting static credential owners) skips only that provider. Catalog availability already resolves plugin-owned credentials per model inside the owner's scope (`model-catalog-decisions.ts`), so these providers' models still show as available when their credential is live. ## User impact Plugin-owned providers no longer fail catalog refreshes or produce warnings at Gateway start. Their keys stay inside the plugin's scope. ## Authority chain Dispatch does not read ambient discovery credentials: runtime auth (`runtime-plan/prepare-auth.ts`) resolves plugin-owned credentials through the owning instance at run time. The existing `src/agents/model-auth.plugin-scope.test.ts` contracts, all passing on this head, cover each link: - authorized dispatch: "plans plugin-owned auth before agent stores, configured bindings and cooldowns" - foreign owner: "rejects hook/secret authority replacement during auth", "refuses static/runtime scope mismatch" - revocation after preparation, before provider I/O: "invalidates catalog readiness on revocation", "refuses revoked protected secret input rather than reusing a prior bearer", "retains credential authority through an awaited exchange (revoked during exchange: true)", "does not read a live credential after preparation is cancelled" The new regression also checks that, with ambient discovery skipping the provider, the owner path still resolves the live credential inside the plugin's scope. ## Production-path trace Run on head `42977e4a1d2` and repeated with `main`'s `agent-auth-discovery.ts`; behavior is identical, which is the point: ambient discovery never fed dispatch. Path: the real `extensions/typesafe` plugin loaded from `plugins.load.paths` (`loadAndActivateRootPluginRegistry`), catalog preparation through `acquireAgentRunPreparedModelRuntime` with runtime plugins (the path where ambient discovery runs), then a consumer plugin calling `api.runtime.decisions.evaluateV2`, which uses TypeSafe's plugin-owned auth and transport to send real HTTP to a loopback fake TypeSafe server. TypeSafe is decision-only (`chat: false`), so an agent chat turn cannot reach its provider I/O; this is the narrowest real path that does. Synthetic keys only. 1. Owner dispatch: catalog has `typesafe/kev-latest`; outcome `ok`; provider requests `[{"path":"/v1/systemone","authorization":"Bearer <synthetic-typesafe-key>"}]`. 2. Foreign owner: a second plugin registering `typesafe` is rejected at load (`provider already registered: typesafe`); registered owners stay `["typesafe"]`; zero requests carry the impostor's key. 3. Revocation after preparation, without re-preparing: after a key rotation republish, zero requests use the old prepared key and the next request uses the rotated key; with `plugins.entries.typesafe.enabled=false` the outcome is `unavailable (disabled)` and zero new provider requests are made. Not covered by this trace: a replaced live instance during an awaited exchange (covered by "retains credential authority through an awaited exchange" above), and the hosted `plugins.entries.typesafe.config.apiKey` route, which targets the public hosted endpoint and cannot point at a loopback server. ## Proof - `src/agents/model-auth.plugin-scope.test.ts` regression, with and without a live prepared credential: ambient discovery (sync and async) does not include the plugin-owned provider and never calls its auth hook. On `main` both cases fail: the hook runs, and with a live credential the plugin's key ends up in the ambient map. - Regression: a provider with conflicting static auth-scope owners next to a healthy sibling. Both ambient APIs keep the sibling's credential. Fails on the previous head with `conflicting static credential owners`. - Related suites pass: plugin-scope auth (36), discovery auth, external CLI discovery, synthetic auth discovery, prepared runtime sources, catalog worker pool, implicit discovery outcomes, `models.list` provider outcomes. - `pnpm check:changed` passes. `pnpm check:madge-import-cycles` reports 0 cycles. - Live evidence: Team server Gateway logs show this refresh failure after starts on Oct 28, 29, 30 and 31, with no config change to the TypeSafe plugin entry or secrets between a working and a failing start. No overlap with Pash/Sarah changes. ## Merge danger Two-way door: a revert fully undoes it. No state, config or contract change. Blast radius: model catalog discovery for installs with plugin-owned providers. Co-authored-by: Ayaan Zaidi <[email protected]>
) ## Problem Model catalog preparation calls plugin hooks one provider at a time. In three of those steps, any throw from one provider failed the whole `models.list` request, so no models came back for any provider: - ambient credential discovery (synthetic auth hooks) - the static provider catalog - catalog augment hooks openclaw#189014 fixed one error shape (a missing plugin-owned credential) in the first step only. Any other error from any provider still emptied the model list, for example when someone adds a new provider. Live provider discovery already followed the right rule: catch per provider, report it `unavailable` and continue. That rule lived only in that one catch block. ## Fix - New `src/agents/provider-failure-isolation.ts` owns the rule. A per-provider failure marks only that provider unavailable, logs a warning naming the step and provider, and continues. Only request-wide failures propagate: a cancelled request signal, plugin lifecycle retirement (`isPreparedModelRuntimePluginLifecycleFailure`, which the prepared runtime owner retries as a superseded publication) and an unresolved config secret. - A failed static catalog stays distinguishable from an empty one: the prepared static entry is marked `failed`, and implicit discovery reports `unavailable` for every selected identity of that hook (for example `family-plan` of a shared `family` hook) instead of publishing empty configs. Publication then keeps those providers' previous models as a refresh failure (already covered by "retains only same-account inventory after failure"). Implicit discovery's own static fallback run uses the same isolation and identities. - All four per-provider steps use it: both ambient discovery loops (replacing openclaw#189014's narrow matcher), the static catalog loop, catalog augment and live implicit discovery (its catch now calls the shared rule and keeps the profile-scoped secret outcome). - Catalog augment moved with its hook-provider resolver from `provider-runtime.ts` to `provider-catalog-augment.ts`, so that file drops under its line cap; the stale max-lines baseline entry is pruned. `provider-runtime.ts` re-exports the function, so the SDK surface is unchanged. - The plugin lifecycle errors and their check moved into the leaf `prepared-model-runtime-admission-errors.ts` (which already holds their base class) to avoid an import cycle; `prepared-model-runtime.errors.ts` re-exports them, so callers are unchanged. Behavior notes: - Live discovery now propagates plugin lifecycle retirement instead of reporting the provider unavailable. The owner already turns that into a superseded publication and retries. - A provider skipped in ambient discovery still shows its models as `missing-auth` through catalog availability. Each skip logs one warning per catalog build. ## User impact One broken, misconfigured or brand-new provider can no longer empty the model picker and Models page. Its own models show as unavailable and every other provider still lists. ## Proof - New regressions, each failing on `main` with the provider's error and passing here: - ambient discovery (sync and async): a throwing hook for one provider keeps the sibling's credential; a cancelled signal still rejects. - static catalog: a throwing catalog keeps the healthy provider's config; a cancelled signal still rejects. - implicit discovery, with and without a prepared static catalog: a throwing static catalog reports `{ provider, status: "unavailable" }` and the healthy provider still lists; a shared hook refreshed for only `family-plan` reports `family-plan`, not `family` (fails on the prior head with `family`). - catalog augment: a throwing hook keeps the other provider's rows. - 13 related suites pass, including plugin-scope auth, implicit discovery outcomes and scope, model catalog, `models.list` provider outcomes, prepared runtime sources and the catalog worker pool. - `pnpm check:changed` passes (typecheck, lint, import cycles, line-cap and max-lines ratchets); `pnpm check:madge-import-cycles` reports 0 cycles. No overlap with Pash/Sarah changes. ## Merge danger Two-way door: a revert fully undoes it. No state, config or public contract change. Blast radius: model catalog preparation and `models.list` for every install. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#189184) ## Problem A plugin-owned provider (`authScope: "plugin"`, for example TypeSafe) was missing from the model list on a live install, and its catalog refresh logged `Plugin-owned auth for provider "typesafe" is unavailable: live credential or no-auth evidence is missing` after nearly every Gateway start since Oct 28. Ambient credential discovery asked every synthetic-auth provider for a credential, including plugin-owned ones. A plugin-owned credential is instance-bound: `getPreparedPluginSecretInput` returns it only inside the owning plugin's Gateway request scope with live instance authority. The prepared model catalog worker builds ambient credentials in a worker thread (`prepared-model-catalog.worker.ts`), where that scope never exists, so the lookup always failed there. Where it did succeed on the main thread, the plugin's key went into the ambient credential map, which is a transferable discovery fact. `provider-runtime.ts` already forbids this for external synthetic auth: "Instance-owned credentials cannot become transferable worker bearer facts." Before openclaw#189059 this failure emptied the whole `models.list`. Since openclaw#189059 the provider is skipped, with a warning on every catalog build. ## Fix Ambient discovery skips providers whose auth scope is `plugin`, so it never calls their auth hook and never stores their key. The scope check runs inside the existing per-provider isolation (openclaw#189059), so an ownership lookup error (for example conflicting static credential owners) skips only that provider. Catalog availability already resolves plugin-owned credentials per model inside the owner's scope (`model-catalog-decisions.ts`), so these providers' models still show as available when their credential is live. ## User impact Plugin-owned providers no longer fail catalog refreshes or produce warnings at Gateway start. Their keys stay inside the plugin's scope. ## Authority chain Dispatch does not read ambient discovery credentials: runtime auth (`runtime-plan/prepare-auth.ts`) resolves plugin-owned credentials through the owning instance at run time. The existing `src/agents/model-auth.plugin-scope.test.ts` contracts, all passing on this head, cover each link: - authorized dispatch: "plans plugin-owned auth before agent stores, configured bindings and cooldowns" - foreign owner: "rejects hook/secret authority replacement during auth", "refuses static/runtime scope mismatch" - revocation after preparation, before provider I/O: "invalidates catalog readiness on revocation", "refuses revoked protected secret input rather than reusing a prior bearer", "retains credential authority through an awaited exchange (revoked during exchange: true)", "does not read a live credential after preparation is cancelled" The new regression also checks that, with ambient discovery skipping the provider, the owner path still resolves the live credential inside the plugin's scope. ## Production-path trace Run on head `42977e4a1d2` and repeated with `main`'s `agent-auth-discovery.ts`; behavior is identical, which is the point: ambient discovery never fed dispatch. Path: the real `extensions/typesafe` plugin loaded from `plugins.load.paths` (`loadAndActivateRootPluginRegistry`), catalog preparation through `acquireAgentRunPreparedModelRuntime` with runtime plugins (the path where ambient discovery runs), then a consumer plugin calling `api.runtime.decisions.evaluateV2`, which uses TypeSafe's plugin-owned auth and transport to send real HTTP to a loopback fake TypeSafe server. TypeSafe is decision-only (`chat: false`), so an agent chat turn cannot reach its provider I/O; this is the narrowest real path that does. Synthetic keys only. 1. Owner dispatch: catalog has `typesafe/kev-latest`; outcome `ok`; provider requests `[{"path":"/v1/systemone","authorization":"Bearer <synthetic-typesafe-key>"}]`. 2. Foreign owner: a second plugin registering `typesafe` is rejected at load (`provider already registered: typesafe`); registered owners stay `["typesafe"]`; zero requests carry the impostor's key. 3. Revocation after preparation, without re-preparing: after a key rotation republish, zero requests use the old prepared key and the next request uses the rotated key; with `plugins.entries.typesafe.enabled=false` the outcome is `unavailable (disabled)` and zero new provider requests are made. Not covered by this trace: a replaced live instance during an awaited exchange (covered by "retains credential authority through an awaited exchange" above), and the hosted `plugins.entries.typesafe.config.apiKey` route, which targets the public hosted endpoint and cannot point at a loopback server. ## Proof - `src/agents/model-auth.plugin-scope.test.ts` regression, with and without a live prepared credential: ambient discovery (sync and async) does not include the plugin-owned provider and never calls its auth hook. On `main` both cases fail: the hook runs, and with a live credential the plugin's key ends up in the ambient map. - Regression: a provider with conflicting static auth-scope owners next to a healthy sibling. Both ambient APIs keep the sibling's credential. Fails on the previous head with `conflicting static credential owners`. - Related suites pass: plugin-scope auth (36), discovery auth, external CLI discovery, synthetic auth discovery, prepared runtime sources, catalog worker pool, implicit discovery outcomes, `models.list` provider outcomes. - `pnpm check:changed` passes. `pnpm check:madge-import-cycles` reports 0 cycles. - Live evidence: Team server Gateway logs show this refresh failure after starts on Oct 28, 29, 30 and 31, with no config change to the TypeSafe plugin entry or secrets between a working and a failing start. No overlap with Pash/Sarah changes. ## Merge danger Two-way door: a revert fully undoes it. No state, config or contract change. Blast radius: model catalog discovery for installs with plugin-owned providers. Co-authored-by: Ayaan Zaidi <[email protected]>
Backport accepted fixes onto 2026.11.5-beta.2. Base: bc061f9 Canonical source tree before commit: e6c0c39 These are adapted/squashed backports; do not claim each is an exact Git cherry-pick. Source provenance (selected verified commits; other cohorts use their frozen patch/adoption manifests): runtime-B: b20a0cc fix(macos): connect with configured credentials despite stale app environment (#191468) c4c0942 fix(update): failed updates from 10.7–10.9 crash in automatic migration recovery (#189713) 6aae408 fix(update): preserve recovery errors and async triage callbacks (#191495) 8910654 fix(macos): prevent first-launch Gateway failures after upgrades (#191436) 00b2ff4 fix: parent sessions miss child approvals with a custom session store (#189827) c6142a8 fix: avoid copying managed plugin binaries during Gateway startup (#187865) e72b356 fix(anthropic): avoid token profile collisions (#187875) 807075d fix(anthropic): set API workspace at login (#186976) bafe92f fix(exec): preserve no-timeout results from macOS app nodes (#190729) 9b05a64 fix(imessage): use a PostgreSQL-safe recovery cursor key (#184919) 6ba197f fix: session search on PostgreSQL scans every transcript row instead of using the text index (#187909) 4f49aa5 fix(sessions): PostgreSQL session search scans every transcript row again after the 5th search on a connection (#188979) de3936c fix(macos): Mac tab shows a blank or stale page when a load fails (#185432) e977080 fix(macos): prevent duplicate voice sends and false sent feedback (#186271) provider-compaction: 1b43c2e fix(compaction): preserve active request provenance (#180214) 7b0cfe3 fix(google): restore tool calls with Python keyword parameters (#191561) 9039ceb fix(ci): keep compaction attribution helpers internal d6a1327 feat(google): use the Interactions API for Gemini Flash models (#189395) fe0f8d1 fix(google): Gemini models ignore configured topP (#190695) history: c51d733 fix(sessions): stop expanding archive reads from exhausting memory (#190690) 3c8bd4d fix(sessions): page oversized earlier history instead of failing at 8 MiB (#188450) b195f61 fix(sessions): page oversized transcript history in both directions (#188483) b65482e fix(gateway): preserve older history across hidden message gaps (#188557) 3d4fc94 fix(sessions): avoid oversized listing and imported-history reads (#189284) 33e7baf fix(sessions): bound active accounting without blocking writers (#190182) 682ade7 fix: preserve chat history continuation metadata (#188612) runtime-C: 7e005b0 fix(macos): keep secrets when a Gateway config save fails (#187734) 15cf738 fix(macos): keep Gateway auth when Tailscale exposure is turned off (#187664) b53a06b perf(update): read candidate state inventory without copying the shared database (#187921) 970fc4e fix: restore CLI message sends with agent tool policies (#188058) 73ad731 fix: stop model fallback when session capability metadata changes (#179312) 32305db fix: subagent turns fail after session metadata changes (#183501) d13bd0f fix(codex): include relay conversation instructions in trajectory (#189005) e375530 fix: replies after a plugin reload from Control UI go to the session's last external chat (#190982) 9346376 fix: reasoning-only retry is refused by Anthropic as reasoning_extraction (#184434) direct-auth-state: 1b15408 fix(models): keep the model list when one plugin-owned provider lacks a credential (#189014) 7d8dc60 fix: recover startup migration with retained worker index (#189023) capacity: 41772e3 fix(worktrees): settle completed disk debt on refused postchecks (#188727) command-once-189369: 8269137 fix(plugins): plugin commands that continue the agent run three times on native command turns (#189369) pg-board-189564: 7232a8d fix(boards): publish widgets with PostgreSQL storage (#189564) queued-edit-189869: 92b32ca fix: hold queued messages through inline edits (#189869) Preserve source attribution from original commits. For a genuinely exact individual pick only, use the conventional (cherry picked from commit <sha>) line. Full file-level provenance: coverage-manifest.json; reviewed patch hashes: artifact-registry.json. No held136/native82 content adopted by this work. No release or full-candidate qualification claim. Additional original-source identities (exact adapted hunk scope is in frozen artifacts): release-guides-185258: 39c37e6 docs(release): define ledger-first hotfix routing (#185258) UI-history: 10a6e4f fix(ui): scope provider-add discovery warning to its own provider (#188541), 3d7b4c4 fix(ui): never fail loading earlier chat history without a boundary (#188372) obsolete-cache-188203: 90d82c2 fix: preserve completed reasoning and refill chat snapshots (#188203) webhook-169778: b1f643f fix(startup): keep webhook decisions startup recorded for channels Doctor left pending (#169778) schema-lease-188391: ba6cfcd fix(state): keep lease renewal independent of parent admission (#188391) backfill-188976: c75a8a8 fix(gateway): stop session row backfill once the Gateway is closing (#188976) canonical-disable-188846: 88b56ee fix(config): auto-enable reads and writes mixed-case plugin policy under the canonical id (#188846) matrix-177272: 5a6d22c fix(matrix): stop seeding new thread sessions from the room transcript (#177272) provider-hook-189059: 0588f51 fix(models): isolate every per-provider catalog failure (#189059) unicode-189868: 87396e7 fix(oc-path): avoid reading and editing a different Unicode key (#189868) replay-cohort: 2031044 fix(sessions): acknowledge committed input retries without duplicate turns (#188527), 9114431 fix: resume configured fallback after interrupted attempts (#188672) Co-authored-by: RomneyDa <[email protected]>
Problem
Model catalog preparation calls plugin hooks one provider at a time. In three of those steps, any throw from one provider failed the whole
models.listrequest, so no models came back for any provider:#189014 fixed one error shape (a missing plugin-owned credential) in the first step only. Any other error from any provider still emptied the model list, for example when someone adds a new provider.
Live provider discovery already followed the right rule: catch per provider, report it
unavailableand continue. That rule lived only in that one catch block.Fix
src/agents/provider-failure-isolation.tsowns the rule. A per-provider failure marks only that provider unavailable, logs a warning naming the step and provider, and continues. Only request-wide failures propagate: a cancelled request signal, plugin lifecycle retirement (isPreparedModelRuntimePluginLifecycleFailure, which the prepared runtime owner retries as a superseded publication) and an unresolved config secret.failed, and implicit discovery reportsunavailablefor every selected identity of that hook (for examplefamily-planof a sharedfamilyhook) instead of publishing empty configs. Publication then keeps those providers' previous models as a refresh failure (already covered by "retains only same-account inventory after failure"). Implicit discovery's own static fallback run uses the same isolation and identities.provider-runtime.tstoprovider-catalog-augment.ts, so that file drops under its line cap; the stale max-lines baseline entry is pruned.provider-runtime.tsre-exports the function, so the SDK surface is unchanged.prepared-model-runtime-admission-errors.ts(which already holds their base class) to avoid an import cycle;prepared-model-runtime.errors.tsre-exports them, so callers are unchanged.Behavior notes:
missing-auththrough catalog availability. Each skip logs one warning per catalog build.User impact
One broken, misconfigured or brand-new provider can no longer empty the model picker and Models page. Its own models show as unavailable and every other provider still lists.
Proof
mainwith the provider's error and passing here:{ provider, status: "unavailable" }and the healthy provider still lists; a shared hook refreshed for onlyfamily-planreportsfamily-plan, notfamily(fails on the prior head withfamily).models.listprovider outcomes, prepared runtime sources and the catalog worker pool.pnpm check:changedpasses (typecheck, lint, import cycles, line-cap and max-lines ratchets);pnpm check:madge-import-cyclesreports 0 cycles.No overlap with Pash/Sarah changes.
Merge danger
Two-way door: a revert fully undoes it. No state, config or public contract change. Blast radius: model catalog preparation and
models.listfor every install.