You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cf2deba
Browse filesBrowse the repository at this point in the historyBrowse files
Lauris
committed
fix(codemode): fail a program that stalls instead of holding the turn
A Code Mode program has no timers, so a promise settles only through a
tool or extension call or the program's own steps. A program awaiting a
promise that nothing can settle, such as `await new Promise(r => r)`,
waited forever, and with no execute timeout the session held its turn
until inactivity eviction interrupted it an hour later.
The interpreter now counts its steps and the host calls in flight,
including their hooks. A new optional `stallMs` limit fails the program
with a `Stalled` diagnostic once a full window passes with no step and no
call running. OpenCode's execute tool sets it to 30 seconds and tells the
model not to use execute to wait or poll.
Closesanomalyco#54340
message: `Execution stalled: nothing ran for ${stallMs}ms while the program awaited a promise that no running call can settle. Timers are unavailable, so a promise settles only through a tool or extension call, or by calling its resolve or reject.`,
// A program that takes no step while no call is running can never resume; fail it instead of holding the turn.
62
+
constSTALL_MS=30_000
63
+
61
64
// Invariant model-facing guidance; the changing tool catalog is delivered through Instructions.
62
65
constdescription=[
63
66
"Run JavaScript in a confined Code Mode runtime to script tool calls and HTTP requests and compose their results.",
@@ -66,6 +69,7 @@ const description = [
66
69
'Call tools through `tools` using only exact paths and signatures from the catalog. Do not infer or normalize tool names; preserve bracket notation such as `tools.<namespace>["tool-name"](input)`.',
67
70
"Prefer an explicit `return`; if omitted, the final top-level expression becomes the result.",
68
71
"Await every call whose completion matters; pending calls are interrupted when execution ends. Run independent calls concurrently with `Promise.allSettled`.",
72
+
"Do not use it to wait or poll: without timers it cannot sleep, and a program awaiting a promise that nothing can settle fails as stalled.",
0 commit comments