Thrown write-action errors get isError+outcomeUnknown even for definitive 4xx rejections, permanently blocking that tool on the thread (write_tool_outcome_unknown)
Environment
@agent-native/core0.209.0, self-hosted production build (Nitro/listhen,node .output/server/index.mjs), threads persisted in Postgres- Observed live 2026-10-17 on a deployed app; engine-backed actions call a Python service over HTTP
Summary
When a non-readOnly action's handler throws, the runner stamps the tool result isError:true plus outcomeUnknown:true — even when the error is a definitive 4xx rejection where provably no side effect ran. From then on, every further call of that same tool on the thread is refused, and the user-facing message tells the user to "check whether it completed before asking me to retry" — which can never succeed. One 422 from our backend burned five consecutive dead retries (14 s – 1 m 23 s each) with no way forward except abandoning the thread.
Mechanism (from the shipped code and recorded run events)
- Handler throws → result recorded as
isError:trueand, because the action was invoked and is not read-only and not refused, alsooutcomeUnknown:true(production-agent.js, the...(isError ? actionInvoked && !actionIsReadOnly && !actionRefused ? { outcomeUnknown: true } : …)branch). emitToolDonewithoutcomeUnknownadds the tool tounknownWriteToolNamesand clears read-only caches.- The model — which did receive the error text in the tool result — does the sensible thing and re-calls the same tool with fixed inputs. The runner instead emits
activity: "Waiting for previous <tool> result."three times (~2 s apart) and then refuses: result text "Theaction was interrupted 1 time(s), and I could not recover its result. I stopped without running it again. Check whether it completed before asking me to retry." - The run terminates with
errorCode: "write_tool_outcome_unknown",recoverable: false; user-facing text: "I stopped because theaction was interrupted 1 time(s) and its result is unknown." - Retries on the thread repeat 3–4 forever.
Recorded evidence (agent_run_events, verbatim, input fields trimmed)
First failed run:
{"type":"tool_start","id":"call_7xp5o2s8","tool":"define-formulation","input":{…}}
{"type":"tool_done","id":"call_7xp5o2s8","tool":"define-formulation","result":"Error running define-formulation: engine rejected the request (422): 1 validation error for SoboStrategy\n Value error, SOBO strategy can only deal with one no-constraint objective. …","isError":true,"outcomeUnknown":true,"approvalPause":false,…}
{"type":"tool_input_start","tool":"define-formulation","id":"call_5yyu71wq"}
{"type":"activity","tool":"define-formulation","label":"Waiting for previous define-formulation result."} ×3, 2s apart
{"type":"tool_start","id":"call_5yyu71wq","tool":"define-formulation","input":{… adjusted inputs …}}
{"type":"tool_done","id":"call_5yyu71wq","tool":"define-formulation","result":"The define-formulation action was interrupted 1 time(s), and I could not recover its result. I stopped without running it again. Check whether it completed before asking me to retry.","isError":true,…}
{"type":"error","error":"I stopped because the define-formulation action was interrupted 1 time(s) and its result is unknown. Check whether it completed before asking me to retry.","errorCode":"write_tool_outcome_unknown","recoverable":false}
Note the contradiction in step 1's event: the tool_done carries a complete, definitive 422 error message as its result (our backend rejected the request; nothing ran — verified: no backend call, no DB row), yet the same event is flagged outcomeUnknown:true, which then arms the refusal. Five subsequent runs, including one where the model first searched the framework docs and then re-called the tool, all died identically.
Expected
- A way for action handlers to signal a definitive rejection with no side effects (typed error class, result flag, or honoring a 4xx statusCode) so the runner does not stamp
outcomeUnknown. - Or at minimum: when the previous same-tool outcome was a delivered error result (the model saw it), allow the model to re-call the tool instead of refusing with "Waiting for previous … result" — the current behavior turns the model's correct self-correction into a permanent dead end.
Workaround we shipped
Catching 4xx in the action handlers and returning { ok:false, verdict:{kind:"invalid", message} } as a normal result — no throw, no outcomeUnknown, and the model fixes its inputs on the next call. Works, but every app built on engine-backed write actions has to discover this the hard way.
Version notes
Observed on 0.209.0; no core changelog entries for 0.209.1/0.209.2 appear to touch this (releases page), so it may still be current — unverified on those versions. Related but separate report filed earlier today: #7777 (graceful-stop timer leak).
I'd like to take this — plan is to only set outcomeUnknown when the error isn't a definitive 4xx, plus a regression test. PR soon.
thanks for the detailed report, the recorded events made this easy to trace. since 0.209.1, setting retrySafe: true on define-formulation covers it, as long as re-running it after an error can't duplicate or corrupt data: when the handler rejects before it writes, the 422 reaches the model and it can retry with fixed arguments instead of the run stopping. a thread that already recorded the unknown outcome stays blocked, so try it on a new thread. retrySafe isn't in the docs yet, so I'm leaving this open until it is.
closing this now that the fixes and docs are in. a correction to my earlier note: on current versions you don't need a new thread, since a blocked tool runs again on your next message. for your engine's 422, the POST counts as a write as soon as it's sent, so throw NoWriteError (or call noWrite()) when the engine rejects a request, and the agent fixes its arguments and retries in the same turn. retrySafe: true still works too, if re-running define-formulation after any error can't duplicate anything. the details are in the actions docs from #8025. thanks again for the detailed report!