Resume agent turns after auto-approval, and fix retryAgent and Scheduler docs (#599)
* Document that retryAgent throws while an agent is running The implementation rejects with the agent-running error, as the other chat mutators do; the doc said it silently did nothing. * Show executeCode minting scheduler callbacks via env.GADGET[restore] The Scheduler's agent-facing types told agents to call ctx.restore() from executeCode, which targets the executeCode worker and throws that it implements no [restore](). The example also called a bare scheduler, the Workers global, rather than env.SCHEDULER. * Resume agent turns whose awaited actions an auto-approval drain decides Only a manual approveAction resumed a turn suspended on awaitDecision. "Always approve" (the chat card, Activity panel and Connections rule toggle) and approveAction's cascade apply actions through the drain alone, so when the drain decided a turn's last awaited action -- e.g. the first Gmail archive or a vetted MCP tool call -- the action applied and the agent never resumed or learned of it. Both drains now resume the chats whose awaited actions were pending on that gatekeeper. A drain requested while one is running now shares its promise, so awaiting drain() waits for the rerun it requested instead of returning before the action is applied. No caller awaits a drain, so a failed resume is logged rather than ending the loop. An auto-approvable awaited action queued behind a manual gate, which the in-order drain stops at, also let its turn run on while the action sat unapplied. submitAction now suspends that turn too, and rejectAction drains as approveAction does, so rejecting the gate applies the queued action and resumes the turn instead of leaving both waiting on a drain that nothing starts. * Resume only chats whose awaited actions the drain approved The drain-and-resume path checked every chat with an awaited action pending on the gatekeeper, including ones the drain left pending, so a chat whose older action stayed on a manual gate could be resumed from its latest turn's already-approved actions.
N
Nathan Disidore committed
1200259dc288fdce0ce7852a43b3db9915348142
Parent: ac473e2
Committed by GitHub <noreply@github.com>
on 9/30/2026, 7:43:15 PM