Pass in isBackground for proper task chat agent message (#282266)

fixes #281570
This commit is contained in:
Megan Rogge 2025-12-09 12:50:18 -05:00 committed by GitHub
parent fdab7f7d2c
commit aab8d1abe9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 7 deletions

View File

@ -137,7 +137,7 @@ export class CreateAndRunTaskTool implements IToolImpl {
const details = terminalResults.map(r => `Terminal: ${r.name}\nOutput:\n${r.output}`);
const uniqueDetails = Array.from(new Set(details)).join('\n\n');
const toolResultDetails = toolResultDetailsFromResponse(terminalResults);
const toolResultMessage = toolResultMessageFromResponse(result, args.task.label, toolResultDetails, terminalResults);
const toolResultMessage = toolResultMessageFromResponse(result, args.task.label, toolResultDetails, terminalResults, undefined, task.configurationProperties.isBackground);
return {
content: [{ kind: 'text', value: uniqueDetails }],
toolResultMessage,

View File

@ -124,7 +124,7 @@ export class GetTaskOutputTool extends Disposable implements IToolImpl {
const details = terminalResults.map(r => `Terminal: ${r.name}\nOutput:\n${r.output}`);
const uniqueDetails = Array.from(new Set(details)).join('\n\n');
const toolResultDetails = toolResultDetailsFromResponse(terminalResults);
const toolResultMessage = toolResultMessageFromResponse(undefined, taskLabel, toolResultDetails, terminalResults, true);
const toolResultMessage = toolResultMessageFromResponse(undefined, taskLabel, toolResultDetails, terminalResults, true, task.configurationProperties.isBackground);
return {
content: [{ kind: 'text', value: uniqueDetails }],

View File

@ -97,7 +97,7 @@ export class RunTaskTool implements IToolImpl {
const details = terminalResults.map(r => `Terminal: ${r.name}\nOutput:\n${r.output}`);
const uniqueDetails = Array.from(new Set(details)).join('\n\n');
const toolResultDetails = toolResultDetailsFromResponse(terminalResults);
const toolResultMessage = toolResultMessageFromResponse(result, taskLabel, toolResultDetails, terminalResults);
const toolResultMessage = toolResultMessageFromResponse(result, taskLabel, toolResultDetails, terminalResults, undefined, task.configurationProperties.isBackground);
return {
content: [{ kind: 'text', value: uniqueDetails }],

View File

@ -27,7 +27,7 @@ export function toolResultDetailsFromResponse(terminalResults: { output: string;
).values());
}
export function toolResultMessageFromResponse(result: ITaskSummary | undefined, taskLabel: string, toolResultDetails: (URI | Location)[], terminalResults: { output: string; resources?: ILinkLocation[]; state: OutputMonitorState }[], getOutputTool?: boolean): MarkdownString {
export function toolResultMessageFromResponse(result: ITaskSummary | undefined, taskLabel: string, toolResultDetails: (URI | Location)[], terminalResults: { output: string; resources?: ILinkLocation[]; state: OutputMonitorState }[], getOutputTool?: boolean, isBackground?: boolean): MarkdownString {
let resultSummary = '';
if (result?.exitCode) {
resultSummary = localize('copilotChat.taskFailedWithExitCode', 'Task `{0}` failed with exit code {1}.', taskLabel, result.exitCode);
@ -42,9 +42,13 @@ export function toolResultMessageFromResponse(result: ITaskSummary | undefined,
? (problemCount
? `finished with \`${problemCount}\` problem${problemCount === 1 ? '' : 's'}`
: 'finished')
: (problemCount
? `started and will continue to run in the background with \`${problemCount}\` problem${problemCount === 1 ? '' : 's'}`
: 'started and will continue to run in the background');
: (isBackground
? (problemCount
? `started and will continue to run in the background with \`${problemCount}\` problem${problemCount === 1 ? '' : 's'}`
: 'started and will continue to run in the background')
: (problemCount
? `started with \`${problemCount}\` problem${problemCount === 1 ? '' : 's'}`
: 'started'));
}
}
return new MarkdownString(resultSummary);