-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Code mode forces one wait round-trip per awaited bridge tool call #109288
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maintainerMaintainer-authored PRMaintainer-authored PR
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maintainerMaintainer-authored PRMaintainer-authored PR
Type
Fields
Priority
None yet
Problem
Code mode (
tools.codeMode) suspends to the model with awaitingresult for every awaited bridge tool call (tools.search/tools.describe/tools.call). Each await therefore costs onewaittool round-trip: a guest block with N tool calls takes N+1 model turns. Onlynamespacebridge calls were auto-drained inline.Live multi-provider bench (4 tasks over a 72-tool catalog with adversarial decoys, code mode enabled, defaults):
Turn counts track tool calls + 1 exactly, so code mode costs ~3x the turns and 2-4.5x the input tokens of direct tool exposure on the same tasks - the opposite of its design goal.
Secondary findings from the same live/stress pass:
API.list/API.readand theMCPnamespace even when the run catalog has no MCP tools; weaker models waste exec turns probing the empty API surface (observed live with gpt-5.4-mini).API.list("mcp/")(trailing slash) throwsinvalid API file pathwhileAPI.list("mcp")works; observed a model hitting exactly this live.Expected
Awaited bridge calls that resolve within the exec deadline should drain inline (like namespace calls already do), one shared wall-clock deadline should bound each exec/wait call, and abort should terminate the guest and drop suspended state.
Repro/measurement harness: multi-provider live bench driving the real
Agentruntime withcreateCodeModeTools+applyCodeModeCatalogover a decoy-heavy catalog; A/B with 20 runs per arm on gpt-5.4-mini confirmed equal success rate (14/20 vs 15/20) with average turns dropping 7.9 -> 4.3.