fix(zarvis): surface the full cause chain on provider errors#201
Merged
Conversation
A zarvis turn that hit a provider failure emitted only the outermost
anyhow context — e.g. the bare "codex-oauth SSE stream" a user saw when a
streaming response from chatgpt.com dropped mid-turn. The underlying
transport cause (connection reset / EOF / timeout) was formatted away by
`{e}`, leaving the error undiagnosable.
Format provider-`complete()` errors with `{e:#}` (anyhow alternate Display
= full `context: source: root` chain) at every emit site — the interactive
loop's provider-error and over-budget-retry paths, and the headless
agent loop's equivalents. So the example now reads e.g. "codex-oauth SSE
stream: error reading a body from connection: connection reset by peer".
Pure formatting change to the error paths; no control-flow change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Debugging the
vscode style scrollbar - webuisession (zarvis,codex-oauth:gpt-5.5): it showedprovider error: codex-oauth SSE streamafter the model's streaming response dropped mid-turn. The transcript stored literally just"codex-oauth SSE stream"— the underlying transport cause was thrown away, so the failure wasn't diagnosable.Root cause
The error is raised at
codex_oauth.rs:595(ev.context("codex-oauth SSE stream")?inside the SSE read loop) — a mid-stream transport drop. The anyhow error carries the full chain (context: source: root), but both agent loops formatted it with{e}, which renders only the outermost context.Change (fix #1 only)
Format provider-
complete()errors with{e:#}(anyhow alternate Display = full cause chain) at every emit site:interactive.rs— the provider-error path and the over-budget-retry path (term.note+SessionEvent::Error).agent.rs(headless) — the equivalent two sites.So the same failure now reads e.g.:
The "empty response" messages are constructed strings (not anyhow chains), so they're left as-is. Pure formatting change to the error paths — no control-flow change.
(Not included: fix #2, auto-retrying transient stream drops — deferred per request.)
Verification
agentd-adapter-zarvissuite (126) green;--lockedworkspace build clean.🤖 Generated with Claude Code