fix(opencode): retry DNS failures and identify terminal responses - #48
Draft
kevoconnell wants to merge 1 commit into
Draft
kevoconnell wants to merge 1 commit into
kevoconnell wants to merge 1 commit into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
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.
Connected-chat requests can recover from a transient DNS lookup failure instead of silently ending, and completion notifications now identify the saved response they belong to. This prevents reply consumers from treating an older answer as the result of a failed turn.
The investigation started from this stuck Slack conversation. A related Messages incident showed
getaddrinfo ETIMEOUTending a request without retry; the deployed processor emitted error/idle before persisting its failed assistant message. The earlier Slack replay stall is a separate finding; this PR does not claim to identify its original blocking operation.Changes
getaddrinfo ETIMEOUT,ETIMEDOUT, andEAI_AGAINerrors. Permit at most two retries using the existing backoff, while honoring a stricter configured budget. Permanent hostname errors and unrelated unknown errors retain their existing behavior.messageIDto error and idle events so consumers can select that response through replay.flowchart TD Request[Model connection] --> Retry[Bounded transient DNS retry] Retry --> Saved[Save assistant result and final parts] Saved --> Terminal[Error or idle carries message ID] Terminal --> Delivery[Consumer settles the identified response]The companion Andytown #27806 consumes the optional identity and deduplicates outbound completion delivery. Deploy consumers before rolling out this runtime. A persistent DNS outage now adds two retry delays (2 and 4 seconds), plus lookup time, before reporting failure. This PR requires a normal Replopencode release and sandbox upgrade; it does not change live sandboxes. Rollback is restoring the previous runtime pin; the wire fields are additive.
Testing Done
bun test test/session/retry.test.ts: 45 passed, including transient/permanent DNS classification and bounded exhaustion.bun test test/session/processor-effect.test.ts: 19 passed, including saved failed-message data and matching terminal identity at notification time.bun test test/session/prompt.test.ts: 61 passed, 1 existing skip, covering follow-ups, shell execution, and cancellation.bun typecheckinpackages/opencode: passed.promptCacheKeyoption.git diff --check: passed.Summary by cubic
Retries transient DNS lookup failures instead of ending the request, and makes terminal error/idle events carry the
messageIDof the saved assistant response so reply consumers no longer settle on an older answer.Transient
getaddrinfo ETIMEOUT,ETIMEDOUT, andEAI_AGAINerrors now retry up to twice with the existing backoff, capped by any configured retry budget. Failed assistant messages are persisted before the terminal event fires, andsession.error/session.idleevents include an optionalmessageID. Permanent hostname errors and unrelated errors keep the previous behavior.Deployment
andytownconsumer before rolling out this runtime.Written for commit 47d938b. Summary will update on new commits.