Conversation
Summary of ChangesHello @thaJeztah, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the codebase by migrating all Docker client interactions to use the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| // FIXME(thaJeztah): can we get the user-agent in some other way? (or just use a default, specific to DMR)? | ||
| // dockerClient, err := DockerClientForContext(cli, cli.CurrentContext()) | ||
| // if err != nil { | ||
| // return nil, fmt.Errorf("unable to create model runner client: %w", err) | ||
| // } | ||
| // httpClient = dockerClient.HTTPClient() | ||
| // dockerClient.Close() |
There was a problem hiding this comment.
This part should probably be looked into; what user-agent do we want to use here? Could model-runner use its own?
There was a problem hiding this comment.
Code Review
The pull request successfully migrates the Docker Model Runner CLI to use Moby modules instead of the deprecated Docker/Docker modules. This is a significant improvement for maintainability and ensures compatibility with the latest Moby API. The changes involve updating import paths, adjusting API calls to match the new Moby client signatures, and refining some logic related to container operations and progress display. The introduction of netip.Addr for IP addresses is a good step towards more robust network handling. Overall, the changes are well-executed and align with modern Go and Docker API practices.
| result := &standaloneRunner{} | ||
| for _, port := range container.Ports { | ||
| if port.IP == "127.0.0.1" { | ||
| if port.IP.IsLoopback() { |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
That bot is really noisy though; mostly with "hey this code-change looks good!" comments 🫠 |
There was a problem hiding this comment.
Code Review
This pull request migrates the project from using the github.com/docker/docker client to the github.com/moby/moby modules. The changes are mostly straightforward API updates. However, I've found a couple of critical issues that could cause panics or prevent containers from starting correctly, along with a minor maintainability improvement. Please review the detailed comments.
6bc319e to
555fcdb
Compare
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In CreateControllerContainer's createPortBindings helper, the initial HostIP is derived by parsing the port string instead of the host (and the host parameter is otherwise unused), which will silently yield an empty/zero IP and ignore non-default hosts; this should parse and use the host value instead.
- In DetectContext for Desktop contexts, the httpClient is now left unset (the DockerClientForContext and HTTPClient wiring is commented out), so any downstream code that assumes a non-nil client may panic or behave differently; consider either wiring a concrete http.Client or making the nil case explicit and handled.
- The new DockerClientForContext drops the previous WithAPIVersionNegotiation option when constructing the moby client, which may cause compatibility issues with older daemons; consider reintroducing equivalent version negotiation behavior if supported.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In CreateControllerContainer's createPortBindings helper, the initial HostIP is derived by parsing the port string instead of the host (and the host parameter is otherwise unused), which will silently yield an empty/zero IP and ignore non-default hosts; this should parse and use the host value instead.
- In DetectContext for Desktop contexts, the httpClient is now left unset (the DockerClientForContext and HTTPClient wiring is commented out), so any downstream code that assumes a non-nil client may panic or behave differently; consider either wiring a concrete http.Client or making the nil case explicit and handled.
- The new DockerClientForContext drops the previous WithAPIVersionNegotiation option when constructing the moby client, which may cause compatibility issues with older daemons; consider reintroducing equivalent version negotiation behavior if supported.
## Individual Comments
### Comment 1
<location> `cmd/cli/pkg/standalone/containers.go:451-456` </location>
<code_context>
// Helper function to create port bindings with optional bridge gateway IP
- createPortBindings := func(port string) []nat.PortBinding {
- portBindings := []nat.PortBinding{{HostIP: host, HostPort: port}}
+ createPortBindings := func(port string) []network.PortBinding {
+ var hostIP netip.Addr
+ if p, err := netip.ParseAddr(port); err == nil {
+ hostIP = p
+ }
+ portBindings := []network.PortBinding{{
+ HostIP: hostIP,
+ HostPort: port,
</code_context>
<issue_to_address>
**issue (bug_risk):** Host IP parsing in `createPortBindings` is using the port string instead of the host string, so the primary binding's HostIP will never be set correctly.
Inside `createPortBindings`, `netip.ParseAddr(port)` is parsing the numeric port string (e.g., "8080"), so it will always fail and `hostIP` remains the zero value. Previously, the host IP came from the `host` variable (e.g., `127.0.0.1`), so the first `PortBinding` now gets an unset HostIP.
`host` should be parsed and used for the initial binding (e.g., parse `host` once and reuse it), and `netip.ParseAddr` should only be applied to actual IP strings (such as `bridgeGatewayIP`).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
3b4864f to
ea003d2
Compare
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
ea003d2 to
e4da837
Compare
No description provided.