Repository navigation
fix(cron): keep the lane timeout cause in scheduled run diagnostics - #188301
xydt-juyaohui wants to merge 2 commits into
Conversation
A cron run killed by its lane's progress-idle watchdog lost why it was killed. `runCronIsolatedAgentTurnInTrace` detected the lane timeout, replaced the real `CommandLaneTaskTimeoutError` with the generic operator text, and then built the cron diagnostic from that generic text. The run history showed only `cron: job execution timed out`, so a watchdog kill was indistinguishable from a task-budget kill or an operator abort. The queue already computes the cause and its numbers (`progress-idle`, `idleMs`, `taskBudgetMs`) and bakes them into the error message. Pass the original error to the diagnostic builder so the existing redaction owner keeps that detail. User-facing text is unchanged: `error` still owns the run row and `lastError`, and only the diagnostic entry carries the lane detail. Refs openclaw#150544
|
🦞👀 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. |
…stic The e2e diagnostic case asserted the generic replacement text itself, so it pinned the defect: a lane timeout recorded cron: job execution timed out and dropped the cause the lane error already carried. Assert the lane error's own message instead. The run row's `error` and `lastError` stay generic, so the operator-facing contract the case also covers is unchanged.
|
Codex review: needs real behavior proof before merge. What this changesPreserves the original lane-timeout error in scheduled-run diagnostics while retaining the existing run-error text. Example: A cron-nested timeout carries an idle window of 900000ms and a task budget of 1800000ms.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep open: current main still loses lane-timeout detail, and this PR provides a focused repair without changing the canonical run error. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherCron isolated-agent orchestration receives execution errors, normalizes the run outcome, and supplies redacted diagnostics to completion events and persisted run history. flowchart TD
A[Scheduled cron job] --> B[Isolated agent execution]
B --> C[Lane timeout error]
C --> D[Cron error handler]
D --> E[Canonical run error]
D --> F[Redacted diagnostic builder]
E --> G[Completion event and run history]
F --> G
Technical reviewBest possible solution: Keep the original error flowing through the existing diagnostic owner, preserve canonical run errors, and consolidate the regression at the persisted-history boundary. Do we have a high-confidence way to reproduce the issue? Source shows a recognized cron-nested timeout losing its original message before diagnostic construction; the existing integration case encodes that loss, but this review executed no target code. Is this the best way to solve the issue? The input swap repairs the loss at its producer using the existing redaction owner, with no new state, policy, API, or timeout mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 33f499563f3e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +5, Tests +33. Total +38 across 3 files. Added test files: 0. View PR surface stats
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 HistoryReview history (1 earlier review cycle)
Reviewed October 30, 2026, 10:37 AM ET / 14:37 UTC (Revision 2). |
|
@clawsweeper re-review The |
|
🦞👀 Re-review progress:
|
Fixes: a scheduled run killed by its lane's progress-idle watchdog records only
cron: job execution timed out, so the run history never says why it was killed.What Problem This Solves
Fixes: a cron run stopped by its lane watchdog reports
cron: job execution timed outwith no cause, so you cannot tell a no-progress watchdog kill from a task-budget kill or an operator abort.User Impact
User impact: Task-run history now records the actual lane-timeout cause (
no progress for <idleMs>ms (task budget <ms>, elapsed <ms>)) instead of a generic message, so an operator can tell a stalled run from one that hit its budget. The user-facing error text is unchanged, and no existing reader needs to change.Why This Change Was Made
runCronIsolatedAgentTurnInTracedetects aCommandLaneTaskTimeoutError, swaps it for the generic operator text, and then built the cron diagnostic from that generic text. The queue had already computed the cause and its numbers (progress-idle,idleMs,taskBudgetMs) and put them in the error message; the diagnostic step discarded them.The fix passes the original error to the diagnostic builder, so the existing redaction owner keeps the detail.
errorstill owns the run row andlastError, so the operator-facing summary is byte-identical to before.This deliberately does not change timeout or progress policy. The issue also claimed the progress timer never re-arms; that claim does not hold on current main (
armProgressTimeout()re-arms offreadLastProgressAtMs()on every fire), and whether agent-side polling should count as lane progress is a progress-contract decision for maintainers.Evidence
The defect is one input swap in
runCronIsolatedAgentTurnInTrace. Before, the run detected thelane timeout, replaced the real error with the generic operator text, and handed that text to
the diagnostic builder; now it hands over the original error:
Before / after through the real diagnostic builder
Both inputs fed to
createCronRunDiagnosticsFromError(src/cron/run-diagnostics.ts) - thegeneric text the old code passed, and the real
CommandLaneTaskTimeoutErrorthe new code passes:Real runtime path:
runCronIsolatedAgentTurnThe regression test drives the real production entry point
src/cron/isolated-agent/run.tsthroughthe real orchestration fixture (
job-fixtures.ts->makeIsolatedAgentParamsFixture), with onlythe model call stubbed to reject with a real
CommandLaneTaskTimeoutError:Both failures reproduce identically with and without this change on the Windows/Node 24 host
used for this run: a 120 s test timeout on the trace case, and dispatch-event duration inflation
(109,225 ms against a 120 s budget) making the
diagnostics: { enabled: false }case observedispatched messages. Neither touches the diagnostic builder this change edits, and the CI
checks-fast-coreshard ran this whole file green on the previous heads.The new case asserts both halves of the contract at once:
Without the fix the assertion fails with
expected 'cron: job execution timed out' to contain 'Command lane "cron-nested" task timed.'- the pre-fix diagnostic carried only the generic text.oxfmt --check: clean.oxlint: exit 0.Gap in local checks
scripts/run-vitest.mjscannot run on this host at all: it fails during its compiled-subprocessbuild (
SyncRpcChannel: timed out connecting to named pipe), reproduced on an unrelated test file,so the commands above call
node_modules/vitest/vitest.mjsdirectly. The repo-widetsgorun onthis checkout reports 12 pre-existing errors in files this change does not touch (
fast-uriand@noble/hashesmodule resolution, plussrc/process/darwin-process-inspection.ts); neitherchanged file appears in that output. CI is the authoritative typecheck and test gate.
Existing coverage that pinned the defect
src/cron/cron-execution-diagnostics.e2e.test.tsasserted the generic replacement text as the expected diagnostic, so it encoded the bug. It now asserts the lane error's own message; the same case still checks that the run row'serrorstayscron: job execution timed out, which is what keeps the operator-facing contract unchanged.