TUI Auto Exit does not work in VSCode
Current Behavior
Even when manually specifying --tuiAutoExit AND with "tui": { "autoExit": true } in my nx.json, it still does not auto exit when called from Copilot Chat/ an agent.
Expected Behavior
Either of those options should be enough and honestly, it should be the default when called from an agent.
GitHub Repo
no repo
Steps to Reproduce
- tell the agent to run something like
npx nx run-many -t type-check --tuiAutoExitand watch the TUI stay up once it is done
Nx Report
NX Report complete - copy this into the issue template
Node : 24.11.1
OS : darwin-arm64
Native Target : aarch64-macos
yarn : 1.22.22
nx (global) : 22.1.3
nx : 22.0.2
@nx/js : 22.0.2
@nx/jest : 22.0.2
@nx/eslint : 22.0.2
@nx/workspace : 22.0.2
@nx/cypress : 22.0.2
@nx/devkit : 22.0.2
@nx/eslint-plugin : 22.0.2
@nx/module-federation : 22.0.2
@nx/next : 22.0.2
@nx/react : 22.0.2
@nx/rollup : 22.0.2
@nx/storybook : 22.0.2
@nx/vite : 22.0.2
@nx/web : 22.0.2
@nx/webpack : 22.0.2
typescript : 5.9.3
---------------------------------------
Nx key licensed packages
Licensed to EFG.
@nx/gcs-cache : 5.0.0
---------------------------------------
Registered Plugins:
@nx/next/plugin
@nx/eslint/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@faceit/nx-helpers : 0.0.1
@nx/gcs-cache : 5.0.0
nx-stylelint : 18.0.2
---------------------------------------
Local workspace plugins:
@faceit/nx-helpers
---------------------------------------
Cache Usage: 75.66 MB / 92.64 GB
Failure Logs
Package Manager Version
yarn 1.22.22
Operating System
- [x] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
I raised this previousy to @juristr on Twitter and he said there might be an issue with VS Code specifically
Investigation Summary
I investigated this issue and found two related problems:
1. VS Code Copilot not detected as AI agent (Fixed in #33766)
The primary issue is that VS Code Copilot wasn't being detected as an AI agent. The isAiAgent() function in Rust checks for Claude Code, Repl.it, and Cursor, but not VS Code Copilot.
When Copilot runs terminal commands, it adds its CLI tool path to PATH (e.g., .../globalStorage/github.copilot-chat/copilotCli). PR #33766 adds detection for this, which will cause shouldUseTui() to return false and disable the TUI entirely when running from VS Code Copilot chat.
2. Why --tuiAutoExit doesn't work (secondary issue)
Even when explicitly setting --tuiAutoExit, there's a potential issue in the TUI's auto-exit logic. In app.rs, the handle_end_command method checks:
if self.user_has_interacted || !self.tui_config.auto_exit.should_exit_automatically() {
return; // Skip auto-exit
}
The user_has_interacted flag gets set to true when any key event is received. If VS Code's terminal sends any key events (or terminal control sequences that get interpreted as key events) before the command completes, the auto-exit is disabled.
Additionally, the check order in shouldUseTui() means that explicit CLI flags (--tui, --outputStyle=tui) take precedence over the AI agent detection, so if TUI is explicitly enabled, the isAiAgent() check is bypassed.
Resolution
PR #33766 should resolve the main issue by disabling TUI entirely when running from VS Code Copilot. This is the cleanest solution since AI agents generally work better with plain text output anyway.
If there's a need to investigate the user_has_interacted issue further (for cases where TUI with auto-exit is explicitly desired in an AI context), that could be a separate follow-up.