Skip to content

fix(windows): restore agents with the actual terminal shell - #13238

Open
innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:fix/actual-windows-shell-dialect
Open

fix(windows): restore agents with the actual terminal shell#13238
innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:fix/actual-windows-shell-dialect

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Description

Cold-restored agent commands now use the shell executable actually selected by the PTY provider instead of replaying the configured Windows shell setting.
The provider-resolved shell is carried through local and daemon session metadata so a stale wsl.exe preference cannot make a PowerShell pane parse POSIX quoting.

Focused fix

  • In scope: report and consume the resolved shell family for queued/cold-restored agent commands.
  • Out of scope (explicit): translating Windows paths into WSL paths and changing the separate WSL working-directory contract.

Preserves

  • Existing shell selection, WSL context, and remote-provider behavior remain unchanged.
  • Older daemons that do not report the new metadata keep the existing compatibility fallback.

Evidence

  • Test: pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport.test.ts -t "provider-resolved shell"
  • Test: pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts -t "provider-resolved shell"
  • Quality: targeted oxlint/oxfmt, pnpm run typecheck:web, and pnpm exec tsc --noEmit -p config/tsconfig.node.json --pretty false passed.

User-regression-tradeoffs

  • A provider that cannot report the resolved shell remains on the legacy setting-based behavior for compatibility; providers that do report it now preserve the syntax of the shell that is actually running.

Fixes #13095

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 52e357ac-d64b-49b4-a2ce-a179a115ac0b

📥 Commits

Reviewing files that changed from the base of the PR and between 39b3410 and 1f01533.

📒 Files selected for processing (1)
  • src/main/daemon/daemon-create-or-attach-result.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/daemon/daemon-create-or-attach-result.ts

📝 Walkthrough

Walkthrough

The change adds optional resolved shell fields to daemon, provider, and renderer PTY results. The daemon forwards the selected shell for new sessions, restores, and reattachments. The renderer stores the value in local session metadata. Cold-restore command resolution uses the provider-resolved shell before the tab-level shell. Tests cover transport metadata and stale-shell replacement during Windows cold restore.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix and testing, but it omits the required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections and complete the Testing checklist, including the required cross-platform AI review and security audit details.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Windows restoration fix and the use of the actual terminal shell.
Linked Issues check ✅ Passed The changes propagate the PTY-resolved shell and use it for cold-restored commands, satisfying the primary objective in issue #13095.
Out of Scope Changes check ✅ Passed The implementation and tests support resolved-shell propagation and cold-restore behavior described in issue #13095, with no unrelated changes shown.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ef065076-75de-4d43-ac2e-2a432b6aef55

📥 Commits

Reviewing files that changed from the base of the PR and between 6da7b8e and 39b3410.

📒 Files selected for processing (12)
  • src/main/daemon/daemon-create-or-attach-result.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-server.ts
  • src/main/daemon/terminal-host-create-contract.ts
  • src/main/daemon/terminal-host-session-create.ts
  • src/main/providers/local-pty-provider.ts
  • src/main/providers/pty-spawn-result.ts
  • src/renderer/src/components/terminal-pane/pty-connection.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/pty-transport.test.ts
  • src/renderer/src/components/terminal-pane/pty-transport.ts

Comment thread src/main/daemon/daemon-create-or-attach-result.ts Outdated
@innocarpe
innocarpe force-pushed the fix/actual-windows-shell-dialect branch from 39b3410 to 1f01533 Compare August 9, 2026 01:17
@innocarpe

Copy link
Copy Markdown
Contributor Author

Sync update (1f01533ddd)

Address review: clarified that resolvedShellOverride may be undefined for older daemons and for providers that do not report a resolved shell. Validation: Node 24.18.0, corepack pnpm exec vitest run --config config/vitest.config.ts src/main/daemon/terminal-host.test.ts passed (38 tests), corepack pnpm run typecheck:node passed, corepack pnpm exec oxfmt --check src/main/daemon/daemon-create-or-attach-result.ts passed, and corepack pnpm exec oxlint src/main/daemon/daemon-create-or-attach-result.ts passed. Commit: 1f01533.

@AmethystLiang
AmethystLiang requested a review from OrcaWin August 9, 2026 16:51
@AmethystLiang AmethystLiang added the P1 High priority: bug or day-to-day user frustration label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High priority: bug or day-to-day user frustration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows queued agent commands use the configured shell dialect, not the pane's actual shell (wsl.exe setting emits POSIX && into PowerShell 5.1)

3 participants