Let a bot launch leave out the workspace's .env.<client> #96

Open
opened 2026-12-02 10:39:38 +01:00 by motoko · 0 comments
Collaborator

Defect

A bot launch loads the workspace's .env.<client>, so the repository
the bot works on sets the variables of the bot's own session. For
OpenCode, an OPENCODE_CONFIG_DIR in .env.opencode replaces the
identity's configuration directory: the bot no longer runs with the
configuration the operator gave it.

Evidence

Trials on a host, with OpenCode 2.4.2 in the image, each launch as
opencode WS --identity BOT --no-tty --mount ETC:/etc/opencode:ro -- run --auto PROMPT,
one variable per launch in the repository's .env.opencode:

  • OPENCODE_CONFIG alone, or OPENCODE_CONFIG_CONTENT alone: the
    session keeps the bot's model.
  • OPENCODE_CONFIG_DIR=/workspace alone: the log has no watcher lines
    on /home/opencode/.config/opencode, and with the three variables
    together the session runs on OpenCode's default model instead of the
    bot's.

The system configuration mounted at /etc/opencode still applied in
each launch. The Azkaban release was not recorded.

Scenario

A caller, such as an automation, launches a bot on a repository whose
content it does not control. Anyone who can commit a .env.opencode
there picks the configuration directory the bot reads, and with it the
bot's model and what that directory holds; the launch line shows
nothing of it.

Smallest fix

An option, on the launch or on the identity, that leaves out the
workspace's .env.<client>, so that a bot's variables come from its
identity's env alone. A launch without it keeps today's behavior.

## Defect A bot launch loads the workspace's `.env.<client>`, so the repository the bot works on sets the variables of the bot's own session. For OpenCode, an `OPENCODE_CONFIG_DIR` in `.env.opencode` replaces the identity's configuration directory: the bot no longer runs with the configuration the operator gave it. ## Evidence Trials on a host, with OpenCode 2.4.2 in the image, each launch as `opencode WS --identity BOT --no-tty --mount ETC:/etc/opencode:ro -- run --auto PROMPT`, one variable per launch in the repository's `.env.opencode`: - `OPENCODE_CONFIG` alone, or `OPENCODE_CONFIG_CONTENT` alone: the session keeps the bot's model. - `OPENCODE_CONFIG_DIR=/workspace` alone: the log has no watcher lines on `/home/opencode/.config/opencode`, and with the three variables together the session runs on OpenCode's default model instead of the bot's. The system configuration mounted at `/etc/opencode` still applied in each launch. The Azkaban release was not recorded. ## Scenario A caller, such as an automation, launches a bot on a repository whose content it does not control. Anyone who can commit a `.env.opencode` there picks the configuration directory the bot reads, and with it the bot's model and what that directory holds; the launch line shows nothing of it. ## Smallest fix An option, on the launch or on the identity, that leaves out the workspace's `.env.<client>`, so that a bot's variables come from its identity's `env` alone. A launch without it keeps today's behavior.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
claudiomaradonna/azkaban#96
No description provided.