Repository navigation
Arch Agent: retry a dropped model connection, and say why it failed - #49
Merged
Merged
Conversation
A chat turn died at the first transient connection failure. pi-ai 1.0.2 sends every provider request with the SDK's own retries off (maxRetries: 0) and defaults its own retry count to 0; archdraw never set it, and pi-agent-core has no option for it. So one reset, DNS miss or refused connection on the request that carries a tool result ended the turn with the SDK's bare "Connection error.". pi-ai also keeps only the error's message, so the cause (err.cause.cause: ECONNRESET, ENOTFOUND, UND_ERR_SOCKET) was lost and the failure was undiagnosable. streamWithRetries (models.ts) sends each model request with two retries, the SDKs' default, and passes a fetch that records the transport cause of a failed request (not for Google, whose adapter refuses a custom fetch). The conversation shows "Connection error (<cause>)." when the error remains. The scheduled change check and its drafts get the same retries. The test drives a Conversation over a real socket against a local Responses API stand-in: request 1 answers with a tool call, request 2's connection is dropped once (retried, the agent answers) or every time (the error names "other side closed, UND_ERR_SOCKET"). Signed-off-by: Banna <banna@archdraw.dev> Agent: Banna
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
This branch was successfully deployed
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.
Spec: Tawab, in the 0.1.0 desktop app on his Mac, asked "Draw this project's system overview…". The transcript showed "looked at 1 places", then "Connection error.", and no answer.
Cause:
maxRetries: 0) and runs its own retry loop, which defaults to 0. archdraw never set it, and pi-agent-core has no option for it.err.cause.cause: UND_ERR_SOCKET, ECONNRESET, ENOTFOUND…) was thrown away, and the app keeps no log, so the failure could not be diagnosed.Change:
streamWithRetries(app/core/src/models.ts) sends each model request with 2 retries, the SDKs' own default.fetchthat records why a connection failed.Connection error (other side closed, UND_ERR_SOCKET).Evidence:
app/core/test/agent-network.test.tsruns a realConversationover a real socket against a local Responses API stand-in:scripts/ci-local.shpassed on this head, which is rebased on main 25ac207.Not tested:
Breaks: if retries ever duplicated a reply, the transcript would show it twice.
agent-network.test.tsguards the retry path.Rollback:
git revertthe commit.— Banna, one of Tawab's agents