Remove task-level approval system
Task-level approval (requiresApproval, mergeRequiresApproval, pending_approval status) was redundant with executionMode (yolo vs review_per_phase) and blocked the orchestrator's phase completion flow. Tasks now complete directly; phase-level review via executionMode is the right granularity. Removed: schema columns (left in DB, removed from Drizzle), TaskPendingApprovalEvent, approveTask/listPendingApprovals procedures, findPendingApproval repository method, and all frontend approval UI.
This commit is contained in:
@@ -19,7 +19,6 @@ All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.r
|
||||
| id | text PK | nanoid |
|
||||
| name | text NOT NULL | |
|
||||
| status | text enum | 'active' \| 'pending_review' \| 'completed' \| 'archived', default 'active' |
|
||||
| mergeRequiresApproval | integer/boolean | default true |
|
||||
| branch | text nullable | auto-generated initiative branch (e.g., 'cw/user-auth') |
|
||||
| createdAt, updatedAt | integer/timestamp | |
|
||||
|
||||
@@ -48,8 +47,7 @@ All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.r
|
||||
| type | text enum | 'auto' \| 'checkpoint:human-verify' \| 'checkpoint:decision' \| 'checkpoint:human-action' |
|
||||
| category | text enum | 'execute' \| 'research' \| 'discuss' \| 'plan' \| 'detail' \| 'refine' \| 'verify' \| 'merge' \| 'review' |
|
||||
| priority | text enum | 'low' \| 'medium' \| 'high' |
|
||||
| status | text enum | 'pending_approval' \| 'pending' \| 'in_progress' \| 'completed' \| 'blocked' |
|
||||
| requiresApproval | integer/boolean nullable | null = inherit from initiative |
|
||||
| status | text enum | 'pending' \| 'in_progress' \| 'completed' \| 'blocked' |
|
||||
| order | integer | default 0 |
|
||||
| summary | text nullable | Agent result summary — propagated to dependent tasks as context |
|
||||
| createdAt, updatedAt | integer/timestamp | |
|
||||
@@ -222,7 +220,7 @@ Index: `(phaseId)`.
|
||||
|-----------|-------------|
|
||||
| InitiativeRepository | create, findById, findAll, findByStatus, update, delete |
|
||||
| PhaseRepository | + createDependency, getDependencies, getDependents, findByInitiativeId |
|
||||
| TaskRepository | + findByParentTaskId, findByPhaseId, findPendingApproval, createDependency |
|
||||
| TaskRepository | + findByParentTaskId, findByPhaseId, createDependency |
|
||||
| AgentRepository | + findByName, findByTaskId, findBySessionId, findByStatus |
|
||||
| MessageRepository | + findPendingForUser, findRequiringResponse, findReplies |
|
||||
| PageRepository | + findRootPage, getOrCreateRootPage, findByParentPageId |
|
||||
@@ -244,4 +242,4 @@ Key rules:
|
||||
- See [database-migrations.md](database-migrations.md) for full workflow
|
||||
- Snapshots stale after 0008; migrations 0008+ are hand-written
|
||||
|
||||
Current migrations: 0000 through 0028 (29 total).
|
||||
Current migrations: 0000 through 0030 (31 total).
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
| Category | Events | Count |
|
||||
|----------|--------|-------|
|
||||
| **Agent** | `agent:spawned`, `agent:stopped`, `agent:crashed`, `agent:resumed`, `agent:account_switched`, `agent:deleted`, `agent:waiting`, `agent:output` | 8 |
|
||||
| **Task** | `task:queued`, `task:dispatched`, `task:completed`, `task:blocked`, `task:pending_approval` | 5 |
|
||||
| **Task** | `task:queued`, `task:dispatched`, `task:completed`, `task:blocked` | 4 |
|
||||
| **Phase** | `phase:queued`, `phase:started`, `phase:completed`, `phase:blocked`, `phase:changes_requested` | 5 |
|
||||
| **Merge** | `merge:queued`, `merge:started`, `merge:completed`, `merge:conflicted` | 4 |
|
||||
| **Page** | `page:created`, `page:updated`, `page:deleted` | 3 |
|
||||
@@ -67,9 +67,7 @@ InitiativeReviewApprovedEvent { initiativeId, branch, strategy: 'push_branch' |
|
||||
5. **Checkpoint skip** — Tasks with type starting with `checkpoint:` skip auto-dispatch
|
||||
6. **Planning skip** — Planning-category tasks (research, discuss, plan, detail, refine) skip auto-dispatch — they use the architect flow
|
||||
7. **Summary propagation** — `completeTask()` reads the completing agent's `result.message` and stores it on the task's `summary` column. Dependent tasks see this summary in `context/tasks/<id>.md` frontmatter.
|
||||
8. **Approval check** — `completeTask()` checks `requiresApproval` (task-level, then initiative-level)
|
||||
9. **Approval flow** — If approval required: status → `pending_approval`, emit `task:pending_approval`
|
||||
10. **Spawn failure** — If `agentManager.spawn()` throws, the task is blocked via `blockTask()` with the error message. The dispatch cycle continues instead of crashing.
|
||||
8. **Spawn failure** — If `agentManager.spawn()` throws, the task is blocked via `blockTask()` with the error message. The dispatch cycle continues instead of crashing.
|
||||
|
||||
### DispatchManager Methods
|
||||
|
||||
@@ -78,8 +76,7 @@ InitiativeReviewApprovedEvent { initiativeId, branch, strategy: 'push_branch' |
|
||||
| `queue(taskId)` | Add task to dispatch queue |
|
||||
| `dispatchNext()` | Find and dispatch next ready task |
|
||||
| `getNextDispatchable()` | Get next task without dispatching |
|
||||
| `completeTask(taskId, agentId?)` | Complete with approval check |
|
||||
| `approveTask(taskId)` | Approve pending task |
|
||||
| `completeTask(taskId, agentId?)` | Complete task |
|
||||
| `blockTask(taskId, reason)` | Block task with reason |
|
||||
| `getQueueState()` | Return queued, ready, blocked tasks |
|
||||
|
||||
|
||||
@@ -78,11 +78,9 @@ Each procedure uses `require*Repository(ctx)` helpers that throw `TRPCError(INTE
|
||||
| createPhaseTask | mutation | Create task on phase |
|
||||
| listInitiativeTasks | query | All tasks for initiative |
|
||||
| listPhaseTasks | query | All tasks for phase |
|
||||
| listPendingApprovals | query | Tasks with status=pending_approval |
|
||||
| deleteTask | mutation | Delete a task by ID |
|
||||
| listPhaseTaskDependencies | query | All task dependency edges for tasks in a phase |
|
||||
| listInitiativeTaskDependencies | query | All task dependency edges for tasks in an initiative |
|
||||
| approveTask | mutation | Approve and complete task |
|
||||
|
||||
### Initiatives
|
||||
| Procedure | Type | Description |
|
||||
@@ -92,7 +90,7 @@ Each procedure uses `require*Repository(ctx)` helpers that throw `TRPCError(INTE
|
||||
| getInitiative | query | With projects array |
|
||||
| updateInitiative | mutation | Name, status |
|
||||
| deleteInitiative | mutation | Cascade delete initiative and all children |
|
||||
| updateInitiativeConfig | mutation | mergeRequiresApproval, executionMode, branch |
|
||||
| updateInitiativeConfig | mutation | executionMode, branch |
|
||||
| getInitiativeReviewDiff | query | Full diff of initiative branch vs project default branch |
|
||||
| getInitiativeReviewCommits | query | Commits on initiative branch not on default branch |
|
||||
| getInitiativeCommitDiff | query | Single commit diff for initiative review |
|
||||
@@ -146,7 +144,7 @@ Each procedure uses `require*Repository(ctx)` helpers that throw `TRPCError(INTE
|
||||
| queueTask | mutation | Add task to dispatch queue |
|
||||
| dispatchNext | mutation | Dispatch next ready task |
|
||||
| getQueueState | query | Queue state |
|
||||
| completeTask | mutation | Complete with approval check |
|
||||
| completeTask | mutation | Complete task |
|
||||
|
||||
### Coordination (Merge Queue)
|
||||
| Procedure | Type | Description |
|
||||
|
||||
Reference in New Issue
Block a user