Skip to content

feat(headless): let the Maka arm run where its competitors run - #2177

Merged
Astro-Han merged 8 commits into
mainfrom
feat/headless-maka-task-run-under-harbor
Aug 5, 2026
Merged

Astro-Han merged 8 commits into
mainfrom
feat/headless-maka-task-run-under-harbor

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Every competitor adapter runs its CLI inside the task container. The Maka arm ran from the host and bridged tool calls in, so it was the one arm a defect in the container path could not reach — and this benchmark found three of those (#2090, #2146, #2151), each of which cost in-container arms cells that the host-side arm never risked. A comparison whose arms do not share an environment cannot attribute a difference to the agents, which is the only thing the comparison exists to measure.

The adapter already had the mode. What gated it was _task_run_in_container also requiring a NetworkAllowlist, which exists only under Pier. That clause reads as a safety check and is not one: every competitor runs in the task container under plain Harbor and returns None from network_allowlist there. It was a condition this arm alone had to satisfy in order to stand where the others already stood, and the arms it was compared against were exactly the ones it excluded it from joining.

Harbor's runner then had no way to place it. The Node toolchain mount, its fingerprint, and the container-side provider channel lived only in the Pier runner; the repo mount carries Maka's code but nothing in the task image is pinned to execute it. Harbor's runner has them now. Two settings also had to start following placement instead of arm identity: MAKA_HOST_* names a host the container cannot see, and advertisedHost: 127.0.0.1 inside the container names the container, so the arm would dial itself.

Opt-in via MAKA_HARNESS_AB_MAKA_PLACEMENT=task-container, not a flipped default. This changes the shape of the experiment rather than a parameter of it, so both topologies stay runnable and can be run against each other — which is the only way to show whether a difference came from the agent or from where it ran.

Refs #1970.

Verification

  • npm --workspace @maka/headless run test:dist — 0 failures.
  • npm run typecheck — clean; npm run format:check — clean.
  • Placement resolution: harbor defaults to host-bridge, honours task-container, pier is always task-container, and both an unknown value and host-bridge under Pier are rejected.
  • Manifest identity: host-bridge and task-container produce different fingerprints, and the historical Terminal-Bench and DeepSWE fingerprints are unchanged (harness composition preserves historical manifest fingerprints passes).

Not verified: no container has been run in this placement. Everything above is wiring and identity; whether an in-container Maka arm actually starts, mounts its toolchain, reaches the provider proxy and produces a graded cell is untested. That is what the task list below covers, and it is why this is a draft.

Review focus

Recording placement in the manifest was deliberately narrowed. An earlier revision recorded it for every arm on every executor, which is more accurate but changed the fingerprints of every historical run: describing a fact that was always true would have forked the identity of runs whose configuration never changed. It is now recorded only where this arm leaves its historical placement. The cost is that a Harbor-executor manifest still does not state that the competitor arms run in the task container; that fact is currently recoverable only from the adapter type.

Second commit: the apt mirror

639f9002 is a separate concern from placement and is revertable on its own. It is here because both are harness-environment changes that have to be deployed together to run the canary, and because the canary itself is what exposed the problem.

Terminal-Bench task images are bare ubuntu:24.04 plus curl, so most tasks apt-install what they need. That makes the benchmark depend on archive.ubuntu.com being reachable from the run host. On the current run host it is not: measured directly, it returned 0 bytes on two of three attempts and 9.8 KB/s on the third, while github.com (2.1 MB/s) and the model provider (150ms) were both fine.

The cost is not slowness, it is noise. The Maka arm ran configure-git-webserver twice in task-container placement, issued an identical 24 tool calls both times, and finished in 479s on one run and hit the 900s deadline on the other. The whole difference was how long apt stalled — 775s of the failing run sat in three Bash calls. Noise of that shape does not cancel across arms; it charges whichever agent happened to need more packages.

MAKA_HARNESS_AB_APT_MIRROR redirects the two apt hosts through a compose overlay layered after the harness compose file, so Compose merges the redirect beside the host.docker.internal:host-gateway mapping every competitor arm dials rather than replacing it (verified with docker compose config). No task image and no sources list changes — the container still resolves and requests archive.ubuntu.com.

It is opt-in and recorded in the manifest, in a way that forks the fingerprint so a redirected run cannot resume one that fetched from Ubuntu's own hosts. Runs that do not redirect keep their existing fingerprints.

Any published number from a redirected run has to disclose this. It changes the environment every task runs in.

Third commit: the proxy's usage on abort

9dae4bee is the second thing the canary found, and the more serious one. The proxy is the only token and cost source for every arm that is not Maka, and its abort path never asked the usage parser for what it had already read. Providers put the usage frame at the end of a stream but not after it, so the frame had usually arrived; it was simply discarded.

That does not produce a gap the report can see. The cell keeps the usage of whichever requests happened to reach [DONE] and reads as fully metered. On four-arm-canary-v5 one arm was credited 1,088 output tokens against a true 27,633 — its short requests completed, its long ones were hung up on — while the other three matched their own logs to the token, so nothing looked wrong.

Measured on four-arm-canary-v6 after the fix, from the proxy's own per-request telemetry:

arm requests aborted aborted with usage kept aborted, usage lost
reasonix 43 20 20 0
codex 31 1 1 0
claude-code 14 0 — 0

All four arms' proxy-metered output now equals their own logs exactly (maka 10,040 / codex 24,708 / claude-code 9,994 / reasonix 16,334). Codex had one aborted request this round and zero the round before, which is why it happened to agree in v5 — agreement there was luck, not immunity.

Locked by provider auth proxy keeps usage from a stream the client hangs up on, verified by mutation: reverting the drain turns that test red.

Remaining work

  • Run one cell with the fake backend in task-container placement — proves the toolchain mount, provider channel and process scope without spending provider budget.
  • Run the predeclared canary in this placement for all arms — four arms, all in the task container, all scored, teardown clean, zero stalls. codex, claude-code and reasonix passed; the Maka cell hit the deadline on an apt stall, which is what the second commit addresses.
  • Re-run the canary with the mirror redirect — the Maka cell went from a 900s deadline abort to 111s and a pass, on an identical 23–24 tool calls.
  • Confirm every arm's economy column is trustworthy — four-arm-canary-v6, all four arms metered exactly, infraFailed: 0, zero stalls.
  • Decide whether the full run adopts this topology, and record the decision on eval(headless): benchmark Maka, Codex, and Claude Code synchronously on DeepSeek V4 Flash #1970.

@Astro-Han

Copy link
Copy Markdown
Contributor Author

Verified against a real container. placement-canary-v1..v3, task configure-git-webserver, MAKA_HARNESS_AB_MAKA_PLACEMENT=task-container:

arm placement status reward
maka task-container completed 1
claude-code task-container completed 1

The pinned Node toolchain mounts and passes its sha256sum --check, the adapter runs Maka's CLI from the repo mount in --mode task-run, the provider channel reaches the host proxy from inside the container, and the verifier grades the cell. No stalls; the stall observer logged nothing.

It took three attempts, and each failure was the same defect wearing different clothes: code that answers "is this Maka?" when the question is "which side of the container boundary is this?". That equivalence held for years because it was true — Maka was the host-side arm — so nothing enforced the distinction.

  1. _task_run_in_container also required a NetworkAllowlist, which exists only under Pier (in the original diff).
  2. MAKA_NODE_TOOLCHAIN_FINGERPRINT was set on the provider channel; the adapter reads it from the agent env, like every other pinned toolchain. The mount arrived and the arm could not start (introduced by me in the original diff, f231130).
  3. usesHostProviderProxy returned agent !== 'maka'. On the host Maka can hold a credential; in the container it has none and needs the proxy every competitor already uses (a1430b8).

Worth recording for how this PR was reviewed: typecheck, the full headless suite, and the manifest-fingerprint checks were all green across every one of those three failures. None of them could catch any of it — they verify wiring and identity, not whether the arm starts. That is why the first revision said in bold that no container had been run, and it is the reason to treat "green" and "verified" as different claims here.

Also confirmed in passing: docker compose exec -e puts the run's proxy credential in plaintext in the host process list. Already recorded on #1970; not introduced by this PR, but a four-arm run adds another arm holding it.

Remaining before this leaves draft: run the canary with all four arms in this placement, and decide on #1970 whether the full run adopts the topology.

Every competitor adapter runs its CLI inside the task container. The Maka
arm ran from the host and bridged tool calls in, so it was the one arm a
defect in the container path could not reach — and this benchmark found
three of those. A comparison whose arms do not share an environment cannot
attribute a difference to the agents.

The adapter already had the mode; what gated it was `_task_run_in_container`
also requiring a `NetworkAllowlist`, which exists only under Pier. That read
as a safety check and was not one: competitors run in the container under
plain Harbor and return no allowlist there, so it was a condition this arm
alone had to meet to stand where the others already stood.

Harbor's runner had no way to place it: the toolchain mount, fingerprint and
container provider channel lived only in the Pier runner. It has them now,
and the loopback address and provider channel follow placement rather than
arm identity, since `MAKA_HOST_*` names a host the container cannot see.

Opt-in, not a flipped default. This changes the shape of the experiment, so
both topologies stay runnable and get distinct manifest fingerprints — while
host-bridge runs keep the fingerprints every existing run resumes against.
The adapter re-verifies the mounted Node toolchain against this fingerprint
before it will install, and it reads it from the agent env, like every other
pinned toolchain. It was being set on the provider channel instead, so the
mount arrived and the arm could not start: "MAKA_NODE_TOOLCHAIN_FINGERPRINT
is required". Caught by the first canary cell in this placement.
`usesHostProviderProxy` answered "is this Maka" when the question is which
side of the container boundary the arm runs on. Maka was exempt because it
ran on the host and could hold a host credential; in the task container it
has none, so it needs the proxy every competitor already uses. Without this
the arm started, mounted and verified its toolchain, then stopped at
"Maka container task-run requires the host provider proxy".
Terminal-Bench task images are bare ubuntu:24.04 plus curl, so most tasks
apt-install what they need and the benchmark silently depends on
archive.ubuntu.com being reachable from the run host. On a host whose link
to it is degraded that dependency stops being a constant. The same arm ran
configure-git-webserver twice in the same topology, issued an identical 24
tool calls both times, and finished in 479s on one run and hit the 900s
deadline on the other -- the entire difference sitting in how long apt
stalled. Measured from the run host: archive.ubuntu.com returned 0 bytes on
two of three attempts and 9.8 KB/s on the third, while github.com and the
model provider were both fine.

Noise of that shape does not cancel across arms. It charges whichever agent
happened to need more packages, which is not what this benchmark measures.

MAKA_HARNESS_AB_APT_MIRROR redirects the two apt hosts the base image's
sources list names, through a compose overlay layered after the harness
compose file so Compose merges the redirect beside the host-gateway mapping
every competitor arm dials rather than replacing it. No task image and no
sources list changes: the container still resolves and requests
archive.ubuntu.com, so what an agent observes is unchanged.

It is opt-in and recorded in the manifest because it changes the environment
every task runs in -- and recorded in a way that forks the fingerprint, so a
redirected run cannot resume a manifest that fetched from Ubuntu's hosts.
Runs that do not redirect keep their existing fingerprints.
…uilt

The report refuses a manifest where only some arms declare placement: a
comparison that names one arm's environment and not the others' invites the
reader to assume they shared it. Declaring it on the Maka arm alone therefore
did not under-describe the run, it made the run unreportable. four-arm-canary-v1
finished all four cells, scored all four, and produced no report.

Competitor arms declared placement only under Pier. They have always run in the
task container under both executors, so the executor was never the right
condition -- the Maka arm's placement is. Once it joins them the fact is worth
stating for everyone; while it bridges from the host, no existing manifest
states it at all and none of their fingerprints move. Pier reaches this through
the same door, since it forces task-container.
@Astro-Han
Astro-Han force-pushed the feat/headless-maka-task-run-under-harbor branch from 9dae4be to 7cd121e Compare August 5, 2026 05:42
The proxy is the only token and cost source for every arm that is not Maka,
and it discarded whatever the usage parser had read whenever the client
hung up before `[DONE]`. Providers put the usage frame at the end of a
stream but not after it, so the frame had usually already arrived; the abort
path simply never asked the parser for it.

The result is not a gap the report can see. A cell keeps the usage of the
requests that happened to run to completion and reads as fully metered.
Measured on the four-arm canary, one arm was credited 1,088 output tokens
against a true 27,633: its short requests ran to `[DONE]` and its long ones
were hung up on, so the economy axis reported 4% of what that arm spent
while the other three arms matched their own logs to the token.

Draining the parser on abort costs nothing -- the bytes were already read
and parsed. `terminalEvent` still records that the stream did not finish, so
a caller that wants only whole streams can still tell the two apart.
@Astro-Han
Astro-Han force-pushed the feat/headless-maka-task-run-under-harbor branch from 7cd121e to 8d1c2d0 Compare August 5, 2026 05:53
Only the harbor runner layers the compose overlay, so naming a mirror on a
pier run recorded a redirect in the manifest that no cell performed, and
forked the run's resume identity on that false record. The guard now lives
in harnessAptMirror beside the name it validates, mirroring the placement
helper that already refuses host-bridge under pier.

Two smaller corrections from the same review: the Copilot rejection told the
Maka arm that an OpenCode adapter was missing, when its actual remedy is the
host-bridge placement it came from; and the compose-order test justified
itself with merge semantics Compose does not have -- extra_hosts entries are
appended across -f files, duplicate keys included, so the overlay's position
does not let it override a task image that names the same host.
The switch that moves the Maka arm into the task container had no test on
any of its three limbs: the Python gate under a tree with no allowlist, the
job config that mounts the toolchain and admits it by fingerprint, and the
provider channel that follows placement rather than arm name.

Each limb is now pinned where it can actually run in CI -- the Python one in
the stubbed adapter smoke script rather than the harness-compat suite, which
skips whenever Harbor is absent, which is always in CI. Reverting any of the
three fails exactly one test: requiring an allowlist again, dropping the
fingerprint beside the mount, or routing the channel by arm name, which is
the revert that would run on the host while the manifest still declared the
container.
@Astro-Han
Astro-Han marked this pull request as ready for review August 5, 2026 06:43
@Astro-Han
Astro-Han merged commit a943ff1 into main Aug 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant