Repository navigation
feat(cron): back automation off when a provider pushes back - #197395
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 pauses extra automation runs for overloaded providers and gradually restores capacity while preserving eight default slots. Example: Provider A returns HTTP 429 with 16 automation requests active.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds useful provider backoff, resolves the earlier findings, and introduces no new actionable defect. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe cron scheduler sends occurrences through its durable worker queue into isolated or shared-session execution; provider lifecycle failures now feed back into admission of extra runs. flowchart TD
A[Scheduled and event occurrences] --> B[Worker run queue]
B --> C[Provider slot admission]
C --> D[Agent execution]
D --> E[Provider lifecycle events]
E --> F[Provider backoff allowances]
F --> B
Technical reviewBest possible solution: Retain provider feedback in the existing queue and execution owners, preserving receipt identity, default capacity, and fresh requester admission after waits. Do we have a high-confidence way to reproduce the issue? This feature has supplied Gateway traces exercising actual HTTP 429 responses, provider-specific waiting, recovery, and shared-session resumption; this review ran no target code. Is this the best way to solve the issue? The change reuses durable queue admission and session settlement, with distinct regressions for receipt promotion, fallback accounting, event custody, cancellation, and requester removal. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7a570c41bc27. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +493, Tests +533, Docs +1, Other +2. Total +1029 across 34 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (25 earlier review cycles; latest 8 shown)
Reviewed November 22, 2026, 4:42 AM ET / 09:42 UTC (Revision 26). |
e16854d to
b2d8647
Compare
b2d8647 to
ff4a3eb
Compare
|
The parent-replacement result from Proof used a synthetic model and focused integration harness. Authority testing at |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
openclaw#197394 landed as a fixed eight run slots plus one extra run per drain while 1 GiB is free, up to 16. Take main's sizing everywhere and drop this branch's earlier agent-limit and memory sizing (run-slots.ts, host and exec memory readers, free-memory test helpers, the per-minute recheck for queued runs). Keep only the provider backoff, now in provider-backoff.ts: a rate limit or overload while automation and hook turns hold more than eight sessions stops runs past the eight default slots, and each minute without pushback allows one more again. The host passes that ceiling to the run-queue worker, which applies it to the extra runs only.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Verification at
|
| UTC | Observed event |
|---|---|
| 23:42:26.818 | The 2026.11.6 Gateway saved a job and one successful run. |
| 23:44:32.040 | The candidate loaded the authored settings, the same definition, and the prior history entry. |
| 23:44:35.147 | The same saved job completed again. Both history entries were successful. |
| 23:45:43.974 | The fixture held 16 overlapping A requests, eight default and eight extra. |
| 23:45:44.101 | The Gateway classified A’s HTTP 429 and logged provider backoff. |
| 23:45:47.583 | The original eight default jobs finished. All eight former extra requests were still held. |
| 23:45:50.577 | Cron activated the new A occurrence but sent no provider request. |
| 23:45:53.332 | The fixture received B as the ninth request. The parked A request was still absent. |
| 23:45:56.462 | B finished successfully and returned its extra slot. The eight former extras were still held. |
| 23:46:47.651 | The same parked A occurrence became the ninth request 63.7s after the 429, with all eight former extras still held. |
| 23:46:49.343 | A and B each had one successful run. The parked A job made one HTTP request. |
Regression and CI attribution. On 43c10db, the worker-level regression failed at the first quiet minute because the parked A job could not start. It passes with receipt promotion. The messaging typecheck also reproduced CI’s missing deliveryAttemptFence field and passes with the fixture fixed. The contemporaneous main run skipped both check lanes. The other PR failure was the excluded UI route-asset assertion, with 57 requests against a budget of 56. PR CI · Main CI
Coverage. 236 focused tests passed, with the recovery, shared-session resume, and shared-session cancellation cases repeated on the final source. The core, cron, and messaging typechecks, targeted lint, formatting, and ratchets passed. The extra test lines cover the 16-run burst and the completion order that exposes stale charges.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Live shared-session readmission on The running Gateway reported build ID The foreground turn finished before any provider request for the parked automation. Once a default slot opened, a non-pausing tracepoint in the compiled Gateway recorded fresh requester authority before the automation’s first provider request. The SQLite observations used read-only queries. The receipt is fingerprinted because its original encoding contains a local path. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Pre-existing failure attribution (verified before merge) The only failing check on The same failures occur on main: commit |
Related: #196859
What Problem This Solves
Main adds an automation run on each queue drain when free memory allows. A provider can keep rate-limiting requests even while retries let individual jobs finish successfully.
User Impact
A rate limit or overload pauses extra work for the provider that reported it when more than eight automation and hook agent sessions share the budget. The provider response describes its own capacity, so other providers and command or script jobs can still use extra slots.
The eight default slots stay available. Running jobs fill those slots as they free up. One extra slot returns per quiet minute at the next drain. A parked occurrence keeps its receipt, completed condition check, and transferred event. Running jobs can finish, and an extra run that falls back counts against the provider it switches to.
Why This Change Was Made
The queue hands out slots in order and reassigns freed default capacity before applying provider allowances. Each charge follows its receipt while that receipt uses extra capacity. A provider waiting on an extra slot releases the provisional slot so other work can proceed. The Gateway logs each reduction and keeps the backoff in memory.
Compare main with this head
Evidence