Skip to content

fix(terminal): honor Settings custom shell when Terminal button clicked (#4085) - #4086

Merged
binaricat merged 3 commits into
mainfrom
fix/4085-custom-shell-path
Nov 1, 2026
Merged

binaricat merged 3 commits into
mainfrom
fix/4085-custom-shell-path

Conversation

@binaricat

Copy link
Copy Markdown
Owner

Summary

Fixes Settings → Terminal custom absolute shell path being ignored when opening a local terminal from the host-page / host-tree Terminal button on Windows (and elsewhere). CLI --open-terminal-shell=<path> already worked.

Root cause

Vault/host-tree buttons used onClick={handleCreateLocalTerminal}. React passes the MouseEvent as the first argument. handleCreateLocalTerminalImpl treated any truthy first arg as an explicit shell, so resolveShellSetting(terminalSettings.localShell, …) never ran → session localShell stayed empty → bridge fell back to the OS default shell.

Fix

  • Only treat objects with a string command as an explicit shell; otherwise resolve from Settings.
  • Wrap onClick sites: () => onCreateLocalTerminal().
  • Unit tests cover Settings custom path, MouseEvent-like arg, and real explicit shell objects.

Notes

Fixes #4085

…ed (#4085)

Vault/host-tree Terminal buttons wired onClick={handler}, so React passed the
MouseEvent as the shell arg and skipped resolveShellSetting(terminalSettings.localShell).
Only treat objects with a string command as explicit shells; wrap onClick sites.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T13:48:22.924748Z 2dbf1cc Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@binaricat

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: f153baef76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@binaricat

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce3a4c06f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

style={{ color: theme.mutedFg }}
disabled={!canCreateLocalTerminal}
onClick={onCreateLocalTerminal}
onClick={() => onCreateLocalTerminal()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the toolbar test to accept the wrapped click handler

The existing test host tree toolbar keeps every default primary action reachable at min width in components/terminalLayer/TerminalHostTreeToolbar.test.ts:52 still requires the literal onClick={onCreateLocalTerminal}. Wrapping both handlers makes that assertion fail, so the repository's npm test suite fails despite the intended behavior being correct. Reproduced by running the toolbar test directly; update the assertion to match the new callback or verify the click behavior instead.

Useful? React with 👍 / 👎.

…ar (#4085)

Codex GH review: source assertion still expected onClick={onCreateLocalTerminal}
after wrappers; update to () => onCreateLocalTerminal() so npm test passes.

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 2dbf1cc52a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@binaricat

Copy link
Copy Markdown
Owner Author

Merge gate

  • GH Codex: CLEAN on 2dbf1cc (toolbar test assertion fixed after P2 on ce3a4c0)
  • CI: lint-and-test / windows-fido / windows-broadcast-ssh green
  • Electron smoke PASS on tip 2dbf1cc52 (Codex CLI 403 → Maintainer self-smoke): Settings → Terminal custom path /tmp/nc-4086-custom-shell.sh → host-tree Local shell click → wrapper marker written; Local Terminal tab opened. Shots: pr-4086-2dbf1cc52-retry3-20261101-215410

@binaricat
binaricat merged commit 9fb2a5c into main Nov 1, 2026
3 checks passed
@binaricat
binaricat deleted the fix/4085-custom-shell-path branch November 1, 2026 14:04
@binaricat

Copy link
Copy Markdown
Owner Author

Merge gate

  • GH Codex: CLEAN on tip 2dbf1cc52 (re-review after toolbar test assertion fix)
  • CI: green on tip (test run 41312952331)
  • Electron smoke: PASS on tip 2dbf1cc52 — Settings custom shell (/tmp/nc-4086-custom-shell.sh) honored when host-tree Local Terminal button clicked; marker /tmp/nc-4086-shell-hit written (hit-1793541270). Shots: pr-4086-2dbf1cc52-retry3-20261101-215410 (Codex CLI 403 class → self-smoke exception, same as fix(tray): do not force-show main window when starting port forward #4082)

Ready to squash-merge. Fixes #4085.

@binaricat

Copy link
Copy Markdown
Owner Author

Electron smoke PASS (tip 2dbf1cc52)

  • Gate: GH Codex CLEAN (no findings) + CI green (lint-and-test / windows-fido / windows-broadcast-ssh)
  • Codex CLI UNAVAILABLE_403 → self-smoke exception (same class as fix(tray): do not force-show main window when starting port forward #4082)
  • Flow: Settings localShell=/bin/bash → reload → click Vault Terminal button (MouseEvent path) → readlink -f /proc/$$/exe + $0
  • Marker: /usr/bin/bash + SMOKE4085:/bin/bash
  • Shots: /workspace/netcatty-smoke-shots/pr-4086-2dbf1cc52-20261101-220631 (incl. 09-4085-after-terminal-click.png, 10-4085-after-shell-probe.png)

Merging.

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.

[Bug] 本地shell无法自动识别第三方shell(nushell)自定义路径也不生效

1 participant