Skip to content

fix(bots): keep version manager dirs under isolated bot homes - #780

Merged
nixuuu merged 1 commit into
devfrom
fix/bot-mise-shim
Nov 15, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/bot-mise-shim

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Every bot turn failed on a worker whose CLIs come from a version manager. Codex and Grok bots run with a private HOME, USERPROFILE and XDG dirs (#190), and CLI discovery often picks a shim (e.g. ~/.local/share/mise/shims/codex). A CLI launcher may also run node from PATH, which can be a shim too. Under the bot's home, the shim can't find its installs or trusted config and exits right away (mise ERROR Config files in ~/.config/mise/config.toml are not trusted.). Codex then failed initialize and was classified as internal; Grok failed with process_exit. The UI only showed "Bot harness could not finish this turn". Threads were not affected because they keep the real HOME.

Fix

  • isolatedHomeEnvironment keeps the device's version manager directories, taken from the worker's real environment: MISE_CONFIG_DIR, MISE_DATA_DIR, MISE_STATE_DIR, MISE_GLOBAL_CONFIG_ROOT, ASDF_DATA_DIR, VOLTA_HOME. Values the device already sets win.
  • Skipped on Windows, where these managers use LOCALAPPDATA.
  • These directories hold tool versions, not provider configuration: login, skills and instructions stay isolated. docs/bots-harness.md describes the rule.

Checks

  • New harness adapter test (apps/worker/src/bots/isolation.test.ts): Codex and Grok bots start through a shim that resolves its install from a data dir under HOME, as mise does, and must reach inference. Without the fix both fail within 10–20 ms; with it both pass.
  • On an affected worker: the codex, claude and grok shims fail under an isolated HOME and start with the kept MISE_* dirs.
  • bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, web build: clean.
  • bun run check:tmp: 3167 passed, 3 failed, nothing left in the temp dir. None of the failures come from this change:
    • tools/direct-inference.test.ts hit its 5 s timeout on a loaded machine and passes when run alone.
    • tests/integration/worker-profile-env.test.ts ("adding variables replaces only the instance process") fails the same way on dev.
    • apps/worker/src/providers/codex/connections.test.ts ("Codex keeps full history when resuming…") fails the same way on dev.

Copy audit (docs/copy.md §8)

No UI text added or changed.

Fixes: #190

🤖 Generated with Claude Code

Codex and Grok bots replace HOME and XDG. A CLI found through a mise,
asdf or Volta shim (or a launcher that runs `node` from PATH) then could
not find its installs or trusted config and exited at once, so every
bot turn failed with an internal harness error.

Keep the device's version manager directories in the bot environment.

Fixes: #190

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nixuuu
nixuuu merged commit 109dbf2 into dev Nov 15, 2026
12 checks passed
@nixuuu
nixuuu deleted the fix/bot-mise-shim branch November 15, 2026 02:01
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.

1 participant