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 June 9, 2026, 6:09 AM ET / 10:09 UTC. Summary PR surface: Source +91, Tests +157, Docs +12, Other +4. Total +264 across 20 files. Reproducibility: yes. for source-level reproduction: current main's main-session Review metrics: 2 noteworthy metrics.
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: Land only after the docs point to SQLite-backed run history, the contributor refreshes current-head proof, and maintainers explicitly accept the default-on diagnostic/protocol addition. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main's main-session Is this the best way to solve the issue? Unclear as a final fix: the gateway/run-log warning is an acceptable diagnostic layer, but it does not prove agent processing and still needs docs repair, current-head proof, and maintainer acceptance of the default-on compatibility impact. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 5e1fbca3cbc6. Label changesLabel changes:
Label 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:
|
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