Skip to content

fix: skip follow-up prompts when useAgentRunner.run() early-terminates#1104

Draft
Copilot wants to merge 31 commits intomainfrom
copilot/sub-pr-1080-again
Draft

fix: skip follow-up prompts when useAgentRunner.run() early-terminates#1104
Copilot wants to merge 31 commits intomainfrom
copilot/sub-pr-1080-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

When shouldEarlyTerminate triggers in useAgentRunner.run(), the session is aborted — but the follow-up loop ran unconditionally, sending prompts to an aborted session and incurring unnecessary LLM turns/cost.

Changes

  • tests/utils/agent-runner.ts: Track early termination with an earlyTerminated flag; skip the followUp loop when set.
// Before: follow-ups always ran after done resolved
await done;
for (const followUpPrompt of config.followUp ?? []) {  }

// After: follow-ups skipped when session was aborted early
if (!earlyTerminated) {
  for (const followUpPrompt of config.followUp ?? []) {  }
}

Covers all test files that combine shouldEarlyTerminate with followUp (e.g. azure-prepare, azure-validate).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

kvenkatrajan and others added 30 commits February 27, 2026 18:05
- azure-deploy: capability-claim description ('This skill runs azd up...'),
  narrowed triggers to already-prepared apps, added scope rule
- azure-prepare: added 'Preparation ONLY' scope boundary, rule 8 for
  scope enforcement, handoff marker in Phase 2
- azure-validate: added handoff language to azure-deploy in description
- Tests: updated 2 deploy prompts with anti-routing signals
- Updated snapshots for all 3 skills
CI runs 3x/day across scheduled runs, providing statistical signal over time.
Running each prompt 5x per CI job was redundant cost with no added reliability.
Set systemMessage to { mode: 'append' } by default instead of undefined,
ensuring the Copilot CLI built-in system prompt is always included in
integration test sessions.
Appends 'When a relevant skill is available, prefer using it instead of doing the task manually.' to the CLI system prompt via mode: append, nudging the model to invoke skills rather than executing tasks directly.
- azure-prepare: Remove handoff sentence ('After preparation, hand off to
  azure-validate then azure-deploy') and 'MUST be invoked FIRST' sentence
  that injected azure-deploy/azure-validate as competing keywords.
  Add explicit WHEN triggers for Terraform, App Service, Container Apps,
  Static Web Apps, and brownfield patterns.
- azure-deploy: Remove 'provision infrastructure' competing trigger,
  add DO NOT USE WHEN guidance for create/build patterns.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan

* fix: replace ⛔ emoji with ⚠️ in azure-prepare SKILL.md per authoring guidelines

Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
… table (#1096)

* Initial plan

* fix: add azure-cloud-migrate to SKILL.md Step 0 routing table

Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
…entRunner.run()

Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add changes based on feedback for skill routing improvements fix: skip follow-up prompts when useAgentRunner.run() early-terminates Mar 3, 2026
Base automatically changed from fix/skill-invocation-claude45-v2 to main March 3, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants