You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #415 Phase 1, item 3. After the auth config field exists (#421) and auth profiles are relocated (#419), the runtime layer needs to resolve profile keys to env vars and inject them into CLI subprocess environments.
Scope
In the agent runner (where buildEnv() or equivalent assembles the CLI subprocess environment):
Resolve the agent's auth config value
If auth: false → skip (no profile injection)
If auth: "profile-id" → load profile, resolve provider → env var name, inject
If auth: ["id1", "id2"] → pick next in rotation, resolve, inject
Provider → env var mapping (already exists in resolveEnvApiKey):
Context
Part of #415 Phase 1, item 3. After the
authconfig field exists (#421) and auth profiles are relocated (#419), the runtime layer needs to resolve profile keys to env vars and inject them into CLI subprocess environments.Scope
In the agent runner (where
buildEnv()or equivalent assembles the CLI subprocess environment):authconfig valueauth: false→ skip (no profile injection)auth: "profile-id"→ load profile, resolve provider → env var name, injectauth: ["id1", "id2"]→ pick next in rotation, resolve, injectProvider → env var mapping (already exists in
resolveEnvApiKey):anthropic→ANTHROPIC_API_KEYgoogle→GEMINI_API_KEYopenai→OPENAI_API_KEYcodex→CODEX_API_KEYCLAUDE_CODE_OAUTH_TOKENCredential precedence (highest to lowest):
If
runtimeEnvalready has the same env var, auth profile takes priority.Round-robin state: track last-used index per agent. Reset on process restart (no persistence needed — rotation is best-effort).
Tests
auth: falseresults in no profile injectionruntimeEnvis overridden by auth profile when both set same varDepends on
Related