Skip to content

[Bug]: Return null bodies for 204 and 205 in raw outbound transports #5109

Closed

Description

@lidge-jun

Client or integration

Direct HTTP/API client

Area

Proxy and routing

Summary

The pinned direct helper constructs a streaming Response for every 2xx response, including 204 and 205. The SOCKS helper excludes 204 but misses 205. These statuses require a null body at the Fetch Response boundary, so a valid no-content upstream response can fail during response construction instead of resolving normally.

Reproduction

Static source trace at 7864869c31c41cca9830d93540238f17df8faafb; the following fake-upstream regression is the proposed executable reproduction, not a claimed local test result.

  1. Have a fake HTTP upstream return 204 or 205 with no content and keep its connection alive.
  2. Invoke pinnedHttpGet against its pinned loopback address. Separately return 205 through a fake SOCKS tunnel.
  3. Assert the call resolves promptly with the original status and body === null, even when representation headers describe an unsupported coding. Current source attaches a stream in those cases.

Version

7864869

Operating system

Source review on macOS 27.0; the transport logic is cross-platform. Runtime reproduction has not been executed in this analysis.

Provider and model

Not provider- or model-specific. Use a local fake upstream and no real credentials.

Logs or error output

No live traffic or runtime logs collected. Evidence is the exact source path below.

Screenshots and supporting files

src/lib/pinned-http.ts:144; src/lib/pinned-http.ts:194; src/lib/socks5-fetch.ts:512. Related #2894 and merged #5070; neither covers this residual status set. Fetch null-body status and HTTP 205.

Redacted configuration

Use a test-owned loopback upstream and SOCKS tunnel or the pinned direct helper as specified above. No user home, provider credentials or running proxy is needed.

Implementation path

  1. MODIFY src/lib/socks5-fetch.ts: include 205 in bodylessResponse; keep HEAD/204/304 behavior.
  2. MODIFY src/lib/pinned-http.ts: branch on null-body status before creating the success stream and safely terminate the underlying response/request. Preserve response headers.
  3. Share a small eligibility predicate only if it simplifies these two owners; do not introduce a broad transport framework. Keep unsupported upgrade behavior outside this issue.
  4. ADD a focused sibling tests/lib/transport-null-body.test.ts or extend uncapped existing tests.

Acceptance criteria and verification

  • 204/205 settle with null body without waiting for connection close.
  • HEAD/304 existing behavior remains covered where the transport supports those request/status paths.
  • 205 carrying Content-Encoding: br is not decoded or rejected for nonexistent body bytes.
  • Ordinary 200 JSON and cleanup/cancellation still work.

New test files must be registered in scripts/test-layout/layout.json and tests/fixtures/test-layout-expected.json; split tests rather than raise file-size caps. Update structure/transports/inventory.md and any other owner declared by the manifest. Run focused regressions and exact-head hosted CI in the implementation PR; no passing runtime result is claimed here.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Sep 19, 2026
  2. added
    proxy
    on Sep 19, 2026
  3. lidge-jun commented on Sep 19, 2026

    @lidge-jun
    OwnerAuthor

    Resolved on dev by #5125, merge commit 4e7d7132d8f8a7d46e460b48c5104a6d5ced4567.

    Both raw transports now honor the supported null-body status contract, including 205, and preserve representation headers without decoding nonexistent content. The new regressions cover pinned 204/205, ordinary pinned 200, and SOCKS 205 with observed connection closure before teardown; existing HEAD/304 coverage remains present.

    Exact reviewed head 6557add72b48e91f8fdb5805a82192777b7d3286 passed all applicable hosted checks, including the final aggregate: https://github.com/lidge-jun/opencodex/actions/runs/35430059298. The new cases are visible as passing in Linux test 4/4 and macOS 2/2 logs. Actual merged state and dev tip were reread before closure. Local suites/typecheck/build/install were not run. Follow-up decoding and upload lifecycle remain separate issues.

  4. lidge-jun commented on Sep 19, 2026

    @lidge-jun
    OwnerAuthor

    Final acceptance audit found one remaining verification gap in the original criteria: direct HEAD/null-body behavior through the supported raw SOCKS transport is not exercised by the current regression suite. Reopening for that focused coverage and hosted execution evidence. The existing implementation and its recorded successful checks remain valid for the cases they cover; this is not a claim of a newly observed production failure. A separate scoped regression follow-up will supply the missing witness before re-closure.

  5. lidge-jun commented on Sep 20, 2026

    @lidge-jun
    OwnerAuthor

    Original acceptance verification is now complete. Follow-up #5225 landed on dev as3f9fe3fa2993126c95a0c64627f4a5d609e0a1a7, with verified ancestry and reviewed tree088e56b6379cd5dbf6b28fd5db8f682bd362a468. Exact-head run35477114410 at9e3ee90f passed all applicable jobs; macOS log105988178081 directly shows the real SOCKS HEAD null-body/header/cleanup case passing. This supplements the preserved #5125 implementation evidence without changing production behavior or weakening checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugproxy

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions