Repository navigation
fix: default cron retries leave time for model fallback - #186368
Conversation
…e timeout The LLM idle and first-event watchdogs classify a provider as local from its baseUrl hostname. A loopback, private or .local relay that forwards to a hosted API is therefore treated as local inference: a stalled stream gets no idle ceiling, and bounded cron runs lose the 60 s stall timeout that lets model fallback run inside the job budget. Add an optional models.providers.<id>.remote boolean. When true, the watchdog locality check returns hosted for that provider before the hostname, provider-id, localService and auth-marker checks. Explicit request timeouts and run budgets keep their precedence. Nothing changes when the key is absent or false. Related: #183287 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge current main into the contributor branch, preserve the watchdog-only remote override, and prove stalled HTTP streams and explicit timeout precedence. Reuse the provider config lookup for locality signals and regenerate configuration documentation.
Bound default replay-safe provider retry admission by elapsed run time when a fallback remains. Preserve explicit retry counts and request timeouts, native harnesses, and no-fallback behavior. Follow up on the relay watchdog investigation in #183637 by @tommyjoseph. Regression fails on the original controller; isolated cron proof uses a stalled managed relay and an Ollama fallback.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR limits default same-model retry admission in bounded runs so an eligible configured fallback can run before the deadline. Example: A 180-second cron job encounters repeated 60-second primary-model stream stalls and has a qwen3:8b fallback.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current retry-budget failure with a focused, maintainer-approved change. No actionable correctness or security defects were found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe embedded runner turns provider failures into same-model retries or existing auth/model failover decisions, consuming run timing, saved retry settings, and replay-safety facts. flowchart TD
A[Cron run budget] --> B[Embedded attempt]
B --> C[Primary provider]
C --> D[Retry controller]
D -->|Retry admitted| B
D -->|Retry declined| E[Existing model fallback]
E --> F[Run result]
Technical reviewBest possible solution: Keep retry admission in the existing controller, preserve explicit overrides, and land this focused repair once the existing CI gate passes. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the timing failure, and the supplied Gateway baseline reports three primary stalls exhausting a 180-second cron job; no target code was executed during this review. Is this the best way to solve the issue? The patch is the smallest complete repair using existing owners: compare retry admission against elapsed candidate time and carry explicit-timeout provenance from the attempt owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ca305f7d9425. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +22, Tests -9, Docs +2, Other 0. Total +15 across 11 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
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 HistoryReviewed October 27, 2026, 8:29 PM ET / October 28, 2026, 00:29 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…e timeout (#183637) Related: #183287 ## What Problem This Solves Fixes: hosted models reached through local relays inherit local-inference watchdog tolerance, so stalled streams miss the normal hosted idle deadline. ## User Impact Set `models.providers.<id>.remote: true` to select hosted watchdog timing through a local relay: 120-second idle/first-event defaults and a 60-second idle deadline for bounded cron runs. Absent or `false` preserves existing classification. Explicit provider timeouts and run/agent budgets keep their precedence. ## Why This Change Was Made The approved setting affects watchdog timing only, including relays launched through `localService` and providers with local IDs/auth markers. One locality owner reads provider configuration for both watchdog phases; its single-use local-signal wrapper is removed. The strict schema, derived type, help/label metadata, documentation, and regenerated config baseline describe the same contract. Routing, authentication, process management, retries, and global defaults retain their existing behavior. Original implementation by @tommyjoseph. Contributor history is preserved; main `eec15d7c6db55c618405c6d42205f4d6dfa57352` was merged to resolve generated-baseline conflicts. The native generator regenerated both files. The production patch remains identical to the previous reviewed head. A final policy-fixture cleanup removes a redundant wrapper and nesting while preserving all cases and assertions; main owns all other content, including the inherited-red fixes. ## Evidence The regression was previously verified red on main (missing hosted/cron timeout) and green with the fix. The merged tree passed all **101 tests across the four watchdog suites and four config/schema suites in 281.94s**, including the real HTTP stalled-relay regression. After the final policy-fixture cleanup, all **21 policy cases** passed again in **6.13s**. Scoped lint (34.38s), core/agent-test types (6.27s / 38.88s), and formatting passed. Scoped max-lines, line-cap, assertion-safety, test-timeout-race, test-mock-exports, test-lines, config docs/schema, and plugin inventory checks pass. Main is over its test-line ceiling; this PR now reduces test lines and passes the existing ratchet rule. Production: **+13/−15 lines (net −2)**; tests: **+161/−162 (net −1)**. Repeated fixture setup was consolidated while retaining cancellation, error mapping, progress, and local tolerance contracts. No baselines were relaxed, and prompt/tool text is unchanged. ### Native Gateway proof, reused on identical watchdog source The watchdog/locality implementation is byte-identical to the previously tested head. Its production patch against the merged main base is also identical. Native `pnpm openclaw --profile relay-watchdog agent` and `automations run --wait` exercised an isolated macOS Gateway, an owned localhost relay started by `localService`, and a synthetic hosted-shaped endpoint. The local control used real Ollama **qwen3:8b** through native `/api/chat`. | Scenario | Observed result | | --- | --- | | Main baseline: hosted relay, 180s cron budget, 70s pause | `PRIMARY_RESUMED` after 70.534s; no model fallback. | | Main baseline: native Ollama, no `remote`, 65s pause | `LOCAL_OK` in 67.012s; no fallback. | | Fixed: `remote: true`, cron, continuation retries configured to zero | Stream closed at 60.006s; configured backup returned `FALLBACK_OK` in 61.124s. | | Fixed: ordinary hosted run, continuation retries zero | Visible model idle timeout at 120.291s, expected exit 1. | | Fixed: native Ollama without `remote`, 65.002s pause | `LOCAL_OK` in 69.306s; no fallback. | | Fixed: explicit 3s provider timeouts, hosted relay and local Ollama | Both retain 3s request deadlines; retry recovery then reaches `FALLBACK_OK` in 68.580s / 88.733s. | **Retry limitation:** selecting hosted watchdog deadlines does not bypass same-model retry policy. With default retries, the 180s cron control reached its outer deadline at 180.529s after repeated 60s stalls. Direct-fallback proof used the existing workspace `settings.json` setting `retry.provider.maxRetries: 0`; this PR does not change retry policy. Platform coverage is macOS arm64 only. Configuration validation and persisted baseline sessions passed main-to-branch compatibility checks; no latest-stable binary upgrade was run. Cron preflight requires an already-running relay, so a normal agent turn starts `localService` before the cron proof. Independent Codex autoreview on `83331544885b939068a9054be57515cdd969a330`: **scoped-clean through P2**, no actionable findings. ClawSweeper reviewed this exact head with **no correctness or security findings**. Its remaining hold is the documented latest-stable upgrade-proof gap. [CI run40601889353, attempt1](https://github.com/openclaw/openclaw/actions/runs/40601889353) completed successfully on this head: **38 jobs passed,29 skipped,0 failed**. The build, selected tests, lint, types, baseline ratchets, security/dependency checks, and `openclaw/ci-gate` are green. No CI rerun or cancellation was used for this refresh. ## Maintainer landing decision The exact-head CI run 40601889353 (attempt 1) passed, including openclaw/ci-gate and the security checks. ClawSweeper completed its review of this head with no code or security findings. The maintainer accepts its proof-only latest-stable upgrade/data-compatibility hold: this is an additive optional configuration field, absent/false preserves existing behavior, no persisted data or index changes, and configuration validation plus main-to-branch session compatibility were demonstrated. The native Gateway/localService relay proof and real-HTTP regression are documented above; a latest-stable binary upgrade was not run. Known limitation: remote selects watchdog timing, not immediate fallback. Default same-model retries can still consume a cron budget; that independent follow-up is tracked by #186368. This lands the provider-level hosted-watchdog override requested in #183287. Co-authored-by: Tommy Joseph <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
|
@clawsweeper re-review Head 96279d9 merges main after #183637 landed and the unrelated skills-policy main red was fixed by 8828adc. The net diff is now only the retry-budget repair. All 201 focused tests, scoped type/lint/format checks, and eight ratchets pass; fresh Codex review is clean through P2. Repeated real Gateway cron proof completed via qwen3:8b in 128.186s after two 60s primary stalls. The latest-stable upgrade scenario remains an accepted proof limitation: no config/schema/persisted-state change is part of this PR. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
The full-budget fixture predates the default fallback reservation in #186368. Supply its expected eight retries explicitly while preserving the nine-dispatch and FailoverError assertions. Production retry policy is unchanged.
openclaw#186306 stopped prompt preparation from discarding the skills catalog for every finite tool cap; the renderer (buildSkillsSection) now gates on the actually admitted reader. The Code Mode skill-policy table still expected the old discard for `toolsAllow: ["message"]`, so main fails attempt.skills-policy.test.ts:298 (seen on PR openclaw#186368's CI). The renderer still omits the catalog there because no skills reader is admitted, and the row keeps asserting that the skills.list() guidance is absent. Proof: attempt.skills-policy 5/5 and system-prompt 60/60 green.
…e timeout (openclaw#183637) Related: openclaw#183287 ## What Problem This Solves Fixes: hosted models reached through local relays inherit local-inference watchdog tolerance, so stalled streams miss the normal hosted idle deadline. ## User Impact Set `models.providers.<id>.remote: true` to select hosted watchdog timing through a local relay: 120-second idle/first-event defaults and a 60-second idle deadline for bounded cron runs. Absent or `false` preserves existing classification. Explicit provider timeouts and run/agent budgets keep their precedence. ## Why This Change Was Made The approved setting affects watchdog timing only, including relays launched through `localService` and providers with local IDs/auth markers. One locality owner reads provider configuration for both watchdog phases; its single-use local-signal wrapper is removed. The strict schema, derived type, help/label metadata, documentation, and regenerated config baseline describe the same contract. Routing, authentication, process management, retries, and global defaults retain their existing behavior. Original implementation by @tommyjoseph. Contributor history is preserved; main `117707193a9944a0c69c4c67b53c61d443be83e4` was merged to resolve generated-baseline conflicts. The native generator regenerated both files. The production patch remains identical to the previous reviewed head. A final policy-fixture cleanup removes a redundant wrapper and nesting while preserving all cases and assertions; main owns all other content, including the inherited-red fixes. ## Evidence The regression was previously verified red on main (missing hosted/cron timeout) and green with the fix. The merged tree passed all **101 tests across the four watchdog suites and four config/schema suites in 281.94s**, including the real HTTP stalled-relay regression. After the final policy-fixture cleanup, all **21 policy cases** passed again in **6.13s**. Scoped lint (34.38s), core/agent-test types (6.27s / 38.88s), and formatting passed. Scoped max-lines, line-cap, assertion-safety, test-timeout-race, test-mock-exports, test-lines, config docs/schema, and plugin inventory checks pass. Main is over its test-line ceiling; this PR now reduces test lines and passes the existing ratchet rule. Production: **+13/−15 lines (net −2)**; tests: **+161/−162 (net −1)**. Repeated fixture setup was consolidated while retaining cancellation, error mapping, progress, and local tolerance contracts. No baselines were relaxed, and prompt/tool text is unchanged. ### Native Gateway proof, reused on identical watchdog source The watchdog/locality implementation is byte-identical to the previously tested head. Its production patch against the merged main base is also identical. Native `pnpm openclaw --profile relay-watchdog agent` and `automations run --wait` exercised an isolated macOS Gateway, an owned localhost relay started by `localService`, and a synthetic hosted-shaped endpoint. The local control used real Ollama **qwen3:8b** through native `/api/chat`. | Scenario | Observed result | | --- | --- | | Main baseline: hosted relay, 180s cron budget, 70s pause | `PRIMARY_RESUMED` after 70.534s; no model fallback. | | Main baseline: native Ollama, no `remote`, 65s pause | `LOCAL_OK` in 67.012s; no fallback. | | Fixed: `remote: true`, cron, continuation retries configured to zero | Stream closed at 60.006s; configured backup returned `FALLBACK_OK` in 61.124s. | | Fixed: ordinary hosted run, continuation retries zero | Visible model idle timeout at 120.291s, expected exit 1. | | Fixed: native Ollama without `remote`, 65.002s pause | `LOCAL_OK` in 69.306s; no fallback. | | Fixed: explicit 3s provider timeouts, hosted relay and local Ollama | Both retain 3s request deadlines; retry recovery then reaches `FALLBACK_OK` in 68.580s / 88.733s. | **Retry limitation:** selecting hosted watchdog deadlines does not bypass same-model retry policy. With default retries, the 180s cron control reached its outer deadline at 180.529s after repeated 60s stalls. Direct-fallback proof used the existing workspace `settings.json` setting `retry.provider.maxRetries: 0`; this PR does not change retry policy. Platform coverage is macOS arm64 only. Configuration validation and persisted baseline sessions passed main-to-branch compatibility checks; no latest-stable binary upgrade was run. Cron preflight requires an already-running relay, so a normal agent turn starts `localService` before the cron proof. Independent Codex autoreview on `83331544885b939068a9054be57515cdd969a330`: **scoped-clean through P2**, no actionable findings. ClawSweeper reviewed this exact head with **no correctness or security findings**. Its remaining hold is the documented latest-stable upgrade-proof gap. [CI run40601889353, attempt1](https://github.com/openclaw/openclaw/actions/runs/40601889353) completed successfully on this head: **38 jobs passed,29 skipped,0 failed**. The build, selected tests, lint, types, baseline ratchets, security/dependency checks, and `openclaw/ci-gate` are green. No CI rerun or cancellation was used for this refresh. ## Maintainer landing decision The exact-head CI run 40601889353 (attempt 1) passed, including openclaw/ci-gate and the security checks. ClawSweeper completed its review of this head with no code or security findings. The maintainer accepts its proof-only latest-stable upgrade/data-compatibility hold: this is an additive optional configuration field, absent/false preserves existing behavior, no persisted data or index changes, and configuration validation plus main-to-branch session compatibility were demonstrated. The native Gateway/localService relay proof and real-HTTP regression are documented above; a latest-stable binary upgrade was not run. Known limitation: remote selects watchdog timing, not immediate fallback. Default same-model retries can still consume a cron budget; that independent follow-up is tracked by openclaw#186368. This lands the provider-level hosted-watchdog override requested in openclaw#183287. Co-authored-by: Tommy Joseph <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
) * feat(models): let a provider behind a local relay keep the hosted idle timeout The LLM idle and first-event watchdogs classify a provider as local from its baseUrl hostname. A loopback, private or .local relay that forwards to a hosted API is therefore treated as local inference: a stalled stream gets no idle ceiling, and bounded cron runs lose the 60 s stall timeout that lets model fallback run inside the job budget. Add an optional models.providers.<id>.remote boolean. When true, the watchdog locality check returns hosted for that provider before the hostname, provider-id, localService and auth-marker checks. Explicit request timeouts and run budgets keep their precedence. Nothing changes when the key is absent or false. Related: openclaw#183287 * test(agents): consolidate relay watchdog regression coverage * fix(agents): leave cron retry budget for model fallback Bound default replay-safe provider retry admission by elapsed run time when a fallback remains. Preserve explicit retry counts and request timeouts, native harnesses, and no-fallback behavior. Follow up on the relay watchdog investigation in openclaw#183637 by @tommyjoseph. Regression fails on the original controller; isolated cron proof uses a stalled managed relay and an Ollama fallback. * test(agents): consolidate retry policy coverage * test(agents): supply retry start time in provider recovery fixture --------- Co-authored-by: Tommy Joseph <[email protected]>
The full-budget fixture predates the default fallback reservation in openclaw#186368. Supply its expected eight retries explicitly while preserving the nine-dispatch and FailoverError assertions. Production retry policy is unchanged.
What Problem This Solves
Default same-model retries can consume an entire cron execution budget before a configured fallback gets a turn. A stalled hosted provider behind a local relay can repeatedly hit its 60-second stream watchdog and exhaust a 180-second job.
Related: #183287. Follow-up to the landed watchdog fix #183637; thanks to @tommyjoseph for investigating the relay and exposing this retry-budget interaction.
User Impact
Bounded runs with an eligible, replay-safe fallback stop admitting default embedded-provider retries once half of the candidate's nominal run budget has elapsed. Explicit retry counts and provider/session request timeouts, native harnesses, final/no-fallback candidates, unlimited runs, and output-limit continuations retain their existing behavior.
An admitted request keeps its timeout. This gives the first fallback an opportunity; it does not guarantee a minimum runtime or divide time across every candidate in a longer fallback chain.
Why This Change Was Made
The existing retry window starts at the first failure, excluding the initial stalled request. The retry controller now also checks elapsed run time before waiting for another same-model attempt. It consumes the attempt owner's explicit-timeout fact rather than re-reading configuration. Declaring the existing model request-timeout field also removes an unsafe assertion.
Main is merged through
14081a8c8b31b8aa9ef89eb2725710a7b25c4852. The watchdog change is already on main; this PR's net diff contains only the retry-budget repair, its callers/tests, and documentation. The earlier skills-policy CI failure was main red introduced by #186306 and fixed by8828adca7e5877faac3bea151b98c438368a4e3d, which is included.Evidence
remote: true, default retries, real Ollamaqwen3:8bfallback: three primary requests, no fallback, timeout at 180.190s (CLI 182.761s).qwen3:8breturned FALLBACK_OK. Cron succeeded in 128.186s, leaving 51.814s in the budget (CLI 133.785s).Production +27/-5 (net +22); tests +83/-92 (net -9); retry docs +2 and a shrinking assertion baseline. Added production code supplies the bounded-admission condition and timeout provenance required to preserve overrides.
Accepted proof limitation: no latest-stable upgrade scenario. This PR changes no configuration schema or persisted state. No changelog or model-facing prompt changes.