Read DOCKER_AGENT_ENV_-prefixed secret variables before the plain names
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
Overview
Let docker-agent read DOCKER_AGENT_ENV_<NAME> in preference to <NAME> for every secret it resolves (e.g. DOCKER_AGENT_ENV_ANTHROPIC_API_KEY before ANTHROPIC_API_KEY).
Motivation
docker-agent resolves op:// 1Password references, which is a nice way to avoid plain-text keys. But the variable names are shared with other tools: exporting ANTHROPIC_API_KEY="op://…" in the shell breaks Claude Code, Codex and provider SDKs, which do not resolve op://. Today the workarounds are the docker-agent env file (~/.config/cagent/.env) or a per-model token_key, which must be repeated in every model of every config and does not apply to --model provider/model.
Use cases
export DOCKER_AGENT_ENV_ANTHROPIC_API_KEY="op://Personal/Anthropic/api-key"
export ANTHROPIC_API_KEY=sk-ant-... # or unset; used by other tools
docker agent run agent.yaml # uses the op:// reference
Also lets a user point docker-agent at a different key (separate billing/project) without touching other tools.
Proposed solution
A PrefixedProvider decorator in pkg/environment, wired through a single chain constructor as OnePassword(Prefixed(Multi(sources...))), so a prefixed value can itself be an op:// reference.
Decisions (revised after code review, see the comment below):
- Prefix
DOCKER_AGENT_ENV_.DOCKER_AGENT_is docker-agent's settings namespace; names already in it are never looked up as overrides. - Precedence:
DOCKER_AGENT_ENV_<NAME>wins across the whole chain,--env-from-fileincluded. - Empty values: an empty override is ignored and
<NAME>is used.
Doctor and follow-ups:
docker agent doctor(findSource) queries sources directly and would report the key as missing; teach it the prefix and show which name supplied the value.- The TUI transcriber reads
OPENAI_API_KEYwithos.Getenv(bypassing bothop://and the prefix); fixing it needs lazy resolution, so it is deferred to a separate PR.
Known limitation: in --sandbox, keys Docker Desktop proxies itself (OPENAI_API_KEY, ANTHROPIC_API_KEY, …) never go through our chain, so neither op:// nor the prefix applies to them there. Documented, not changed.
Alternatives
- Per-model
token_key: works, but verbose and not available for--modelshorthand. - Docker Agent env file: works, but a plain shell export of the same name still wins, which is the common setup for users of several AI tools.
Related issues
- #4701: docs fix for the credential helper scope and an
op://isolation tip. - #4703: credential helper for all secrets.
- #4708: implementation.
- 主要言語
- Go
- スター
- 4.6k
- フォーク
- 522
- 平均マージ
- 10時間 33分
- マージ済み PR(30日)
- 231
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docker/docker-agent のほかの issue
-
Error when trying to run sandbox example?対応中かも @dgageot が 2 日前に担当しました。 オープンarea/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
docker/docker-agent#4672 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
pkg/hooks tests fail with a misleading assertion when jq is not installed対応中かも @dwin-gharibi が 59 日前に担当しました。 オープンarea/testing
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
docker/docker-agent#4052 ·
メンテナーはふだん 1 日以内に返信
-
`remove_directory` and `create_directory` hide work they already did when a later path fails対応中かも @dwin-gharibi が 78 日前に担当しました。 オープンarea/tools
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
docker/docker-agent#3933 ·
メンテナーはふだん 1 日以内に返信
-
`edit_file` silently edits the first match when `oldText` occurs more than once対応中かも @dwin-gharibi が 78 日前に担当しました。 オープンarea/tools
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
docker/docker-agent#3929 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
area/config area/mcp area/providers area/security kind/feat status/needs-design
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
docker/docker-agent#4703 ·
メンテナーはふだん 1 日以内に返信
docker/docker-agent の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
FiloSottile/age#758 ·
-
nginx configオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信