Repository navigation
fix(cron): wait for failed run completion in state regression test - #148749
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. Reviewed September 15, 2026, 12:23 AM ET / 04:23 UTC (Revision 2). ClawSweeper reviewWhat this changesThe Cron regression test now waits for the second run’s error completion event before checking its recorded status and error count. Merge readiness✅ Ready for maintainer review The patch correctly synchronizes the regression test with completed state publication without weakening its assertions. Current main still lacks this wait, and the maintainer-authored PR remains useful. No actionable findings remain. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s Cron scheduler runs scheduled jobs, commits their results, and publishes completion events. This test checks the recorded state after a delivery failure followed by an execution error. flowchart TD
A[Scheduled test job] --> B[First run has delivery failure]
B --> C[Second run has execution error]
C --> D[Commit result and update resident state]
D --> E[Publish error completion event]
E --> F[Test checks status and error count]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +3. Total +3 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the existing completion-event barrier as the synchronization point while preserving all behavioral assertions and production code. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the race: the runner invocation precedes asynchronous result finalization, while getJob reads resident state immediately. No tests were executed in this read-only review. Is this the best way to solve the issue? Yes. Reusing the existing event helper establishes the required completion ordering without retries, longer timeouts, weaker assertions, or production changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 261d5c51fb65. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
The flake is real — the second waitFor only proves the runner was invoked, while |
|
Merged via squash.
|
What Problem This Solves
The Cron regression test for an execution error after a delivery-only failure can inspect the previous completed state after the second runner invocation but before that run is finalized.
User Impact
No user-visible runtime change. The regression test checks the completed execution result while retaining its error-count, status, enabled-state, scheduling, and invocation-count assertions.
Why This Change Was Made
Wait for the existing event helper to observe this job's
finishedevent withstatus: "error"before reading its state. The scheduler applies the committed result to its resident state before publishing that event. Matching the error status excludes the first delivery-only run's successful completion; the helper also observes matching events that already occurred.The change adds three test lines. Production code, fake-timer advances, timeouts, and assertions are unchanged.
Evidence
0/okstate after the second invocation, where the test expected1/error. The test's invocation-only wait does not establish result finalization.git diff --check, scoped formatting, and normal commit hooks passed. The reviewed postimage is unchanged after formatting.e28943d1307f7c9c51b7442dd0b416773c07b828. Selected type, lint, dependency, guard, and pinned formatter checks passed; build and platform lanes were not selected.f7874aead37d38629e5d29cc1282737033788306contains exactly the reviewed three-line insertion and unchanged assertions. This is fixture and service runtime proof; no live provider behavior is claimed.