Surface the CEO self-review guard as a proper 422
The database layer already refuses to advance a top-level assignee's task to in_review without requires_user_review=1 — the right invariant. But the HTTP route caught nothing specific and returned a bare 500, so the CEO prompt had to carry a paragraph of "the system will demote any such task back to todo, but the cycle wastes a heartbeat slot" prose to keep the model away from the error path. Translate the guard to a 422 NO_REVIEWER_ON_TOP_LEVEL_TASK response with an actionable hint and rewrite the prompt section to describe the contract instead of begging the model to avoid the failure. Also drop the residual skill-looping paragraph now that hires get their default kit on approval.
This commit is contained in:
1 parent
0443b4a197
commit
dd8485b7e2
2 files changed
+14
-7
No files matched your search
@@ -278,6 +278,17 @@ export function registerTaskRoutes(server: AgentApiServer) {
|
||||
server.json(res, 404, { error: error.message });
|
||||
return;
|
||||
}
|
||||
// Top-level assignee self-review guard: translate to a 422 so the
|
||||
// agent sees an actionable business-logic rejection rather than a
|
||||
// generic server failure.
|
||||
if (error instanceof Error && error.message.includes("cannot enter in_review")) {
|
||||
server.json(res, 422, {
|
||||
error: error.message,
|
||||
code: "NO_REVIEWER_ON_TOP_LEVEL_TASK",
|
||||
hint: "Either reassign the task to a report, mark it done directly if the work is complete, or set requires_user_review=1 if the Board should review.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
server.json(res, 500, { error: error instanceof Error ? error.message : "Task update failed" });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user