Q150: work can be sent back, reopened, moved to backlog, or blocked with a reason

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 01:12:17 -04:00
1 parent 7ab46bb2de
commit 809c67a54a
21 files changed
+153 -7

No files matched your search

+10
View File
@@ -95,6 +95,16 @@ test("the pinned CEO conversation is the Messages front door", async () => {
return [task.writingMode, task.requiresFilesystem];
});
expect(edited).toEqual(["technical", true]);
// Blocking says why on the task and stops it; work can also move backwards.
await taskDialog.getByRole("button", { name: "Block", exact: true }).click();
await taskDialog.getByRole("textbox", { name: "Why is it blocked?" }).fill("Waiting for the legal review.");
await taskDialog.getByRole("button", { name: "Block task" }).click();
await expect(taskDialog.getByRole("status")).toContainText("Blocked: Waiting for the legal review.");
await taskDialog.getByRole("button", { name: "Unblock" }).click();
await expect(taskDialog.getByText("Blocked: Waiting for the legal review.")).toHaveCount(0);
await taskDialog.getByRole("button", { name: "In progress" }).click();
await taskDialog.getByRole("button", { name: "Back to backlog" }).click();
await expect(taskDialog.getByRole("button", { name: "In progress" })).toBeVisible();
await taskDialog.getByRole("button", { name: "Close" }).click();
await page.getByRole("button", { name: "Messages" }).click();
+27
View File
@@ -8,6 +8,7 @@ import { ProviderService } from "../../src/main/services/provider-service";
import { providerAdapters } from "../../src/main/services/provider-adapters";
import { TaskExecutionService } from "../../src/main/services/task-execution-service";
import { SnapshotService } from "../../src/main/services/snapshot-service";
import { OrganizationService } from "../../src/main/services/organization-service";
import { currentProviderUsageWindow } from "../../src/shared/provider-runtime-domain";
import type { AgentTurnResult } from "../../src/main/services/provider-tool-turn";
@@ -106,3 +107,29 @@ describe("why an open task is not moving", () => {
h.connection.close();
});
});
describe("blocking a task", () => {
test("stops it until unblocked: no new session, queued ones superseded, manual runs refused, and the board says why", async () => {
const h = company();
const organization = new OrganizationService(h.connection.db);
expect(h.connection.transaction(() => h.execution.enqueueHeartbeatRuns())).toHaveLength(1);
h.connection.transaction(() => organization.setTaskBlocked({ orgId: h.orgId, taskId: h.taskId, reason: "Waiting for the legal review." }));
expect(h.connection.db.prepare("select state from task_runs where task_id = ? order by rowid desc limit 1").get(h.taskId)).toEqual({ state: "superseded" });
expect(h.hold()).toEqual({ reason: "Blocked: Waiting for the legal review.", resumesAt: null, waitingOn: "operator" });
expect(h.connection.transaction(() => h.execution.enqueueHeartbeatRuns())).toEqual([]);
await expect(h.execution.runTask({ orgId: h.orgId, taskId: h.taskId })).rejects.toThrow("is blocked: Waiting for the legal review. Unblock it to run it.");
expect(() => organization.setTaskBlocked({ orgId: h.orgId, taskId: h.taskId, reason: " " })).toThrow("Say why the task is blocked.");
h.connection.transaction(() => organization.setTaskBlocked({ orgId: h.orgId, taskId: h.taskId, reason: null }));
expect(h.hold()).toBeNull();
// Work in review can be blocked too, and says so.
h.connection.db.prepare("update tasks set status = 'review' where id = ?").run(h.taskId);
h.connection.transaction(() => organization.setTaskBlocked({ orgId: h.orgId, taskId: h.taskId, reason: "Spec changed." }));
expect(h.hold()).toEqual({ reason: "Blocked: Spec changed.", resumesAt: null, waitingOn: "operator" });
h.connection.transaction(() => organization.setTaskBlocked({ orgId: h.orgId, taskId: h.taskId, reason: null }));
expect(h.hold()).toBeNull();
h.connection.db.prepare("update tasks set status = 'backlog' where id = ?").run(h.taskId);
expect(h.connection.transaction(() => h.execution.enqueueHeartbeatRuns())).toHaveLength(1);
h.connection.close();
});
});
+1 -1
View File
@@ -35,7 +35,7 @@ describe("domain services", () => {
const connection = createConnection();
const rows = connection.db.prepare("select version from schema_migrations order by version asc").all() as Array<{ version: number }>;
expect(rows.map((row) => row.version)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]);
expect(rows.map((row) => row.version)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101]);
connection.close();
});