Repository navigation
fix: scheduled runs fail after unrelated channel reloads - #188650
Conversation
Keep policy freshness scoped to the scheduled run and restore existing pre-effect event and mailbox readmission without replaying possible effects. Co-authored-by: steipete <[email protected]>
|
🦞👀 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 real behavior proof before merge. What this changesThe PR preserves scheduled work across unrelated channel reloads and retries known refusals before execution through existing admission owners. Example: A scheduled session turn is preparing when another Discord channel's users allowlist changes.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep this PR open: it addresses a current scheduled-run failure, but the later execution marker can replay model-resolution hook effects. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherCron submits occurrences to the session-event owner, which checks current authority, joins the session FIFO, dispatches agent execution, and records or delivers the result. flowchart TD
A[Cron occurrence] --> B[Session event owner]
C[Runtime policy snapshots] --> B
B --> D[Session FIFO admission]
D --> E[Hooks and agent execution]
E --> F[Result and delivery]
E --> B
Technical reviewBest possible solution: Retain the existing event and FIFO owners, with relevant-policy comparison and replay custody consumed before every effect-capable hook dispatch. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the unconditional publication rejection, and the introduced hook-replay path is source-traceable; no target code was executed during this review. Is this the best way to solve the issue? The existing-owner approach is proportionate, but its definition of possible execution must include model-resolution hooks before readmission is safe. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 48df899f6f16. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The relaxed policy fence needs final-effect authorization evidence, although source review found no concrete credential or supply-chain regression. EvidenceWhat I checked:
PR surfaceSource +125, Tests -1, Docs +1. Total +125 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
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 30, 2026, 4:02 PM ET / 20:02 UTC. |
Integrate main after scheduled-main run 41144429846 passed the formerly failing cron fallback, Gateway fallback, thinking-claim and manual-custody leaves. Preserve main's prepared source-effect authority around the R6 policy comparison when resolving the handoff conflict. Current-main baseline remains red on seven R6 regressions. The integrated candidate passes all 99 focused cases and targeted typecheck/format. Local lint retains its max-lines finding under the existing CI advisory policy. Co-authored-by: steipete <[email protected]>
Consume the existing event custody marker at registered before_model_resolve dispatch, after live authority checks and before invoking the handler. Keep locked and no-hook preparation eligible for the existing bounded readmission. Exercise registered model/reply hooks with persisted effects through native cron dispatch and preparation. Reuse the job fixture's metadata defaults. Co-authored-by: steipete <[email protected]>
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…8650) * fix: preserve scheduled work across unrelated policy reloads Keep policy freshness scoped to the scheduled run and restore existing pre-effect event and mailbox readmission without replaying possible effects. Co-authored-by: steipete <[email protected]> * fix: prevent scheduled policy retries after model hook effects Consume the existing event custody marker at registered before_model_resolve dispatch, after live authority checks and before invoking the handler. Keep locked and no-hook preparation eligible for the existing bounded readmission. Exercise registered model/reply hooks with persisted effects through native cron dispatch and preparation. Reuse the job fixture's metadata defaults. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]>
Related: #188530 covers caller-turn custody separately; this change does not modify that boundary.
What Problem This Solves
Fixes scheduled work failing after unrelated channel configuration reloads, and known pre-effect policy refusals stranding an occurrence until a later slot.
User Impact
Unrelated channel reloads leave valid scheduled work active. Relevant policy changes can re-admit genuinely unstarted work under fresh authority. Work that may already have performed effects, including model-resolution hooks, is not replayed by this policy retry.
Why This Change Was Made
Scheduled events compare effective policy using canonical runtime/source snapshots for the selected agent, trusted creator and delivery channels, including shared channel policy and activation. Live source/job and per-effect authority checks remain. The existing event owner retains the same occurrence, with its existing two-readmission limit and 100/200 ms backoff. A typed lifecycle refusal before operation acquisition returns the existing mailbox receipt to the existing FIFO drain.
Execution and registered hook dispatch consume existing custody. This includes
before_model_resolve, the only registered hook dispatched by the logical entry/setup modules before native candidate preparation, alongside the existing bootstrap and reply-hook barriers. Treating a registered model hook as possible work conservatively gives up policy retry even if that handler happened to be pure. No hook-runner semantics, second retry queue, persistence, configuration option or FIFO/coalescing behavior changed.Evidence
8034bb1fafbe83e5ce95fc985686bc2f95ff5ce1and green with R6. The committed registered-hook regression is red on incoming67533beaef03f344b1386afa081c1b5096919afa, observing two persisted filesystem appends. Corrected4607413216a54980402d55074ce7bedbaaf90279produces one append, one preparation, no provider request and terminal error after the relevant policy publication.max-linesfinding: 735/700, with unmodified integrated main also above the cap at 712/700. The existing GitHub Actions advisory size policy is unchanged; no cap, baseline or suppression changed. Focused suites used the pinned CI Bun runtime in isolated, network-disabled rootless Podman, limited to 4 CPUs/8 GiB and one test worker.4607413216a54980402d55074ce7bedbaaf90279completed scoped-clean at P0–P2, with no findings. It assessed source and did not independently execute tests. The native correction review resolvesR6-HOOK-REPLAYand retains the incoming NEEDS WORK evidence.agent_end survives closureandsubagent_ended survives closure, have the samelog.isEnabledTypeError and assertion/diagnostic locations as scheduled-main 41155320395. Their test and diagnostic files are byte-identical in main, tested merge6703bc567b47782bd99056ff07e794109d74b0cb, and its first parent21fd5cbb06b33b1c45daa2eb178843d014cd1b43. The automatic failure table is unknown because job groupings differ; attribution uses the actual logs and Git objects. CI remains failed, and native inherited-failure admission must still enforce current review/security gates. No full-package, live external-model/channel or R3 external-owner proof is claimed.Requested by @steipete.
Work sessions