Repository navigation
fix: preserve catalog metadata and provider failure outcomes - #137063
Conversation
The catalog worker reconstructed an authoritative plugin registry with only augmentation and harness owners, so runtime catalog discovery lost provider names and reasoning metadata. Plan discovery through the canonical provider scope and materialize its owners after auth refresh using captured metadata. Keep the startup generation immutable and preserve lightweight and empty discovery scopes. Shared planning absorbs the owner selection instead of adding a registry fallback. Proof: both original ClawRouter cases fail on release 730dc39 and main eea96a3. All three repaired cases, including late durable auth, and 116 owner/sibling tests pass. Combined catalog, retry, abort and Telegram release proof passes 13 tests.
The fixtures still expected the retired 10s/20s backoff and advanced past a model after one HTTP 500, although the retry owner allows three transient retries with jittered 1s/2s/4s delays. Fix the random source and script persistent errors that exhaust that existing budget. Preserve exact delay, profile order, fallback winner and exhaustion prose assertions. No runtime retry policy changes. Proof: the same three tests fail on release 730dc39 and main eea96a3; all eight repaired fault-sequence tests pass, including the combined patched-release run.
The cold Gateway fixture expected a failed/blocked result after Stop, contradicting the existing authoritative cancellation repair. Assert the exact timeout/rpc/aborted wire payload and the canonical cancelled task. Keep provider connection closure and exactly one request checks. Owner: Gateway agent execution and task lifecycle. No product changes. Proof: the identical assertion fails on release 730dc39 and main eea96a3. The strengthened built-Gateway test passes on both patched main and release, including its first chat RPC and provider cancellation.
Failure handling read error text from successful current-attempt assistants, allowing stale text to replace an actual timeout or trigger a thinking retry after a successful reply. Normalize the failed assistant once at the failure owner for classification, retry decisions, profile health and failure copy. Keep structured terminal replay-safety checks and provider-start evidence independent of that text selection. Proof: full-entry regressions reproduce misleading HTTP 500 timeout copy and an unnecessary second attempt before the fix. Six context tests and 21 assistant-failure owner tests pass after the repair.
The failover owner reconstructed HTTP status from its routing reason, turning an observed 500 into 408 and mislabeling the final reply as a timeout. Preserve the canonical assistant failure signal status before using a synthesized status for failures without one. Apply the same rule to profile-rotation exhaustion, model fallback and surfaced failures. The Telegram proof expects the existing safe detailed copy and rejects raw provider details. Document status versus retry reason. Proof: six status cases fail before the fix; 82 owner tests pass after. Both baseline Gateway runs reproduce 17 requests and the wrong 408 reply. The patched release Telegram flow passes with exact 500 copy and the raw-error privacy canary excluded.
The stream contract returns failed assistant messages without throwing. The diagnostic observer treated normal iterator/result completion as success, hiding timeout evidence from operators and recovery proofs. Record terminal failure at the observation owner and use one terminal emitter for events, request timelines and sanitized hooks. Preserve usage, byte accounting, iterator cleanup and duplicate-event protection. Production code shrinks by 14 lines. Proof: 12 observation cases and two hook/timeline cases fail before the repair; 52 owner tests pass afterward. The built-Gateway scenario now observes its real provider timeout, exposing a separate repeated-stall fixture defect without changing production retry policy.
The recovery mock stalled every request from the fifth onward for 180s. After the fifth request timed out, the legitimate transient retry stalled again, preventing the queued followup from settling inside the existing scenario bound. This fixture predated the current shared retry controller. Keep the first four 80s failures and fifth 180s stall, then return the same persistent failure immediately so the ordinary retry budget can settle. The mock provider owns this schedule; production retry policy is unchanged. Proof: both release and main time out at 510s before the repair. The unchanged Gateway scenario passes after both the diagnostic and fixture repairs, exercising a real 90s timeout, one cumulative stall, no forced recovery, and exactly one successful queued provider request.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 2:07 AM ET / 06:07 UTC. ClawSweeper reviewWhat this changesThe PR preserves provider metadata after credential refresh, retains actual provider failure status through failover, records terminal stream failures as errors, and aligns related Gateway test fixtures. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. This active maintainer PR repairs source-proven pre-existing agent/provider failures; no blocking correctness or security defect was found in the introduced patch. Priority: P1 Review scores
Verification
How this fits togetherThe embedded agent runner obtains models through plugin provider discovery and turns provider streams into user-visible replies and diagnostic events. The prepared catalog worker supplies Gateway model listings after configuration and credential resolution. flowchart LR
A[Config and credentials] --> B[Provider discovery]
B --> C[Prepared catalog worker]
C --> D[Gateway model listings]
E[Provider stream] --> F[Embedded agent runner]
F --> G[Failover and diagnostics]
G --> H[User reply and operator events]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +60, Tests +210, Docs +2. Total +272 across 19 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the owner-boundary repair once normal exact-head CI passes, retaining the scoped discovery plan and the cold, sibling, and refreshed-auth regressions; no new configuration, API, or fallback path is needed. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the relevant pre-patch paths: failover synthesized status from its routing reason, successful assistants could supply failure fields, and terminal stream errors were treated as completion. This read-only environment did not execute the supplied regressions; Is this the best way to solve the issue? Yes. The patch repairs each defect at its owning catalog, failure, or diagnostic lifecycle boundary and reuses the existing metadata scope and stream contract rather than adding a downstream fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d1774564e686. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Collapses the model-list cleanup (#135912) and the provider-login branch into one change rebased onto main. - models.list reads one closed catalog source (gateway, prepared, published); the CLI `models list` and chat `/models` consume the prepared catalog directly. - Prepared model runtime: owners publish one curated build, live discovery runs only in the catalog worker, and secret-free provider-auth facts captured at build time replace native readiness reobservation and auth-mode flags. - Provider login: one login runtime shared by the CLI, chat `/login`, Telegram, and the Control UI; `openclaw.setup.auth.start` owns interactive sign-in. - First-run setup inference saves the credential, confirms the in-memory candidate with one tool-free turn, and commits config only on success. - xai catalog derives from the manifest; Codex native auth probes the CLI; doctor repairs legacy model refs and session routes. Integration with main: keeps the worker discovery plan (#137063), worker plugin scoping (#135486), auth order and profile identity (#132450, #137022), the plugin-owned Codex/Claude login readers, and the built-artifact preference for setup revalidation (#136036). Drops main's readiness reobservation (#134524) and stale-refresh catalog mode (#136915): the prepared build already carries the provider-auth facts those paths re-derived. Claude-Session: https://claude.ai/code/session_01CnvVXNnjjQGMrBLYjq29RP
…w#137063) * fix(models): preserve discovered catalog metadata in prepared workers The catalog worker reconstructed an authoritative plugin registry with only augmentation and harness owners, so runtime catalog discovery lost provider names and reasoning metadata. Plan discovery through the canonical provider scope and materialize its owners after auth refresh using captured metadata. Keep the startup generation immutable and preserve lightweight and empty discovery scopes. Shared planning absorbs the owner selection instead of adding a registry fallback. Proof: both original ClawRouter cases fail on release 730dc39 and main 801884b. All three repaired cases, including late durable auth, and 116 owner/sibling tests pass. Combined catalog, retry, abort and Telegram release proof passes 13 tests. * test(agents): align fault sequences with the shared retry budget The fixtures still expected the retired 10s/20s backoff and advanced past a model after one HTTP 500, although the retry owner allows three transient retries with jittered 1s/2s/4s delays. Fix the random source and script persistent errors that exhaust that existing budget. Preserve exact delay, profile order, fallback winner and exhaustion prose assertions. No runtime retry policy changes. Proof: the same three tests fail on release 730dc39 and main 801884b; all eight repaired fault-sequence tests pass, including the combined patched-release run. * test(gateway): assert authoritative cancellation in cold abort proof The cold Gateway fixture expected a failed/blocked result after Stop, contradicting the existing authoritative cancellation repair. Assert the exact timeout/rpc/aborted wire payload and the canonical cancelled task. Keep provider connection closure and exactly one request checks. Owner: Gateway agent execution and task lifecycle. No product changes. Proof: the identical assertion fails on release 730dc39 and main 801884b. The strengthened built-Gateway test passes on both patched main and release, including its first chat RPC and provider cancellation. * fix(agents): ignore stale error fields on successful assistant replies Failure handling read error text from successful current-attempt assistants, allowing stale text to replace an actual timeout or trigger a thinking retry after a successful reply. Normalize the failed assistant once at the failure owner for classification, retry decisions, profile health and failure copy. Keep structured terminal replay-safety checks and provider-start evidence independent of that text selection. Proof: full-entry regressions reproduce misleading HTTP 500 timeout copy and an unnecessary second attempt before the fix. Six context tests and 21 assistant-failure owner tests pass after the repair. * fix(agents): retain provider HTTP status through failover The failover owner reconstructed HTTP status from its routing reason, turning an observed 500 into 408 and mislabeling the final reply as a timeout. Preserve the canonical assistant failure signal status before using a synthesized status for failures without one. Apply the same rule to profile-rotation exhaustion, model fallback and surfaced failures. The Telegram proof expects the existing safe detailed copy and rejects raw provider details. Document status versus retry reason. Proof: six status cases fail before the fix; 82 owner tests pass after. Both baseline Gateway runs reproduce 17 requests and the wrong 408 reply. The patched release Telegram flow passes with exact 500 copy and the raw-error privacy canary excluded. * fix(diagnostics): record provider stream failures as model call errors The stream contract returns failed assistant messages without throwing. The diagnostic observer treated normal iterator/result completion as success, hiding timeout evidence from operators and recovery proofs. Record terminal failure at the observation owner and use one terminal emitter for events, request timelines and sanitized hooks. Preserve usage, byte accounting, iterator cleanup and duplicate-event protection. Production code shrinks by 14 lines. Proof: 12 observation cases and two hook/timeline cases fail before the repair; 52 owner tests pass afterward. The built-Gateway scenario now observes its real provider timeout, exposing a separate repeated-stall fixture defect without changing production retry policy. * test(qa-lab): let recovery retries settle after the timeout probe The recovery mock stalled every request from the fifth onward for 180s. After the fifth request timed out, the legitimate transient retry stalled again, preventing the queued followup from settling inside the existing scenario bound. This fixture predated the current shared retry controller. Keep the first four 80s failures and fifth 180s stall, then return the same persistent failure immediately so the ordinary retry budget can settle. The mock provider owns this schedule; production retry policy is unchanged. Proof: both release and main time out at 510s before the repair. The unchanged Gateway scenario passes after both the diagnostic and fixture repairs, exercising a real 90s timeout, one cumulative stall, no forced recovery, and exactly one successful queued provider request.
What Problem This Solves
Fixes an issue where cold model inventories lose provider display names and reasoning metadata, provider HTTP 500 failures are presented as HTTP 408 timeouts, and diagnostic streams report failed model calls as completed. These defects and stale retry/cancellation fixtures broke Gateway E2E in 2026.9.1 Full Release Validation #4, child run 33715186698.
All five reported failures reproduce on both release Code SHA
730dc392a5bc198774971f2ec61ee28ba46aba36and maineea96a33d8912a737e24920baddb56a02e6a467e. They are pre-existing main failures, not missing companions to the run #3→#4 cherry-picks. The PR is based on401ad5b14b485813b53c590801cf6394191168e2; its affected source is identical to the tested main baseline.Why This Change Was Made
The catalog worker now shares canonical discovery planning and materializes the required catalog owners after auth refresh, using the captured metadata and a separate catalog generation. Failure handling keeps the provider's actual HTTP status and selects error fields only from failed assistants. Model diagnostics record terminal stream failures through one deduplicated emitter for events, timelines, and sanitized hooks.
The fixtures now exercise the existing contracts: persistent faults exhaust the shared retry budget; Stop produces its established cancellation wire response and a cancelled task; the recovery mock stalls exactly the fifth request, then lets subsequent failures settle through the normal retry budget. The recovery test and its timing/assertions remain unchanged.
User Impact
Cold catalog listings retain their names and reasoning capabilities, including providers discovered through newly persisted credentials. Operators receive accurate failure copy and timeout diagnostics. Stale error text on a successful reply cannot trigger an unnecessary thinking retry or replace a later timeout. Telegram failure settlement continues to produce one visible error reply with notifications disabled without leaking raw provider details.
Production code is +58 lines net: +58 for the catalog ownership phase and shared planning, +14 for error provenance, and −14 from consolidating diagnostic termination. Tests/support are +212 net; docs are +2. There are no runtime retry, timeout, configuration, protocol, or storage changes.
Evidence
Two additional full-entry regressions demonstrate stale successful-assistant error text causing misleading timeout copy and an unnecessary second attempt. Both fail before; six context cases and 21 failure-owner tests pass after. For diagnostics, all 12 new consumption/error cases plus two hook/timeline cases fail before; 52 owner tests pass after. The diagnostic-only Gateway run reaches the timeout predicate and exposes the separate repeated-stall fixture defect.
The integrated main run passes all five E2E files (14 tests); patched release passes A–D together (13 tests) and E separately (1 test).
pnpm build, private QA runtime builds, andpnpm check:changed --base 401ad5b14b485813b53c590801cf6394191168e2pass. One test-matrix lint issue was corrected before the final clean check. The refreshed local Codex P2 review is clean.The requested
.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --max-priority P2review is scoped-clean with no findings. All seven exact commits cherry-pick cleanly onto release Code SHA730dc392a5bc198774971f2ec61ee28ba46aba36; the verification checkout is clean.Backport order: A, B, C, D stale error fields, D HTTP status, E diagnostics, E fixture. All are new PR commits; there are no existing main-only prerequisite picks.
Contract audit: terminal errors are returned stream data in
packages/llm-core/src/types.ts:198–206andpackages/ai/src/transports/transport-stream-shared.ts:445–456. Direct upstream Codex inspection covered model metadata and interrupted turns; the repaired owners remain in OpenClaw.History: A's worker narrowing (
cf59ce401fee), B's retry contract (4a1cc226964a), C's Stop repair (03e4bc05af66), D's safe failure-copy contract (ee8657a02329), and E's observer/fixture history (0e7250f37bf3,c8c6e5a990b2) all predate run #3's37a5c5bd3d88. No existing main-only fix replaces these repairs. Why run #3 did not expose the failures remains unproven; its logs were not refetched. The full Linux release workflow was not rerun; the before/after Gateway proofs here run locally on macOS with Node 26.8.1.