You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
muse-proxy: MUSE_PROXY_PORT parsed with bare parseInt — the one bin proxy that skips the strict parseProxyPort helper (#483) #661
Every sibling uses parseProxyPort from bin/proxy-port.mjs — codex-proxy.mjs:10, clef-proxy.mjs:8, agy-proxy.mjs:10, antigravity-ls-proxy.mjs:10, design-code-proxy.mjs:6/:9/:10 (7 sites). The helper's header (proxy-port.mjs:1-8, from #483) states the rule and the exact failure modes a bare parseInt causes:
A bare parseInt is not a validator: 'abc' becomes NaN (an opaque ERR_SOCKET_BAD_PORT crash at listen time), '18744abc' and '18744.9' silently become 18744, and '0x4a38' becomes 0, which binds a random ephemeral port while every client keeps dialling the configured one. Every proxy parses its *_PROXY_PORT through here instead, so a bad value fails at startup with the env var and its value named.
muse-proxy was added after that rule (it mirrors codex-proxy per its header comment) and never adopted the helper — and the guard that should have caught it doesn't see it: bin/proxy-port.test.mjs's test "all seven parse sites in the five proxies use the shared helper" enumerates only the five older proxies, so muse-proxy is in neither its import/parseInt checks nor the site count.
99999 → crashes with an unhandled RangeError [ERR_SOCKET_BAD_PORT] stack from node:net, naming neither the env var nor its value
abc → same opaque crash (Received type number (NaN))
0x4a38 → binds port 0 — a random ephemeral port — and logs listening on http://127.0.0.1:0, while clients keep dialling 18747
With the helper, each of these exits 1 at startup with MUSE_PROXY_PORT="<value>" is not a valid port (expected an integer 1-65535).
Why it matters
This is the exact silent-misconfiguration class #483/#494 fixed for the other five proxies: a typo'd MUSE_PROXY_PORT in a service environment either crashes opaquely or — worse, for 0x…/0 spellings — starts "successfully" on a random port while every configured client dials the dead one. The proxy family is meant to be uniform here; one member quietly opting out is how the bug class comes back.
Acceptance criteria
bin/muse-proxy.mjs imports parseProxyPort from ./proxy-port.mjs and parses its port as parseProxyPort('MUSE_PROXY_PORT', 18747); no bare parseInt(process.env.…PROXY_PORT…) remains in the file.
Bad spellings (abc, 99999, 18747abc, 18747.9, 0x4a38, 0, -1) exit 1 at startup with the error naming MUSE_PROXY_PORT and the offending value; unset/empty still defaults to 18747 and a valid value binds exactly that port (existing bin/muse-proxy.test.mjs suite stays green).
The guard test in bin/proxy-port.test.mjs covers muse-proxy: it joins the enumerated proxy list (import + no-bare-parseInt assertions) and the parse-site count goes from seven to eight. If muse-proxy is not launched from home/common/default.nix the way the other five are, the home-manager test's file list should be evaluated separately rather than silently extended.
Cross-repo: muse-proxy exists only in this repo (no MUSE_PROXY_PORT/muse-proxy copy in developing-today/opencode, developing-today/openchamber, or dezren39/nix — grep-verified at filing), so this is a single-repo fix, not a cross-repo set.
Activity
Merge pull request #662 from developing-today/creator/661-muse-proxy-…