feat(agent-cli): forward Switchyard candidate models to the in-sandbox pi agent (2/2) - #129
Merged
Merged
Conversation
ayush-or
added this pull request to stack #130
October 1, 2026 13:18
Base automatically changed from
devin/1790733057-sandbox-switchyard-plugin
to
main
October 1, 2026 18:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Terminal-Bench (and deep_swe / swe_atlas with an Ori agent) can now send Switchyard's two candidate models from inside the sandbox. Before, any run that set
modelswas rejected because the in-sandbox agent never put amodelsarray on its requests, sonvidia/switchyardhad nothing to route between. Stacked on #127, which forwards theswitchyard-routerplugin the same way.What changed?
TB_OPENROUTER_MODELS.buildAgentCliEnvwritesopts.modelsas JSON when it is set.before_provider_requestextension setspayload.modelsfrom that env var, replacing anymodelsalready on the request, next to the plugin merge from fix(terminal-bench): forward auto-router cost tier to the in-sandbox pi agent #126/feat(agent-cli): forward the switchyard-router plugin through sandbox request plugins (1/2) #127. The extension is written and loaded when plugins or models are configured (hasRequestPluginsis renamed toloadsRequestExtension).sandboxAgentPluginErroracceptsmodelsforpi. It still rejectsmodelsforclaude,prime-agentandomp, which cannot rewrite outgoing requests. The runner keeps a matching defensiveSolverError.benchmarkConfig.modelsinto the agent CLI options.max_output_tokenswhen it setsmodels. pi sizes that field from its catalog entry for the requested model.nvidia/switchyardisn't in the catalog, so pi used a default of 235,929 tokens. That is above the 128,000 limit of GPT-6-Sol, GPT-6-Astra and Opus 5.5, so routing dropped every endpoint of the capable model. Switchyard still picked it, but the request was silently served by the efficient model. Without the cap, each candidate uses its own provider default.Resulting in-sandbox request body for a Switchyard cell:
{ "model": "nvidia/switchyard", "models": ["z-ai/glm-5.3-flash", "anthropic/claude-opus-5.5"], "plugins": [{ "id": "switchyard-router", "algorithm": "stage" }] }How to test
bun test src/benchmarks/agent-cli src/benchmarks/terminal-bench src/benchmarks/deep-swe src/benchmarks/swe-atlas: 180 pass. New cases:modelsand the switchyard-router plugin together, and addsmodelsalone when no plugins are configured;TB_MODEL=nvidia/switchyard,TB_OPENROUTER_MODELSandTB_OPENROUTER_PLUGINS, and loads the extension;models+switchyardAlgorithmforpiand rejectsmodelsforclaude.bun test: 1599 pass, 2 fail. The same 2 fail on the base branch without this change (makeResponsesLayer > serializes input_video.processing=*).bun run typecheckandbun run checkpass.Live validation (commit
1410e8c, production OpenRouter, default deployed runtime)1. Real
ori pi+ pi 0.84.2 on this machine, running the exact run script and env generated byharness.buildRunScript/buildAgentCliEnv. A capture proxy recorded each request body and theswitchyard-routerpipeline entry fromx-openrouter-metadata. The task was a two-step prompt with a failing tool call. Every request carriedmodel: nvidia/switchyard, both candidatemodels, andplugins: [{id: "switchyard-router", algorithm: "stage"}].stagestagecaller_order(equal_pricing)stageBefore the
max_output_tokensfix, the same run showed DeepSeek + Sol picking Sol but serving Flash. Replaying pi's captured body withalgorithm: randomand 8 fresh sessions per arm:2. Real Terminal-Bench on Modal through the harness CLI (
bun src/cli/index.ts --benchmark terminal_bench --model nvidia/switchyard --solver-config '{…, "agent":"pi", "taskSubset":["fix-git"]}'):/generation)router=nvidia/switchyardrouter=nvidia/switchyardTotal live spend for this validation was under $1.
Reviewer focus
modelsinstead of merging. The harness config is the source of truth for the experiment.equal_pricingand serves the caller order. This is a server-side pricing issue, not a harness bug, and the Sept 28 preflight found the same.terminal_benchfor Switchyard (SWITCHYARD_INCOMPATIBLE_BENCHMARK_IDSinpackages/temporal/src/schemas.ts). After this merges, openrouter-web needs a subtree sync plus a schema change that allows forwarding agents.