Skip to content

Commit aeca3fc

Browse files
committed
fix: require active sprint, remove fallback to all tasks
Sprint start API must succeed. If no active sprint exists, CLI exits with error instead of falling back to fetching all tasks (which caused unrelated tasks like user tasks to be picked up). Also skip tasks where owner is "user".
1 parent 9df61f7 commit aeca3fc

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

src/cli.ts

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,18 @@ async function runLoop(cliArgs: CliArgs, runner: AgentRunner): Promise<void> {
352352
}
353353
}
354354

355-
let sprintData: SprintStartResult | null = null;
355+
let sprintData: SprintStartResult;
356356
try {
357357
sprintData = await api.startSprint();
358358
ui.sprintInfo(sprintData.sprint.number, sprintData.agents.length, sprintData.tasks.length);
359359
} catch (err) {
360-
ui.warn(`Sprint API unavailable, falling back to task fetch`);
360+
ui.error(`Failed to start sprint: ${err}`);
361+
await api.updateAgent({
362+
name: cliArgs.agentName,
363+
status: "error",
364+
activity: `No active sprint: ${err}`,
365+
});
366+
process.exit(1);
361367
}
362368

363369
// Start the manager chat system
@@ -399,25 +405,10 @@ async function runLoop(cliArgs: CliArgs, runner: AgentRunner): Promise<void> {
399405
llmProvider: cliArgs.llmBaseUrl || "Claude Code CLI",
400406
});
401407

402-
let tasks: Task[];
403-
if (sprintData?.tasks && sprintData.tasks.length > 0) {
404-
tasks = sprintData.tasks;
405-
} else {
406-
try {
407-
tasks = await api.fetchTasks();
408-
} catch (err) {
409-
ui.error(`Failed to fetch tasks: ${err}`);
410-
await api.updateAgent({
411-
name: cliArgs.agentName,
412-
status: "error",
413-
activity: `Failed to fetch tasks: ${err}`,
414-
});
415-
process.exit(1);
416-
}
417-
}
408+
const tasks: Task[] = sprintData.tasks;
418409

419410
const todoTasks = tasks
420-
.filter((t) => t.status === "todo" || t.status === "in_progress")
411+
.filter((t) => (t.status === "todo" || t.status === "in_progress") && t.owner !== "user")
421412
.sort((a, b) => {
422413
const pa = typeof a.priority === "string" ? parseInt(a.priority.replace("p", ""), 10) : (a.priority ?? 99);
423414
const pb = typeof b.priority === "string" ? parseInt(b.priority.replace("p", ""), 10) : (b.priority ?? 99);
@@ -544,7 +535,7 @@ async function runLoop(cliArgs: CliArgs, runner: AgentRunner): Promise<void> {
544535
apiUrl: cliArgs.apiUrl,
545536
prompt,
546537
parentAgent: cliArgs.agentName,
547-
sprintNumber: sprintData?.sprint.number,
538+
sprintNumber: sprintData.sprint.number,
548539
...(Object.keys(secrets).length > 0 ? { secrets } : {}),
549540
};
550541

0 commit comments

Comments
 (0)