How to force stop Copilot Session when setup step in copilot-setup-steps.yml fails? #188165
Replies: 2 comments
-
|
This is expected behavior today. copilot-setup-steps.yml failures only stop the remaining setup steps — they don’t abort the Copilot agent session. The setup phase is treated as best-effort provisioning rather than a hard gate. At the moment there isn’t a supported way to force-stop the session when a step fails. The usual workaround is to fail fast inside your repo scripts (or enforce strict checks in CI) so the agent can’t proceed meaningfully when the environment is invalid. |
Beta Was this translation helpful? Give feedback.
-
|
Workaround: In your setup script, write a sentinel file on failure and have a background validation step that monitors for this file and kills the agent process (e.g., ). Cleanup: also remove the sentinel to avoid stale stops. Alternatively, use a timeout wrapper around the entire agent session so it exits automatically when your setup exceeds a threshold. These are self-managed approaches until GitHub adds a native abort-on-failure flag. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Copilot Feature Area
Copilot Agent Mode
Body
Hi all,

I found
If any setup step fails by returning a non-zero exit code, Copilot will skip the remaining setup steps and begin working with the current state of its development environment.in GitHub document: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#customizing-copilots-development-environment-with-copilot-setup-steps :Here is part of my copilot-setup-steps.yml:
The exit 1 command has no effect; Copilot continues to operate, as described in the GitHub documentation.
Is there any way to force stop Copilot Session when setup step in copilot-setup-steps.yml fails?
Beta Was this translation helpful? Give feedback.
All reactions