Expand description
Identity → env-var resolver.
Per-provider matrix of which env vars carry which credential. The
GitHub PAT becomes both GITHUB_TOKEN and GH_TOKEN because both
the official gh CLI and direct API consumers (curl, oct.js) read
one or the other; emitting both is the lowest-friction way to make
every common workflow Just Work.
Before touching gate_oauth_failure / inject_identity_env_with_broker:
this module is where SPEC_PROVIDER_ISOLATION_2026_06_20.md’s INV-A
(“never the user’s global ~/.<P> dir”) is enforced — or, once already,
silently stopped being enforced. Read
docs/retro/retro-auth-isolation-invariant-silently-orphaned-2026-07-14.md
first. Short version: an unbound oauth-class provider used to
auto-route to an AgentMux-owned isolated dir (no user action, no global
exposure); a 2026-07-08 refactor orphaned that path without meaning to,
and it was never restored. Today’s gate always blocks an unbound
oauth-class provider; the per-agent “true ambient” opt-out
(use_ambient_login) is no longer read.
§Module layout
Split from a single ~2193-line resolver.rs file into a directory
(pure relocation, no behavior change — mirrors the
backend/subagent_watcher/ and backend/blockcontroller/subprocess/
splits) so each self-contained piece lives in its own file:
oauth_probe:oauth_statusconstants,OAuthProbeStatus, andprobe_oauth_status— on-disk OAuth token-file probing.errors:SpawnGateError,ResolverError.provider:ProviderClass,provider_class— the provider classification table.secret:resolve_secret.inject— this module’s security-critical core (see the warning above):inject_identity_env/inject_identity_env_async,IdentityBinding,resolve_bindings_for_instance, andinject_identity_env_with_broker— the layer-3 credential- injection spawn gate. The INV-A warning is repeated there, attached directly toinject_identity_env_with_broker, and every test exercising that function moved WITH it intoinject.rsas one atomic unit.
Re-exports§
pub use errors::SpawnGateError;pub use inject::block_agent_id;pub use inject::inject_identity_env;pub use inject::inject_identity_env_async;pub use inject::inject_identity_env_for_spawn;pub use inject::resolve_account;pub use inject::agent_has_identity_binding;pub use inject::resolve_bound_claude_config_dir_for_agent;pub use inject::resolve_bound_oauth_config_dir;pub use effective_links::effective_identity_links;pub use cli_sign_in_files::signed_in as cli_file_signed_in;pub use oauth_probe::claude_token_expiry_ms;pub use oauth_probe::oauth_status;pub use oauth_probe::probe_oauth_status;pub use oauth_probe::release_sign_in;pub use oauth_probe::sign_in_file;pub use oauth_probe::OAuthProbeStatus;pub use provider::provider_class;pub use provider::ProviderClass;
Modules§
- cli_
sign_ in_ files - The sign-in of a CLI that has no status command, read from the credential file its login writes.
- effective_
links - The account links a definition resolves through, for callers outside the spawn gate (a new fork copies its source’s from here).
- errors
- Resolver error types:
SpawnGateErrorandResolverError. - inject
- The credential-injection entry points and the layer-3 spawn gate.
- oauth_
probe - OAuth token-file probing: the
oauth_statuscanonical-value constants,OAuthProbeStatus, andprobe_oauth_statusitself. - provider
- Provider classification:
ProviderClassandprovider_class. - secret
resolve_secret: turning aSecretRefinto a plaintext credential.