diff --git a/src/main/api-server/routes-tasks.ts b/src/main/api-server/routes-tasks.ts index eaf45852..3dfafa41 100644 --- a/src/main/api-server/routes-tasks.ts +++ b/src/main/api-server/routes-tasks.ts @@ -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" }); } }); diff --git a/src/main/prompt-builder/ceo-modes/team-building.en.md b/src/main/prompt-builder/ceo-modes/team-building.en.md index 2e51cbfe..d8320708 100644 --- a/src/main/prompt-builder/ceo-modes/team-building.en.md +++ b/src/main/prompt-builder/ceo-modes/team-building.en.md @@ -35,11 +35,7 @@ For each role chosen in Step 2, `POST /api/companies/{companyId}/agents` with: - `budgetMonthlyUsd`: 50–250 per agent - `model`: pick per role complexity -After each hire is approved (`hire_agent` auto-approves when company policy allows), assign skills: - -1. `GET /api/companies/{companyId}/skills` to review options. -2. For every relevant skill: `POST /api/agents/{agentId}/skills` with `{"skillId": ""}`. -3. Match skills to role — engineering skills to engineers, writing/marketing skills to writers, etc. +Default domain skills are assigned automatically the moment a hire is approved — do not loop over skills unless you want to override the defaults for a specific agent. **You must submit every intended hire before you consider Step 4.** @@ -53,9 +49,9 @@ Once — and only once — all hire requests for this wake are live, `POST` one Do not submit this approval more than once per team-building phase. If it exists already (pending or approved), you are finished here. -## Self-assignment: do not do it +## Self-assignment is rejected at the API -Do **not** assign large goal-level tasks to yourself and move them to `in_review`. You have no manager; no one can review you. The system will demote any such task back to `todo` on the next boot, but the cycle wastes a heartbeat slot. Instead: create the task with an assignee from Step 3's hires, or leave it unassigned for the auto-assign rule to pick up. +Attempts to move a task you own to `in_review` without a reviewer return `422 NO_REVIEWER_ON_TOP_LEVEL_TASK` — the error response carries the options. Assign the task to one of your hires from Step 3 instead, or mark it directly `done` when the work is genuinely complete. ## End state for this wake