gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

bug: fix ide-client connection to ide-companion when inside docker via ssh/devcontainer

Open kapsner opened this issue 2 months ago • 8 comments

Summary

  • fix ide-server-host for containers in ssh-setup and devcontainer setup
  • fix path of cli companion server config files to 'os.tmpdir()/gemini/ide/' according to https://github.com/google-gemini/gemini-cli/blob/7a720375729cc1e5b92ec02910a2fa8be77aa05d/docs/ide-integration/ide-companion-spec.md?plain=1#L38

and

https://github.com/google-gemini/gemini-cli/blob/7a720375729cc1e5b92ec02910a2fa8be77aa05d/packages/core/src/ide/ide-client.ts#L598

Details

  • ide-client currently uses "host.docker.internal" as ide-server-host in all containers. However, this breaks connection between ide-server and ide-client when using remote-ssh in a container or when using devcontainers. This PR introduces a more sophisticated logic to set "host.docker.internal" as ide-server-host only in containers in sandbox setups and to use "127.0.0.1" for containers with ssh-connection or when devcontainer setup is detected.
  • some paths to detect ide-server-config files were not yet updated to 'os.tmpdir()/gemini/ide/'

Related Issues

Fixes #10473 Fixess #6297 Fixes #7426 Fixes #6480 Fixes #6928

How to Validate

  • open ssh-connection into a container
  • Pull this patch
  • cd gemini-cli
  • npm install
  • run "./bundle/gemini.js" and "/ide install"
  • --> should successfully connect to ide-server

Pre-Merge Checklist

  • [ ] Updated relevant documentation and README (if needed)
  • [x] Added/updated tests (if needed)
  • [ ] Noted breaking changes (if any)
  • [x] Validated on required platforms/methods:
    • [ ] MacOS
      • [ ] npm run
      • [ ] npx
      • [ ] Docker
      • [ ] Podman
      • [ ] Seatbelt
    • [ ] Windows
      • [ ] npm run
      • [ ] npx
      • [ ] Docker
    • [x] Linux
      • [x] npm run
      • [x] npx
      • [x] Docker

kapsner avatar Dec 13 '25 13:12 kapsner