fix: Provide OPENCODE & AGENT env vars#3843
Conversation
Plus generic AGENT var used by eg bun test: https://bun.com/docs/test#environment-variables
| })(), | ||
| }) | ||
|
|
||
| process.env["OPENCODE"] = "1" |
There was a problem hiding this comment.
why remove this?
should we just also set AGENT=1 here too instead?
Note there is also the user invoked commands in prompt.ts
There was a problem hiding this comment.
Thanks, I'll take a look at prompt. I just don't think a process can mutate its environment like this? Might be wrong of course but it certainly doesn't work for the bash spawn
There was a problem hiding this comment.
according to bun docs u can: https://bun.com/docs/runtime/environment-variables
There was a problem hiding this comment.
Added the env vars to the shell prompts 40b3730
Happy to revert the - process.env["OPENCODE"] = "1" change but atm I don't see how it has ever served its intended purpose.
There was a problem hiding this comment.
according to bun docs u can: https://bun.com/docs/runtime/environment-variables
sorry, just seen this. Interesting:
-
My unit tests fail on dev
-
Interactive session fails on dev:
print the value of OPENCODE env var
stevoland (10:44:17 PM)
I'll check the value of the OPENCODE environment variable for you.
# Print OPENCODE environment variable value
$ echo $OPENCODE
The OPENCODE environment variable is not set or is empty in your current environment.
- but
opencode runworks on dev:
$ opencode run "print the OPENCODE env var"
I'll check the OPENCODE environment variable for you.
| Bash echo $OPENCODE
1
The OPENCODE environment variable is set to `1`.
- All work on 40b3730
I've re-added the mutation (and AGENT) out of caution b939a9d
Thanks
|
thanks for PR, couple questions for u |
This works as-is `opencode run` for not for interactive sessions
|
found the issue, when we spawn a worker we weren't passing process.env to it |
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Plus generic AGENT var used by eg
bun test: https://bun.com/docs/test#environment-variables(I don't think you can mutate the environment as currently attempted)