Repository navigation
perf(test): fast-forward cron receipt handoff - #124417
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready proof for exact head
No production code, docs, config, dependencies, or release surfaces changed. Production LOC: |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 12:49 AM ET / 04:49 UTC. ClawSweeper reviewWhat this changesThe PR replaces real monitor-delay waits in the cron durable-ownership handoff test with parent-only fake-timer advancement while keeping the external processes and SQLite handoff real. Merge readinessKeep open. No blocking correctness or security finding: the test preserves the real child-process and SQLite handoff, then advances only the parent monitor timeout. Likely related people: steipete (high confidence; introduced and recently maintained this cron ownership surface). Priority: P3 Review scores
Verification
How this fits togetherCron persists run-receipt ownership in SQLite so another scheduler can monitor a foreign owner and recover interrupted work. This test exercises the handoff from one external owner to a replacement owner, then verifies the parent service records recovery after that owner exits. flowchart LR
A[First cron owner] --> B[SQLite run receipt]
B --> C[Replacement owner]
C --> D[Parent receipt monitor]
D --> E[Owner exit reconciliation]
E --> F[Interrupted run recovery]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +28. Total +28 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the production monitor interval and land this focused test optimization once the normal exact-head merge gate is green. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR improves the timing and determinism of an existing regression test rather than reporting a user-facing failure. Is this the best way to solve the issue? Yes. The change preserves real process and SQLite ownership transitions while advancing only the lifecycle-owned parent monitor; changing the production interval would alter runtime behavior without improving this test's contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0c7b560b2346. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
The cron durable-ownership handoff regression waits on real two-second monitor intervals while coordinating two external owner processes. The test must prove that the replacement receipt becomes the monitored authority and that its later death is recovered, but it does not need to spend four seconds of wall clock observing those parent-owned timers.
Why This Change Was Made
Keep both real child processes, the shared SQLite state, durable receipt replacement, process death, and final interrupted recovery. After the replacement process has claimed ownership, switch only the parent process to fake timers, isolate the foreign-receipt monitor from the ordinary cron job timer, advance each two-second monitor interval explicitly, and observe the exact replacement receipt in the monitor before killing its owner.
The immediate-yield poll does not advance fake timers, so it can distinguish asynchronous receipt enrollment from another elapsed monitor cycle. Production code and monitor timing remain unchanged.
User Impact
Maintainer cron test feedback is faster and the handoff proof is more deterministic. Runtime behavior is unchanged.
Evidence
Controlled same-Testbox A/B on
tbx_01m04cmmjg6s60dwa9n79qxcn8, one excluded warmup plus two retained samples per state, one worker, distinct filesystem module caches, import diagnostics, and/usr/bin/time -v:CPU and peak RSS were effectively flat, so this PR makes no resource-usage claim.
Validation:
enrollForeignReceipt(state, result.receipt)from superseded-receipt recovery fails waiting for the exact replacement receipt to enter the monitor.+0/-0; test LOC:+32/-4.Testbox hydration run: https://github.com/openclaw/openclaw/actions/runs/31926297673