fix(dmr): honor the models gateway when creating the client - #3875
Merged
Conversation
Sayt-0
approved these changes
Jul 31, 2026
Sayt-0
left a comment
Member
There was a problem hiding this comment.
Changes looks good. Thank you !
Member
|
Can you sign your commits ? |
aboullaite
force-pushed
the
fix/dmr-honor-models-gateway
branch
from
July 31, 2026 15:32
7117402 to
717e657
Compare
Author
Yes sorry for that. Done ✅ |
Collaborator
|
/review |
Member
|
hello @aboullaite It looks like they still haven't been signed. |
Every other provider routes through --models-gateway when one is set, but the DMR provider ignored it: NewClient always probed for a local Model Runner via docker model status and failed with ErrNotInstalled in environments where the gateway is the only reachable path, e.g. inside a Docker Sandbox where the host CLI has already allowlisted the gateway in the sandbox proxy. When a gateway is configured, dial it directly as the OpenAI-compatible endpoint and skip local endpoint discovery, auto-pull and backend configuration, which all assume a local installation. Fixes docker#3871 Signed-off-by: Mohammed Aboullaite <mohammed@aboullaite.me>
aboullaite
force-pushed
the
fix/dmr-honor-models-gateway
branch
from
August 3, 2026 09:47
717e657 to
f222358
Compare
Author
|
Pretty sure its fixed now @Sayt-0. At least that's what the UI says |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
--models-gatewaypart of #3871.Every other provider (openai, anthropic, gemini) routes through the configured models gateway, but the DMR provider ignored it:
NewClientalways probed for a local Model Runner viadocker model statusand failed withErrNotInstalledin environments where the gateway is the only reachable path. The concrete case from the issue is a Docker Sandbox, wheredocker agent run --sandbox --models-gateway ...has already allowlisted the gateway in the sandbox proxy, yet the agent inside the sandbox refuses to start.What changed
When a gateway is configured,
NewClientnow dials it directly as the OpenAI compatible endpoint (<gateway>/v1/), skipping endpoint discovery, auto pull and backend configuration, which all assume a local installation. The gateway branch follows the same if/else shape the sibling providers use and shares the existing construction tail. Gateway requests carry the standard request contract (X-Cagent-Forwardset to the default DMR host URL, provider and model identity headers, gateway query parameters). DMR requires no auth, so the gateway is dialed with an empty API key, matching the direct path.dmrmodels.defaultHostURLis now exported as it doubles as the forward target.One consideration deliberately left out: threading
environment.Providerthrough to callVerifyDockerGatewayAuth/GatewayAuthToken. Those helpers no op for gateways outside the trusted Docker domains, and DMR is a local, credential free provider, so there is no real configuration today where they would fire. Happy to add the plumbing if you want parity with the other providers.Validation
go test ./pkg/model/provider/dmr/...passes, including a request contract test that sends a real SDK backed operation (CreateBatchEmbedding) through an httptest gateway and asserts the path, query parameters andX-Cagent-*headers, plus a broken docker CLI shim test proving no local discovery happens when a gateway is set.golangci-lint run pkg/model/provider/dmr/...reports 0 issues;go build ./...is clean.--model dmr/ai/gemma4 --models-gateway http://host.docker.internal:12434/engines. The client connects through the sandbox proxy to the host's Model Runner and completes the task. The same invocation on the current release fails with "docker model runner is not available".The self update 404 and the host CLI's
inspect exectimeout from #3871 are not addressable from this repo (release pipeline and sbx side respectively), so this PR covers only the gateway half.