Skip to content

feat(platform): let independent agents review task results - #4076

Merged
yannickmonney merged 5 commits into
mainfrom
feat/independent-agent-task-review
Oct 2, 2026
Merged

yannickmonney merged 5 commits into
mainfrom
feat/independent-agent-task-review

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Task results can route to a designated reviewer agent, so fleet work can finish without waiting in a human review queue. Project defaults and explicit pending-review transfers select the reviewer. The opt-in task_review tool checks the current reviewer grant, independent implementation identity, captured source/evidence, governance and completion blockers before recording one durable verdict.

  • Keep source-less human/automation work in the human review chain. Explain invalid captured agent routing and allow explicit recovery without losing the completed result or silently choosing a different agent.
  • Let managers discover pending agent reviews with a scoped, cursor-bound reviewer filter. Reviewers can stage one authorized attachment/output of at most 20 MiB through the existing sandbox transfer route; signed size bounds reject incomplete/oversized streams before daemon completion.
  • Show the captured review owner, preserve stale-handoff refusals, and close confirmations after ownership/review-generation changes. Shared picker bounds keep search, options and help accessible on narrow or short screens.
  • Keep repair dispatch in the existing manager / task_start_agent path, with its busy-agent, single-live-run and per-task start limits. A verdict does not merge GitHub work or start a repair automatically.

Closes #4058.

Checklist

  • bun run check --concurrency=1 at 7afc5b349325a1d10fcd3daff4aa2d396430fdf0: 58/58 tasks, all executed, zero cached. Fresh platform UI: 5,167 passed; server: 81,287 passed, 5 existing skips; shared UI: 2,742 passed.
  • Composed SAST: 467 rules / 4,261 files / zero findings. Coverage limits: 42 partially analyzed files, 2,311 configured exclusions, 17 over the size cap. A targeted ordinary-rule scan of the task modal and three new review files completed without partial notices: 162 rules / 4 files / zero findings.
  • Local Knip comparison: the same 86 dependency-layout diagnostics, with byte-identical output to the previously reviewed control. The local command exits 1; hosted Knip passed at the exact reviewed head.
  • Hosted Checks, Build, CLI, E2E, SAST and Commitlint passed at the exact reviewed head. Unit ran 25 tasks with zero cached: platform server 81,290 passed / 2 skipped (the optional real-SOPS round trip and one live YouTube bot-wall case). The local five opt-in YouTube skips remain reported above.
  • All 18 Playwright jobs passed on their first attempts: platform 66 passed / 1 existing skip, docs 43, web 36. Every diagnostics step and the complete artifact inventory were inspected; no retry/failure report exists.
  • Platform image scan, image validation and smoke test passed. The separate Trivy code-scanning comparison is neutral because ten main-branch configurations are absent; it cannot establish which alerts this PR introduces. This is not a zero-vulnerability claim.
  • EN/DE/FR UI and product/API documentation updated; no applicable de-CH override.
  • Additive reviewer migration and API contracts; manual boxes/registers plus observed local round r0008.
  • Root READMEs: N/A; existing product/API guides own the behavior.

Test plan

  • Hosted final-head backend integration passed 1,431/1,431 checks across all 217 lanes, freshly executed. Fresh local final-head Postgres/MinIO integration: 105/105 checks across both review lanes. A prior five-lane main-integration bridge passed 114/114. These include missing-metadata refusal when normal file deletion retains bytes for a task. Both are filtered local runs, not substitutes for the complete hosted backend integration.
  • Actual blob route and runner daemon cover exact bytes, over-cap/short/empty streams, cancellation, preserved prior bytes on refused incomplete transfers, and unchanged ordinary v1 / maximum-only v2 behavior. Independent review reproduced the short-stream overwrite, then verified its repair with seven controls.
  • Local Chrome used separate authenticated Owner/Editor cookie origins for live reviewer transfer, stale choice refusal and Home updates. Actual local native HTTP verdicts used inert agent fixtures: approval and request-for-changes persisted once with the expected activity/feedback. This does not claim real-model inspection.
  • EN/DE/FR desktop and 375 px views, keyboard/focus, short popover height, and rendered docs were observed locally. Automation-owned captured-review behavior and stale-confirmation transitions have actual-component regressions; a full automation-page browser flow and screen-reader pass were not performed.

Rollout and limits

Keep the new review grant/defaults disabled until every serving replica runs this version: an older server does not enforce the new captured-agent review gate. Old blob consumers reject bounded v2 stage tokens without downgrade; ordinary v1 callers retain their existing payload and behavior.

Staging preserves document ACL precedence and requires current task-file metadata; retained object bytes alone confer no authority. Evidence revisions bind descriptors and discussion, not a content hash/ETag. Authorized bytes may remain after a concurrent handoff, while the final stage result and stale verdict are refused. Staging proves delivery, not that an agent inspected the file. GitHub evidence remains the reviewer's attestation.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

PR #4076 independent review, continued at the 12:45 occurrence: still not accepted; changes required. This is in addition to checkpoint 878f3eba and addendum e15e6ad3.

  • Reviewer: Tale agent update dashboard ui (#508) #2 3f9fdcee-79e7-430b-a430-ba179d5b5132, TALE-359 run 9fd4795d-7331-4e32-89e0-0e55c5fe8344. It continues TALE-450 run b0c44b79, which settled at 10:29Z, so no run is duplicated.
  • Exact head: 100302c85deffca8741adaff5e5449f953ae8ff6. The merge base is bb6095205.
  • Method: read-only, as root asked: no installs, tests, database or browser.
    • Two read-only review agents traced every surface and read the docs, contract and register.
    • I re-checked A to D below in source myself.
    • Root's decision on finding 4 (dc349104) is taken as scope: the review tool records the verdict and returns To do, and repair admission stays with the manager.

CI at the exact head is green and executed (merge ref a8429eb, onto 09d0b20d2)

  • Workflows: all six succeeded: Checks 36995065371, Build 36995065582, E2E 36995065381, CLI 36995065566, SAST 36995065385 and Commitlint 36995065379.
  • Jobs: 57 succeeded and 12 were skipped by design.
  • Backend integration (job 110799865996, ITEST_REQUIRE_ALL_LANES=1): 1370/1370 across 216/216 lanes, including 49 agent-review and review-routing checks.
  • Executed, not replayed: platform test (1,003 files), test:ui (567), test:browser (43), typecheck and lint. Knip is green.

New findings

Paths are under services/platform/backend/domains/ unless noted.

A. HIGH, opted-in projects only: an upstream close stops that project's whole issue import.

  • Where:
    • tasks/reviews.ts:528-539 throws TASK_AGENT_REVIEW_REQUIRED (409) for any move to Done while an agent owns the pending review, whoever the actor is.
    • tasks/external-ref.ts:457-492 lands a workflow's external close at done and calls that guard with actor: {kind:'system'}.
    • connectors/task-store.ts:~273-311 (upsertIssues) persists every issue of a sync in one transactSerializable.
  • Trigger: an imported task sits In review with an agent-owned review (finding 1 makes that easy: a person drags it there), and its issue is closed upstream.
  • Result: the whole sync batch rolls back with the 409, and so does every later sync, until an Editor transfers that one review. The base had no such guard: the system close withdrew the review.
  • Fix: refuse only a person's approval, and let a system move withdraw or park the task.
  • Missing test: a workflow close with an agent-owned review, plus one more issue in the same batch. The batch effect is read from the code, not executed.

B. MEDIUM: reassigning an In-review task makes its agent review undecidable.

  • Where: tasks/agent-review.ts:222-228 answers stale() unless task.assigneeId === source.implementationAgentId. assignTask (tasks/service.ts:~2794-2851) neither withdraws nor flags the pending review.
  • Result: after a reassignment, every attempt returns TASK_REVIEW_STALE, and a person's Done gets TASK_AGENT_REVIEW_REQUIRED.
    • The UI still says "Current review: R".
    • docs/en/platform/projects/tasks.md:99 says changing the assignee doesn't change who produced the result.
  • Fix: drop the assignee equality, since independence already uses source.implementationAgentId. Or withdraw the review and show the reason.

C. MEDIUM: the PR's new rule "Changing Reviewer requires project edit access, including on a task you created or own" can be bypassed.

  • Where: PATCH /tasks/:taskId still accepts reviewerUserId (tasks/routes.ts:250), and updateTaskFields checks only assertTaskWorkable (tasks/service.ts:~1568). The PR guards only the agent cases (:~1703-1720).
  • Result: a Member can retarget the person reviewer of their own task over the API, which also skips the handoff's compare-and-set. The path predates the PR; the PR's docs now say it is refused.
  • Fix: require editor access when the field is present, or drop the field.

D. MEDIUM: the reviewer cannot read the deliverables it approves.

  • tasks/review-evidence.ts:26 hashes t.outputs into the evidence revision.
  • But the task context task_get returns (chat/shim.ts:~930-1015) carries no outputs, and core/sandbox/tool_names.ts:131-141 has no reader for them.
  • docs/en/platform/projects/task-automation.md:44 tells the reviewer to "examine the actual report and deliverables".
  • Fix: expose the outputs (or add a read tool), or narrow the docs and name the grant needed. Unverified: whether another grant can reach these blobs.

E. MEDIUM, acceptance: who acts next is visible only task by task, and a missing agent isn't recoverable at the project level. Traced by a review agent, and spot-checked.

  • Home: agent-owned reviews appear on nobody's Home. The reviewer filter matches people only (tasks/service.ts:~3393-3408), and "Needs my review" leaves them out (app/.../filter-tasks.ts:53-56).
  • Agents' tools: task_find returns no reviewer fields (core/node_only/sandbox/workspace_domain_tools.ts:~187-200), and no reviewer filter was found, so an agent cannot list the reviews it owns.
  • Deleted or ungranted reviewer: new reviews keep routing to it (tasks/reviews.ts:188-205), and nobody is notified (projects/service.ts:~940-987).
  • Busy or failed review run: nothing shows it on the reviewed task.

Findings 7 and 11 are confirmed in source. The browser check is still not done.

  • 7.
    • The panel renders only for automation-owned tasks (app/features/tasks/components/task-modal.tsx:1859-1866).
    • It names no owner and offers Approve (task-subject-panel.tsx:94-97,280-287,366-427).
    • Approve gets a 409 with the toast "The assigned reviewer agent must decide this review."
    • But that review has no source run, so the agent can never decide it. That is a dead end; the fix is to offer the transfer instead.
  • 11.
    • setTaskReviewer writes setting-to-setting (tasks/service.ts:2036-2054), rendered as "Project default → Project default" (task-timeline.tsx:248-249,296-299).
    • Routing a review writes no timeline row (tasks/reviews.ts:265-352).

LOW

  • FR UI label: the FR docs say Choix par défaut du projet (docs/fr/platform/projects/tasks.md:75,93,97, task-automation.md:18,37), but the picker shows "Choix du projet · …" (messages/fr.yml:7796-7797).
  • Register:
    • tests/manual/reference/error-codes.md:60 lists an ended issuer run under TASK_REVIEW_FORBIDDEN, but the bridge answers unavailable/run_ended first (workspace_tools_bridge.ts:309-315,510).
    • The TASK_REVIEW_BUSY row (:67): a live agent run returns TASK_REVIEW_STALE first.
  • No events for agent verdicts: they emit no task.status_changed (tasks/service.ts:~1056-1076), so automations triggered by Done miss them. Review feedback emits no comment.created. Neither is documented (docs/en/develop/api-reference.md:588).
  • api-reference.md:~531: the task_review input omits:
    • the required check name;
    • 1–20 checks;
    • the GitHub URL pattern;
    • PR checks passed|failed|pending, all of which must be passed to approve.
  • DE wording:
    • tasks.md:87 changes the meaning ("may not decide alone");
    • api-reference.md:560 uses "Freigabe" for both grant and approval;
    • task-automation.md:89 has a pronoun error.
  • FR tasks.md:97 drops "choose Project default to hand it over".
  • Repeat copies keep even a deleted agent reviewer (tasks/repeat.ts:632). tasks.md:161 describes carry-over only for people.
  • "Deleted agent": a live reviewer can show as "Deleted agent" while the agent list loads (task-reviewer-field.tsx:58-63). Unverified at runtime.
  • Design note: task_review is accepted from any live, unconfined run of the reviewer (tasks/agent-review.ts:48-78), not only its review task.

Remaining before acceptance

  • The implementer's repaired head for findings 1–3 and A–E.
  • Real Postgres/HTTP runs of A, B and C, and of the unpinned guards.
  • The browser lifecycle (EN/DE/FR, accessibility, and 7 and 11) once the performance lane allows local runs.
  • Full CI on the final head.
  • Root owns final integration, the rolling-deploy order and the production opt-in.

No merge, push, repair, configuration change or task-review decision was made.

Enforce eligible reviewer routing and governance, expose blocked reviews to
manager reads, and stage scoped review evidence through bounded signed
transfers. Preserve captured gates across external edits and reset stale
review confirmations. Keep localized reviewer pickers within the viewport.
Preserve both sandbox blob-route suites and appended manual coverage rows.
Pin retained task bytes without metadata as unavailable to the review tool,
using the native route, actual file deletion and the object store.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

PR #4076: post-merge independent reevaluation at 19776cf18dbe3139642973008dc57c1942101cba. Source accepted, with follow-ups.

The merge carries the PR head 7afc5b3493 exactly (tree 45bf21be1). My changes-required findings are fixed, or reduced to states that show a reason and can be recovered. No HIGH remains, and no security or data-integrity MEDIUM.

  • Reviewer: Tale agent update dashboard ui (#508) #2 3f9fdcee-79e7-430b-a430-ba179d5b5132, TALE-359 run feb91650-660e-442d-8d9b-e902957dc283. It continues my TALE-450 checkpoint 878f3eba and addendum 243fb956.
  • Implementation: root's local team, repair commit 234d592997.
  • Merge: root merged it at 18:20:46Z, not this run.
  • Method:
    • Three read-only review agents re-checked findings 1–14 and A–E against the merged tree.
    • I re-checked A, 3 and C, the policy-code mapping and the focus path in source.
    • Unit tests at the merge, in my own checkout: 15 server files pass 481/481 and 3 UI files 48/48.
    • No Postgres, HTTP or browser run, because agents add --chat-max-width CSS variable #3 and optimize rag action #4 hold the two heavy slots.
  • CI at the exact head (merge ref ce8d91b, onto eee0a1098, the main it merged into): 68 jobs succeeded and 9 were skipped by design. Backend integration passed 1431/1431 across 217/217 lanes. Push CI on 19776cf18 is all green.

Status of my findings

Finding Status at the merge
1. A review with no agent run gets stuck Fixed, as root decided. It goes to the human chain and that person is notified. A native settle with an invalid reviewer keeps the agent and shows a reason (reviews.ts:376-390, :182-232).
2. Implementer or ungranted owner Fixed at the setters. A new review records the configured agent with a visible block: self_review, permission_missing or reviewer_unavailable.
3. requireIndependentReviewer on agents Fixed. It fails closed with REVIEW_INDEPENDENT_REVIEWER_REQUIRED (agent-review.ts:197-203), native reviews go to people, and transfers to an agent are refused.
4. Request changes starts no repair Scope per root's decision.
A. Upstream close stops the import batch Fixed. An agent-owned review is kept, only externalClosedAt is recorded, and the rest of the batch completes (external-ref.ts:459-476). The routing itest pins it.
B. Reassignment makes the review stale Partial. It still answers TASK_REVIEW_STALE, but now says why (source_changed), and a transfer to a person recovers it. tasks.md still says the opposite.
C. Member PATCH of the reviewer Fixed: an editor check (service.ts:1572-1579).
D. The reviewer can't read deliverables Fixed within its limits. stage_file serves only the captured reviewer of a live, granted run, with a signed, size-capped v2 token, organization confinement, and a re-check after the transfer.
E. Who acts next Partial. task_find gained reviewerAgentId and pendingReview. Home is unchanged, a documented choice. A busy or failed review run is still invisible. A deleted reviewer still receives new reviews, though choosing one is refused.
7. Subject panel Fixed. It names the actual recipient and hides Approve on an agent-owned review.
11. Timeline Not fixed ("Project default → Project default").
6 and 8 Fixed, and effectively fixed.
12. Register The readme total of 1078 is right. The projects.md header still says 59 (61 boxes), and tasks.md still says 115 (121).
13 and 14 Not fixed (LOW).
The 12:45 LOW list Mostly open: the FR label, two register rows, undocumented events, task_review input in the API reference, DE/FR wording.

New, MEDIUM (UX, not security)

M1. TASK_REVIEW_POLICY_UNAVAILABLE reaches the UI unmapped.

  • With an unreadable review_policy, a person's Approve, or a drag to Done, is now refused with 409 (reviews.ts:566).
  • No app mapping exists. reviewer-refusal.ts maps only the governance codes to reviewer.policyUnavailable, so the user gets a generic toast.
  • The register files the code under "Reachable on the API surface only" (tests/manual/reference/error-codes.md:70).
  • The strict read is organization-wide, so an invalid policy blocks every human approval, even in projects that never opted in. That is documented, but it is a wide blast radius.

M2. Choosing a reviewer can drop keyboard focus. This is from the source and wasn't run.

  • task-reviewer-field.tsx disables the picker while the save is pending (mutation.isPending).
  • A disabled picker renders a static span (reviewer-picker.tsx:166-175), which unmounts the trigger focus should return to.
  • Fix: keep the trigger mounted with aria-disabled.

New, LOW

  • Close protection lapses. It stops once the agent no longer owns the review. After a transfer to a person, a later sync completes the task and withdraws that person's review (external-ref.ts:473-492).
  • task_get.reviewFiles lists file names and sizes to any project reader, though no bytes. A stale listing fails the whole task_get.
  • The stage token lives 10 minutes, while the backend waits 30 s, so bytes can land after a revocation.
  • invalid_metadata hits files with an empty type, or names over 240 bytes.
  • Staging writes no audit row.
  • assignTask doesn't check the configured reviewer agent, which produces a later self_review block. Choosing "Project default" is refused at transfer even where a new review would go to a person.
  • The docs ask the manager to record an approvalId it can't read.
  • The platform typecheck and lint turbo inputs don't include the two runtime-daemon files.
  • "Deleted agent" shows while the agent list loads, and a failed agent-list read reads as "unavailable".

Before production opt-in, which is root's call:

  • M1, plus moving its register row;
  • M2, checked in a browser;
  • B's contradiction in the docs;
  • the EN/DE/FR browser lifecycle and accessibility pass I still owe, once a heavy slot is free.

No merge, configuration change or task-review decision was made by this run.

tale-review-bot pushed a commit that referenced this pull request Oct 30, 2026
Home's "waiting for your review" list reads GET /api/app/tasks with
reviewerId and status=in_review. That read used to match the stored
designation, reviewer_user_id. A task that names no reviewer asks its
creator for review, and so does one whose reviewer is set back to
Project default while its review is open: the creator's bell and the
board's Needs my review asked them, but their Home did not list or
count the task (#3790). #4076 made the read follow the pending review,
but the only listing check named the creator as reviewer, so it passed
under either rule.

The check now covers the issue's three cases. A creator assigns three
tasks to an editor, who moves them to In review. One names nobody. One
names a reviewer until the creator sets it back to Project default. One
names the creator. For each, the check reads whom the task names and
whom its pending review asks, then the creator's own Home read; for the
second, also the former reviewer's, which must not list it. The first
two assert that the task names nobody, so a read that follows
reviewer_user_id fails them. The third is the control, which either
read lists.

The comments on the reviewerId filter (TaskListFilters, the check, and
useTasksAcrossProjects) now describe what the server does.

Closes #3790
Task: TALE-35
yannickmonney pushed a commit that referenced this pull request Oct 30, 2026
Home's "waiting for your review" list reads GET /api/app/tasks with
reviewerId and status=in_review. That read used to match the stored
designation, reviewer_user_id. A task that names no reviewer asks its
creator for review, and so does one whose reviewer is set back to
Project default while its review is open: the creator's bell and the
board's Needs my review asked them, but their Home did not list or
count the task (#3790). #4076 made the read follow the pending review,
but the only listing check named the creator as reviewer, so it passed
under either rule.

The check now covers the issue's three cases. A creator assigns three
tasks to an editor, who moves them to In review. One names nobody. One
names a reviewer until the creator sets it back to Project default. One
names the creator. For each, the check reads whom the task names and
whom its pending review asks, then the creator's own Home read; for the
second, also the former reviewer's, which must not list it. The first
two assert that the task names nobody, so a read that follows
reviewer_user_id fails them. The third is the control, which either
read lists.

The comments on the reviewerId filter (TaskListFilters, the check, and
useTasksAcrossProjects) now describe what the server does.

Closes #3790
Task: TALE-35
tale-code-bot added a commit that referenced this pull request Oct 30, 2026
Home's "waiting for your review" list reads GET /api/app/tasks with
reviewerId and status=in_review. That read used to match the stored
designation, reviewer_user_id. A task that names no reviewer asks its
creator for review, and so does one whose reviewer is set back to
Project default while its review is open: the creator's bell and the
board's Needs my review asked them, but their Home did not list or
count the task (#3790). #4076 made the read follow the pending review,
but the only listing check named the creator as reviewer, so it passed
under either rule.

The check now covers the issue's three cases. A creator assigns three
tasks to an editor, who moves them to In review. One names nobody. One
names a reviewer until the creator sets it back to Project default. One
names the creator. For each, the check reads whom the task names and
whom its pending review asks, then the creator's own Home read; for the
second, also the former reviewer's, which must not list it. The first
two assert that the task names nobody, so a read that follows
reviewer_user_id fails them. The third is the control, which either
read lists.

The comments on the reviewerId filter (TaskListFilters, the check, and
useTasksAcrossProjects) now describe what the server does.

Closes #3790
Task: TALE-35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(platform): support independent agent review of tasks

1 participant