Repository navigation
fix(cron): avoid loading provider runtimes in state workers - #184598
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: needs maintainer review before merge. What this changesThis PR prepares cron error classification on the host and passes it explicitly to persistence and recovery workers. Example: Cron recovers a failed run with a stored errorReason of undefined.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR makes a focused ownership repair, and source review found no actionable production defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe cron host executes jobs and prepares terminal outcomes; the shared-state worker atomically records receipts, job state, and history, then returns committed facts for publication. flowchart LR
A[Cron execution host] --> B[Prepare error classification]
B --> C[Shared state worker]
C --> D[Job state and receipts]
C --> E[Run history]
E --> F[Startup recovery]
F --> D
Technical reviewBest possible solution: Keep classification with the host and let the existing worker persist and recover that prepared fact. Do we have a high-confidence way to reproduce the issue? Source inspection establishes the worker-to-provider-runtime dependency path on current main; no runtime reproduction or RSS measurement was performed during this read-only review. Is this the best way to solve the issue? The patch follows the smallest complete repair: prepare classification at the existing host boundary, require its explicit result, and remove worker-side recomputation without introducing another owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2988b14f22e6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +10, Tests +175. Total +185 across 22 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 26, 2026, 8:33 AM ET / 12:33 UTC. |
…#184598) * fix(cron): avoid loading provider runtimes in state workers * test(cron): prepare the database conformance outcome reason
What Problem This Solves
Resolves a problem where cron recovery makes the shared SQLite writer load provider and agent runtime code that it does not need, increasing memory pressure on smaller devices.
User Impact
Cron persistence and startup recovery use the classification already prepared by the execution owner. No configuration, database schema, retry policy, or operator action changes. End-to-end RSS savings are not yet quantified.
Why This Change Was Made
Classify the canonical finished event on the host, before dispatch to the writer. Make the result an explicit worker input, including an authoritative
undefined, and use that same fact for job state and run history. Startup recovery reuses the persisted reason.This removes the worker import path through provider-aware failover classification. It retains the separate permanent-error and aborted-run policies. Production changes are +10 net lines; the extra field establishes the host/worker ownership boundary.
Evidence
timeout; the candidate preserves the host result.7e1b0c6eae371965fcc3f1a1358e721b5f26d341: core, cron test, and Gateway test type-check lanes passed;pnpm buildcompleted.errorReason. Commit081a461db09c0103cec9f173aee8ae13d8556286adds explicitundefinedto its successful outcome; production code is unchanged. Formatting and diff checks pass. Exact-head CI is now green, including the corrected test-type lane and all PostgreSQL conformance shards.Review follow-up
Exact-head ClawSweeper review found no actionable defect or pre-merge action. Its optional rank-up move asks for a packaged baseline/candidate worker-import or RSS comparison. That measurement is deferred to the continuing RSS campaign: this PR lands the independently verified ownership repair and makes no quantified process-memory or latency claim.