FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(record): don't require Docker Desktop sign-in for non-gateway providers by aheritier · Pull Request #4252 · docker/docker-agent · GitHub

fix(record): don't require Docker Desktop sign-in for non-gateway providers - #4252

Draft
aheritier wants to merge 1 commit into
mainfrom
fix/record-gateway-docker-auth-4250
Draft

fix(record): don't require Docker Desktop sign-in for non-gateway providers#4252
aheritier wants to merge 1 commit into
mainfrom
fix/record-gateway-docker-auth-4250

Conversation

Copy link
Copy Markdown
Collaborator

🤖 Automated implementer agentthis comment was posted by the implementer bot from Docker Agentic Platform, not by a human developer

Fixes #4250.

--record/--fake always point runConfig.ModelsGateway at their local capture proxy (localhost) so every provider call can be intercepted. environment.IsTrustedDockerURL treats any localhost address as a trusted Docker AI Gateway — a heuristic meant for genuine local Docker gateways — so provider clients refused to build without a real Docker Desktop token, even for providers (e.g. OpenRouter) that have nothing to do with the Docker AI Gateway.

Fix: a new Config.EnvOverrides map[string]string, layered in front of the computed environment provider chain (RuntimeConfig.EnvProvider()), lets --record/--fake supply a placeholder Docker token — but only when the gateway actually configured before the proxy took over isn't itself a trusted Docker gateway. The recording proxy already discards this placeholder and re-authenticates with the provider's own credentials (pkg/fake/proxy.go); a genuine upstream Docker gateway keeps using the real token, unaffected.

Verified end-to-end with the exact repro from the issue (OpenRouter provider, no Docker Desktop, --record --exec): the run now gets past client construction and correctly forwards to https://openrouter.ai/..., recording the interaction to the cassette.

Testing: task build, task test, task lint all pass (pre-existing unrelated pkg/rag/treesitter CGO failure aside). Added unit tests in cmd/root/record_test.go and pkg/config/runtime_test.go covering: no gateway configured, non-Docker upstream gateway, genuine trusted Docker upstream gateway (real token preserved), --fake proxy, and EnvOverrides/Clone() semantics.

Reviewed by an independent pass (approved); two low-severity, non-blocking observations were raised (EnvOverrides is visible to the whole env-provider chain, not just gateway-auth checks; and encrypted-config forwarding is reachable more often now, an unrelated pre-existing behavior) — noted here for visibility, not addressed as out of scope for this fix.

…viders

--record and --fake always pointed the runtime's models gateway at their
local capture proxy so every provider call could be intercepted. The proxy
binds to localhost, which environment.IsTrustedDockerURL treats as a
trusted Docker AI Gateway address, so provider clients refused to build
without a real Docker Desktop token even when the configured provider
(e.g. OpenRouter) has nothing to do with the Docker AI Gateway.

Supply a placeholder Docker token via the runtime config's environment
provider chain only when the gateway actually configured before the proxy
took over isn't itself a trusted Docker gateway. The proxy already
discards this placeholder and re-authenticates with the provider's own
credentials (or, for a genuine upstream Docker gateway, the real token
keeps flowing through unaffected).

Fixes #4250
aheritier marked this pull request as ready for review September 12, 2026 11:17
aheritier requested a review from a team as a code owner September 12, 2026 11:17
aheritier added area/cli CLI commands, flags, output formatting area/config For configuration parsing, YAML, environment variables kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Sep 12, 2026
aheritier marked this pull request as draft September 12, 2026 18:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands, flags, output formatting area/config For configuration parsing, YAML, environment variables kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run --record requires Docker AI Gateway

1 participant


Back | FazBrowse Home | New Git URL