No, it stops if the session runs locally on your Mac. Closing a MacBook without an external monitor puts macOS to sleep, suspending VS Code's local Agent Host so a running Copilot turn stalls until the laptop wakes; only a Copilot cloud session or a separate remote host keeps running on its own. Clamshell for Mac keeps an Apple Silicon MacBook awake with the lid closed on power or battery so local Copilot runs can finish, with no admin password, no sudo and nothing to undo, for $9.99 once after a 7-day free trial.
Written by Matyas Rathonyi, the maker of Clamshell for Mac.
Which Copilot session stops when you close your laptop
This guide covers Macs. Whether closing your laptop stops GitHub Copilot depends on where the session runs, not on whether the VS Code editor window stays open:
- Copilot harness on this Mac (default Agent Host): Stops when your Mac sleeps. VS Code's agent harnesses docs explain that sessions "can continue in the background after you close [the editor window], while the Agent Host stays running", as long as you do not quit VS Code. Once closing the lid puts macOS to sleep, a VS Code maintainer wrote in
microsoft/vscode#348891that "the local agent host is suspended with everything else, so a running turn stalls partway until the machine wakes. Nothing tells the user it happened." Scheduled sends follow the same rule: "Scheduling doesn't wake a sleeping computer or start a stopped host." - Local harness (deprecated): Stops when you close either the editor window or the laptop. GitHub's November 16, 2026 changelog says it will be removed in February 2027.
- Cloud session: Keeps running on GitHub's servers ("so closing your laptop doesn't stop it"), because it runs away from your Mac. It requires a paid Copilot plan, a GitHub-backed repository and usage-billed cloud sandbox compute, and VS Code marks it "experimental and might change or be removed." Uncommitted edits, local dependencies and files that exist only on your computer are not copied to the cloud environment.
- Remote host (SSH, dev tunnel or registered machine): Keeps running when your laptop closes only if the remote machine stays awake, online and running its Agent Host. If you use GitHub Mobile to control a session on your Mac (documented with
code agent host --github-environment), your Mac and its Agent Host must still stay awake.
The free fixes, and where they stop
Every built-in VS Code feature and free macOS shortcut hits a wall when you close your laptop without a monitor:
- VS Code's own keep-awake setting (
sessions.keepAwakeWhileWorking): Added as a preview setting in VS Code 1.148 (Insiders as of November 23, 2026, with release notes dated November 25, 2026; not in stable 1.147.0), with valuesnever,alwaysandwhenPluggedIn(default). Its own test plan (microsoft/vscode#349545) states the limit directly: "This prevents idle system sleep, not the screen turning off, closing the lid, or explicitly choosing Sleep." The Copilot extension's earlier internal power-save blocker (cited inmicrosoft/vscode#276546) is a team-internal experiment and makes no closed-lid claim either. - VS Code "no sleep" marketplace extensions: Neither of the two extensions people find offers closed-lid support on macOS. Sleepwalker's listing says "macOS is not supported yet", and NoSleep says it "simulates pressing the F15 key" with no closed-lid claim.
caffeinate(built into macOS): Keeps an open Mac awake for free while a command runs, for example:
Apple'scaffeinate -i -t 3600caffeinatemanual lists-ifor idle sleep only and says nothing about closing the lid.- Apple's closed-display setup: Free per Apple Support 102501, but only while your MacBook is connected to power, an external display, an external keyboard and a mouse. Unplug the monitor or charger and your laptop sleeps.
sudo pmset -a disablesleep 1and free lid-closed apps: Disabling sleep in Terminal requires an admin password and a manual undo (sudo pmset -a disablesleep 0) afterward. Among free lid-closed apps, Amphetamine's Closed-Display Mode ends when you plug in or unplug on Apple Silicon unless you install its Power Protect add-on, which asks for an admin password and adds asudoersrule, and Keepresso asks for an admin password or a privileged helper.
Why pay $9.99 once for Clamshell? You keep local VS Code sessions running with your laptop closed on power or battery, with no admin passwords, no sudoers files, no privileged helpers and nothing to undo.
Keep local Copilot sessions running on a closed MacBook with Clamshell
When your task relies on uncommitted files, local dependencies or local tooling and you want to close your laptop without breaking the run, Clamshell keeps macOS awake:
- No admin rights, no sudo, nothing to undo. Clamshell keeps an Apple Silicon MacBook running with the lid closed on power or battery, with no admin password, no
sudoersfile and no privileged helper to stay awake. Normal lid sleep returns when you disarm or quit. - Arm automatically while VS Code runs. Clamshell's optional Arm While an App Runs module ("Your closed Mac stays awake while any app you choose runs") keeps your plugged-in MacBook awake while VS Code is open and lets it sleep normally once you quit VS Code or unplug. Scripts can also arm and disarm directly with
open "clamshell://arm"andopen "clamshell://disarm". - Always-on heat protection and a 20% battery floor. Thermal safety stays on and disarms toward normal sleep on serious or critical thermal pressure. Low-battery disarm at 20% on battery is on by default.
- Notarized and ready for macOS 14 or later. Built for Apple Silicon MacBooks, available by direct download, Homebrew (
brew install --cask clamshell) or Setapp.
Test Clamshell on your next local Copilot run before paying anything: Download free trial (7-day free trial, no card required; $9.99 once for 1 Mac or $19.99 for up to 3 Macs, with a 14-day money-back guarantee).
When a cloud session or another option is the better pick
- Your repository is on GitHub, your work is committed and you have a paid Copilot plan. A Copilot cloud session runs on GitHub's infrastructure so your laptop can close without interrupting the turn (note that VS Code marks cloud sessions experimental and bills sandbox compute by usage). A remote SSH host or dev tunnel (using
code tunnel --no-sleepon the remote host) also lets your laptop sleep while the remote machine finishes the work. - You run an Intel MacBook or want turn-by-turn Copilot detection. Clamshell requires Apple Silicon and macOS 14 or later, and its built-in agent monitor does not track individual Copilot turns (Arm While an App Runs watches whether VS Code itself is running). For other lid-closed apps compared side by side, see which app keeps a Mac awake for AI agents with the lid closed, or read how to run AI agents overnight on a MacBook for heat and power checks.
Frequently asked questions
Will VS Code itself keep running if I close my laptop?
Not while your Mac sleeps. Apple documents closing the display as a way to sleep a Mac laptop, and a VS Code maintainer notes that sleep suspends the local Agent Host "with everything else", pausing agent turns until wake. Keep the Mac awake with Apple's external-monitor setup or a lid-closed app like Clamshell.
Does sessions.keepAwakeWhileWorking keep Copilot running with the lid closed?
No. VS Code's own test plan (microsoft/vscode#349545) states that sessions.keepAwakeWhileWorking prevents "idle system sleep, not the screen turning off, closing the lid, or explicitly choosing Sleep" (and as of November 23, 2026 it is still in VS Code 1.148 Insiders, not stable 1.147.0). To close your laptop during a local run, you still need a lid-closed solution like Clamshell.
Does closing the VS Code editor window stop Copilot?
With the default Copilot harness (Agent Host), closing the editor window lets the session continue in the background as long as you do not quit VS Code and your Mac stays awake. With the deprecated Local harness, closing the editor window stops the agent's ongoing work.
Will Copilot keep running if I lock my Mac?
Yes, while the lid stays open: locking the screen does not put the Mac to sleep, and a VS Code maintainer says the Copilot extension "prevents the system from going to sleep while the agent is processing." Closing the lid is what stops the run, so arm Clamshell first if you also close the lid.
Do VS Code "no sleep" extensions keep a closed MacBook awake?
Not by their own listings. Sleepwalker's Visual Studio Marketplace listing states "macOS is not supported yet", and NoSleep states it "simulates pressing the F15 key" with no closed-lid claim. Use a macOS lid-closed app such as Clamshell instead.
Try Clamshell free for 7 days
Close your MacBook and let local Copilot sessions in VS Code finish, with no admin password, an always-on heat cut-off and a 20% battery floor. Normal lid sleep returns when you disarm or quit.
$9.99 for 1 Mac, $19.99 for up to 3 Macs. 7-day free trial with no card required and a 14-day money-back guarantee. Apple Silicon, macOS 14 or later, notarized by Apple. Also available via Homebrew or Setapp.
Sources checked November 23, 2026: GitHub changelog posts (October 28 and November 16, 2026), GitHub Copilot cloud documentation, VS Code documentation (agent harnesses, Agent Host, Agents window, remote agent sessions, Remote Tunnels, cloud continuity), VS Code source and issues #276546, #348891 and #349545, PRs #348889 and #349491, release 1.147.0 and 1.148 Insiders notes, Visual Studio Marketplace listings for Sleepwalker and NoSleep, Apple's Mac User Guide, Apple Support article 102501, the macOS 27.2.1 caffeinate(8) manual, and vendor pages for Amphetamine and Keepresso. Clamshell details come from version 2.0.5. Product names belong to their respective owners.