Repository navigation
fix(cron): preserve lazy ownership and bounded notification lifetimes - #117018
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 5:18 PM ET / 21:18 UTC. ClawSweeper reviewWhat this changesThis PR makes Gateway cron wakes load their lazy scheduler before acknowledging a wake, preserves system-owned cleanup options, reports rejected CLI wakes as errors, and bounds cron notification and webhook cleanup lifetimes. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain Keep this PR open for human merge review: the source repair is coherent and has no concrete correctness finding, but the current head still needs directly inspectable after-fix runtime proof and a review refresh against current Priority: P1 Review scores
Verification
How this fits togetherGateway receives operator and model wake requests, then delegates them to the cron scheduler; cron failures can send channel alerts or webhooks under Gateway work admission. This PR changes the scheduler readiness boundary and the timeout/release behavior of those detached notification paths. flowchart LR
Wake[Operator or model wake] --> Gateway[Gateway cron handler]
Gateway --> LazyOwner[Lazy cron owner]
LazyOwner --> Scheduler[Cron scheduler]
Scheduler --> Alerts[Failure notifications]
Alerts --> Delivery[Channel or webhook delivery]
Delivery --> Release[Gateway work release]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +34, Tests +240. Total +274 across 11 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase or merge-test the exact head against current Do we have a high-confidence way to reproduce the issue? Yes, from source and focused regression coverage: a lazy cron wake can return before the owner is loaded, and unresolved notification or response-body promises retain Gateway admission. This read-only review did not execute a live current-head reproduction. Is this the best way to solve the issue? Yes, provisionally: the diff repairs the owner boundaries rather than adding a parallel scheduler or fallback, and it reuses the existing timeout facade. Its merge suitability still depends on exact-head runtime proof and current-base validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e73250f54baf. LabelsLabel 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
History |
|
Merged via squash.
|
* origin/main: (22 commits) fix(cron): preserve lazy ownership and bounded notification lifetimes (#117018) fix: live updater no-op restarts healthy gateways (#117038) fix(bedrock): release streaming clients (#117039) fix(google): restore canonical Gemini and Vertex provider invariants (#117042) fix(channels): preserve accepted LINE and Mattermost delivery (#117024) fix(feishu): unify truthful delivery and media ownership (#117023) fix(ui): isolate gateway observer lifecycles (#117017) fix(tui): keep reset transitions isolated from stale input (#116873) fix(gateway): centralize streamed media descriptor ownership (#117000) feat(plugins): externalize OpenCode provider (#117035) fix(onboarding): restore skill dependency consent (#116644) fix(streaming): preserve incomplete bracket tails in final replies (#116983) fix: allow slower gateway readiness after updates (#117032) fix(plugin-state): avoid shared SQLite corruption when CLI starts during gateway runtime (#113204) fix(cli): keep config file output raw under JSON logging (#116968) fix(ai): malformed Anthropic stream frames expose raw event payloads (#116938) fix(qa): authenticate actual scenario execution evidence (#117004) feat(plugins): externalize NovitaAI provider (#117007) fix(text): preserve fenced tool markers in visible-text sanitizer (#116939) (#116971) fix(channels): reset metadata memos with plugin lifecycle (#117005) ...
…openclaw#117018) * fix(cron): preserve lazy ownership and bound notification lifetimes * fix(cron): respect fs-safe policy boundary --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Five distinct cron/Gateway owner-boundary defects could silently lose an operator/model wake, misreport that loss as CLI success, strand a system-owned heartbeat monitor, or keep detached Gateway work alive indefinitely:
remove(..., { systemOwned: true }), so the real owner rejected legitimate stale heartbeat-monitor cleanup.{ ok: false }and never delivered the requested event.openclaw system eventprintedokeven when its actual wake acknowledgment resolved to{ ok: false }.Why This Change Was Made
Each defect is repaired at its canonical lifecycle/decision owner. The lazy proxy transparently forwards removal options and provides Gateway-only optional wake preparation after existing authorization. The CLI consumes the real acknowledgment. Failure notifications reuse the existing timeout helper through OpenClaw's canonical
src/infra/fs-safe.tspolicy owner around the complete target-resolution and transport lifetime, propagate abort, and share one late-send checkpoint. The immediate-alert sibling drops duplicate timer/race machinery. Webhook body cleanup is bounded by its existing original request deadline before the existing dispatcher release.Historical caller-scoped cross-agent authorization, scheduled update policy forwarding, persisted session collisions, broad scheduler starvation, and durable delivery-state changes were deliberately held for separate authority/state review. This change adds no config, environment option, dependency, public Gateway protocol, authorization behavior, SQLite schema, or persisted-state shape.
User Impact
Cold-start system/model wake requests are actually delivered to the intended system-event queue. Rejected CLI wake requests report their real reason. Stale system-owned heartbeat monitors can be removed. Hung cron notification targets, transports, and unread webhook bodies stop retaining Gateway work indefinitely; timed-out work cannot send after ownership has ended. Existing wake authorization and public contracts remain unchanged.
Evidence
Real post-fix Gateway runtime transcript
Executed the actual changed source implementation, actual Gateway
wakeRPC handler, actual lazy cron service, and actual system-event queue against isolated throwaway state. No module mocking, fake clock, external account, credential, or live-user state was involved. The same process then exercised a genuinely non-settlingReadableStream.cancel(), the production fs-safe timeout facade, and the production Gateway independent-root admission owner using a real 40 ms clock:The cleanup probe intentionally uses a controlled non-settling response stream; it does not claim that an external webhook or channel was contacted. Its measured transition from one admitted Gateway root to zero after the real timeout demonstrates the production lifecycle invariant directly.
Exact-head verbose Gateway, CLI, and notification owner proof
Actual focused execution on immutable commit
9d07dff959b4615c024d7cd36ba1b9a99d3c24d5; controlled stalled transports and fake timers are explicitly scoped to the regression tests:Separate complete exact-head focused coverage: 240/240 passed across Gateway lazy/notifications/validation, cron failure notification, system CLI, and the fs-safe import-policy boundary. Parent commit
c032c9a1additionally passed the complete remote changed gate: all repository guards, formatting, public SDK baseline, plugin boundaries, dead exports, production and testtsgo, runtime import cycles, webhook/database checks, and changed-file oxlint with zero warnings/errors. The exact corrected head changes only two canonical infrastructure-owner imports from that remotely proven parent.Refreshed current-main review and hosted CI
661afc22ac0eafe395625c8cc32469dabc22a5a0:src/gateway/server-cron-lazy.tsstill drops system-owned remove options and has noprepareWake; the wake handler has no lazy-owner preparation;src/cron/delivery.tshas no full-owner timeout/late-send checkpoint;src/gateway/server-cron-notifications.tsstill awaits unbounded response-body cancellation;src/infra/fs-safe.ts:60already exposes the canonical existing timeout facade used by this PR.openclaw/ci-gate: SUCCESS — https://github.com/openclaw/openclaw/actions/runs/30665696116/job/91274171962.gpt-5.6-sol, high reasoning,--max-priority P3, CLEAN, confidence 0.88, verified TruffleHog clean; independent full-owner/caller/sibling cross-review clean.@openclaw/[email protected]timing implementation, TypeScript declaration, and timing documentation; no new dependency or private dependency import outside the infrastructure facade.+98/-64(net+34); the additional lifecycle ownership replaces duplicate timeout machinery. Baseline36b80ada3ceae2de21b3d8710b883d778e4c4578; exact reviewed/CI-green head9d07dff959b4615c024d7cd36ba1b9a99d3c24d5.