Skip to content

Commit 009586b

Browse files
authored
fix get task output tool issues (#279)
* fix #256156 * only say active tasks there
1 parent 80fe89c commit 009586b

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/extension/prompts/node/agent/agentPrompt.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ class AgentTasksInstructions extends PromptElement {
578578
<Tag name='task' attrs={{ id: `${t.type}: ${t.label || i}` }}>
579579
{this.makeTaskPresentation(t)}
580580
{isActive && <> (This task is currently running. You can use the {ToolName.GetTaskOutput} tool to view its output.)</>}
581-
{!isActive && <> (This task is not running. Use the {ToolName.GetTaskOutput} tool to view its output and check its status.)</>}
582581
</Tag>
583582
);
584583
})}

src/extension/prompts/node/base/terminalAndTaskState.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export class TerminalAndTaskStatePromptElement extends PromptElement<TerminalAnd
2727
const resultTasks: { name: string; isBackground: boolean; type?: string; command?: string; problemMatcher?: string; group?: { isDefault?: boolean; kind?: string }; script?: string; dependsOn?: string; isActive?: boolean }[] = [];
2828
const allTasks = this.tasksService.getTasks()?.[0]?.[1] ?? [];
2929
const tasks = Array.isArray(allTasks) ? allTasks : [];
30-
for (const exec of tasks.filter(t => this.tasksService.getTerminalForTask(t))) {
30+
const filteredTasks = tasks.filter(t => this.tasksService.getTerminalForTask(t));
31+
for (const exec of filteredTasks) {
3132
if (exec.label) {
3233
resultTasks.push({
3334
name: exec.label,
@@ -64,7 +65,7 @@ export class TerminalAndTaskStatePromptElement extends PromptElement<TerminalAnd
6465
Tasks:<br />
6566
{resultTasks.map((t) => (
6667
<>
67-
Task: {t.name} ({t.isBackground && `is background: ${String(t.isBackground)}`}
68+
Task: {t.name} ({t.isBackground && `is background: ${String(t.isBackground)} `}
6869
{t.isActive ? ', is running' : 'is inactive'}
6970
{t.type ? `, type: ${t.type}` : ''}
7071
{t.command ? `, command: ${t.command}` : ''}
@@ -100,7 +101,7 @@ export class TerminalAndTaskStatePromptElement extends PromptElement<TerminalAnd
100101

101102
return (
102103
<>
103-
{tasks.length > 0 ? renderTasks() : 'Tasks: No tasks found.'}
104+
{resultTasks.length > 0 ? renderTasks() : 'Tasks: No tasks found.'}
104105
{terminals.length > 0 ? renderTerminals() : 'Copilot Terminals: No active Copilot terminals found.'}
105106
</>
106107
);

src/extension/tools/node/getTaskOutputTool.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class GetTaskOutputTool implements vscode.LanguageModelTool<ITaskOptions>
8585
taskLabel = input.id;
8686
}
8787
} catch { }
88-
return { workspaceFolder, task, taskLabel, terminal: task.terminal ?? this.tasksService.getTerminalForTask(task) };
88+
return { workspaceFolder, task, taskLabel: task.label || taskLabel, terminal: task.terminal ?? this.tasksService.getTerminalForTask(task) };
8989
}
9090
}
9191

src/extension/tools/node/runTaskTool.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class RunTaskTool implements vscode.LanguageModelTool<IRunTaskToolInput> {
205205
taskLabel = input.id;
206206
}
207207
} catch { }
208-
return { workspaceFolder, task, taskLabel };
208+
return { workspaceFolder, task, taskLabel: task.label || taskLabel };
209209
}
210210
}
211211

0 commit comments

Comments
 (0)