claw-code/rust/crates/runtime
TheArchitectit 7dc422de9c fix(team): inject /setup-saved provider config for sub-agents
Sub-agents failed because the main CLI calls inject_config_as_env_fallbacks()
to set CLAWCUSTOMOPENAI_API_KEY / CLAWCUSTOMOPENAI_BASE_URL (and other
provider env vars) before building its provider client, but the sub-agent
spawn path in the tools crate never did. Custom providers set up via /setup
were invisible to spawned agents, so they fell through to the Anthropic
provider and died with 'missing Anthropic credentials'.

Move inject_config_as_env_fallbacks from main.rs private fn into
runtime/src/config.rs as a pub fn, export it via runtime::lib.rs, and call
it at the top of run_agent_job() before the agent runtime is built.

- runtime::inject_config_as_env_fallbacks(): idempotent (only sets env vars
  that aren't already present), reads provider config saved by /setup,
  maps provider kind -> env var names (including custom-openai ->
  CLAWCUSTOMOPENAI_*), injects api_key/base_url/model.
- main.rs now calls runtime::inject_config_as_env_fallbacks() instead of
  the local private version.
- tools::run_agent_job calls runtime::inject_config_as_env_fallbacks()
  before building the agent runtime so custom/exotic providers work for
  spawned agents too.

Together with the earlier model-resolution and chain-fallback fixes
(d8716efb), sub-agents now: (1) use the session's model by default,
(2) inject the /setup-saved provider credentials, and (3) fall through
to the next configured chain entry on a model-not-found 404.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-17 12:55:49 -05:00
..
src fix(team): inject /setup-saved provider config for sub-agents 2026-06-17 12:55:49 -05:00
tests omx(team): auto-checkpoint worker-3 [4] 2026-05-14 18:26:55 +09:00
Cargo.toml fix(#698): dedup config deprecation warnings per process; add tempfile dev-dep to runtime crate (fixes pre-existing test compile error) 2026-05-25 14:11:37 +09:00