Repository navigation
fix(platform): refuse review delegation by the source implementer - #4487
Conversation
Review B's post-merge review of #4482 (PR review 5442169399) found that nothing stopped the caller of task_delegate_review from being the implementation agent of the captured source: an implementer holding the grant could move the review of its own work to a reviewer it picked. delegateAgentTaskReview now refuses that caller with 403 TASK_REVIEWER_NOT_INDEPENDENT as soon as the captured source is read under the task lock, before the evidence check and the replay branch, so neither a first admission nor a retry gets through. The wording follows the task_review refusal for the same agent. The cross-project refusal ("The task is outside this project") had no test. Unit regressions now cover both refusals (the implementer caller fails on main), and the native HTTP + PostgreSQL delegation lane checks both with no-effect snapshots. The TASK-R21 card, the task automation and API reference pages (EN/DE/FR) and the error-code and automation registers describe the refusal.
yannickmonney
left a comment
There was a problem hiding this comment.
ACCEPT — reviewed at exact head ecc182916c02565c6693dfd76a3da58b5187a4da.
- SECURITY — PASS.
delegateAgentTaskReviewcompares the captured source implementation agent toauth.agentIdand returns 403TASK_REVIEWER_NOT_INDEPENDENTwith “The implementation agent cannot delegate the review of its own work”. The guard runs before handoff/activity writes and before replay receipt handling. Unit coverage checks both current and reassigned task ownership; integration coverage verifies a granted implementer cannot route its own review. - WORKFLOW — PASS. The captured reviewer/source/evidence checks remain intact, and replay cannot bypass the independence guard. The implementation agent cannot move its own gate to a reviewer of its choice.
- CODE — PASS. The change is localized and reuses the existing
TaskErrorrefusal code and delegation flow. - DATA — PASS. Tests assert no queue, gate, activity, or other writes on refusal; integration snapshots remain unchanged for cross-project refusal.
- LOCALE — PASS. New behavior text has EN/DE/FR parity in API reference and task-automation docs.
- DOCS — PASS. The TASK-R21 specification, manual coverage reference, and error-code reference document the new refusal and cross-project case.
- CICD — PASS. Check-runs were read once at this exact head; observed checks completed successfully. No rerun or cancellation performed.
- CROSS-PROJECT — PASS. Integration coverage adds a task in a neighboring project and verifies
TASK_REVIEW_FORBIDDEN(“The task is outside this project”) before queue/gate changes.
The new tests target the two post-merge gaps identified in review 5442169399 and would fail on the pre-change behavior.
yannickmonney
left a comment
There was a problem hiding this comment.
Part B check of this follow-up at ecc182916c02565c6693dfd76a3da58b5187a4da. It closes the gap from my post-merge review of #4482 (review 5442169399).
Scope: the delegation guard and its regression tests. I did not review the docs and spec wording (Part A's) or anything else in the diff. Method: a static read plus CI execution evidence.
-
Guard. In
delegateAgentTaskReview,source.implementationAgentId === auth.agentIdnow throwsTASK_REVIEWER_NOT_INDEPENDENT(403). The check runs right after the captured source is read, before the evidence-revision check, the destination-eligibility check, the replay path andhandoffPendingTaskReview. So an implementer is refused before any mutation, and also can't use the replay path. -
Cross-project refusal is now covered by a regression as well.
-
CI execution. Backend integration job
112826112067(Checks37631290776, attempt 1) ran 36review delegation:checks, all PASS, with 0 FAIL in the job (1,669 PASS in total). They include:granted implementer cannot delegate the review of its own source→TASK_REVIEWER_NOT_INDEPENDENT;a granted manager cannot delegate a task of another project→TASK_REVIEW_FORBIDDEN.
All seven
CI ready (…)aggregators are green at this head. -
Verdict (Part B, this delta): no remaining concern. The gap I noted on #4482 is closed at this head. Merge through the normal lane. The
task_delegate_reviewgrant can be provisioned, manager-only, after this merges.
|
Merge-lane coverage dispositions at
Merge-gate dry run at 17:02:44Z: open, CLEAN, head matches; no required contexts. checks total=78 not-completed=0 failing=0 [neutral=1 skipped=24 success=53] neutral=[Trivy[github-advanced-security]] statuses=[pending total=0]. Every skip is on the by-design allowlist |
Summary
Follow-up to #4482, from Review B's post-merge Part B review (PR review 5442169399), proposed follow-up items 1 and 2.
task_delegate_reviewfrom being the implementation agent of the captured source. An implementer holding the grant could move the review of its own work to a reviewer it picked.delegateAgentTaskReviewnow refuses that caller with 403TASK_REVIEWER_NOT_INDEPENDENT, "The implementation agent cannot delegate the review of its own work". The wording and code follow thetask_reviewrefusal for the same agent ("The implementation agent cannot review its own work"). The check runs as soon as the captured source run is read under the task lock, before the evidence check and before the replay branch, so neither a first admission nor a retry gets through. It binds to the captured source's agent, not to the current assignee.Tests
backend/domains/tasks/review-delegation.test.ts(vitestserverproject, one worker):origin/main'sreview-delegation.ts: 2 failed | 30 passed (both "refuses the captured source implementation agent as the delegating caller" cases:promise resolved "{ …(11) }" instead of rejecting);backend/domains/tasks/review-delegation.integration.ts(throughcheckAgentTaskReviewsinbackend:integration) gains two checks with no-effect snapshots over native HTTP and real PostgreSQL:review delegation: granted implementer cannot delegate the review of its own source: the implementation agent gets the grant and a live project-wide run. Afterwards its run is cancelled, its workspace session removed and its tools restored, so the later lanes, which start this implementer, see the earlier state.review delegation: a granted manager cannot delegate a task of another project(the lane's neighbour project, same organization).Docs and registers
TASK-R21card inbackend/domains/tasks/spec.md: rule text plus a new example.error-codes.md: rows forTASK_REVIEWER_NOT_INDEPENDENTandTASK_REVIEW_FORBIDDENontask_delegate_review. Manualautomation.md: the delegation row.Not run locally
Type check, lint, the domain-specs guard, docs/i18n checks and
backend:integrationare left to CI.Rollout note
Per the review's item 3, keep
task_delegate_reviewunprovisioned until this merges.