From 1a8915560ff27bd9194feadecf5d601404b319fc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 15:32:33 +0000 Subject: [PATCH 1/2] fix: keep Homebrew last on PATH for runner sessions and the startup hook ## Short Summary (TL;DR) Claude Code runner sessions and `~/.coder-startup.sh` put Homebrew ahead of the system PATH, so they used Homebrew's `curl`, which doesn't trust the mkcert CA. This change puts Homebrew last, as the image already does, so `curl https://.ddev.site` works there without extra steps. ## The Issue In a Claude Code self-hosted runner session, `curl https://.ddev.site` fails: ```text curl: (60) SSL certificate OpenSSL verify result: unable to get local issuer certificate (20) ``` `mkcert -install` doesn't help, although the workspace startup already runs it. The image puts Homebrew last on PATH, so its formulas never shadow system tools. Two places reverse that order: - `claude-runner-loop.sh.tftpl`, which starts every runner session - The `~/.coder-startup.sh` user hook in all three templates Nobody installs Homebrew's `curl` on purpose. It comes in as a dependency of `zellij`. It uses Homebrew's own CA bundle, which Homebrew copies from the system store once, when the image is built. The mkcert CA only reaches the system store at workspace start, so that copy never has it. The system `curl` reads `/etc/ssl/certs` and trusts the CA. ## How This PR Solves The Issue The four PATH lines now put Homebrew after `$PATH` instead of before it, as the image and `~/.bashrc` already do. The system `curl`, `openssl`, util-linux, `xz`, `zstd`, and ncurses tools then win over Homebrew's copies. Tools that only Homebrew provides, such as `go`, `bats`, `golangci-lint`, and `claude`, still resolve from Homebrew. Removing Homebrew's `curl` was not possible, because `zellij` depends on it. ## Manual Testing Instructions 1. Push the `freeform` template and restart a workspace that has the self-hosted runner enabled. 2. Start a Claude Code session on that runner, and start a DDEV project in it. 3. In the session, run `command -v curl`. Expect `/usr/bin/curl`. 4. Run `curl -sSI https://.ddev.site`. Expect an HTTP status line and no certificate error. 5. Run `command -v go bats claude`. Expect paths under `/home/linuxbrew/.linuxbrew/bin`. For the startup hook, put `command -v curl > /tmp/hook-curl.txt` in `~/.coder-startup.sh`, restart the workspace, and expect `/usr/bin/curl` in that file. ## Automated Testing Overview There are no new tests, because the change is in shell text that the Terraform tests don't run. Claude Code ran both PATH orders in an existing workspace with a running DDEV project. With Homebrew first, `curl` was Homebrew's and failed with the error above. With Homebrew last, `curl` was `/usr/bin/curl` and returned HTTP 200, and `go`, `bats`, `claude`, and `golangci-lint` still came from Homebrew. Terraform was not available locally, so `make validate` and `make test-templates` run only in CI. ## Release/Deployment Notes Push all three templates. Running workspaces get the change at their next restart. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UrTUMyUJqyV4ePwb7PKcWo --- drupal-contrib/template.tf | 2 +- drupal-core/template.tf | 2 +- .../files/claude-runner-loop.sh.tftpl | 4 +++- freeform/template.tf | 2 +- .../files/claude-runner-loop.sh.tftpl | 4 +++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drupal-contrib/template.tf b/drupal-contrib/template.tf index cbea4d2..75adecd 100644 --- a/drupal-contrib/template.tf +++ b/drupal-contrib/template.tf @@ -1079,7 +1079,7 @@ BASHPROFILE_WELCOME # PATH because ~/.bashrc returns early for non-interactive shells. if [ -x ~/.coder-startup.sh ]; then echo "Running user startup hook ~/.coder-startup.sh (log: /tmp/coder-startup-user.log)" - PATH="$HOME/.local/bin:$HOME/.npm-global/bin:/home/linuxbrew/.linuxbrew/bin:$PATH" \ + PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH:/home/linuxbrew/.linuxbrew/bin" \ nohup setsid ~/.coder-startup.sh > /tmp/coder-startup-user.log 2>&1 < /dev/null & fi diff --git a/drupal-core/template.tf b/drupal-core/template.tf index 5148ec2..f189efd 100644 --- a/drupal-core/template.tf +++ b/drupal-core/template.tf @@ -1383,7 +1383,7 @@ BASHCOMP # PATH because ~/.bashrc returns early for non-interactive shells. if [ -x ~/.coder-startup.sh ]; then echo "Running user startup hook ~/.coder-startup.sh (log: /tmp/coder-startup-user.log)" - PATH="$HOME/.local/bin:$HOME/.npm-global/bin:/home/linuxbrew/.linuxbrew/bin:$PATH" \ + PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH:/home/linuxbrew/.linuxbrew/bin" \ nohup setsid ~/.coder-startup.sh > /tmp/coder-startup-user.log 2>&1 < /dev/null & fi diff --git a/freeform/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl b/freeform/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl index daa7387..4a47efc 100644 --- a/freeform/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl +++ b/freeform/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl @@ -7,7 +7,9 @@ set -u n="$1" base="${base_dir}/runner-$n" mkdir -p "$base" -export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:/home/linuxbrew/.linuxbrew/bin:$PATH" +# Homebrew goes last, as in the image, so its curl and openssl never shadow the +# system ones. Its CA bundle lacks the mkcert CA that DDEV sites use. +export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH:/home/linuxbrew/.linuxbrew/bin" export GIT_CONFIG_GLOBAL="$base/.gitconfig" # The workspace SSH agent relay (shared/ssh-agent-setup.sh): the user's # forwarded agent when one is connected, otherwise the Coder workspace key. diff --git a/freeform/template.tf b/freeform/template.tf index 61a6066..3ebed2e 100644 --- a/freeform/template.tf +++ b/freeform/template.tf @@ -376,7 +376,7 @@ BASHCOMP # PATH because ~/.bashrc returns early for non-interactive shells. if [ -x ~/.coder-startup.sh ]; then echo "Running user startup hook ~/.coder-startup.sh (log: /tmp/coder-startup-user.log)" - PATH="$HOME/.local/bin:$HOME/.npm-global/bin:/home/linuxbrew/.linuxbrew/bin:$PATH" \ + PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH:/home/linuxbrew/.linuxbrew/bin" \ nohup setsid ~/.coder-startup.sh > /tmp/coder-startup-user.log 2>&1 < /dev/null & fi diff --git a/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl b/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl index daa7387..4a47efc 100644 --- a/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl +++ b/modules/claude-self-hosted-runner/files/claude-runner-loop.sh.tftpl @@ -7,7 +7,9 @@ set -u n="$1" base="${base_dir}/runner-$n" mkdir -p "$base" -export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:/home/linuxbrew/.linuxbrew/bin:$PATH" +# Homebrew goes last, as in the image, so its curl and openssl never shadow the +# system ones. Its CA bundle lacks the mkcert CA that DDEV sites use. +export PATH="$HOME/.local/bin:$HOME/.npm-global/bin:$PATH:/home/linuxbrew/.linuxbrew/bin" export GIT_CONFIG_GLOBAL="$base/.gitconfig" # The workspace SSH agent relay (shared/ssh-agent-setup.sh): the user's # forwarded agent when one is connected, otherwise the Coder workspace key. From dcd82cac1125816540b4df533e31f95c943c8ea1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 15:35:30 +0000 Subject: [PATCH 2/2] chore(image): drop unused zellij, which pulled in Homebrew curl zellij came in with #172 without explanation, and nothing in the repository uses it. It was the only formula that depended on Homebrew's curl, openssl@4, and ca-certificates, so new images no longer install them. Existing workspaces keep zellij and its dependencies in their persistent /home/linuxbrew volume. To remove them, run `brew uninstall zellij && brew autoremove`. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UrTUMyUJqyV4ePwb7PKcWo --- image/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/image/Dockerfile b/image/Dockerfile index 277f0e9..673a236 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -187,8 +187,7 @@ RUN mkdir -p "$HOMEBREW_CACHE" && /home/linuxbrew/.linuxbrew/bin/brew install \ go \ golangci-lint \ gopls \ - yq \ - zellij + yq USER root # Every process in the workspace gets this PATH, including ones no shell