A local-first multi-agent app development platform, built on PenguinHarness
Stop reasons converge to four values
- Date: 2026-08-24
- Type: refactor
- Scope:
core,server,web,cli - PR: #458
- Breaking: yes —
StopReasondropsfailed/timeout/malformed/authin favor ofretryable/fataland becomes the only stop-reason vocabulary (ToolStopReason/CompactionStatus/McpConnectStatusare removed);LLMOutcome.permanentis removed; the Web composer's auth-dead gate is retired
There is now exactly one stop-reason vocabulary: completed / aborted / retryable / fatal, used by every message and event that carries a stop reason — LLM fragments, tool outputs, compaction ends, MCP connect ends. A stop reason answers exactly one question — should this be retried — and the concrete failure rides on error_message (LLMOutcome.errorMessage → request_end.error_message) instead of on the reason value.
retryable covers everything worth another attempt: transport drops, idle timeouts, 408/429/5xx, malformed or truncated responses, and every unclassifiable error — the fatal detector is a deterministic allowlist, so a gateway phrasing a transient fault its own way keeps its retries. The engine reconnects on the existing backoff ladder, unchanged.
fatal covers what no retry can fix: a provider 4xx rejection (408/429 excluded), a credentials failure, fast mode on a model without a fast tier, and input that fails to assemble into a request. The engine stops the run and surfaces the message at once. Previously a deterministic 400 was classified failed and burned the whole five-step ladder before the user saw the actionable error — the direct motivation, uncovered while diagnosing the Vertex mixed-content 400.
Details
LLMOutcome.permanentis gone:fatalis the classification, not a flag on a classification. The engine's fatal branch replaces the formerauthand permanent-failed branches.- The dedicated
authstatus is gone, and with it the Web composer's auth-dead input gate (the time-gated lock cleared bycredentials_updated): a fatal's reason shows in the failure banner, and after fixing the key the user simply sends again.credentials_updatedremains as an informational broadcast; the server-side runtime-cache invalidation it announced is unchanged. - Tool outputs rarely say
retryable: a tool error or timeout is definitive for that call — nothing in the harness retries a tool — so failures converge tofataland are fed back to the model as content for it to adjust. The separateToolStopReasontype is gone. compaction_end.statusdistinguishesretryable— abandoned this time on exhausted retries, and the standing trigger makes it up at the next opportunity — fromfatal— the attempt died on a failure no retry can fix, so the model configuration needs fixing first. The Web and CLI compaction banners word the two differently. The separateCompactionStatustype is gone.mcp_connect_end(overall and per-server) joins the same vocabulary: a failed connect isfatal— nothing retries it within the run. The separateMcpConnectStatustype is gone.- The server's error records reclassify:
llm_fatal(unexpected),llm_failed(retries exhausted, unexpected),llm_retried(absorbed by the ladder, expected); tool failures file astool_fatal:<name>. The oldllm_auth/llm_timeout/llm_malformed/llm_failed_retried/tool_failed:/tool_timeout:codes are no longer produced. An exhausted retry run is now recorded as unexpected — previously an exhausted timeout still filed as expected. - The model connectivity probe passes any
retryableending that streamed real content (previously only themalformedshape did): content arriving is what a connectivity test measures. - Legacy Traces stay readable: replay only ever compares against
completed, and the Web, CLI and trace analysis keep rendering the retired spellings (failed/timeout/malformed/authon LLM fragments,failed/timeouton tool outputs,failedon compaction and MCP ends).
Compatibility
Nothing on disk changes and no migration runs; Traces recorded with the retired spellings keep rendering, as the last point above states.
The break is source-level, for an SDK embedder or an HTTP consumer that reads a stop reason.
Replace failed / timeout / malformed / auth with retryable where the work is worth another
attempt and fatal where it is not, and read the concrete failure off error_message rather than
off the reason value. ToolStopReason, CompactionStatus and McpConnectStatus are gone — import
StopReason in their place — and a check on LLMOutcome.permanent becomes a check for fatal. A
consumer of the server's error records replaces the retired llm_auth / llm_timeout /
llm_malformed / llm_failed_retried / tool_failed: / tool_timeout: codes with llm_fatal /
llm_failed / llm_retried / tool_fatal:<name>.