Skip to content

Commit ab4e1af

Browse files
authored
Show remaining turns to execution subagents (#332704)
Show execution subagent turns remaining Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 62f6758b-a71d-4533-8f3d-9028975772bf
1 parent 8a6a845 commit ab4e1af

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

extensions/copilot/src/extension/prompts/node/agent/executionSubagentPrompt.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class ExecutionSubagentPrompt extends PromptElement<ExecutionSubagentProm
3333
// Check if we're at the last turn (to align with training where we coax final answer)
3434
const currentTurn = toolCallRounds?.length ?? 0;
3535
const isLastTurn = currentTurn >= this.props.maxExecutionTurns - 1;
36+
const remainingTurns = Math.max(this.props.maxExecutionTurns - currentTurn, 1);
3637

3738
return (
3839
<>
@@ -82,11 +83,9 @@ export class ExecutionSubagentPrompt extends PromptElement<ExecutionSubagentProm
8283
toolCallResults={toolCallResults}
8384
toolCallMode={CopilotToolMode.FullContext}
8485
/>
85-
{isLastTurn && (
86-
<UserMessage priority={900}>
87-
OK, your allotted iterations are finished. Show the &lt;final_answer&gt;.
88-
</UserMessage>
89-
)}
86+
<UserMessage priority={900}>
87+
You have {remainingTurns} of {this.props.maxExecutionTurns} allotted iterations remaining. When one iteration remains, do not call tools; return only the &lt;final_answer&gt;.
88+
</UserMessage>
9089
{!isLastTurn && this.props.hasBackgroundCommand && (
9190
<UserMessage priority={900}>
9291
One or more commands are running in the background. You do not have the ability to monitor them. Show the &lt;final_answer&gt;.

0 commit comments

Comments
 (0)