Repository navigation
fix(agent): keep the attachment host out of the unreachable-attachment error - #5708
Conversation
…t error The agent and chat attachment check named the URL host in its reason, so a loopback, private-network or local-network hostname appeared in the error text sent back for the turn. The reason now says what kind of host it is without repeating it, matching the provider runtime message. The relative URL reason no longer echoes the input either. The URL itself stays on UnreachableAttachmentError for server-side callers.
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c28d0eaae5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…e-attachment test
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|



Problem
When an agent or chat turn carries an attachment whose URL points at a host the model provider cannot reach (loopback, private network, a local-network name, or the unspecified address), the turn fails with
UnreachableAttachmentError. The error message quoted that host, for example"files.corp.internal" is a local-network name .... The message reaches the client stream body, so the sender saw an internal hostname or address that is not theirs to see.Cause
In
src/agent/runtime/attachment-reachability.ts, the loopback, private-network, local-network-name and unspecified-address reasons all put the hostname in quotes. The relative-URL reason repeated the raw input, so a host-only string such as//10.0.0.5/a.pngwas echoed too.UnreachableAttachmentErroradds the reason to its message.Change
describeUnreachableIPv4anddescribeUnreachableIPv6no longer take the unused hostname parameter.attachmentUrlstays on the error object for server-side callers. No other callers needed changes:inline-file.tsonly checks whetherdescribeUnreachableAttachmentUrlreturnsundefined, and the message converter only throws the error.Tests
In
src/agent/runtime/attachment-reachability.test.ts:.local,.internalwith a trailing dot, and the host-only relative form.localhostnow asserts it saysloopbackand does not containlocalhost.Results, all run with
deno task test:file src/agent/runtime/attachment-reachability.test.ts:Attachment "report.pdf" cannot be sent to the model: "files.corp.internal" is a local-network name ....deno fmt --checkanddeno linton the two changed files: clean.Review
An independent review found no blocking issues. It suggested one optional test addition: URL rewrites
[::ffff:192.168.1.4]to[::ffff:c0a8:104], so the mapped case only checked the hex form. The test now also checks the dotted192.168.1.4the sender typed (separate commit). No production code changed in that round.Not verified
Left to CI: typecheck, the full unit and integration suites, and verify. I did not run
tests/integration/agent/runtime-stream-error-origin.test.ts; its assertion checks only the message prefixAttachment "capacity.png" cannot be sent to the model, which is unchanged. I did not runsrc/provider/runtime-loader/private-network-file-url.test.tsortext-generation-runtime-message-converter.test.ts; a search found neither asserting on the changed reason text.