You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the chat.tools.terminal.detachBackgroundProcesses setting is enabled, also wrap commands with nohup when the agent passed mode='sync' but the command line ends with a single trailing & (POSIX background operator, distinct from &&).
Previously the rewriter only fired for mode='async' (legacy isBackground: true). When the agent used mode='sync' + &, the & was interpreted by the foreground shell and the process was SIGHUP'd as soon as the tool's terminal was disposed — fine for interactive UX, but it breaks eval harnesses where the eval step connects to the service from a fresh process and gets Connection refused.
Evidence
terminalbench2 run 25136645365 (claude-opus-4.6) had three failures attributable to this:
In all three the agent's same-turn verification (curl, ps aux, ss -tlnp) confirmed the service was alive — it just didn't survive to the eval phase.
Behavior
Setting still gates the rewrite, so default users are unaffected.
Eval harnesses already set chat.tools.terminal.detachBackgroundProcesses=true (see vscode-copilot-evaluation/src/vsCodeApplication.ts), so they pick this up automatically.
PowerShell has no equivalent trailing-& operator, so the Windows path remains async-only.
Existing nohup/shell -c wrapping of compound constructs and the de-duplication of an already-trailing & continue to work.
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Extends the terminal chat tool’s background-detach command-line rewriter so eval harnesses (which enable chat.tools.terminal.detachBackgroundProcesses) also detach POSIX commands invoked in mode='sync' when the command line ends with a single trailing &, preventing services from dying when the tool terminal is disposed.
Changes:
Gate rewriter on the detach setting first, then detach when isBackground=trueor the command ends with a bare trailing & (POSIX).
Keep Windows behavior async-only (PowerShell path only rewrites when isBackground=true).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes microsoft/vscode-internalbacklog#7605
When the
chat.tools.terminal.detachBackgroundProcessessetting is enabled, also wrap commands withnohupwhen the agent passedmode='sync'but the command line ends with a single trailing&(POSIX background operator, distinct from&&).Previously the rewriter only fired for
mode='async'(legacyisBackground: true). When the agent usedmode='sync'+&, the&was interpreted by the foreground shell and the process was SIGHUP'd as soon as the tool's terminal was disposed — fine for interactive UX, but it breaks eval harnesses where the eval step connects to the service from a fresh process and getsConnection refused.Evidence
terminalbench2 run
25136645365(claude-opus-4.6) had three failures attributable to this:hf-model-inference—python app.py > /app/server.log 2>&1 &install-windows-3.11—qemu-system-i386 ... -vnc :1 -qmp ... -monitor ...(no daemonize)qemu-alpine-ssh—nohup expect setup_vm.exp > /app/vm_output.log 2>&1 &in sync modeIn all three the agent's same-turn verification (
curl,ps aux,ss -tlnp) confirmed the service was alive — it just didn't survive to the eval phase.Behavior
chat.tools.terminal.detachBackgroundProcesses=true(seevscode-copilot-evaluation/src/vsCodeApplication.ts), so they pick this up automatically.&operator, so the Windows path remains async-only.shell -cwrapping of compound constructs and the de-duplication of an already-trailing&continue to work.