Blocks that run your tools need the shell's environment (node from mise isn't on the daemon's PATH) #74

Closed
opened 2026-10-02 21:15:44 +00:00 by jhgaylor · 2 comments
Owner

From S21 (#70). Small and on its own, since every block that runs your tools needs it.


  • The problem: the daemon starts blocks' commands with its own environment. Tools set up in .bashrc (node and others from mise, nvm, fnm, pyenv) aren't on that PATH, though every pane has them. S21's workspace block failed with "node is not on PATH on this host" on geek, where node is a mise shim set up in .bashrc only.
  • What S21 did: when node is missing, take PATH from $SHELL -ic 'printf %s "$PATH"' (spikes/s21-chant-workspace/src/model.rs). That's per call, with no cache.
  • The fix:
    • Resolve the user's shell environment once per host, as VS Code does: the login shell, interactive, with a timeout. Then cache it and use it for blocks that run the user's tools (workspace, any later ones).
    • On a VM, do the same once per machine, through the provider.
    • Refresh it on demand (illogicald restart, or a call), not on a timer.
    • Panes don't change: they already run the real shell.
  • Done when: a workspace block on a host whose node lives only in .bashrc reads its workspace with no per-call fallback, and a test covers an rc file that adds to PATH.
*From S21 (#70). Small and on its own, since every block that runs your tools needs it.* -------- - **The problem:** the daemon starts blocks' commands with its own environment. Tools set up in `.bashrc` (node and others from mise, nvm, fnm, pyenv) aren't on that PATH, though every pane has them. S21's workspace block failed with "node is not on PATH on this host" on geek, where node is a mise shim set up in `.bashrc` only. - **What S21 did:** when node is missing, take PATH from `$SHELL -ic 'printf %s "$PATH"'` (`spikes/s21-chant-workspace/src/model.rs`). That's per call, with no cache. - **The fix:** - Resolve the user's shell environment once per host, as VS Code does: the login shell, interactive, with a timeout. Then cache it and use it for blocks that run the user's tools (workspace, any later ones). - On a VM, do the same once per machine, through the provider. - Refresh it on demand (`illogicald` restart, or a call), not on a timer. - Panes don't change: they already run the real shell. - **Done when:** a workspace block on a host whose node lives only in `.bashrc` reads its workspace with no per-call fallback, and a test covers an rc file that adds to PATH.
Author
Owner

Merged into local main as d1a9513 (branch i74-shell-env, 462616d; CI green on linux 797 and macos 796). Not pushed. Measured on geek: a cold resolve at startup took 236 ms; refreshes took 182–190 ms. A dev daemon started with PATH=/usr/bin:/bin resolved mise's shims, and node was found (v22.23.2). The workspace half of "done when" is checked in M34's run on geek, once the workspace block uses Runner::user with no per-call fallback. Tracker: #86.

Merged into local main as d1a9513 (branch i74-shell-env, 462616d; CI green on linux 797 and macos 796). Not pushed. Measured on geek: a cold resolve at startup took 236 ms; refreshes took 182–190 ms. A dev daemon started with PATH=/usr/bin:/bin resolved mise's shims, and node was found (v22.23.2). The workspace half of "done when" is checked in M34's run on geek, once the workspace block uses `Runner::user` with no per-call fallback. Tracker: #86.
jhgaylor referenced this issue from a commit 2026-10-03 03:20:22 +00:00
Author
Owner

Shipped in v0.7.0 (tag on 84b5e9b; geek, jake-mini and jake-air upgraded). Tracker: #86.

Shipped in v0.7.0 (tag on 84b5e9b; geek, jake-mini and jake-air upgraded). Tracker: #86.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
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
jhgaylor/illogical#74
No description provided.