Resume agent turns after auto-approval, and fix retryAgent and Scheduler docs - #599
Conversation
The implementation rejects with the agent-running error, as the other chat mutators do; the doc said it silently did nothing.
Preview:
|
|
Review: 1 findings. I posted one inline finding: auto-approval can finish before the submitting agent turn has suspended, leaving the turn idle instead of resuming it. |
|
Review: 0 findings. No new actionable issues beyond the existing inline discussions about auto-approval resumption. |
c36bd80 to
46d8e44
Compare
|
Review: 1 findings. I posted one actionable inline finding. |
46d8e44 to
d6cd3d8
Compare
|
LGTM! |
This comment was marked as outdated.
This comment was marked as outdated.
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.
d6cd3d8 to
735e772
Compare
|
LGTM! |
Eval resultsVerdict: ⚪ Unchanged. No task moved beyond what 10 runs can tell apart from noise.
Failed checks
|
🔬 Eval runs reviewPerformanceComparable tasks scored chess 90% → 90%, incident-desk 100% → 90%, and worker-logs 100% → 80%; ⚪ VERDICT: NO REGRESSION FROM THIS PRThe observed failures are model mistakes in generated gadgets, not consequences of the diff’s auto-approval resumption, Scheduler guidance, or TriageFailure modes
Tool errors
Prompt cacheNo comparable task’s cache-hit rate moved by five percentage points or more; no task meets the requested investigation threshold. What to do
|
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.
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.
735e772 to
35de05d
Compare
|
LGTM! |
Resume agent turns that auto-approval decides
A turn paused on an awaited action resumed only when the user clicked Approve on that action. "Always approve" and the drain that runs after a manual approval applied actions without resuming the turn, so always-approving the first Gmail archive left the agent idle until the user sent another message. Both paths now resume the turn, and a drain requested while another is running waits for that one to finish, so the resume sees the applied action.
Fix the Scheduler's restore guidance for agents
The Scheduler's agent-facing types told agents to call
ctx.restore()fromexecuteCode. That call targets theexecuteCodeworker and throws because the worker has no[restore]()method. The types and README now useenv.MY_GADGET[restore](params), and the example callsenv.SCHEDULERinstead of the Workers globalscheduler.Document that
retryAgentthrows while an agent is runningThe
retryAgentdoc said the call does nothing when an agent is already running. It throws the agent-running error, as the other chat methods do, and the frontend already shows a toast for it.