fix(cron): warn on main heartbeat handoff ghost runs#72677
Conversation
Greptile SummaryThis PR adds a scoped ghost-run warning for fast Confidence Score: 5/5Safe to merge — additive warning path with no changes to existing control flow. All changes are additive: new config field with a safe default (50ms), new warning emission that does not alter the run outcome, and proper de-serialization of the new No files require special attention. Reviews (1): Last reviewed commit: "fix(cron): warn on main heartbeat handof..." | Re-trigger Greptile |
0fad0d0 to
4f7d668
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 5:59 AM ET / 09:59 UTC. Summary PR surface: Source +91, Tests +157, Docs +12, Other +4. Total +264 across 20 files. Reproducibility: yes. from source: current main still requests a next-heartbeat cron wake and records ok without awaiting agent processing or persisting any warning marker. I did not run a live gateway-down repro because this was a read-only review. Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: The best end state is a refreshed, narrowed PR that implements the warning in the accepted config/protocol shape, has exact-head proof, and keeps docs aligned to SQLite run history. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main still requests a next-heartbeat cron wake and records ok without awaiting agent processing or persisting any warning marker. I did not run a live gateway-down repro because this was a read-only review. Is this the best way to solve the issue? Unclear as submitted. The gateway/run-log warning is a plausible mitigation, but the defaulted config key, protocol field, conflict state, and stale docs/proof need maintainer acceptance and refresh before this is the best fix. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 36dd9ee3c3c1. Label changesLabel justifications:
Evidence reviewedPR surface: Source +91, Tests +157, Docs +12, Other +4. Total +264 across 20 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Current head 55b75e7 carries CronRunLogEntry.warnings through the Control UI run-history type/renderer/test, removes the release-owned CHANGELOG.md entry, and updates the PR body Real behavior proof with focused UI + cron/gateway test output. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Current head acd4a5f preserves Swift source compatibility for CronRunLogEntry.warnings by defaulting the generated optional initializer parameter to nil, regenerates GatewayModels.swift, updates Real behavior proof with focused cron/UI tests, protocol generation stability, and a Swift typecheck proving old call sites compile without warnings:. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@liaoandi thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(cron): warn on main heartbeat handoff ghost runs This is item 1/1 in the current shard. Shard 7/22. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Fixes #63106.
Summary
systemEventcron jobs usingwakeMode="next-heartbeat".possible-main-next-heartbeat-ghost-runannotation in cron run logs.cron.ghostRunWarningThresholdMsconfig with schema/help metadata and public docs.CronRunLogEntry.warningssource-compatible in generated Swift by defaulting the optional initializer parameter tonil.CHANGELOG.md.Real behavior proof
Behavior or issue addressed: Verified that a fast successful main-session
systemEventcron handoff usingwakeMode: "next-heartbeat"writes thepossible-main-next-heartbeat-ghost-runwarning into the cron run log, that Control UI run history can render that warning fromCronRunLogEntry.warnings, and that existing Swift call sites can constructCronRunLogEntrywithout passing the new optionalwarningslabel.Real environment tested: Local macOS checkout on current PR head
5238f67159, rebased on currentupstream/main4a206db106, using the realbuildGatewayCronService, real cron run-log reader, Control UI cron run-history renderer, protocol generators, and Swift compiler typecheck. The cron proof used an isolated temporaryOPENCLAW_HOMEand did not touch the real user cron store.Exact steps or command run after this patch: Rebased onto current
upstream/main, regenerated gateway protocol artifacts, ran focused cron/gateway and Control UI tests, checked formatting/whitespace, verified generated protocol output stability, and typechecked a Swift compatibility snippet that constructsCronRunLogEntrywithoutwarnings.Evidence after fix: Current-head focused test output:
Current-head isolated run-log proof shape, redacted from the real gateway cron service/run-log path:
{ "home": "/tmp/openclaw-ghost-proof.redacted", "jobId": "redacted-job-id", "logPath": "/tmp/openclaw-ghost-proof.redacted/runs/redacted-job-id.jsonl", "latest": { "action": "finished", "status": "ok", "summary": "proof handoff", "runId": "cron:redacted-job-id:redacted-start-ms", "durationMs": 7, "deliveryStatus": "not-requested", "warnings": [ "possible-main-next-heartbeat-ghost-run" ] } }Swift compatibility proof:
The compatibility snippet constructs
CronRunLogEntry(...)without awarnings:argument, matching existing Swift call sites.Protocol generation stability:
Format and whitespace checks:
Observed result after fix: The forced main-session
next-heartbeathandoff completed successfully, the persisted run-log entry containswarnings: ["possible-main-next-heartbeat-ghost-run"], Control UI run history renders that warning as a warning chip, regenerated Swift now emitswarnings: [String]? = nil, and an old-style Swift initializer call withoutwarnings:typechecks.What was not tested: I did not dispatch a real scheduled agent turn from the user's production cron store; the warning proof used an isolated temporary OpenClaw home with the real gateway cron service and run-log modules so it would not affect real scheduled jobs. Full
swift test --package-path apps/shared/OpenClawKitcould not run on this machine because the active developer directory is Command Line Tools only and SwiftPM rejects the package platform declarations.iOS(.v18)/.macOS(.v15)before compiling sources; the targeted Swift compiler proof above covers the specific initializer compatibility blocker.Tests
node scripts/test-projects.mjs src/gateway/server-cron.test.ts src/cron/cron-protocol-conformance.test.ts ui/src/ui/views/cron.test.ts --reporter verbose./node_modules/.bin/oxfmt --check scripts/protocol-gen-swift.ts src/gateway/server-cron.ts src/gateway/server-cron.test.ts src/cron/run-log.ts src/cron/cron-protocol-conformance.test.ts ui/src/ui/views/cron.ts ui/src/ui/views/cron.test.tsgit diff --check upstream/main...HEADnode --import tsx scripts/protocol-gen.tsnode --import tsx scripts/protocol-gen-swift.tsgit diff --exit-code -- dist/protocol.schema.json apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swiftswiftc -typecheck apps/shared/OpenClawKit/Sources/OpenClawProtocol/AnyCodable.swift apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift /private/tmp/openclaw-pr72677-swift-compat.swift