Skip to content

fix(cron): prevent extra timer runs in on-exit tests - #149841

Merged
vincentkoc merged 1 commit into
mainfrom
fix/cron-on-exit-settlement-fixtures-20260916
Sep 16, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/cron-on-exit-settlement-fixtures-20260916

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an unintended timer run in the on-exit receipt-settlement tests, which can make the competing-manual-run case observe three runner calls instead of two.

User Impact

No product behavior changes. These tests now exercise the intended manual-run and observed-exit race without also admitting a scheduled timer run.

Why This Change Was Made

Both directly persisted on-exit fixtures inherited a due nextRunAtMs from the timed-job helper. Event-driven schedules have no timer slot. Clear that inherited state and check its absence before observed-exit reservation. Keep the real timers, deadlines, deferred ordering, atomic receipt assertions, exact runner counts, payload updates, cancellation and rearm checks.

Evidence

  • The original hosted failure observed three calls; it did not record the third call's exact interleaving.
  • Source review confirmed the fixture mismatch against the canonical schedule and admission owners. No production or dependency files change.
  • Pinned oxfmt 0.66.0 and git diff --check pass.
  • Hosted focused proof passed all eight original cases in their normal order, with zero skips or errors. The competing-manual-run case passed in 2,038 ms; the three existing timeout-owner cases retained their original deadlines. The repository wrapper exited successfully.
  • This proof ran source facff0ee4201f80f71c2c98d1f628cc29911cc7b in tested merge c9c08bd5b08d7cdc875d6393b092ea43453c8267 (tree 0ce69e123f8ac6800f58b155b811fe12811b0ff9). Full CI and current-head review are still pending.

@vincentkoc vincentkoc self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 16, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 16, 2026 07:14
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 3:28 AM ET / 07:28 UTC (Revision 2).

ClawSweeper review

What this changes

Clears inherited timer timestamps from exit-triggered cron test fixtures so the tests exercise manual-run and observed-exit races without an unintended scheduled run.

Merge readiness

✅ Ready for maintainer review

The fixture repair remains useful on current main and preserves the existing race coverage. No actionable patch defects were found; this maintainer-authored PR is not a cleanup candidate.

Priority: P3
Reviewed head: facff0ee4201f80f71c2c98d1f628cc29911cc7b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, well-supported fixture correction preserves the original behavioral coverage and has successful focused hosted validation.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored fixture repair has no production behavior change or authority-chain change; the successful focused hosted test job is relevant supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored fixture repair has no production behavior change or authority-chain change; the successful focused hosted test job is relevant supplemental validation.
Evidence reviewed 8 items Introduced patch and retained coverage: The complete introduced patch changes only fixture state and adds unscheduled-state assertions. Exact runner counts, atomic reservation checks, payload updates, cancellation, rearming, real timers, and deadlines remain intact.
Canonical event-driven schedule contract: The schedule owner returns undefined for on-exit and stream schedules. Job creation computes nextRunAtMs through that owner; the existing on-exit schedule test independently asserts that these jobs are never time-due. The directly persisted fixtures bypass creation and previously retained the timed helper’s due timestamp.
Timer eligibility explains fixture interference: Timer admission accepts an enabled, inactive job with a due nextRunAtMs. Removing that timestamp eliminates the unrelated timer eligibility without changing production admission or receipt ownership.
Findings None None.
Security None None.

How this fits together

OpenClaw’s cron service accepts scheduled jobs, manual runs, and observed command exits. These tests exercise its durable run reservations and verify that competing executions, cancellation, and rearming preserve ownership.

flowchart TD
 A[Test job fixtures] --> B[Cron service]
 C[Manual run] --> B
 D[Observed command exit] --> B
 B --> E[Durable run reservation]
 E --> F[Payload execution]
 F --> G[Settlement and ownership assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +9. Total +9 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 11 2 +9
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 11 2 +9

Review metrics

None.

Technical review

Best possible solution:

Keep the event-driven fixtures consistent with normal job creation while retaining the existing receipt-settlement race assertions.

Do we have a high-confidence way to reproduce the issue?

Yes for the fixture mismatch: current main supplies a due timer timestamp to event-driven jobs, making them eligible for unrelated scheduled admission. The historical third-call interleaving was not reproduced during this read-only review.

Is this the best way to solve the issue?

Yes. Correcting the fixture state matches the existing schedule contract and preserves the meaningful concurrency checks without weakening assertions or changing runtime behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 05a5bd1c19b7.

Labels

Label justifications:

  • P3: This is a focused test-fixture correction with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored fixture repair has no production behavior change or authority-chain change; the successful focused hosted test job is relevant supplemental validation.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-16T07:21:32.249Z sha facff0e :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc merged commit 1c21e36 into main Sep 16, 2026
172 checks passed
@vincentkoc
vincentkoc deleted the fix/cron-on-exit-settlement-fixtures-20260916 branch September 16, 2026 07:36
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant