Skip to content

feat: add tapes auth and credential injection for agents#98

Merged
bdougie merged 2 commits intomainfrom
feat/tapes-login-credential-storage
Feb 14, 2026
Merged

feat: add tapes auth and credential injection for agents#98
bdougie merged 2 commits intomainfrom
feat/tapes-login-credential-storage

Conversation

@bdougie
Copy link
Contributor

@bdougie bdougie commented Feb 14, 2026

Summary

  • Adds tapes auth <provider> command to store API credentials in ~/.tapes/credentials.toml
  • Stored keys are auto-injected as env vars when launching agents via tapes start
  • For codex specifically, temporarily patches ~/.codex/auth.json with the stored key on launch and restores the original on exit — so running codex directly still uses the Codex plan (OAuth)

close #88

DX Discoveries

During implementation we found that codex ignores OPENAI_API_KEY env vars when OAuth tokens exist in ~/.codex/auth.json. The OAuth tokens are scoped for ChatGPT's internal API (/api/codex/) and lack the api.responses.write scope needed for the public /v1/responses endpoint that the tapes proxy routes to.

Additionally, personal project keys (sk-proj-) from OpenAI may lack required API scopes even with "All" permissions selected. Service account keys (sk-svcacct-) are required for codex proxy telemetry. The auth command messaging guides users toward this.

Usage

tapes auth openai              # stores key + configures codex
tapes auth anthropic           # stores Anthropic key
tapes auth --list              # shows stored providers
tapes auth --remove openai     # removes stored key
tapes start codex              # auto-injects key, restores on exit

Test plan

  • go test ./pkg/credentials/... — 20 specs pass
  • go test ./cmd/tapes/auth/... — 10 specs pass
  • make format — lint clean
  • Manual: tapes auth openaitapes start codex → verify telemetry captured
  • Manual: after codex exits, verify codex directly still uses OAuth

Continue Tasks: ✅ 3 no changes — View all

Add credential storage and auto-injection so users don't need to
manually set API keys in their shell before launching agents.
…rface errors

Move codex auth.json helpers into pkg/credentials for reuse, remove
permanent ~/.codex/auth.json modification from tapes auth, add sk-proj-
key format warning, surface swallowed errors in injectCredentials, and
add test coverage for credential injection.
@bdougie bdougie marked this pull request as ready for review February 14, 2026 13:35
@bdougie
Copy link
Contributor Author

bdougie commented Feb 14, 2026

Going to move this forward and merge to unblock #94 and #89

@bdougie bdougie merged commit ee61aa7 into main Feb 14, 2026
11 checks passed
@bdougie bdougie deleted the feat/tapes-login-credential-storage branch February 14, 2026 14:03
@continue
Copy link

continue bot commented Feb 14, 2026

Documentation updated for this PR.

Docs PR: https://github.com/papercomputeco/tapes.dev/pull/51

Changes include:

  • Added tapes auth section to CLI reference with usage examples and flags
  • Documented supported providers (openai, anthropic) and their environment variables
  • Explained Codex integration and service account key requirement
  • Updated tapes start section with credential injection details
  • Updated "How It Works" to include credential injection step
  • Removed WIP label from codex agent

Copy link
Contributor

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work: just a few comments

golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/term v0.40.0 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you had a dirty go mod: you need to run go mod tidy before pushing although I honestly haven't been the best about this either.

I created a new dagger module that runs in CI to check we have a clean go mod during PR!

Comment on lines +101 to +103
if err := os.WriteFile(m.targetPath, buf.Bytes(), 0o600); err != nil {
return fmt.Errorf("writing credentials: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this: 0600 file perms is the main thing I was looking for since dropping plain text creds readable / usable by the rest of the system would be a problem.

We might also consider aligning on XDG_CONFIG_HOME and putting these in ~/.config/tapes vs in the user's home at ~/.tapes by default. I suppose it's up to us since ~/.aws/ is definitely a thing - just depends on if we want to scatter configs on the user's home directory or in ~/.config/.


I know that some tools, like GitHub's gh have started using the native password/security tooling on the system (MacOS keychain, GNOME Keyring, KDE Wallet, etc.) but are much more challenging to implement in a headless server setting. We may consider adopting those as defaults for tapes but this works for now!


We could also consider implementing shelling into the 1password CLI to resolve op:// secrets like:

version = 0

[providers]
  [providers.openai]
    api_key = "op://Engineering/openai-key"

that can evaluate then evaluate to a vault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tapes start codex requires manual API key configuration

2 participants