feat(KB-176): complete Step 4 — update executor system prompt and task_done tool
This commit is contained in:
@@ -550,7 +550,7 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
|||||||
|
|
||||||
async updateTask(
|
async updateTask(
|
||||||
id: string,
|
id: string,
|
||||||
updates: { title?: string; description?: string; prompt?: string; worktree?: string; status?: string | null; dependencies?: string[]; blockedBy?: string | null; paused?: boolean; baseBranch?: string; size?: "S" | "M" | "L"; reviewLevel?: number; mergeRetries?: number; modelProvider?: string | null; modelId?: string | null; validatorModelProvider?: string | null; validatorModelId?: string | null; error?: string | null },
|
updates: { title?: string; description?: string; prompt?: string; worktree?: string; status?: string | null; dependencies?: string[]; blockedBy?: string | null; paused?: boolean; baseBranch?: string; size?: "S" | "M" | "L"; reviewLevel?: number; mergeRetries?: number; modelProvider?: string | null; modelId?: string | null; validatorModelProvider?: string | null; validatorModelId?: string | null; error?: string | null; summary?: string | null },
|
||||||
): Promise<Task> {
|
): Promise<Task> {
|
||||||
return this.withTaskLock(id, async () => {
|
return this.withTaskLock(id, async () => {
|
||||||
const dir = this.taskDir(id);
|
const dir = this.taskDir(id);
|
||||||
@@ -623,6 +623,11 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
|||||||
} else if (updates.error !== undefined) {
|
} else if (updates.error !== undefined) {
|
||||||
task.error = updates.error;
|
task.error = updates.error;
|
||||||
}
|
}
|
||||||
|
if (updates.summary === null) {
|
||||||
|
task.summary = undefined;
|
||||||
|
} else if (updates.summary !== undefined) {
|
||||||
|
task.summary = updates.summary;
|
||||||
|
}
|
||||||
task.updatedAt = new Date().toISOString();
|
task.updatedAt = new Date().toISOString();
|
||||||
|
|
||||||
await this.atomicWriteTaskJson(dir, task);
|
await this.atomicWriteTaskJson(dir, task);
|
||||||
|
|||||||
@@ -186,6 +186,8 @@ export interface Task {
|
|||||||
mergeRetries?: number;
|
mergeRetries?: number;
|
||||||
/** Error message from the last failure, if the task failed during execution */
|
/** Error message from the last failure, if the task failed during execution */
|
||||||
error?: string;
|
error?: string;
|
||||||
|
/** Optional summary of what was changed/fixed when task is completed */
|
||||||
|
summary?: string;
|
||||||
/** ISO-8601 timestamp of when the task last entered its current column.
|
/** ISO-8601 timestamp of when the task last entered its current column.
|
||||||
* Used to sort cards within a column so that recently-moved cards appear at the top. */
|
* Used to sort cards within a column so that recently-moved cards appear at the top. */
|
||||||
columnMovedAt?: string;
|
columnMovedAt?: string;
|
||||||
|
|||||||
@@ -773,9 +773,14 @@ export class TaskExecutor {
|
|||||||
description:
|
description:
|
||||||
"Signal that all steps are complete, tests pass, and documentation is updated. " +
|
"Signal that all steps are complete, tests pass, and documentation is updated. " +
|
||||||
"Call this as the final action after finishing all work. " +
|
"Call this as the final action after finishing all work. " +
|
||||||
"Automatically marks all remaining steps as done.",
|
"Automatically marks all remaining steps as done. " +
|
||||||
parameters: Type.Object({}),
|
"Optionally provide a summary of what was changed/fixed.",
|
||||||
execute: async () => {
|
parameters: Type.Object({
|
||||||
|
summary: Type.Optional(Type.String({
|
||||||
|
description: "Optional summary of what was changed/fixed and what was verified (2-4 sentences)",
|
||||||
|
})),
|
||||||
|
}),
|
||||||
|
execute: async (_id: string, params: { summary?: string }) => {
|
||||||
onDone();
|
onDone();
|
||||||
// Mark all pending/in-progress steps as done
|
// Mark all pending/in-progress steps as done
|
||||||
const task = await store.getTask(taskId);
|
const task = await store.getTask(taskId);
|
||||||
@@ -784,9 +789,16 @@ export class TaskExecutor {
|
|||||||
await store.updateStep(taskId, i, "done");
|
await store.updateStep(taskId, i, "done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Save summary if provided
|
||||||
|
if (params.summary) {
|
||||||
|
await store.updateTask(taskId, { summary: params.summary });
|
||||||
|
}
|
||||||
await store.logEntry(taskId, "Task marked done by agent");
|
await store.logEntry(taskId, "Task marked done by agent");
|
||||||
|
const successMessage = params.summary
|
||||||
|
? "Task marked complete with summary. All steps done. Moving to in-review."
|
||||||
|
: "Task marked complete. All steps done. Moving to in-review.";
|
||||||
return {
|
return {
|
||||||
content: [{ type: "text" as const, text: "Task marked complete. All steps done. Moving to in-review." }],
|
content: [{ type: "text" as const, text: successMessage }],
|
||||||
details: {},
|
details: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user