Skip to content

feat(shell): let [tools.shell] pick the bash tool's interpreter#4131

Merged
esengine merged 1 commit into
main-v2from
feat/shell-config
Jun 12, 2026
Merged

feat(shell): let [tools.shell] pick the bash tool's interpreter#4131
esengine merged 1 commit into
main-v2from
feat/shell-config

Conversation

@esengine

Copy link
Copy Markdown
Owner

Part of #4114. This is the backend / config-file half; the desktop Settings dropdown follows in a separate PR (it builds on this [tools.shell] field).

Problem

The shell tool auto-detects its interpreter (real bash → Git-for-Windows bash → PowerShell) with no override. A Windows user who prefers PowerShell but has Git for Windows installed is stuck on Git bash.

Change

A [tools.shell] config block, mirroring the existing [tools.search] engine config:

[tools.shell]
prefer = "powershell"   # auto (default) | bash | powershell | pwsh
# path = "C:\Program Files\PowerShell\7\pwsh.exe"   # optional explicit executable
  • prefer = "auto" (default) is the exact current behaviour.
  • bash / powershell / pwsh force that interpreter; path overrides the PATH lookup.
  • A forced shell that isn't installed warns at startup and falls back to auto-detection (same posture as [tools.search] engine="rg"), so a typo can't break the tool.
  • The resolved shell rides on sandbox.Spec, so it reaches both the agent's bash tool (via ConfineBash) and user-invoked ! commands (the controller stores it). The "bash not found → using PowerShell" hint is suppressed once a shell is chosen explicitly.

Cache

No impact by default: prefer=auto resolves identically to today, so the bash tool's description (the only shell-dependent part of the prompt) is byte-for-byte the same. Forcing a shell changes that description to match the chosen interpreter — intrinsic to switching shells, and stable per config.

Tests

resolveShell is dependency-injected; the existing decision table is updated and a new TestResolveShellPrefer covers force / explicit-path / missing-shell-fallback / unknown-value. go test ./internal/{sandbox,config,boot,control,tool/builtin} green; cd desktop && go build ./... green; gofmt/vet clean.

The shell tool auto-detected its interpreter — real bash first, Git-for-Windows
bash next, PowerShell only as a last resort — with no way to override it. A
Windows user who prefers PowerShell but has Git installed was stuck on Git bash.

Add a [tools.shell] config block mirroring [tools.search]: prefer = auto
(default, unchanged behaviour) | bash | powershell | pwsh, with an optional
explicit path. A forced shell that isn't installed warns at startup and falls
back to auto-detection, so a typo can't leave the tool broken. The resolved
shell rides on sandbox.Spec, so it reaches both the agent's bash tool and
user-invoked "!" commands (the controller stores it too). The "fell back to
PowerShell" hint is suppressed once a shell is chosen explicitly.

Cache-neutral by default: prefer=auto resolves exactly as before, so the bash
tool's description (the only shell-dependent part of the prompt) is byte
identical. Forcing a shell changes that description to match — intrinsic to
switching shells, and stable per config.

Part of #4114 (desktop Settings UI follows in a separate PR).
@esengine esengine requested a review from SivanCola as a code owner June 12, 2026 06:21
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development skills Skill system (internal/skill, internal/tool) agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 12, 2026
@esengine esengine merged commit da3fdb7 into main-v2 Jun 12, 2026
14 checks passed
@esengine esengine deleted the feat/shell-config branch June 12, 2026 06:24
esengine added a commit that referenced this pull request Jun 12, 2026
Surfaces the [tools.shell] preference (added in #4131) in the desktop Settings
panel so users don't have to hand-edit reasonix.toml. The Sandbox tab gains a
"Shell interpreter" select — auto / bash / PowerShell / pwsh — wired through the
existing SetSandbox apply path (snapshot → reload → resume), with en/zh strings.

Closes #4114
esengine added a commit that referenced this pull request Jun 12, 2026
…#4134)

Surfaces the [tools.shell] preference (added in #4131) in the desktop Settings
panel so users don't have to hand-edit reasonix.toml. The Sandbox tab gains a
"Shell interpreter" select — auto / bash / PowerShell / pwsh — wired through the
existing SetSandbox apply path (snapshot → reload → resume), with en/zh strings.

Closes #4114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) skills Skill system (internal/skill, internal/tool)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant