Skip to content

Explain: Fix passthrough of environment to Copilot CLI.#93

Merged
mark-undoio merged 1 commit intomasterfrom
fix-copilot-env-passthrough
Nov 6, 2025
Merged

Explain: Fix passthrough of environment to Copilot CLI.#93
mark-undoio merged 1 commit intomasterfrom
fix-copilot-env-passthrough

Conversation

@mark-undoio
Copy link
Copy Markdown
Contributor

This bug caused errors of the form:

env: 'node': No such file or directory

To appear when Node was installed at a non-distro path (i.e. installed manually or using NVM, rather than at /usr/bin/node by the distro's package manager).

This occurred because the #!/usr/bin/env node at the start of Copilot's index.js couldn't guess a PATH to node. With a distro-based install, env will sometimes guess standard paths for you.

This was always a bug in my code but didn't manifest until we saw the right host environment.

This bug caused errors of the form:

```
env: 'node': No such file or directory
```

To appear when Node was installed at a non-distro path (i.e. installed manually
or using NVM, rather than at `/usr/bin/node` by the distro's package manager).

This occurred because the `#!/usr/bin/env node` at the start of Copilot's
`index.js` couldn't guess a PATH to node.  With a distro-based install, env will
sometimes guess standard paths for you.

This was always a bug in my code but didn't manifest until we saw the right host
environment.

allowed_tools = ["UDB_Server", "shell(grep)", "shell(find)", "shell(cat)", "shell(xargs)"]
env = {
env_changes = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the more idiomatic way of doing this is:

env = {
    **os.environ,
    "...": ...
}

@mark-undoio mark-undoio merged commit e33f0d9 into master Nov 6, 2025
2 checks passed
@mark-undoio mark-undoio deleted the fix-copilot-env-passthrough branch November 6, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants