Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(cli): match status aliases in the task_list status filter (#4536)

kevinb49078cc4094
diff --git a/v3/@claude-flow/cli/__tests__/task-list-status-alias.test.ts b/v3/@claude-flow/cli/__tests__/task-list-status-alias.test.ts
new file mode 100644
index 0000000000..621873042c
--- /dev/null
+++ b/v3/@claude-flow/cli/__tests__/task-list-status-alias.test.ts
@@ -0,0 +1,70 @@
+/**
+ * task_update accepts the status spellings agents write ("done", "canceled",
+ * "running", any case), but task_list compared the filter literally, so
+ * `task_list {status: "done"}` returned no tasks even when completed ones
+ * existed.
+ */
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
+import { mkdtempSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { taskTools } from '../src/mcp-tools/task-tools.js';
+
+const tool = (name: string) => {
+ const t = taskTools.find(t => t.name === name);
+ if (!t) throw new Error(`MCP tool not registered: ${name}`);
+ return t;
+};
+
+type ListResult = { tasks: Array<{ taskId: string; status: string }>; total: number };
+
+describe('task_list status filter aliases', () => {
+ let dir: string;
+ let prevCwd: string | undefined;
+
+ beforeEach(async () => {
+ dir = mkdtempSync(join(tmpdir(), 'ruflo-task-list-status-'));
+ prevCwd = process.env.CLAUDE_FLOW_CWD;
+ process.env.CLAUDE_FLOW_CWD = dir;
+ const create = tool('task_create').handler;
+ const update = tool('task_update').handler;
+ const statuses = ['pending', 'in_progress', 'completed', 'cancelled'];
+ for (const status of statuses) {
+ const created = await create({ type: 'feature', description: `task ${status}` }) as { taskId: string };
+ if (status !== 'pending') await update({ taskId: created.taskId, status });
+ }
+ });
+
+ afterEach(() => {
+ if (prevCwd === undefined) delete process.env.CLAUDE_FLOW_CWD;
+ else process.env.CLAUDE_FLOW_CWD = prevCwd;
+ rmSync(dir, { recursive: true, force: true });
+ });
+
+ const list = async (status: string) =>
+ (await tool('task_list').handler({ status })) as ListResult;
+
+ it.each([
+ ['done', 'completed'],
+ ['complete', 'completed'],
+ ['Completed', 'completed'],
+ ['canceled', 'cancelled'],
+ ['running', 'in_progress'],
+ ['in-progress', 'in_progress'],
+ ])('status "%s" lists the %s tasks', async (written, canonical) => {
+ const result = await list(written);
+ expect(result.tasks.map(t => t.status)).toEqual([canonical]);
+ expect(result.total).toBe(1);
+ });
+
+ it('resolves each entry of a comma-separated filter', async () => {
+ const result = await list('pending, running');
+ expect(result.tasks.map(t => t.status).sort()).toEqual(['in_progress', 'pending']);
+ });
+
+ it('keeps canonical filters and "all" working as before', async () => {
+ expect((await list('completed')).tasks.map(t => t.status)).toEqual(['completed']);
+ expect((await list('all')).total).toBe(4);
+ expect((await list('bogus')).total).toBe(0);
+ });
+});
diff --git a/v3/@claude-flow/cli/src/mcp-tools/task-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/task-tools.ts
index 4c0c6d6b12..99d958be37 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/task-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/task-tools.ts
@@ -242,7 +242,9 @@ export const taskTools: MCPTool[] = [
// Apply filters
if (input.status) {
// Support comma-separated status values. 'all' (sent by `status tasks`) means no status filter.
- const statuses = (input.status as string).split(',').map(s => s.trim());
+ // Each value goes through statusOf, the reader task_update uses, so "done", "canceled",
+ // "running" or "Completed" match the stored status rather than matching nothing.
+ const statuses = (input.status as string).split(',').map(s => s.trim()).map(s => statusOf(s) ?? s);
if (!statuses.includes('all')) {
tasks = tasks.filter(t => statuses.includes(t.status));
}