fix(cron): per-attempt AbortControllers and deferred execution timeout#392
Open
BingqingLyu wants to merge 1 commit intomainfrom
Open
fix(cron): per-attempt AbortControllers and deferred execution timeout#392BingqingLyu wants to merge 1 commit intomainfrom
BingqingLyu wants to merge 1 commit intomainfrom
Conversation
Fix two root causes of cron agentTurn jobs hanging until timeout: 1. Shared AbortController kills fallback chain (openclaw#37505): When the cron timeout fires, it aborts a shared signal that propagates to all subsequent model fallback attempts, killing them instantly (~100ms). Now each fallback attempt in runCronIsolatedAgentTurn gets its own AbortController linked to the parent signal, so new attempts start with a fresh (non-aborted) controller. 2. Queue wait consumes execution timeout (openclaw#41783): The timeout timer started immediately in executeJobCoreWithTimeout, but the job may wait in the lane queue (inside runEmbeddedPiAgent) before doing real work. Now executeJobCore accepts an onExecutionStart callback and calls it right before runIsolatedAgentJob, deferring the timeout clock until actual execution begins. A 2x safety backstop prevents indefinite hangs if the callback is never called. Closes openclaw#37505 Closes openclaw#41783 Refs openclaw#42464 openclaw#40237
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix two root causes of isolated cron
agentTurnjobs hanging until timeout (openclaw#42464):Per-attempt AbortControllers (Cron job timeout aborts entire model fallback chain via shared AbortController openclaw/openclaw#37505): The cron timeout fires a shared
AbortControllersignal that propagates to all subsequent model fallback attempts, killing them instantly (~100ms) without making a network request. Each fallback attempt inrunCronIsolatedAgentTurnnow gets its ownAbortControllerlinked to the parent signal, so when one attempt is aborted the next attempt starts with a fresh (non-aborted) controller.Deferred execution timeout (bug(cron): job timeout includes cron-lane queue wait time openclaw/openclaw#41783): The timeout timer in
executeJobCoreWithTimeoutstarted immediately viaPromise.race, but the job may wait in the lane queue (insiderunEmbeddedPiAgent) before doing real work.executeJobCorenow accepts anonExecutionStartcallback and calls it right beforerunIsolatedAgentJob, deferring the timeout clock until actual execution begins. A 2× safety backstop prevents indefinite hangs if the callback is never called.Files changed
src/cron/isolated-agent/run.ts— per-attemptAbortControllerin therunWithModelFallbackrun callbacksrc/cron/service/timer.ts— deferred timeout arming viaonExecutionStartcallbacksrc/cron/service.cron-timeout-abort.test.ts— 5 new tests covering both fixesTest plan
executeJobCorecallsonExecutionStartbefore running isolated jobsexecuteJobCorecallsonExecutionStartfor main session jobsexecuteJobCoreWithTimeoutstill times out correctly with deferred startCloses openclaw#37505
Closes openclaw#41783
Fixes openclaw#42632
Refs openclaw#42464 openclaw#40237
Related
sessionTarget="isolated"+agentTurncan time out on a minimal prompt openclaw/openclaw#42632 (6 confirmations from affected users)