feat: forward known AI agent ENVs on exec, fixes #8378#8380
feat: forward known AI agent ENVs on exec, fixes #8378#8380
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
rfay
left a comment
There was a problem hiding this comment.
This looks to be great. Could it be made more general? I'm sure that other environment variables would be lovely to have sometimes. It's possible we should have a global or project config to say what env vars to deliver to in-container environments.
|
Making it configurable in some way does sound like a good idea. Defaults plus extendable overrides? |
Makes sense to me. However, I'm not sure the agent environment variables are the default starters, people could add those as needed. |
Hmmm... well, the feature ticket explicitly asked for it: "We should have first-class support for this - users shouldn't have to do extra work for it." |
It's true. But the need is far more general and the AI usage seems like a tiny piece of it. But let's let @stasadev weigh in here. |
stasadev
left a comment
There was a problem hiding this comment.
The env pass for ddev exec looks good.
I haven't tested it yet - I'll do it during the week.
This looks to be great. Could it be made more general? I'm sure that other environment variables would be lovely to have sometimes. It's possible we should have a global or project config to say what env vars to deliver to in-container environments.
We already have a passthrough in ddev start, added in v1.25.2:
DDEV could read globalconfig.DdevGlobalConfig.WebEnvironment + app.WebEnvironment during ddev exec and look up env vars declared as bare variables.
This feels like a natural flow to me and wouldn't require any new config.
The Issue
AI_AGENT) for AI detection inside web container #8378How This PR Solves The Issue
Forward the well-known agent ENVs listed in https://github.com/laravel/agent-detector#supported-agents on exec to all DDEV services.
Apart from COPILOT_GITHUB_TOKEN. I don't think we should automatically forward authentication information like that.
Manual Testing Instructions
Expected result: both commands print manual-test.
Automated Testing Overview
go test -v ./pkg/ddevapp -run 'TestAgentDetectionEnv'Release/Deployment Notes