fix(acp): honor configured terminal shell - #434
Conversation
|
Thanks for this — the plumbing here is genuinely nice work. The shared
I also ran the full matrix on this branch merged into current There's one thing I'd like fixed before this lands, plus some smaller notes. Blocking: the unconfigured case silently changes shell toolet shell = configured_shell.unwrap_or_else(resolve_shell);A user who has never touched the setting stores That matters because this fallback exists specifically to evaluate the POSIX line an agent emitted — dc5057d calls it "the platform shell", and the surrounding comment is explicit that it's there so fish is the more likely real-world case (it's literally the placeholder in Suggested minimal fix, which keeps the PR's stated goal intact and shrinks the blast radius to explicit opt-in: let shell = configured_shell.unwrap_or_else(default_platform_shell); // "/bin/sh" / $COMSPECi.e. Non-blocking notesWindows PowerShell 5.1 can't do Consider the env-var indirection for the PowerShell branch. The built-in terminal deliberately goes through Shell classification is now duplicated.
Settings copy is now understated. Startup ordering (pre-existing pattern). Nit: the cfg-gated Happy to merge as soon as the unset-default case is preserved — everything else on the list is optional. Nice change overall. 🙏 |
|
Fixed the blocking case in c2acace: when General Settings has no explicit shell, ACP now preserves its legacy platform fallback ( |
|
I re-ran the full matrix on this branch merged into current I also wrote a throwaway call-site test to confirm the fix works end to end and not just at the helper — unconfigured runtime, I'll merge this shortly. Everything below is optional — recording it so it isn't lost, not asking for another round.
Nice work on this one — the shared hot-swappable handle is a clean piece of design. 🙏 |
The configurable-shell change left a handful of loose ends from review. Shell dialect classification lived in two places — `detect_windows_shell_flavor` for the built-in terminal and an inline copy in the ACP terminal runtime — and the copies had inverted fallthrough: an unrecognized Windows shell got cmd's `/C` from one and POSIX `-c` from the other, so a `COMSPEC` pointing at a cmd-compatible replacement was invoked with the wrong convention. Both now go through `terminal::shell_flavor`. The shell-fallback retry for a bare no-argv command keyed off "did the user configure something", which made an explicit `/bin/sh` behave differently from leaving the setting on its default. It now keys off whether the fallback shell resolves names the OS cannot — PowerShell's `Get-ChildItem`, cmd's `dir`. Desktop startup now seeds the persisted shell before the chat-channel dispatcher spawns, matching server startup, which seeds before it binds. The unset default was only pinned at the helper, so a future edit to `create_terminal` could reintroduce the login-shell regression without failing anything. `$0` names the shell that actually ran the line, which pins the selection itself — reverting the call site to `resolve_shell` fails it with `ran-under=/bin/zsh`. Settings copy said the shell applied only to terminal tabs. It now says agents use it too, and warns that they emit POSIX syntax which fish, nushell, and Windows PowerShell 5.1 may reject. All ten locales. Left deliberately unfixed, with the reasoning recorded next to the code: Windows PowerShell 5.1 and cmd write redirected output in the OEM code page while this runtime decodes it as UTF-8. The obvious preambles (`chcp 65001`, `[Console]::OutputEncoding`) both need a console, and these children spawn with `CREATE_NO_WINDOW` — they would fail and add a diagnostic to the agent's output without changing the encoding. The built-in terminal can set them only because it runs its shell under a PTY.
|
Pushed Shell classification is now shared. The retry gate no longer keys off "is something configured". Explicitly selecting The unset default is pinned at the call site, not just the helper. Desktop startup seeds the shell before the chat-channel dispatcher spawns, matching server startup, which seeds before it binds. Settings copy updated in all 10 locales — it now says agents use this shell too, with a hint that they emit POSIX syntax which fish, nushell, and Windows PowerShell 5.1 may reject, and that System default keeps agent lines on the platform shell. Plus the import-order nit. One item I deliberately did not fixThe Windows OEM-encoding gap. I had implemented it — Also worth flagging as a conscious tradeoff: unrecognized Windows shells now get the cmd convention rather than POSIX VerificationI don't have a Windows host, so the Windows arms are argv-asserted by unit tests but never executed on Windows — same as before this commit, since the wrapper now passes the line verbatim exactly as it did. Ready to merge from my side. Thanks again for the quick turnarounds on this one. 🙏 |
# Conflicts: # src/components/settings/general-settings.tsx # src/i18n/messages/ar.json # src/i18n/messages/de.json # src/i18n/messages/en.json # src/i18n/messages/es.json # src/i18n/messages/fr.json # src/i18n/messages/ja.json # src/i18n/messages/ko.json # src/i18n/messages/pt.json # src/i18n/messages/zh-CN.json # src/i18n/messages/zh-TW.json
|
Follow-up: Re-ran everything on the merged result, since #432 brought a fair amount of Rust with it: Back to |
Summary
Verification