Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(debug): report bound port in capture-first-inference

Steven Enamakel37f313f6eb57
diff --git a/scripts/debug/capture-first-inference.mjs b/scripts/debug/capture-first-inference.mjs
index 9b420500ee..9b381c5c7b 100644
--- a/scripts/debug/capture-first-inference.mjs
+++ b/scripts/debug/capture-first-inference.mjs
@@ -303,8 +303,11 @@ const server = http.createServer((req, res) => {
});
server.listen(listenPort, listenHost, () => {
+ // Report the bound port, not the configured one: CAPTURE_PORT=0 asks the OS
+ // for a free port, which is how the self-test runs several proxies at once.
+ const boundPort = server.address().port;
process.stdout.write(
- `[capture] listening on http://${listenHost}:${listenPort}; forwarding to ${upstream.origin}` +
+ `[capture] listening on http://${listenHost}:${boundPort}; forwarding to ${upstream.origin}` +
`; summaries → ${summaryLogPath}` +
`${captureAll ? `; recording every request under ${captureAllDir}` : ''}\n`
);