Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions packages/core/src/tools/task-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,58 @@ describe('TaskListTool', () => {
expect(result.llmContent).not.toContain('Pending');
});

it('lists tasks when optional filters are omitted', async () => {
const pending = await createTask(TEAM, {
subject: 'Pending task',
description: 'desc',
});
const running = await createTask(TEAM, {
subject: 'Running task',
description: 'desc',
});
await updateTask(TEAM, running.id, {
status: 'in_progress',
owner: 'worker',
});

const pendingResult = await tool
.build({ status: 'pending' })
.execute(new AbortController().signal);
const ownerResult = await tool
.build({ owner: 'worker' })
.execute(new AbortController().signal);

expect(pendingResult.llmContent).toContain(pending.subject);
expect(ownerResult.llmContent).toContain(running.subject);
expect(ownerResult.llmContent).not.toContain(pending.subject);
});

it('treats a blank owner filter as omitted', async () => {
const pending = await createTask(TEAM, {
subject: 'Pending task',
description: 'desc',
});

const result = await tool
.build({ status: 'pending', owner: '' })
.execute(new AbortController().signal);

expect(result.llmContent).toContain(pending.subject);
});

it('treats a blank blockedBy filter as omitted', async () => {
const pending = await createTask(TEAM, {
subject: 'Pending task',
description: 'desc',
});

const result = await tool
.build({ status: 'pending', blockedBy: '' })
.execute(new AbortController().signal);

expect(result.llmContent).toContain(pending.subject);
});

it('returns TaskListResultDisplay', async () => {
await createTask(TEAM, {
subject: 'Task X',
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/tools/task-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ export class TaskListTool extends BaseDeclarativeTool<
protected createInvocation(
params: TaskListParams,
): ToolInvocation<TaskListParams, ToolResult> {
return new TaskListInvocation(this.config, params);
return new TaskListInvocation(this.config, {
...params,
owner: params.owner === '' ? undefined : params.owner,
blockedBy: params.blockedBy === '' ? undefined : params.blockedBy,
});
}
}
Loading