fix(loop): retry recoverable stream/parse error instead of killing the run#74
Merged
arniwesth merged 1 commit intoJun 27, 2026
Conversation
… the run dispatch_step Err (e.g. a Go-side 'XML syntax error ... unexpected EOF' from AILANG std/xml choking on the model's malformed DOCX XML, surfaced as AIError code=Internal) terminated the whole run with finish=error at the step it happened. Now re-issue the step (fresh generation), bounded by step_budget. Same pattern as arniwesth#13 (length) / arniwesth#19 (empty). Disable: MOTOKO_RETRY_STREAM_ERROR=0.
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.
Problem
A stream/parse error mid-step — e.g. the AILANG
std/xmlprovider raising "unexpected EOF" while parsing a partial generation — currently terminates the whole run (finish=error). One transient hiccup kills an otherwise-healthy session. This is the failure mode behind several "the model died" reports that turned out to be harness-side, not model-side.Fix (+16 / −2,
agent_loop_v2.ail)Treat a recoverable stream/parse error the same way #13 (truncation) and #19 (empty response) are already treated: re-issue the step (fresh generation) instead of bailing.
step_budget— can't loop forever.MOTOKO_RETRY_STREAM_ERROR(default1); set0to restore the old kill-on-error behavior.stream_error_retrytelemetry event so it's visible, not silent.Caveat (why this is draft)
This is a backstop, not a root-cause fix. I haven't yet pinned the exact source of the
std/xml"unexpected EOF" — that needs a debug build to capture the raw partial generation. The retry stops it from killing runs today, but you may prefer:Posting as draft to decide scope. The env gate + telemetry event make it safe to ship as-is if you'd rather have the backstop now and chase the root cause separately — your call.
🤖 Generated with Claude Code