Skip to content

fix(test): cron Gateway fixture conflicts with database custody - #165457

Merged
roboclaw-bot merged 1 commit into
mainfrom
openclaw/cron-fixture-custody
Oct 5, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
openclaw/cron-fixture-custody

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes the cron multi-Gateway E2E failure when an offline scheduler tries to open a database still owned by a scheduler-disabled Gateway.

User Impact

No user-visible runtime change. The fixture now respects existing exclusive database custody while continuing to verify that a Gateway edit preserves persisted scheduler runtime.

Why This Change Was Made

Disabling scheduling does not release the Gateway's cron mutation authority. Stop and join its client and process before starting the offline scheduler, then restart and reconnect before the API edit. All original assertions and timeouts remain unchanged. The existing shared-store regression still covers stale in-memory service snapshots.

This inherited failure reproduced with both baseline and updated dependencies. A direct-main repair push in this task was rejected by the repository's PR-only ruleset, so this uses the required focused PR fallback. Only the fixture changes; no production, dependency, or database-policy changes.

Evidence

  • Original baseline: the cron-authority lock timeout reproduced; the other two Gateway cases passed (47.05s wrapper).
  • Corrected fixture: all 3 real-Gateway cases pass (60.94s wrapper); all 5 cleanup/acquisition cases pass; the retained stale-snapshot regression passes across its five mutation variants.
  • Final integrated candidate, rootless Node 24.19.0: full build passes; both full runtime suites pass 4 cases in 221.56s wrapper time, including 36.838s for the three Gateway cases (24.572s for this cron case). No new test cases or CI jobs; existing assertions, timeouts, and managed-Gateway safeguards are preserved.
  • Exact fixture bytes match the tested candidate. Current-main lifecycle, cleanup, and cron authority inputs were checked; the only cron-tree difference from the integrated candidate is an unrelated existing lint comment.
  • Focused AutoReview found no actionable P0/P1 issues. Its lifecycle-helper context limitation was covered by manual helper inspection and the five passing cleanup cases. Formatting and git diff --check pass.

Contributor credit

Requested by Peter Steinberger (@steipete).

Work sessions

Stop and join the disabled Gateway before an offline scheduler opens the same database, then reconnect for the API mutation. The stale in-memory service contract retains its existing dedicated regression. Preserve production authority rules, all assertions, and timeouts.

Co-authored-by: steipete <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 5, 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.

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 5, 2026 08:47
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 4:52 AM ET / 08:52 UTC.

ClawSweeper review

What this changes

The cron Gateway test stops its client and Gateway before an offline scheduler uses the database, then restarts and reconnects for the API edit.

Merge readiness

✅ Ready for maintainer review

The fixture repair remains necessary on current main. The custody handoff preserves the persistence assertions, and no actionable patch defect was found.

Priority: P2
Reviewed head: 21365e1a57c34d7cb8ba47d3dc0007bb46d1b945

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture repair preserves meaningful assertions and uses verified lifecycle helpers without introducing a correctness blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: This bot-authored fixture repair is exempt from the external-contributor proof gate; the captured body additionally reports the changed stop/scheduler/restart/API path passing through real Gateway processes. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This bot-authored fixture repair is exempt from the external-contributor proof gate; the captured body additionally reports the changed stop/scheduler/restart/API path passing through real Gateway processes. No stored-data contract changes.
Evidence reviewed 7 items Introduced fixture change: The pinned introduction delta changes only the fixture's custody handoff and reconnect sequence; existing assertions and timeouts remain intact.
Still needed on current main: Comparison with fetched main shows that main retains the original overlapping Gateway/offline-scheduler sequence. No merged replacement was established; the live API reports this PR open, unmerged, and mergeable.
Database custody owner: The receipt authority owner acquires an exclusive database-specific cron lock and releases it through database-resource cleanup. Disabling scheduling does not release this owner.
Findings None None.
Security None None.

How this fits together

OpenClaw's cron service stores scheduled jobs and execution state in its database. This fixture exercises an offline scheduler followed by a Gateway API edit to verify that the saved execution state survives.

flowchart TD
  A[Gateway creates jobs] --> B[Client and Gateway stop]
  B --> C[Offline scheduler runs job]
  C --> D[Execution state saved]
  D --> E[Gateway restarts]
  E --> F[API edits another job]
  F --> G[Verify execution state preserved]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +6. Total +6 across 1 file.

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

Review metrics

None.

Technical review

Best possible solution:

Keep exclusive production database custody and exercise scheduler-to-Gateway persistence through the existing fixture lifecycle.

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

Yes, source establishes the conflicting sequence: a live Gateway has mutated cron jobs before another process acquires the same exclusive cron custody. The PR reports baseline reproduction; this review did not execute it.

Is this the best way to solve the issue?

Yes, the existing stop/restart lifecycle is the narrow repair, and dedicated shared-store coverage preserves the stale-snapshot contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7fce6261cefd.

Labels

Label changes:

  • add P2: This repairs a bounded E2E fixture failure without changing user-facing runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This bot-authored fixture repair is exempt from the external-contributor proof gate; the captured body additionally reports the changed stop/scheduler/restart/API path passing through real Gateway processes. No stored-data contract changes.

Label justifications:

  • P2: This repairs a bounded E2E fixture failure without changing user-facing runtime behavior.
  • 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 bot-authored fixture repair is exempt from the external-contributor proof gate; the captured body additionally reports the changed stop/scheduler/restart/API path passing through real Gateway processes. No stored-data contract changes.

Evidence

What I checked:

  • Introduced fixture change: The pinned introduction delta changes only the fixture's custody handoff and reconnect sequence; existing assertions and timeouts remain intact. (test/gateway.multi.e2e.test.ts:181, 21365e1a57c3)
  • Still needed on current main: Comparison with fetched main shows that main retains the original overlapping Gateway/offline-scheduler sequence. No merged replacement was established; the live API reports this PR open, unmerged, and mergeable. (test/gateway.multi.e2e.test.ts:181, 7fce6261cefd)
  • Database custody owner: The receipt authority owner acquires an exclusive database-specific cron lock and releases it through database-resource cleanup. Disabling scheduling does not release this owner. (src/cron/store/receipt-authority-owner.ts:126, 21365e1a57c3)
  • Verified shutdown boundary: The fixture helper refuses to complete shutdown without verified process termination and output closure. Restart preserves the instance's state directory; terminal cleanup remains separate. (test/helpers/openclaw-test-instance.ts:1019, 21365e1a57c3)
  • Stale snapshot coverage retained: The dedicated shared-store regression retains disabled service snapshots while a scheduler child advances persisted runtime, then checks preservation across add, update, remove, same-job update, and state update. (src/cron/service/shared-store-runtime.test.ts:259, 21365e1a57c3)
  • Reported real Gateway validation: The captured PR body reports baseline custody failure and passing corrected real-Gateway runs on rootless Node 24.19.0, including a 24.572-second cron case and passing cleanup/acquisition coverage. These are contributor-reported results; this read-only review did not execute tests. (21365e1a57c3)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Avant: 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.

@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) October 5, 2026 08:55
@roboclaw-bot
roboclaw-bot merged commit 543c383 into main Oct 5, 2026
128 of 129 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/cron-fixture-custody branch October 5, 2026 08:57
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…5457)

Stop and join the disabled Gateway before an offline scheduler opens the same database, then reconnect for the API mutation. The stale in-memory service contract retains its existing dedicated regression. Preserve production authority rules, all assertions, and timeouts.

Co-authored-by: steipete <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. 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