Skip to content

design-code-proxy: DESIGN_CODE_PROXY_BACKEND_TIMEOUT_MS has no upper bound — a value over 2^31-1 is silently truncated to ~24.8 days, defeating the #2097 silent-backend timeout (house parseProxyMillis bypassed) #4225

Closed

Description

@dezren39

Summary

bin/design-code-proxy.mjs parses DESIGN_CODE_PROXY_BACKEND_TIMEOUT_MS with a hand-rolled Number() guard that checks only Number.isFinite(raw) && raw > 0 — no upper bound and no integer-spelling check. Values above 2^31−1 are silently truncated by Node's timer layer to 2147483647 ms (~24.8 days), so a too-large value defeats the #2097 backend-inactivity timeout instead of extending it modestly; non-decimal spellings (0x10 → 16 ms, 1e5) are also admitted. The house helper for exactly this — parseProxyMillis in the sibling bin/proxy-port.mjs, which this file already imports parseProxyPort from — refuses anything outside integer 1..2147483647 at startup, naming the variable.

Evidence (verified this run, 2026-11-02)

  • bin/design-code-proxy.mjs:27-30 (md5 c1460c96f7a72fa35231051f93c33de0):

    const BACKEND_TIMEOUT_MS = (() => {
      const raw = Number(process.env.DESIGN_CODE_PROXY_BACKEND_TIMEOUT_MS);
      return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 60_000;
    })();
  • The value feeds clientReq.setTimeout(BACKEND_TIMEOUT_MS, …) (bin/design-code-proxy.mjs:249) and localReq.setTimeout(BACKEND_TIMEOUT_MS, …) (bin/design-code-proxy.mjs:463) — the design-code-proxy: backend dispatch has no timeout — a backend that accepts and never responds hangs the request forever and the fallback never fires #2097 silent-backend protection.

  • bin/proxy-port.mjs:50-70 (md5 b833b6038a74d5a34b78306c70702f0f): MAX_TIMEOUT_MS = 2147483647 and parseProxyMillis/parseProxyMillisValue refuse non-integer or out-of-range values with a startup error naming the env var. design-code-proxy.mjs:4 already imports from this module (ports only).

Laptop probe (Node v24.21.0): an HTTP request to a silent local server with req.setTimeout(2147483648, cb):

(node) TimeoutOverflowWarning: 2147483648 does not fit into a 32-bit signed integer.
Timer duration was truncated to 2147483647.
no timeout callback within 3000ms

So DESIGN_CODE_PROXY_BACKEND_TIMEOUT_MS=2147483648 (or any larger finite value, e.g. a typo'd extra zero) does not produce an error and does not produce the requested timeout — it produces a ~24.8-day inactivity timeout, i.e. a silent backend holds the client request and a pooled keep-alive socket effectively forever, which is exactly the hang #2097 added this timeout to prevent. Conversely 0x10 is admitted as a 16 ms timeout, which would kill every slow-but-alive backend call.

Why it matters

The timeout is a hang-protection mechanism; a configuration path that silently converts it to ~25 days (or to 16 ms) removes the protection while the process starts healthy and logs nothing. Sibling proxies' env numbers are being moved onto the strict helper family (#2835 design; per-file instances filed for other proxies), and this one was missed because it has a partial guard — finite-and-positive looks validated at a glance.

Acceptance criteria

  • DESIGN_CODE_PROXY_BACKEND_TIMEOUT_MS is parsed through parseProxyMillis (or an equivalent strict check): decimal integer, 1..2147483647, startup error naming the variable and value otherwise.
  • Unset/empty keeps the 60_000 ms default.
  • Tests in bin/design-code-proxy.test.mjs cover: 2147483648 refuses to start (or is refused by the parse), 0x10 / 1e5 refused, a valid value (e.g. 5000) honoured.
  • Existing design-code-proxy tests still pass.

Activity

  1. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    effort/sSmall: expected under 2 hours of work
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked_up
    task: 6114 (repo-health-code-pilot, repo-worker-code; openchamber-scheduled-lane 7b47536b)
    state: claimed; triaging #4225 on fresh origin/main before any work.

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  5. 26 remaining items

  6. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 3, 2026
  7. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  8. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 3, 2026
  9. added a commit that references this issue on Nov 3, 2026
  10. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: done (task 8758)

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

Metadata

Metadata

Assignees

Labels

app/design-code-proxybin/design-code-proxy.mjs fleet proxyeffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions