feat(FN-3957): add delegate_task override flag to bypass executor role poli
Adds a `delegate_override` flag to the `delegate_task` tool that allows executor-role tasks to be assigned to non-executor agents. The override is persisted as metadata in the extension and honored by the heartbeat inbox guard, with test coverage across engine, core, and CLI packages plus updated do Fusion-Task-Id: FN-3957
This commit is contained in:
@@ -963,6 +963,23 @@ describe("TaskStore", () => {
|
||||
expect(selected?.task.id).toBe(todo.id);
|
||||
expect(selected?.priority).toBe("todo");
|
||||
});
|
||||
|
||||
it("allows non-executor role agents to pick assigned todos when override metadata is set", async () => {
|
||||
const delegated = await store.createTask({
|
||||
description: "Assigned todo override",
|
||||
column: "todo",
|
||||
assignedAgentId: "agent-1",
|
||||
source: { sourceType: "api", sourceMetadata: { executorRoleOverride: true } },
|
||||
});
|
||||
|
||||
const selected = await store.selectNextTaskForAgent("agent-1", {
|
||||
id: "agent-1",
|
||||
role: "reviewer",
|
||||
});
|
||||
|
||||
expect(selected?.task.id).toBe(delegated.id);
|
||||
expect(selected?.priority).toBe("todo");
|
||||
});
|
||||
});
|
||||
|
||||
// ── Lock serialization test ──────────────────────────────────────
|
||||
|
||||
@@ -3029,6 +3029,7 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
||||
agentId: string,
|
||||
agent?: Pick<Agent, "id" | "role">,
|
||||
): Promise<InboxTask | null> {
|
||||
const hasExecutorRoleOverride = (task: Task): boolean => task.sourceMetadata?.executorRoleOverride === true;
|
||||
const tasks = await this.listTasks({ slim: true });
|
||||
if (tasks.length === 0) {
|
||||
return null;
|
||||
@@ -3056,7 +3057,7 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
|
||||
|
||||
const roleCompatibleAssignedTasks = agent
|
||||
? assignedTasks.filter((task) => {
|
||||
if (task.column === "in-progress") {
|
||||
if (task.column === "in-progress" || hasExecutorRoleOverride(task)) {
|
||||
return true;
|
||||
}
|
||||
return canAgentTakeImplementationTask(agent, task);
|
||||
|
||||
Reference in New Issue
Block a user