Skip to main content

resolve_cli_args

Function resolve_cli_args 

Source
fn resolve_cli_args(
    provider: &ProviderConfig,
    controller_type: &str,
) -> Vec<String>
Expand description

Resolve the (env_var, value) pair to inject for this agent’s model vendor override, if any — redirects the harness at a non-default backend (e.g. ANTHROPIC_BASE_URL for a claude-provider agent). Pure — no I/O — so it’s directly unit-testable without the full async spawn-time harness this is called from.

None when there’s nothing to override (empty model_vendor_base_url) OR the provider doesn’t declare base_url_env_var — the latter should already be impossible by the time an agent reaches spawn (rejected at agent.define), but this stays defensive rather than trusting that write-time validation is the only thing that can ever set this field. Resolve the CLI argv for spawning provider’s process under controller_type (the string form: "persistent" / "subprocess" / "acp" / "app-server"). Pure — no I/O — so it’s directly unit-testable without the full async spawn-time harness this is called from.

ReAgent P1 on PR #3215: this used to only branch on "persistent", so an "app-server" controller silently fell back to provider.launch_args — Codex’s one-shot exec --json args — instead of provider.app_server’s --listen stdio:// args. The spawned child would never complete the App Server handshake once the provider registry flips a provider’s controller type to AppServer.