Repository navigation
Description
Summary
In the Pier-executor harness A/B (DeepSWE), the container-CLI competitor arm (Codex/Kimi) is serialized to one attempt at a time by a module-level lock on host proxy port 443. This caps effective concurrency regardless of pairConcurrency, so a 30-task Maka-vs-Codex run is bound by ~30 sequential Codex arms (~20h wall clock). Raising MAKA_HARNESS_AB_PAIR_CONCURRENCY from 2 to 4 does not help — only the Maka arm parallelizes.
Root cause
Pier's Squid egress for offline (allow_internet=false) tasks only permits destination ports 80/443. A container-CLI arm reaches the host provider auth-proxy through Squid, so the proxy must listen on a Squid-legal port; it defaults to 443. Two proxies cannot bind the same host port at once (EADDRINUSE), so the runner serializes the whole proxy-holding section on that port:
packages/headless/src/pier-task-runner.ts:77-87— module-level per-port queuewithProxyPortLock.packages/headless/src/pier-task-runner.ts:366-373— a non-makaarm on a fixed port runslaunchAttempt(bind →pier run→ full trial, ~40 min) entirely underwithProxyPortLock(443, …); the Maka arm (loopback/ephemeral) runs unlocked.
Observed on a live subset-30 run at pairConcurrency=4: 4 Maka arms active + exactly 1 Codex arm active; the other 3 Codex arms' promises were parked inside withProxyPortLock(443) before spawning pier (empty trial dirs). This matches the design exactly — it is not a bug, but the concurrency ceiling is now the binding constraint.
Options
A. Minimal — 2-slot port pool over {443, 80}
Turn the single-port lock into a pool that hands out a free Squid-legal port from {443, 80} and holds that slot for the trial. The chosen port already flows to the container via proxy.baseUrl → MAKA_PROVIDER_PROXY_URL (pier-task-runner.ts:735), so no container-side wiring changes. ~10-15 lines + a pool acquire/release/exhaustion test.
- Effect: 2 concurrent container-CLI arms → Codex side ~20h → ~10h.
- Ceiling: 2 (only two Squid-legal ports). Matches an A/B that has exactly one competitor arm per pair, i.e. pairs with
pairConcurrency=2.
B. Thorough — one shared proxy, demux by per-attempt token
The scarce resource was never "a proxy" or "port 443"; it is per-attempt attribution. A single long-lived host proxy on 443 can serve unlimited concurrent container arms if it maps each incoming per-attempt scoped token to its attempt (Squid multiplexes many CONNECTs to the same host:443 fine).
- For Codex specifically this is cleaner than general: usage is metered from the codex rollout files (
providerProxyUsageProtocol('codex')is undefined), not through the proxy, so the shared proxy needs only per-attempt credential resolution (resolveUpstreamCredentialalready has that shape) — no usage demux. The Kimi path does meter via the proxy and would need token→attempt usage bucketing. - Effect: container-CLI concurrency bounded only by the provider account (a subset-30 run already sustains 4 Maka + 1 Codex = 5 concurrent streams on one ChatGPT OAuth account without throttling), not by ports.
- Cost: hoists the proxy from attempt scope to run scope with per-attempt register/deregister and telemetry bucketing — larger blast radius; should land as its own PR with tests.
Recommendation
Ship A (2-slot pool) + pairConcurrency=2 for the immediate DeepSWE runs and the #1343 K3 head-to-head: small, low-risk, 2× speedup, and right-sized since each A/B pair has exactly one competitor arm. Keep B as the correct end-state to do properly when the harness is industrialized.
Notes
- Verified against current
mainsource (post PR feat(headless): run DeepSWE via Pier as a benchmark axis of the harness A/B #1398 merge). No code was changed while diagnosing this. - The code comment at
pier-task-runner.ts:74-76already anticipates option A ("A pool over both Squid-legal ports is deferred until concurrency actually needs it"). - Blocks/relates to eval(headless): DeepSWE 1.1 discriminative-30 harness A/B — Maka vs Kimi Code and Codex CLI #1343.
Activity
Astro-Han commentedon Aug 2, 2026
Resolved by #1502 (share Pier provider proxy across concurrent attempts), merged 2026-07-26.
The module-level port-443 lock that serialized container-CLI arms is now only a fallback for non-hub setups; Pier benchmark runs share one listener through
providerProxyHubwith per-attempt token demux, so A/B concurrency is no longer capped by the proxy port. This is the option-B end-state the issue recommended. #1343 remains open as a separate benchmark-run tracking issue.