feat(FN-1982): merge fusion/fn-1982

This commit is contained in:
gsxdsm
2026-04-17 14:09:37 -07:00
parent 217ccdd4aa
commit e51393285b
16 changed files with 300 additions and 37 deletions

View File

@@ -1219,3 +1219,17 @@ The cross-node system uses a **proxy-based model** where the local dashboard ser
- Use `async function` declarations (not arrow functions) for the route handlers to ensure proper TypeScript scope resolution
- For mock fetch responses in tests: always use `ReadableStream` for the body — never return `null` for body, or the streaming pipe won't work
- `proxyToRemoteNode` helper uses `new URL(req.url, 'http://localhost')` to reliably extract query params for forwarding
## Mission Validation Board Tasks (FN-1982)
When a mission feature's implementation task completes, `MissionExecutionLoop.processTaskOutcome()` runs validation against contract assertions. As of FN-1982, each validation run creates a visible board task:
- **Task creation**: `taskStore.createTask()` with `column: "in-progress"`, `missionId`, `sliceId`, and `status: "mission-validation"`
- **Task lifecycle**:
- `in-progress``done` (validation passes)
- `in-progress``in-review` (validation fails, blocked, or errors)
- **Status marker**: `status: "mission-validation"` prevents scheduler/stuck-detector from dispatching the task
- **Validator run linkage**: `MissionValidatorRun.taskId` stores the board task ID for cross-referencing
- **VALID_TRANSITIONS**: `"in-progress"``"done"` was added specifically for validation tasks (note in `types.ts`)
The error status from `parseValidationResult()` (empty response, invalid JSON, invalid status) is now handled in `processTaskOutcome()` alongside pass/fail/blocked.

View File

@@ -51,7 +51,7 @@ describe("TaskStore task documents", () => {
expect(tableNames.has("task_documents")).toBe(true);
expect(tableNames.has("task_document_revisions")).toBe(true);
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
const index = db
.prepare(

View File

@@ -46,8 +46,8 @@ describe("board", () => {
expect(canTransition("triage", "in-progress")).toBe(false);
// todo cannot skip to in-review
expect(canTransition("todo", "in-review")).toBe(false);
// in-progress cannot skip to done
expect(canTransition("in-progress", "done")).toBe(false);
// Note: in-progress can transition to done for mission validation tasks
// so we don't test that case here
});
});
@@ -75,7 +75,7 @@ describe("board", () => {
});
it("returns correct transitions for in-progress", () => {
expect(getValidTransitions("in-progress")).toEqual(["in-review", "todo", "triage"]);
expect(getValidTransitions("in-progress")).toEqual(["in-review", "todo", "triage", "done"]);
});
it("returns correct transitions for in-review", () => {

View File

@@ -119,7 +119,7 @@ describe("Database", () => {
});
it("seeds schema version", () => {
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
});
it("seeds lastModified", () => {
@@ -142,7 +142,7 @@ describe("Database", () => {
it("is idempotent - calling init() twice does not fail", () => {
expect(() => db.init()).not.toThrow();
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
});
it("does not overwrite existing config on re-init", () => {
@@ -749,7 +749,7 @@ describe("schema migrations", () => {
db.init();
// Verify version bumped to 29 (includes v1→v2 through v26→v29)
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -774,11 +774,11 @@ describe("schema migrations", () => {
const db = new Database(kbDir);
db.init();
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
// Re-init should not fail
db.init();
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
db.close();
});
@@ -794,7 +794,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'agentRatings'").all() as Array<{ name: string }>;
expect(tables).toEqual([{ name: "agentRatings" }]);
@@ -818,7 +818,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'mission_events'").all() as Array<{ name: string }>;
expect(tables).toEqual([{ name: "mission_events" }]);
@@ -922,7 +922,7 @@ describe("schema migrations", () => {
db.init();
// Verify version bumped to 29
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -1291,7 +1291,7 @@ describe("createDatabase factory", () => {
const db = createDatabase(kbDir);
db.init();
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
expect(db.getLastModified()).toBeGreaterThan(0);
db.close();

View File

@@ -59,7 +59,7 @@ export function fromJson<T>(json: string | null | undefined): T | undefined {
// ── Schema Definition ────────────────────────────────────────────────
const SCHEMA_VERSION = 36;
const SCHEMA_VERSION = 37;
function normalizeTaskComments(
steeringComments: SteeringComment[] | undefined,
@@ -1464,6 +1464,12 @@ export class Database {
});
}
if (version < 37) {
this.applyMigration(37, () => {
this.addColumnIfMissing("mission_validator_runs", "taskId", "TEXT");
});
}
}
/**

View File

@@ -776,7 +776,7 @@ describe("Migration: pre-33 DB upgrade", () => {
// Step 1: Create a fresh database at v33 (runs all migrations up to 33)
const db1 = createDatabase(legacyDir);
db1.init();
expect(db1.getSchemaVersion()).toBe(36);
expect(db1.getSchemaVersion()).toBe(37);
db1.close();
// Step 2: Manually downgrade to version 32 and drop insight tables
@@ -811,7 +811,7 @@ describe("Migration: pre-33 DB upgrade", () => {
expect(tableNamesBefore).not.toContain("project_insight_runs");
// Now run init — this triggers the v32→v33 migration
db3.init();
expect(db3.getSchemaVersion()).toBe(36);
expect(db3.getSchemaVersion()).toBe(37);
// Step 4: Verify insight tables exist after migration
const tablesAfter = db3.prepare(
@@ -842,12 +842,12 @@ describe("Migration: pre-33 DB upgrade", () => {
try {
const db1 = createDatabase(testDir);
db1.init();
expect(db1.getSchemaVersion()).toBe(36);
expect(db1.getSchemaVersion()).toBe(37);
db1.close();
const db2 = createDatabase(testDir);
expect(() => db2.init()).not.toThrow();
expect(db2.getSchemaVersion()).toBe(36);
expect(db2.getSchemaVersion()).toBe(37);
db2.close();
} finally {
rmSync(testDir, { recursive: true, force: true });

View File

@@ -2543,8 +2543,8 @@ describe("MissionStore", () => {
// ── Loop State & Validator Run Schema Tests ───────────────────────────
describe("Loop State & Validator Run Schema (v31)", () => {
it("schema version is 32 after migration", () => {
expect(db.getSchemaVersion()).toBe(36);
it("schema version is 37 after migration", () => {
expect(db.getSchemaVersion()).toBe(37);
});
it("mission_features table has loop state columns", () => {
@@ -2570,6 +2570,7 @@ describe("MissionStore", () => {
expect(colNames).toContain("triggerType");
expect(colNames).toContain("implementationAttempt");
expect(colNames).toContain("validatorAttempt");
expect(colNames).toContain("taskId");
expect(colNames).toContain("summary");
expect(colNames).toContain("blockedReason");
expect(colNames).toContain("startedAt");
@@ -2770,6 +2771,36 @@ describe("MissionStore", () => {
expect(updatedFeature!.lastValidatorRunId).toBe(run2.id);
});
it("startValidatorRun accepts and persists optional taskId", () => {
const mission = store.createMission({ title: "Validator Run Test" });
const milestone = store.addMilestone(mission.id, { title: "MS" });
const slice = store.addSlice(milestone.id, { title: "SL" });
const feature = store.addFeature(slice.id, { title: "Test Feature" });
const run = store.startValidatorRun(feature.id, "task_completion", "KB-999");
expect(run.taskId).toBe("KB-999");
// Verify by reading back from DB
const runFromDb = store.getValidatorRun(run.id);
expect(runFromDb?.taskId).toBe("KB-999");
});
it("startValidatorRun works without taskId (backward compatibility)", () => {
const mission = store.createMission({ title: "Validator Run Test" });
const milestone = store.addMilestone(mission.id, { title: "MS" });
const slice = store.addSlice(milestone.id, { title: "SL" });
const feature = store.addFeature(slice.id, { title: "Test Feature" });
const run = store.startValidatorRun(feature.id, "manual");
expect(run.taskId).toBeUndefined();
// Verify by reading back from DB
const runFromDb = store.getValidatorRun(run.id);
expect(runFromDb?.taskId).toBeUndefined();
});
it("completeValidatorRun transitions to passed (VAL-DM-016)", () => {
const mission = store.createMission({ title: "Complete Test" });
const milestone = store.addMilestone(mission.id, { title: "MS" });

View File

@@ -294,6 +294,7 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
triggerType: row.triggerType || undefined,
implementationAttempt: row.implementationAttempt ?? 0,
validatorAttempt: row.validatorAttempt ?? 0,
taskId: row.taskId || undefined,
summary: row.summary || undefined,
blockedReason: row.blockedReason || undefined,
startedAt: row.startedAt,
@@ -1786,10 +1787,11 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
*
* @param featureId - Feature ID to start validation for
* @param triggerType - What triggered this run (e.g., 'task_completion', 'manual', 'scheduled')
* @param taskId - Optional board task ID for this validation run (enables board visibility)
* @returns The created validator run
* @throws Error if feature not found
*/
startValidatorRun(featureId: string, triggerType?: string): MissionValidatorRun {
startValidatorRun(featureId: string, triggerType?: string, taskId?: string): MissionValidatorRun {
const feature = this.getFeature(featureId);
if (!feature) {
throw new Error(`Feature ${featureId} not found`);
@@ -1821,6 +1823,7 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
triggerType,
implementationAttempt: feature.implementationAttemptCount ?? 0,
validatorAttempt: newValidatorAttemptCount,
taskId,
startedAt: now,
createdAt: now,
updatedAt: now,
@@ -1829,8 +1832,8 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
this.db.transaction(() => {
// Insert the validator run
this.db.prepare(`
INSERT INTO mission_validator_runs (id, featureId, milestoneId, sliceId, status, triggerType, implementationAttempt, validatorAttempt, startedAt, createdAt, updatedAt)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
INSERT INTO mission_validator_runs (id, featureId, milestoneId, sliceId, status, triggerType, implementationAttempt, validatorAttempt, taskId, startedAt, createdAt, updatedAt)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`).run(
run.id,
run.featureId,
@@ -1840,6 +1843,7 @@ export class MissionStore extends EventEmitter<MissionStoreEvents> {
run.triggerType ?? "auto",
run.implementationAttempt,
run.validatorAttempt,
run.taskId ?? null,
run.startedAt,
run.createdAt,
run.updatedAt,

View File

@@ -268,6 +268,8 @@ export interface MissionValidatorRun {
implementationAttempt: number;
/** Which validation attempt this run corresponds to */
validatorAttempt: number;
/** Board task ID created for this validation run (for board visibility) */
taskId?: string;
/** Summary of the validation run results */
summary?: string;
/** Reason for blocked status if applicable */

View File

@@ -739,7 +739,7 @@ describe("RoadmapStore", () => {
describe("schema version", () => {
it("schema version is 32 after init", () => {
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
});
});

View File

@@ -465,7 +465,7 @@ describe("Run Audit", () => {
});
it("schema version is bumped to 28", () => {
expect(db.getSchemaVersion()).toBe(36);
expect(db.getSchemaVersion()).toBe(37);
});
});
});

View File

@@ -174,6 +174,34 @@ describe("TaskStore", () => {
const detail = await store.getTask(task.id);
expect(detail.breakIntoSubtasks).toBeUndefined();
});
it("persists missionId and sliceId when provided during task creation", async () => {
const task = await store.createTask({
description: "Mission-linked task",
missionId: "MS-001",
sliceId: "SL-001",
});
expect(task.missionId).toBe("MS-001");
expect(task.sliceId).toBe("SL-001");
const detail = await store.getTask(task.id);
expect(detail.missionId).toBe("MS-001");
expect(detail.sliceId).toBe("SL-001");
});
it("leaves missionId and sliceId unset when not provided", async () => {
const task = await store.createTask({
description: "Regular task",
});
expect(task.missionId).toBeUndefined();
expect(task.sliceId).toBeUndefined();
const detail = await store.getTask(task.id);
expect(detail.missionId).toBeUndefined();
expect(detail.sliceId).toBeUndefined();
});
});
describe("assignedAgentId persistence", () => {

View File

@@ -1484,6 +1484,8 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
planningModelProvider: input.planningModelProvider,
planningModelId: input.planningModelId,
thinkingLevel: input.thinkingLevel,
missionId: input.missionId,
sliceId: input.sliceId,
steps: [],
currentStep: 0,
log: [{ timestamp: now, action: "Task created" }],

View File

@@ -1433,7 +1433,9 @@ export const COLUMN_DESCRIPTIONS: Record<Column, string> = {
export const VALID_TRANSITIONS: Record<Column, Column[]> = {
triage: ["todo"],
todo: ["in-progress", "triage"],
"in-progress": ["in-review", "todo", "triage"],
// NOTE: "in-progress" → "done" is enabled for mission validation tasks that complete directly.
// Regular implementation tasks should move through "in-review" before "done".
"in-progress": ["in-review", "todo", "triage", "done"],
"in-review": ["done", "in-progress", "todo"],
done: ["todo", "triage", "archived"],
archived: ["done"],

View File

@@ -173,9 +173,17 @@ function createMockMissionStore() {
}),
listAssertionsForFeature: vi.fn(() => []),
getAssertionsForFeature: vi.fn(() => []),
getSlice: vi.fn((id: string) => {
// Return a mock slice with milestoneId for the hierarchy
return createMockSlice({ id });
}),
getMilestone: vi.fn((id: string) => {
// Return a mock milestone with missionId for the hierarchy
return createMockMilestone({ id });
}),
// Validator run methods
startValidatorRun: vi.fn((featureId: string, _triggerType?: string) => {
startValidatorRun: vi.fn((featureId: string, _triggerType?: string, _taskId?: string) => {
const run = createMockValidatorRun({ featureId });
validatorRuns.set(run.id, run);
return run;
@@ -249,12 +257,18 @@ function createMockMissionStore() {
}
function createMockTaskStore() {
const tasks = new Map<string, { id: string; title?: string; description?: string; log?: Array<{ action?: string }> }>();
const tasks = new Map<string, { id: string; title?: string; description?: string; log?: Array<{ action?: string }>; column?: string; missionId?: string; sliceId?: string; status?: string }>();
const store = {
getTask: vi.fn(async (id: string) => tasks.get(id)),
moveTask: vi.fn(),
updateTask: vi.fn(),
createTask: vi.fn(async (input: { title?: string; description?: string; column?: string; missionId?: string; sliceId?: string }) => {
const id = `KB-${tasks.size + 1}`;
const task = { id, ...input };
tasks.set(id, task);
return task;
}),
moveTask: vi.fn(async () => {}),
updateTask: vi.fn(async () => {}),
getSettings: vi.fn().mockResolvedValue({
missionStaleThresholdMs: 600_000,
missionMaxTaskRetries: 3,
@@ -262,7 +276,7 @@ function createMockTaskStore() {
on: vi.fn(),
off: vi.fn(),
_setTask: (t: { id: string; title?: string; description?: string; log?: Array<{ action?: string }> }) => tasks.set(t.id, t),
_setTask: (t: { id: string; title?: string; description?: string; log?: Array<{ action?: string }>; column?: string; missionId?: string; sliceId?: string; status?: string }) => tasks.set(t.id, t),
_clear: () => tasks.clear(),
};
@@ -449,6 +463,87 @@ describe("MissionExecutionLoop", () => {
expect.objectContaining({ featureId: "F-001" }),
);
});
it("creates validation board task when feature has assertions", async () => {
const feature = createMockFeature({ loopState: "implementing", taskId: "FN-001", sliceId: "SL-001" });
missionStore._setFeature(feature);
taskStore._setTask({ id: "FN-001", title: "Test", description: "Test task", log: [] });
missionStore.getFeatureByTaskId = vi.fn().mockReturnValue(feature);
missionStore.listAssertionsForFeature = vi.fn().mockReturnValue([
{ id: "CA-1", milestoneId: "MS-001", title: "Test assertion", assertion: "Should work", status: "pending" as const, orderIndex: 0, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() },
]);
loop = new MissionExecutionLoop({
taskStore: taskStore as any,
missionStore: missionStore as any,
rootDir: "/tmp",
});
loop.start();
await loop.processTaskOutcome("FN-001");
// Should create a validation board task
expect(taskStore.createTask).toHaveBeenCalledWith(
expect.objectContaining({
title: expect.stringContaining("Validate:"),
column: "in-progress",
sliceId: "SL-001",
}),
);
});
it("sets validation task status to mission-validation", async () => {
const feature = createMockFeature({ loopState: "implementing", taskId: "FN-001", sliceId: "SL-001" });
missionStore._setFeature(feature);
taskStore._setTask({ id: "FN-001", title: "Test", description: "Test task", log: [] });
missionStore.getFeatureByTaskId = vi.fn().mockReturnValue(feature);
missionStore.listAssertionsForFeature = vi.fn().mockReturnValue([
{ id: "CA-1", milestoneId: "MS-001", title: "Test assertion", assertion: "Should work", status: "pending" as const, orderIndex: 0, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() },
]);
loop = new MissionExecutionLoop({
taskStore: taskStore as any,
missionStore: missionStore as any,
rootDir: "/tmp",
});
loop.start();
await loop.processTaskOutcome("FN-001");
// Should update the task status to mission-validation
expect(taskStore.updateTask).toHaveBeenCalledWith(
expect.any(String),
expect.objectContaining({ status: "mission-validation" }),
);
});
it("passes taskId to startValidatorRun", async () => {
const feature = createMockFeature({ loopState: "implementing", taskId: "FN-001", sliceId: "SL-001" });
missionStore._setFeature(feature);
taskStore._setTask({ id: "FN-001", title: "Test", description: "Test task", log: [] });
missionStore.getFeatureByTaskId = vi.fn().mockReturnValue(feature);
missionStore.listAssertionsForFeature = vi.fn().mockReturnValue([
{ id: "CA-1", milestoneId: "MS-001", title: "Test assertion", assertion: "Should work", status: "pending" as const, orderIndex: 0, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() },
]);
// Make createTask return a predictable ID
taskStore.createTask = vi.fn().mockResolvedValue({ id: "KB-999" });
loop = new MissionExecutionLoop({
taskStore: taskStore as any,
missionStore: missionStore as any,
rootDir: "/tmp",
});
loop.start();
await loop.processTaskOutcome("FN-001");
// Should pass the created task ID to startValidatorRun
expect(missionStore.startValidatorRun).toHaveBeenCalledWith(
"F-001",
"task_completion",
"KB-999",
);
});
});
// ── recoverActiveMissions ────────────────────────────────────────────────

View File

@@ -211,6 +211,9 @@ export class MissionExecutionLoop extends EventEmitter {
loopLog.log(`Processing task outcome for ${taskId}`);
// Track the validation board task ID (created later if there are assertions)
let validationTaskId: string | undefined;
try {
// Find the feature linked to this task
const feature = this.missionStore.getFeatureByTaskId(taskId);
@@ -230,7 +233,7 @@ export class MissionExecutionLoop extends EventEmitter {
if (assertions.length === 0) {
loopLog.log(`Feature ${feature.id} has no linked assertions; marking as passed`);
// No assertions = automatically pass
await this.handleValidationPass(feature.id, undefined, "No assertions linked");
await this.handleValidationPass(feature.id, undefined, "No assertions linked", undefined);
return;
}
@@ -238,8 +241,27 @@ export class MissionExecutionLoop extends EventEmitter {
this.activeValidations.add(feature.id);
try {
// Start a validator run
const run = this.missionStore.startValidatorRun(feature.id, "task_completion");
// Resolve mission context for creating the validation board task
const featureSlice = this.missionStore.getSlice(feature.sliceId);
const featureMilestone = featureSlice ? this.missionStore.getMilestone(featureSlice.milestoneId) : undefined;
const missionId = featureMilestone?.missionId;
// Create a visible board task for this validation run
const validationTask = await this.taskStore.createTask({
title: `🔍 Validate: ${feature.title}`,
description: `Validating implementation for feature "${feature.title}" against ${assertions.length} contract assertion(s).\n\nFeature: ${feature.id}\nSlice: ${feature.sliceId}\nAssertions: ${assertions.map(a => a.title).join(", ")}`,
column: "in-progress",
missionId,
sliceId: feature.sliceId,
});
validationTaskId = validationTask.id;
// Mark as validation task so scheduler/stuck-detector skip it
await this.taskStore.updateTask(validationTaskId, { status: "mission-validation" });
loopLog.log(`Created validation board task ${validationTaskId} for feature ${feature.id}`);
// Start the validator run, linked to the board task
const run = this.missionStore.startValidatorRun(feature.id, "task_completion", validationTaskId);
loopLog.log(`Started validator run ${run.id} for feature ${feature.id}`);
// Run the validation
@@ -247,17 +269,31 @@ export class MissionExecutionLoop extends EventEmitter {
// Handle the result
if (result.status === "pass") {
await this.handleValidationPass(feature.id, run.id, result.summary);
await this.handleValidationPass(feature.id, run.id, result.summary, validationTaskId);
} else if (result.status === "fail") {
await this.handleValidationFail(feature.id, run.id, result);
await this.handleValidationFail(feature.id, run.id, result, validationTaskId);
} else if (result.status === "blocked") {
await this.handleValidationBlocked(feature.id, run.id, result.blockedReason);
await this.handleValidationBlocked(feature.id, run.id, result.blockedReason, validationTaskId);
} else if (result.status === "error") {
await this.handleValidationError(feature.id, run.id, result.summary, validationTaskId);
}
} finally {
this.activeValidations.delete(feature.id);
}
} catch (err) {
loopLog.error(`Error processing task outcome for ${taskId}:`, err);
// Move the validation task to in-review if it exists
if (validationTaskId) {
try {
await this.taskStore.updateTask(validationTaskId, {
error: err instanceof Error ? err.message : String(err),
summary: "Validation failed unexpectedly",
});
await this.taskStore.moveTask(validationTaskId, "in-review");
} catch (moveErr) {
loopLog.error(`Failed to move validation task ${validationTaskId} on error:`, moveErr);
}
}
// Don't crash the loop - log and continue
}
}
@@ -698,6 +734,7 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
featureId: string,
runId: string | undefined,
summary: string,
validationTaskId: string | undefined,
): Promise<void> {
try {
if (runId) {
@@ -705,6 +742,15 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
}
loopLog.log(`Feature ${featureId} passed validation`);
// Move the validation board task to done if it exists
if (validationTaskId) {
await this.taskStore.updateTask(validationTaskId, {
summary: summary || "Validation passed",
});
await this.taskStore.moveTask(validationTaskId, "done");
loopLog.log(`Moved validation task ${validationTaskId} to done`);
}
// Notify autopilot if configured
if (this.missionAutopilot?.notifyValidationComplete) {
await this.missionAutopilot.notifyValidationComplete(featureId, "passed");
@@ -723,6 +769,7 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
featureId: string,
runId: string | undefined,
result: ValidationResult,
validationTaskId: string | undefined,
): Promise<void> {
try {
// Record the failures
@@ -746,6 +793,16 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
loopLog.log(`Feature ${featureId} failed validation with ${failures.length} failures`);
// Move the validation board task to in-review if it exists
if (validationTaskId) {
await this.taskStore.updateTask(validationTaskId, {
error: result.summary,
summary: `Failed: ${failures.length} assertion(s) failed`,
});
await this.taskStore.moveTask(validationTaskId, "in-review");
loopLog.log(`Moved validation task ${validationTaskId} to in-review`);
}
// Create fix feature
try {
const fixFeature = this.missionStore.createGeneratedFixFeature(
@@ -798,6 +855,7 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
featureId: string,
runId: string | undefined,
blockedReason: string | undefined,
validationTaskId: string | undefined,
): Promise<void> {
try {
if (runId) {
@@ -805,6 +863,16 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
}
loopLog.log(`Feature ${featureId} blocked: ${blockedReason}`);
// Move the validation board task to in-review if it exists
if (validationTaskId) {
await this.taskStore.updateTask(validationTaskId, {
error: blockedReason,
summary: `Blocked: ${blockedReason}`,
});
await this.taskStore.moveTask(validationTaskId, "in-review");
loopLog.log(`Moved validation task ${validationTaskId} to in-review`);
}
// Notify autopilot if configured
if (this.missionAutopilot?.notifyValidationComplete) {
await this.missionAutopilot.notifyValidationComplete(featureId, "blocked");
@@ -823,6 +891,7 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
featureId: string,
runId: string | undefined,
error: string,
validationTaskId: string | undefined,
): Promise<void> {
try {
if (runId) {
@@ -830,6 +899,16 @@ ${taskContext ? `\n\nImplementation context:\n${taskContext}` : ""}`;
}
loopLog.error(`Feature ${featureId} validation error: ${error}`);
// Move the validation board task to in-review if it exists
if (validationTaskId) {
await this.taskStore.updateTask(validationTaskId, {
error,
summary: "Validation error",
});
await this.taskStore.moveTask(validationTaskId, "in-review");
loopLog.log(`Moved validation task ${validationTaskId} to in-review`);
}
// Notify autopilot if configured
if (this.missionAutopilot?.notifyValidationComplete) {
await this.missionAutopilot.notifyValidationComplete(featureId, "error");