Skip to content

fix: keep host variables out of the daemons' ddev start launches, for #8380 - #8976

Merged
rfay merged 2 commits into
ddev:mainfrom
stasadev:20261019_stasadev_start_sh_no_agent_env
Oct 21, 2026
Merged

rfay merged 2 commits into
ddev:mainfrom
stasadev:20261019_stasadev_start_sh_no_agent_env

Conversation

@stasadev

@stasadev stasadev commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Short Summary (TL;DR)

ddev start no longer passes AI agent variables like AI_AGENT or CLAUDECODE to supervisord and web_extra_daemons, so a project runs the same whether a person or an agent started it.

The Issue

ddev start runs /start.sh through app.Exec, which since #8380 adds the host variables that execEnv forwards, and start.sh ends with exec supervisord. So every daemon inherited the agent variables of the shell that ran ddev start, while PID 1 did not have them. Astro 7.4 runs astro dev in the background when it detects an agent, so its web_extra_daemons command exited at once and supervisor kept respawning it.

How This PR Solves The Issue

A new ExecOpts.SkipHostEnv makes Exec pass only Env, without execEnv, and the /start.sh exec sets it. That gives start.sh the same environment it had before #8380. This leaves the container environment alone, so bare web_environment names that Compose resolved at start still reach the daemons, as they did before #8380.

Manual Testing Instructions

ddev utility download-ddev --pr 8976
export PATH="$HOME/tmp/ddev-download-ddev/pr-8976:$PATH"
mkdir -p ~/tmp/start-env && cd ~/tmp/start-env
ddev config --project-type=php --web-environment-add=MY_BARE_VAR
AI_AGENT=manual-test MY_BARE_VAR=from-host ddev start -y
ddev exec 'tr "\0" "\n" < /proc/$(pgrep -x supervisord)/environ | grep -E "AI_AGENT|MY_BARE_VAR"'
# MY_BARE_VAR=from-host only, no AI_AGENT
AI_AGENT=manual-test ddev exec 'echo $AI_AGENT'
# manual-test, ddev exec still forwards it

See the note added under Host Variables Forwarded on Exec.

Automated Testing Overview

TestExtraPortExpose, which already starts a project with web_extra_daemons, now sets AI_AGENT before ddev start and checks that ddev exec gets it while supervisord does not. It fails without the fix.

🤖 Developed with assistance from Claude Code

## Short Summary (TL;DR)

`ddev start` no longer passes AI agent variables like `AI_AGENT` or `CLAUDECODE` to `supervisord` and `web_extra_daemons`, so a project runs the same whether a person or an agent started it.

## The Issue

- Follow-up to ddev#8380, see ddev#8380 (comment)

`ddev start` runs `/start.sh` through `app.Exec`, which since ddev#8380 adds the host variables that `execEnv` forwards, and `start.sh` ends with `exec supervisord`. So every daemon inherited the agent variables of the shell that ran `ddev start`, while PID 1 did not have them. Astro 7.4 runs `astro dev` in the background when it detects an agent, so its `web_extra_daemons` command exited at once and supervisor kept respawning it.

## How This PR Solves The Issue

A new `ExecOpts.SkipHostEnv` makes `Exec` pass only `Env`, without `execEnv`, and the `/start.sh` exec sets it. That gives `start.sh` the same environment it had before ddev#8380. This leaves the container environment alone, so bare `web_environment` names that Compose resolved at start still reach the daemons, as they did before ddev#8380.

## Manual Testing Instructions

```bash
ddev utility download-ddev --pr 8976
export PATH="$HOME/tmp/ddev-download-ddev/pr-8976:$PATH"
mkdir -p ~/tmp/start-env && cd ~/tmp/start-env
ddev config --project-type=php --web-environment-add=MY_BARE_VAR
AI_AGENT=manual-test MY_BARE_VAR=from-host ddev start -y
ddev exec 'tr "\0" "\n" < /proc/$(pgrep -x supervisord)/environ | grep -E "AI_AGENT|MY_BARE_VAR"'
# MY_BARE_VAR=from-host only, no AI_AGENT
AI_AGENT=manual-test ddev exec 'echo $AI_AGENT'
# manual-test, ddev exec still forwards it
```

See the note added under [Host Variables Forwarded on Exec](https://ddev--8976.org.readthedocs.build/en/8976/users/configuration/environment-variables/#host-variables-forwarded-on-exec).

## Automated Testing Overview

`TestExtraPortExpose`, which already starts a project with `web_extra_daemons`, now sets `AI_AGENT` before `ddev start` and checks that `ddev exec` gets it while `supervisord` does not. It fails without the fix.

🤖 Developed with assistance from [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
stasadev added a commit to ddev/ddev.com that referenced this pull request Oct 19, 2026
ddev/ddev#8976 stops `ddev start` from passing `AI_AGENT`, `CLAUDECODE` and the other agent variables to supervisord, so `astro dev` stays in the foreground whoever ran `ddev start`, and the flag is no longer needed. The leak came from ddev/ddev#8380, which no DDEV release includes, so `ddev_version_constraint` stays as it is.

The `bump-deps` skill keeps the daemon check without naming the flag.

🤖 Developed with assistance from [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Download this PR's build for your OS and architecture with:

ddev utility download-ddev --pr 8976

Or download the artifact for your OS and architecture directly:

See Testing a PR.

Open in GitHub Codespaces

@stasadev stasadev changed the title fix: keep host variables out of the daemons ddev start launches fix: keep host variables out of the daemons ddev start launches, for #8380 Oct 19, 2026
@stasadev
stasadev force-pushed the 20261019_stasadev_start_sh_no_agent_env branch from 33639c5 to cea2a7d Compare October 19, 2026 12:49

@rfay rfay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wow, amazing how much complexity we're dealing with in our world. I thought this was just a little docker-compose wrapper!

@rfay rfay changed the title fix: keep host variables out of the daemons ddev start launches, for #8380 fix: keep host variables out of the daemons' ddev start launches, for #8380 Oct 20, 2026
@rfay
rfay merged commit a7f3f33 into ddev:main Oct 21, 2026
46 of 47 checks passed
@rfay
rfay deleted the 20261019_stasadev_start_sh_no_agent_env branch October 21, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants