Repository navigation
Conversation
Preserved successful HTTP status when the response has no reader and surfaced a no-content result without HTML fallback. Covered 204 health checks and bodyless 503 failures with live endpoints. Fixes #15667
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9eebf2ebeb
ℹ️ 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".
| const reader = response.body?.getReader(); | ||
| if (!reader) { | ||
| return { content: "", contentType, finalUrl, ok: false, status: response.status }; | ||
| return { content: "", contentType, finalUrl, ok: response.ok, status: response.status }; |
There was a problem hiding this comment.
Handle every successful null-body status before rendering
For a GET returning HTTP 205 Reset Content, Fetch exposes response.body as null and response.ok as true, so this now reports a successful load; however, renderUrl only short-circuits status 204. A 205 response can therefore enter the empty-HTML pipeline, trigger .md/content-negotiation and reader-backend requests (including Jina), and eventually be mislabeled as raw-html instead of immediately returning an empty successful response. Either preserve null-body state for the renderer to handle or extend the no-content branch beyond only 204.
Useful? React with 👍 / 👎.
Repro
read {"path":"https://httpbin.org/status/204"}reportedMethod: failedandFailed to fetch URL (HTTP 204).bun -e 'import { loadPage } from "./packages/coding-agent/src/web/scrapers/types.ts"; console.log(JSON.stringify(await loadPage("https://httpbin.org/status/204")))'returnedok: falsefor status 204 before the fix.Cause
loadPageinpackages/coding-agent/src/web/scrapers/types.tstreated a missing response body reader as an HTTP failure regardless ofresponse.ok;renderUrlinpackages/coding-agent/src/tools/fetch.tsthen rendered a failed read.Fix
response.okwhenloadPagereceives a bodyless response.no-contentread with a status note, without attempting HTML extraction.Verification
bun test packages/coding-agent/test/tools/fetch-http-status.test.ts packages/coding-agent/test/tools/fetch-raw-mode.test.ts packages/coding-agent/test/tools/fetch-binary-dispatch.test.ts packages/coding-agent/test/tools/fetch-url-selectors.test.ts— 29 passed. DirectfetchReadUrlsmoke againsthttps://httpbin.org/status/204returnedMethod: no-contentandNotes: HTTP 204 No Content;bun run check:tspassed. Skipped the PR pre-publish gate (bun run fix,bun check,bun run test) becausebun run testfailed on the branch and the identical grep-internal-URLs chunk fails on a cleanorigin/mainsource snapshot: two long-line assertions inpackages/coding-agent/test/tools/grep-internal-urls.test.ts. The same-email Codex workspace assertion inpackages/coding-agent/test/usage-cli.test.tsalso fails identically onorigin/main. No files in either failing path differ fromorigin/main. The branch push pre-publish gate completed. The local Rust build also could not write its shared cache (Operation not permitted), independently of these TypeScript changes.Fixes #15667