Repository navigation
feat: make local dev credential discovery and sandbox projection first-class #1423
Description
Problem Statement
Setting up a sandbox for realistic developer/agent pairing currently has too much credential plumbing before the useful workflow begins.
The agent-driven policy demo shows the desired loop well, but the setup path has to manually discover and inject credentials for tools like GitHub, Codex, and Claude. In practice, this makes demos and dev workflows spend a lot of time on auth setup instead of the actual OpenShell value proposition: scoped sandbox access, policy denies, agent proposals, human approval, and hot reload.
This is especially noticeable for manual policy workflow demos. A developer may already be signed in locally with gh auth login, codex login, or Claude tooling, but openshell sandbox create --auto-providers does not currently turn that local state into a ready-to-use sandbox environment.
Proposed Design
Make local developer credential discovery and sandbox projection first-class provider behavior.
The product flow should be explicit and reviewable, not silent magic. For example:
Found local credentials:
github: gh auth token
codex: ~/.codex/auth.json
claude: ANTHROPIC_API_KEY or local Claude auth
Attach these to sandbox policy-demo-123? [Y/n]
Suggested behavior:
-
Provider plugins discover local credentials from common sources:
- GitHub:
GITHUB_TOKEN,GH_TOKEN, orgh auth token - Codex:
OPENAI_API_KEYand/or~/.codex/auth.json - Claude:
ANTHROPIC_API_KEY,CLAUDE_API_KEY, and possibly Claude local auth if stable and safe
- GitHub:
-
The CLI presents discovered credentials before importing or attaching them.
-
Provider plugins know how to project credentials into the sandbox in the form the target tool expects:
- GitHub token as
GITHUB_TOKEN - Codex login state as a usable
~/.codex/auth.jsonor equivalent runtime projection - Claude credentials in the expected env/file form
- GitHub token as
-
--auto-providersshould either:- grow into this behavior, with clear consent prompts when interactive, or
- remain narrow but be paired with a more explicit dev workflow flag, such as
--dev-access github,codex,claude.
The key UX principle: OpenShell should make the credential bridge visible and intentional, but developers should not have to hand-copy local auth state into provider records or sandbox bootstrap scripts.
Claude support should be part of the initial scope, not a follow-up. Manual pairing needs to work naturally for both Codex and Claude-style agent sessions.
Alternatives Considered
Keep credential setup in demos/scripts.
This works for the current automated policy demo, but it makes each demo reimplement provider discovery and projection logic. It also hides a real product gap: users expect local tool auth to be reusable when creating a developer sandbox.
Require users to create providers manually.
This is explicit, but too much friction for common dev pairing workflows. It also makes --auto-providers feel surprising because it does not currently discover local tool auth unless specific environment variables are already exported.
Silently import all local credentials.
This would be smoother but too opaque. The better UX is explicit discovery with a short review/confirmation step.
Implementation Pointers
The current agent-driven policy demo already prototypes the missing behavior:
examples/agent-driven-policy-management/demo.shresolves GitHub owner and token fromgh/env:resolve_github_ownerresolve_github_token
examples/agent-driven-policy-management/demo.shresolves Codex auth from~/.codex/auth.json:resolve_codex_auth
examples/agent-driven-policy-management/demo.shcreates generic providers from the discovered values:create_providers
examples/agent-driven-policy-management/sandbox-agent.shprojects those env vars back into the runtime shape Codex expects:- exports
GITHUB_TOKEN - materializes
~/.codex/auth.json
- exports
This demo behavior is a useful spike, but the durable implementation should move into provider discovery/projection rather than staying as example-specific shell glue.
Current code behavior observed during investigation:
- Provider auto-creation is driven by explicit
--providervalues or command inference. - Provider discovery currently reads known environment variables.
- GitHub provider discovery checks
GITHUB_TOKEN/GH_TOKEN, but notgh auth token. - Codex provider discovery checks
OPENAI_API_KEY, but not~/.codex/auth.json. - Claude provider discovery checks
ANTHROPIC_API_KEY/CLAUDE_API_KEY; local Claude auth discovery/projection should be evaluated as part of this issue.
Relevant files:
crates/openshell-cli/src/run.rscrates/openshell-providers/src/discovery.rscrates/openshell-providers/src/providers/github.rscrates/openshell-providers/src/providers/codex.rscrates/openshell-providers/src/providers/claude.rsexamples/agent-driven-policy-management/demo.shexamples/agent-driven-policy-management/sandbox-agent.sh
Definition of Done
- GitHub provider can discover credentials from
gh auth tokenwhen env vars are absent. - Codex provider can discover local
codex loginstate or clearly document why it cannot. - Claude provider can discover and project the minimum local auth needed for a Claude agent session, or clearly document any stable/safety limitation.
- Sandbox runtime projection can materialize provider credentials in tool-native forms where needed.
- CLI shows a concise “Found local credentials” review before importing/attaching discovered credentials.
- Manual agent-driven policy workflow setup no longer requires demo-specific credential extraction for GitHub/Codex/Claude.
- Docs explain the difference between provider discovery, provider attachment, and sandbox runtime projection.
Activity
github-actions commentedon Jun 16, 2026
This issue has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. Comment or remove the state:stale label to keep it open.
zredlined commentedon Jul 2, 2026
Closing as deferred/not currently roadmap-committed. The local credential discovery and projection UX here is still useful, but the durable provider direction is now being shaped through provider profiles and Providers v2 work (#896, #1988). We can reopen or file a smaller issue when local dev credential import becomes an active priority.