Skip to content

feat(bench): tool-using router backend (routerToolLoop) + self-repair gate#198

Merged
drewstone merged 1 commit into
mainfrom
feat/router-tool-backend
Jun 8, 2026
Merged

feat(bench): tool-using router backend (routerToolLoop) + self-repair gate#198
drewstone merged 1 commit into
mainfrom
feat/router-tool-backend

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

What

Adds the tool-using router backend — a real agentic loop over the Tangle router's tool-calling, off-box (no sandbox) — and uses it to run the strongest form of the steering gate.

  • routerToolLoop (bench/src/router-client.ts): each turn is a router completion with tools; tool_calls execute on the host and fold back as tool messages; repeat until the model answers without a tool or the turn budget is hit. One turn = one completion, so maxTurns is the equal-compute unit. This is the depth substrate the chat-only routerChatWithUsage couldn't express, and it routes around the sandbox→router egress block (#984).
  • humaneval-repair-gate.mts: the worker gets a run_tests tool (the deployable Docker checker, now returning the failure detail), so it runs the tests, sees the real failure, and fixes — vs blind resampling at equal k. Removes the weakness of the earlier null (an LLM that guessed the bug without running it).

Result (gpt-3.5-turbo, HumanEval hard half, n=82, equal k=3, paired bootstrap B=10000)

arm pass
blind@1 54.9%
blind@3 (resample) 75.6%
repair@3 (tool-grounded) 58.5%
contrast lift 95% CI verdict
repair@3 − blind@3 (steering) −17.1pp [−26.8, −7.3] SIGNIFICANT NEGATIVE
blind@3 − blind@1 (more-compute) +20.7pp [+12.2, +30.5] significant positive

Even with real execution feedback, self-repair is significantly worse than blind resampling at equal budget. Refining one anchored attempt loses to exploring k fresh ones — repair barely beats a single shot; resampling crushes it. The tool backend works (it recovered tasks blind missed); the depth strategy loses on single-shot codegen.

This sharpens the steering-vs-compute boundary: breadth/resampling wins where fresh samples are cheap and independent; depth/steering's one win remains EOPS (stateful, multi-step ops, where you can't cheaply resample).

Test

typecheck clean (bench tsconfig); smoke (N=3) fired the tool loop end-to-end; full n=82 ran with 0 errors.

… gate

routerToolLoop (router-client.ts): a real agentic loop OVER the Tangle router's
tool-calling, OFF-BOX — each turn is a router completion with `tools`; tool_calls
execute on the host and fold back as `tool` messages; repeat until done or budget.
The depth substrate the chat-only routerChatWithUsage couldn't express (routes
around the sandbox→router egress block, #984). One turn = one completion, so
maxTurns is the equal-compute unit vs random@k.

humaneval-repair-gate.mts: the strongest steering test — the worker gets a
run_tests tool (the deployable Docker checker, now returning failure detail), so
it RUNS the tests, sees the real failure, and fixes, vs blind resampling at equal
k. Removes the weakness of the earlier LLM-audit null (which never ran the code).

Gate result (gpt-3.5-turbo, HumanEval hard half, n=82, equal k=3, paired bootstrap):
  blind@1 54.9%  blind@3 (resample) 75.6%  repair@3 (tools) 58.5%
  repair@3 − blind@3 (steering)     -17.1pp  CI [-26.8, -7.3]   SIGNIFICANT NEGATIVE
  blind@3 − blind@1 (more-compute)  +20.7pp  CI [+12.2, +30.5]  SIGNIFICANT POSITIVE

Execution-grounded self-repair is SIGNIFICANTLY WORSE than blind resampling at
equal budget: refining one anchored attempt loses to exploring k fresh ones. The
tool backend works (recovered tasks blind missed); the depth strategy loses on
single-shot codegen. Sharpens the steering-vs-compute boundary: breadth wins where
fresh samples are cheap+independent; depth's one win remains EOPS (stateful/agentic).
@drewstone drewstone merged commit f3a3027 into main Jun 8, 2026
1 check passed
@drewstone drewstone deleted the feat/router-tool-backend branch June 8, 2026 16:32
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