Skip to content

Allow models.dev in sandbox proxy for model catalog resolution#3041

Merged
dgageot merged 2 commits into
docker:mainfrom
dgageot:board/1207b534eee25a21
Jun 10, 2026
Merged

Allow models.dev in sandbox proxy for model catalog resolution#3041
dgageot merged 2 commits into
docker:mainfrom
dgageot:board/1207b534eee25a21

Conversation

@dgageot

@dgageot dgageot commented Jun 9, 2026

Copy link
Copy Markdown
Member

What

docker agent run --sandbox now always allowlists the models.dev
catalog host in the sandbox's default-deny network proxy, so the
in-sandbox agent can fetch the model list and resolve model metadata
(context limits, pricing, capabilities).

Why

Every agent run resolves model metadata against models.dev, but the
sandbox proxy denies it by default. Without an explicit allow rule the
inner agent's first catalog lookup fails with a misleading
403 Blocked by network policy. This wires models.dev into the same
auto-allowlist machinery that already opens the models gateway and the
auto-installer's package hosts.

Changes

  • pkg/modelsdev: export APIHost = "models.dev" and derive
    ModelsDevAPIURL from it so the host and URL can't drift.
  • cmd/root/sandbox.go: always include modelsdev.APIHost in
    allowSandboxHosts, and surface it via a new printModelsDevAllowance
    line alongside the gateway/tool-install output.
  • cmd/root/sandbox_test.go: add TestPrintModelsDevAllowance.

Validation

  • go build ./...
  • go test ./cmd/root/ ./pkg/modelsdev/
  • golangci-lint run (0 issues)

@dgageot dgageot requested a review from a team as a code owner June 9, 2026 18:00

@docker-agent docker-agent left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Assessment: 🟢 APPROVE

The changes are clean, correct, and well-structured:

  • pkg/modelsdev: Exporting APIHost = "models.dev" and deriving ModelsDevAPIURL from it is a sound refactor — it eliminates the possibility of the host and URL drifting apart.
  • sandbox.go: Unconditionally prepending modelsdev.APIHost to the allowlist is the right approach since every run resolves model metadata, and the new printModelsDevAllowance helper follows the same pattern as the existing gateway/tool-install print functions.
  • sandbox_test.go: TestPrintModelsDevAllowance is correctly structured with t.Parallel() and a strings.Builder.

No bugs found in the added code.

@aheritier aheritier added area/cli CLI commands, flags, output formatting area/security Authentication, authorization, secrets, vulnerabilities kind/fix PR fixes a bug (maps to fix: commit prefix) area/agent For work that has to do with the general agent loop/agentic features of the app and removed area/security Authentication, authorization, secrets, vulnerabilities labels Jun 9, 2026
@dgageot dgageot merged commit 7c2d75c into docker:main Jun 10, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agent For work that has to do with the general agent loop/agentic features of the app area/cli CLI commands, flags, output formatting kind/fix PR fixes a bug (maps to fix: commit prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants