Skip to content

fix(tasks): make delegated completions review-ready - #78985

Merged
steipete merged 1 commit into
openclaw:mainfrom
100menotu001:codex/parent-review-task-wording
May 16, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
100menotu001:codex/parent-review-task-wording

Conversation

@100menotu001

@100menotu001 100menotu001 commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • label successful background task completions as ready for parent review instead of done
  • add an explicit next step that the parent will review/verify before calling work done
  • label successful subagent announcements as ready for parent review
  • update requester instructions, docs, changelog, and task-registry delivery/fallback expectations for the new wording

Real behavior proof

Behavior addressed: Successful delegated/background task and subagent completion messages should no longer tell the requester the work is simply “done” or “completed successfully”; they should say the result is ready for parent review and tell the parent/requester to review/verify before calling it done.

Real environment tested: OpenClaw source checkout for branch codex/parent-review-task-wording, commit d51ea15d0e.

Exact steps or command run after the patch: Applied the wording patch, updated direct delivery/fallback test expectations, updated the requester handoff instruction plus docs/changelog, then ran the focused formatter/test commands and a source-runtime proof script that creates an ACP task record, emits its lifecycle completion event, and reads the queued requester system event.

Evidence after fix: Runtime output from the source checkout after the patch:

$ node --import tsx <proof-script>
task.status=succeeded
task.deliveryStatus=session_queued
systemEvent=Background task ready for review: ACP background task (run run-proo). Next: parent will review/verify before calling it done.

Additional source verification:

$ rg -n "ready for parent review|review/verify" src/agents/subagent-announce.ts src/agents/subagent-announce.format.e2e.test.ts src/tasks/task-executor-policy.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts docs/tools/subagents.md CHANGELOG.md
docs/tools/subagents.md:98:    - `Status` — `completed; ready for parent review` / `failed` / `timed out` / `unknown`.
docs/tools/subagents.md:100:    - A delivery instruction telling the requester agent to review/verify the result before deciding whether it is done, then rewrite in normal assistant voice with the truthful state (not forward raw internal metadata).
src/tasks/task-executor-policy.ts:41:    const reviewNext = "Next: parent will review/verify before calling it done.";
src/agents/subagent-announce.ts:88:    return `A completed ${params.announceType} is ready for parent review. Review/verify the result above before deciding whether it is done, then send a user-facing update with the truthful state. Keep this internal context private (don't mention system/log/stats/session details or announce type).`;
src/agents/subagent-announce.ts:90:  return `A completed ${params.announceType} is ready for parent review. Review/verify the result above before deciding whether it is done, then send a user-facing update with the truthful state. Keep this internal context private (don't mention system/log/stats/session details or announce type), and do not copy the internal event text verbatim. Reply ONLY: ${SILENT_REPLY_TOKEN} if this exact result was already delivered to the user in this same turn.`;
src/agents/subagent-announce.ts:458:        ? "completed; ready for parent review"
CHANGELOG.md:9:- Agents/subagents: label delegated task and subagent completion handoffs as ready for parent review, and tell the requester agent to review/verify results before calling them done.

Observed result after fix: The actual task completion delivery path queued Background task ready for review... Next: parent will review/verify before calling it done. for a completed ACP task. The subagent handoff instruction now tells the requester to review/verify before calling the result done, and docs/changelog are updated to match.

What was not tested: I did not run a full external model-backed subagent conversation. The runtime proof exercises the source task-registry completion/delivery path directly with isolated temporary state; focused tests cover the task formatter, registry delivery/fallback expectations, and subagent announcement formatter.

Tests

  • node --import tsx <proof-script> — passed; produced the runtime output above
  • pnpm exec oxfmt --check --threads=1 src/agents/subagent-announce.ts src/agents/subagent-announce.format.e2e.test.ts src/tasks/task-registry.test.ts src/tasks/task-executor-policy.ts src/tasks/task-executor-policy.test.ts — passed
  • pnpm exec vitest run --config test/vitest/vitest.tasks.config.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts — passed: 2 files, 63 tests
  • pnpm exec vitest run --config test/vitest/vitest.e2e.config.ts src/agents/subagent-announce.format.e2e.test.ts — passed: 1 file, 79 tests
  • git diff --check — passed

Verification

  • rg confirmed new review-ready wording is present in the changed source/docs/tests/changelog.
  • Targeted grep confirmed stale requester-instruction text is absent from the changed subagent announcement source/tests/docs.

Closes #44471

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 7, 2026
@100menotu001
100menotu001 force-pushed the codex/parent-review-task-wording branch from 3b32fda to 300d9fd Compare May 7, 2026 15:06
@clawsweeper

clawsweeper Bot commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Summary
The branch changes delegated task and subagent completion wording, tests, docs, and changelog so successful completions are framed as ready for parent review rather than final delivery.

Reproducibility: yes. as a source reproduction: current main still contains Background task done in the task terminal formatter and completed successfully in the subagent completion status label. I did not run a live model-backed subagent conversation.

Real behavior proof
Needs stronger real behavior proof before merge: The PR supplies terminal proof, but it names older commit d51ea15d0e while the current head is 06b8e8e49e9e67b265c665b5ecc1c44443d78191 and now changes direct delegated routing behavior not shown by that proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, ask a maintainer to comment @clawsweeper re-review.

Next step before merge
The PR needs contributor or maintainer updates for current-head proof and two narrow review findings; it should not be routed to repair automation while the external real-behavior proof is stale.

Security
Cleared: The diff changes runtime prompt/status text, task delivery routing logic, tests, docs, and changelog only; I found no dependency, workflow, secret, permission, or supply-chain surface change.

Review findings

  • [P2] Preserve the current follow-up guidance — src/agents/subagent-announce.ts:91-93
  • [P2] Mark queued parent handoffs as no longer pending — src/tasks/task-registry.ts:1169-1172
Review details

Best possible solution:

Land a refreshed narrow patch that preserves current main's review-and-follow-up subagent wording, updates the remaining status labels/docs, and routes delegated ACP terminal handoffs to the parent session without leaving terminal delivery indefinitely pending.

Do we have a high-confidence way to reproduce the issue?

Yes, as a source reproduction: current main still contains Background task done in the task terminal formatter and completed successfully in the subagent completion status label. I did not run a live model-backed subagent conversation.

Is this the best way to solve the issue?

No, not yet. The review-first direction is right, but the branch needs to preserve the merged follow-up guidance, avoid repeated parent-session terminal re-queues, and update proof for the current head.

Full review comments:

  • [P2] Preserve the current follow-up guidance — src/agents/subagent-announce.ts:91-93
    Current main already tells the requester to decide whether the original task is done and to continue or record follow-up when a child result leaves more work. This branch's replacement drops that explicit follow-up path, so resolving it as written would regress the behavior fixed by fix(subagents): make completion handoff review-first #82724.
    Confidence: 0.86
  • [P2] Mark queued parent handoffs as no longer pending — src/tasks/task-registry.ts:1169-1172
    After a parent-session event is queued successfully, leaving deliveryStatus as pending keeps this terminal task eligible for future maybeDeliverTaskTerminalUpdate calls. The new test demonstrates a reload can enqueue the same completion again; use a non-pending queued state after a successful enqueue, or add a bounded retry state that cannot repeatedly re-prompt the parent after delivery.
    Confidence: 0.82

Overall correctness: patch is incorrect
Overall confidence: 0.84

Acceptance criteria:

  • node scripts/run-vitest.mjs src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts
  • node scripts/run-vitest.mjs src/agents/subagent-announce.format.e2e.test.ts
  • git diff --check

What I checked:

  • Current main still has task finality wording: Current main formats successful non-blocked task terminal messages as Background task done, so the task-registry part of the PR is addressing remaining current-main behavior. (src/tasks/task-executor-policy.ts:41, 54619d403303)
  • Current main still has subagent status finality wording: Current main already has parent-review subagent instructions from the merged follow-up, but the successful internal status label still says completed successfully. (src/agents/subagent-announce.ts:463, 54619d403303)
  • Merged related PR already strengthened subagent follow-up guidance: The related merged PR changed subagent handoffs to require review/verification of the original task and to continue or record follow-up when additional action remains; current main contains that stronger wording. (src/agents/subagent-announce.ts:91, 8040f28bc5e7)
  • PR head weakens the merged subagent guidance: The PR head says to review before deciding whether it is done and then send an update, but it does not preserve current main's explicit original-task and continue-or-record-follow-up guidance. (src/agents/subagent-announce.ts:91, 06b8e8e49e9e)
  • PR head keeps routed delegated completions pending: After successfully queueing a parent-session system event, the PR leaves deliveryStatus as pending whenever direct delivery would have been possible, so the same terminal task remains eligible for later terminal delivery attempts. (src/tasks/task-registry.ts:1170, 06b8e8e49e9e)
  • PR proof is not for the current head: The PR body's real behavior proof names commit d51ea15d0e, while the current head is 06b8e8e49e9e67b265c665b5ecc1c44443d78191; the later head changes direct delegated delivery expectations and is not covered by the supplied runtime output. (06b8e8e49e9e)

Likely related people:

  • steipete: Recent task-registry and subagent-announce history shows repeated commits and merges on the affected files, including the merged review-first subagent change and recent task delivery fixes. (role: recent area contributor and committer; confidence: high; commits: 8040f28bc5e7, 3cef9a65d354, c0fe7ab34ab8; files: src/agents/subagent-announce.ts, src/tasks/task-registry.ts, src/tasks/task-executor-policy.ts)
  • vincentkoc: History for the affected task delivery files includes refactor(tasks): extract delivery policy and fallback subagent completion delivery work that shaped the current delivery-policy boundary. (role: task delivery policy contributor; confidence: high; commits: 817ac551b655, a1b656705992, 210cccb0fea5; files: src/tasks/task-executor-policy.ts, src/tasks/task-registry.ts, src/agents/subagent-announce.ts)
  • 100menotu001: The current-main subagent review-first wording came from their merged related PR, so they are relevant to preserving that wording while reviewing this broader task-registry PR. (role: recent adjacent contributor; confidence: medium; commits: 8040f28bc5e7; files: src/agents/subagent-announce.ts, docs/tools/subagents.md, CHANGELOG.md)

Remaining risk / open question:

  • The PR body proof is for an older head and does not show the current head's direct-delegated routing behavior.
  • The desired retry semantics for in-memory parent-session system events may need maintainer confirmation, but leaving terminal tasks pending indefinitely is a concrete repeat-delivery risk.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 54619d403303.

@100menotu001
100menotu001 force-pushed the codex/parent-review-task-wording branch from 300d9fd to d51ea15 Compare May 7, 2026 15:50
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label May 7, 2026
@100menotu001

Copy link
Copy Markdown
Contributor Author

Addressed the review feedback in d51ea15d0e:

  • Updated the requester handoff instruction so completed subagent tasks are "ready for parent review" and explicitly tell the requester to review/verify before calling the result done.
  • Added the Unreleased changelog entry for the user-facing completion-copy change.
  • Updated docs/tools/subagents.md so the documented status and delivery instruction match the new review-ready behavior.
  • Added real behavior proof to the PR body showing the source task-registry completion path queuing:
    Background task ready for review: ACP background task ... Next: parent will review/verify before calling it done.

Focused checks run locally:

  • pnpm exec oxfmt --check --threads=1 src/agents/subagent-announce.ts src/agents/subagent-announce.format.e2e.test.ts src/tasks/task-registry.test.ts src/tasks/task-executor-policy.ts src/tasks/task-executor-policy.test.ts
  • pnpm exec vitest run --config test/vitest/vitest.tasks.config.ts src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts
  • pnpm exec vitest run --config test/vitest/vitest.e2e.config.ts src/agents/subagent-announce.format.e2e.test.ts
  • git diff --check

@clawsweeper re-review

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@100menotu001
100menotu001 force-pushed the codex/parent-review-task-wording branch from d51ea15 to 852cac8 Compare May 11, 2026 14:46
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed size: XS proof: sufficient ClawSweeper judged the real behavior proof convincing. labels May 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@clawsweeper

clawsweeper Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 16, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. P2 Normal backlog priority with limited blast radius. labels May 16, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 16, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 16, 2026
@steipete
steipete force-pushed the codex/parent-review-task-wording branch from f4f828f to 06b8e8e Compare May 16, 2026 22:34
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 16, 2026
@steipete
steipete force-pushed the codex/parent-review-task-wording branch from 06b8e8e to c064025 Compare May 16, 2026 22:47
@steipete

Copy link
Copy Markdown
Contributor

Verification for rebased head c064025.

Behavior addressed: delegated ACP/subagent completion handoffs are labeled ready for parent review; successful ACP child task completions wake the requester session for parent review instead of raw direct "done" delivery. Direct-origin handoffs remain pending so the session event can be retried after restart.
Real environment tested: local macOS checkout, Node/Vitest repo wrappers.
Exact steps or command run after this patch:

  • pnpm docs:list | rg -i "subagents|tools/subagents|agents"
  • pnpm exec oxfmt --check --threads=1 src/agents/subagent-announce.ts src/agents/subagent-announce.format.e2e.test.ts src/tasks/task-registry.ts src/tasks/task-registry.test.ts src/tasks/task-executor-policy.ts src/tasks/task-executor-policy.test.ts
  • node scripts/run-vitest.mjs src/tasks/task-executor-policy.test.ts src/tasks/task-registry.test.ts src/agents/pi-embedded-runner/context-engine-maintenance.test.ts
  • node scripts/run-vitest.mjs --config test/vitest/vitest.e2e.config.ts src/agents/subagent-announce.format.e2e.test.ts
  • /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch --base origin/main
  • git diff --check origin/main...HEAD
    Evidence after fix: direct delegated ACP completions queue parent-review system events and stay pending for durable retry; non-delegated ACP completions still direct-deliver; context-engine maintenance still uses ordinary done wording.
    Observed result after fix: focused Vitest suites, docs lookup, oxfmt, diff whitespace check, and codex-review passed.
    What was not tested: full CI/Testbox/E2E provider run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Runtime event wording causes premature success claims in subagent flows

2 participants