Skip to content

Context awareness: agent pane & autofix recognize the active WSL/bash shell (OSC 9001;ShellType) #352

Description

@vanzue

Feature

The agent pane and autofix should be context-aware of the active session''s shell — in particular, recognize when the current pane is running WSL/bash (not PowerShell) — so that:

  • Agent pane chat answers and suggested commands use the right shell syntax (ls -a vs Get-ChildItem, forward-slash paths, etc.).
  • Autofix suggests a fix appropriate to the failing pane''s shell.

Problem

Previously the shell was inferred only from the pane''s host process pid (pwsh.exe / wsl.exe …) on the wta side. That has a blind spot for nested shells: in pwshwsl → bash, the host process stays wsl.exe/pwsh.exe, so the agent could not tell the prompt is now bash and would suggest PowerShell. This is the root cause of the WSL-gives-PowerShell behavior in #200.

Implementation

Shells self-report their identity every prompt via OSC 9001;ShellType;<name>;<version> (e.g. pwsh, bash, wsl:Ubuntu). This flows through adaptDispatchTerminal::SetShellTypeControlCorePaneInfo.Shell (protocol JSON), and wta now prefers this reported shell over the pid-based lookup (kept as a fallback). The agent''s terminal context (build_terminal_context_json) carries it as the shell field consumed by the planner/autofix.

Status

✅ Implemented in PR #345.

Related

Metadata

Metadata

Assignees

Labels

Area-AgentPaneThe agent pane UX, ?<prompt> delegation, command palette AI entriesArea-AutoFixDetecting failed commands and offering fixes; includes shell-integration problemsIssue-BugSomething is broken or behaves incorrectlyNeeds-Tag-FixNeeds-TriageAwaiting first review by the team

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions