Repository navigation
Conversation
Isolated cron setup counts the session-row write against the 60 s setup watchdog, so a slow storage commit can fail a run whose setup finishes moments later. Report the pre-run write as a session-preparation pause so the watchdog gives storage its own bounded budget. The pause is capped by the existing setup budget, and lane-wait attribution stays untouched, so a hung write still times out and cancellation remains authoritative. Related to openclaw#184429
|
🦞👀 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: blocked before merge. What this changesThis PR gives pre-run session persistence a bounded 60-second allowance and restarts the setup watchdog afterward. Example: An isolated automation takes 61.7 seconds overall, including a 57.3-second session write.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it addresses a current storage-accounting failure without an identified correctness defect, but the new timeout policy needs an owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe cron service supervises scheduled agent preparation, receives admission and persistence signals, and records execution or timeout outcomes. flowchart TD
A[Scheduled automation] --> B[Cron service runner]
B --> C[Session admission]
C --> D[Session persistence]
D --> E[Agent execution]
C --> F[Setup watchdog]
D --> F
E --> G[Recorded outcome]
F --> G
Technical reviewBest possible solution: Adopt an owner-approved bounded storage allowance in the existing watchdog, preserving admission exemptions and authoritative cancellation. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the accounting mechanism, and the linked release report supplies concrete storage timings; this read-only review ran no target code. Is this the best way to solve the issue? The focused repair uses the existing watchdog and wait callbacks, retains the earlier admission fix, and avoids post-abort revival; its separate storage budget is an owner policy choice. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c8ea362fdaf9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +81, Tests +76. Total +157 across 8 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label 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, 12:01 AM ET / 04:01 UTC (Revision 3). |
Keep the existing session-preparation admission exemption unbounded, and report the pre-run session write as its own session-persistence stage so only storage gets the bounded allowance. Add routing regressions for a busy admission beyond 60 s and for the bounded persistence path. Related to openclaw#184429
|
@clawsweeper re-review Addressed the P1 admission-wait regression: storage now uses a distinct Real-timer proof against the production watchdog/router: 21 relevant tests pass; the PR body was updated with the matrix and the remaining gap (no running-Gateway slow-disk reproduction). |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Added the running-Gateway behavior proof requested in the last review. Dev Gateway from this head, real isolated Observed:
The 57.3 s write is still in flight when the former 60 s setup deadline expires, so this is the reported case. The PR body was updated with the raw lines. The bounded-allowance maintainer decision is unchanged. Cancellation through a Gateway cancel RPC is not exposed; that path is unchanged and covered by |
|
🦞👀 Re-review progress:
|
|
Closing as stale: this branch is 4160 commits behind main and now conflicts in |
What Problem This Solves
An isolated cron run can be recorded as failed even though only the session-row write was slow. Setup waits for
persistSessionEntry(), but the 60 s setup watchdog keeps counting that storage time and aborts before the runner starts; the write then completes and setup finishes after the deadline, leaving a failed occurrence for work that never ran.This change reports the pre-run write as a new
session-persistencewait. The setup watchdog pauses while that write is in flight and restarts with a fresh setup budget when it completes. The pause is bounded by the existingCRON_AGENT_SETUP_WATCHDOG_MS; a write that stalls for the whole budget still times out, so a hung cron slot cannot stay paused indefinitely.Controller-admission waits are deliberately untouched. The existing
session-preparationsignal keeps its original behavior (pause the setup watchdog for the session turn, with lane-wait attribution), and a separate stage now distinguishes actual persistence from admission.Why This Change Was Made
withCronSessionPreparationalready emitsstage: "session-preparation"while waiting for the session turn, and that contract must keep pausing setup indefinitely while the session is busy. Reusing that stage for storage would cap admission waits at 60 s, so this revision adds a distinctsession-persistencestage:persistSessionEntry()withwaiting: true/falseandstage: "session-persistence".prepareSessionEventTargetForHost()the same way.applyCronWatchdogWaitSignal()routessession-persistencetonotePersistenceWait()/notePersistenceResumed()and leaves every other signal on the existing lane-admission path.Cancellation is unchanged: the abort signal still governs the run, and the fix never revives a run after a timeout.
Scope note: this addresses the reported storage-accounting path. It does not add a configurable timeout or a general post-deadline revival path; a write that exceeds the bounded budget still fails with the existing setup-timeout message.
User Impact
Scheduled automation no longer reports a false setup failure when a slow volume makes the session-row write outlast the deadline but preparation completes normally. Operators keep a bounded failure mode for genuinely hung storage. Controller admission, lane waits, cancellation, and command jobs keep their existing behavior.
Evidence
Running Gateway proof from this PR head: a dev Gateway with a real isolated
agentTurncron job, real session/agent SQLite, and a local OpenAI-compatible endpoint returningPROOF_OK. Storage latency was injected atpwrite64with a localLD_PRELOADshim (5 s on the state DB, then the agent-DB session write) to emulate the reported slow volume.session-entry.patch57.3 sstatus: ok,summary: PROOF_OKsession-entry.patch65.3 scron: isolated agent setup timed out before runner start; no executionWhy this is the reported case: with a 5 s pre-write stall, the 57.3 s session write is still in flight when the former 60 s setup deadline expires. The fix pauses the setup timer for that write and restarts it, so the occurrence executes; a write that exceeds the bounded allowance still fails.
Raw observed lines:
Watchdog/router real-timer matrix (60 s budget): admission wait 65 s ->
fired: 0; persistence write 37 s ->fired: 0; persistence write 65 s ->fired: 1.Regression tests (pre-fix failure confirmed by reverting production files, then re-applied): 21 passed across
src/cron/service/command-timeout.test.tsandsrc/cron/isolated-agent/run.session-lane.test.ts, including the busy-admission and bounded-persistence routing cases.timer-job-runner.interruption.test.ts(6) andagent-runner-execution-session-events.test.ts(17) also pass;tsc,oxlint, andoxfmtare clean for the changed files.What was not tested: operator cancellation during persistence through a Gateway cancel RPC (none is exposed). That path is unchanged and covered by
timer-job-runner.interruption.test.ts; the model endpoint was a local mock, while persistence, the watchdog, cron admission, and settlement were real.AI Assistance
This PR is AI-assisted. Used
git diff,rg, andnode --import tsxto analyze issue #184429, locate the setup watchdog accounting insrc/cron/service/agent-watchdog.ts, and implement the bounded persistence pause. The implementer understands the code: admission waits and persistence waits are separate stages, persistence is bounded by the existing setup budget, and cancellation is unchanged. All evidence above is from real local runtime execution.