Repository navigation
refactor(cron): keep receipt checks off the Gateway thread - #161935
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 30, 2026, 1:45 PM ET / 17:45 UTC (Revision 3). ClawSweeper reviewWhat this changesCron runs move receipt, job, and agent-deletion reads to the SQLite worker and recheck cancellation before payload, event, script-result, and webhook effects, with regression tests and storage documentation. Merge readiness⛔ Blocked before merge - 1 item remains Keep open. Current main still performs synchronous receipt checks, and the latest branch addresses the removal race identified in the prior review. This remains a distinct, reviewable improvement. Priority: P2 Review scores
Verification
How this fits togetherCron accepts scheduled and manual jobs, checks durable run receipts and current job definitions, then dispatches events, payloads, or webhooks. The shared-state reader worker supplies SQLite facts to the Gateway. flowchart LR
A[Scheduled or manual job] --> B[Run receipt]
B --> C[SQLite read worker]
C --> D[Gateway currentness check]
E[Job removal] --> D
D --> F[Event, payload, or webhook]
F --> G[Run result]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +224, Tests +437, Docs +10. Total +671 across 24 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the existing receipt owner and native read worker, with live cancellation and marker checks immediately before each affected effect. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main calls the synchronous receipt guard on the Gateway path before effects. I did not execute the checkout in this read-only review. Is this the best way to solve the issue? Yes. Using the existing shared-state reader and rechecking live run authority after its await is a narrow repair that preserves the stored receipt contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 25eb94b22ac6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…161935) * refactor(cron): offload direct receipt checks * fix(cron): keep receipt read facts in a leaf contract * fix(cron): honor removal after awaited receipt reads
What Problem This Solves
Cron receipt-currentness checks still executed SQLite on the Gateway thread before payload dispatch, script-result publication, and webhook delivery.
User Impact
Those direct checks now await native reads without blocking the Gateway event loop. Removal remains effective across the new await, including main-session jobs that retain a cancellation request without a bound abort controller. Run ownership, accepted self-removal, storage formats, and retention stay unchanged.
Why This Change Was Made
The existing shared-state read worker reads the receipt, current job, and required deletion facts in one transaction. It sends only the owner fields needed by the caller after the same full row decoding. The run retains its original database context, bypasses stale discovery snapshots, and checks cancellation and its exact active marker again before each effect. Reopening the same database cannot revive a retired context; missing receipt storage refuses execution without initialization.
Cancellation requests and marker identity remain distinct: a removed run keeps its marker for duplicate exclusion and settlement, but cannot produce another effect. The synchronous SDK message-action and message-source guards retain their existing current-read owner and remain separate follow-through work; this PR does not claim universal Cron SQL elimination.
Evidence
qaRuntimebuild passed (78.10 s, source unchanged).The first hosted run, 36733462593, found an introduced type-import cycle, repaired by the leaf owner-field contract. 36736723276 then exposed the two fixture ordering assumptions; both were reproduced and corrected. Failed and cancelled lanes remain historical, not coverage.
A final local Gateway group attempt also hit the unchanged one-second first-RPC deadline before the changed entry wait. Diagnostic passes do not establish its cause; that timing failure remains explicit, and fresh final-head hosted receiving is required. No deadline was increased. No published-driver upgrade cell or full SDK declaration build is claimed: this cut changes no updater, Doctor, schema, migration, or service handoff contract.