Repository navigation
fix(agents): show spawned ACP tasks only once - #153071
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
One ACP execution, one task cardBefore — main After — These inspected captures contain only a synthetic task label and controlled fixture output. They demonstrate task identity/cardinality, not a badge or liveness change. The two images were taken at different moments in the held request; the progress text and elapsed times are not part of the comparison. No native Cursor/Codex or live-channel behavior is claimed. |
|
Codex review: needs maintainer review before merge. Reviewed September 19, 2026, 1:54 PM ET / 17:54 UTC. ClawSweeper reviewWhat this changesThe PR makes newly spawned ACP child runs use the Gateway’s existing task record, preventing a second task card while preserving subagent registration and controls. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main still creates the duplicate projection, and the inspected before/after evidence supports the repair. No blocking correctness findings were found; the broader lifecycle proposal remains separate. Priority: P2 Review scores
Verification
How this fits togetherACP spawning starts a child agent through the Gateway. The ACP manager records its execution for the Tasks panel, while the subagent registry tracks the parent-child relationship and controls. flowchart TD
A[Child spawn request] --> B[Gateway ACP execution]
B --> C[Canonical ACP task]
C --> D[Tasks panel]
A --> E[Subagent registration]
E --> F[Child relationship and controls]
E --> G[Skip duplicate task projection]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +18. Total +20 across 3 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the ACP manager as the sole producer of new ACP task records while retaining subagent topology and controls, with lifecycle recovery changes handled separately. Do we have a high-confidence way to reproduce the issue? Yes: current source shows both task producers reached by ACP spawning, and the supplied before capture demonstrates the duplicate cards. This review inspected source and contributor evidence without executing a current-main reproduction. Is this the best way to solve the issue? Yes: selecting the existing Gateway-owned task path removes the duplicate at its producer and preserves registration, avoiding UI filtering or a parallel lifecycle implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e1880e0a6edf. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged as New ACP child runs now keep one canonical task instead of creating separate Subagent and ACP cards. The actual UI/Gateway/HTTP reproduction changed from two task IDs for one execution to one; normal completion, physical cancellation through Stop, child topology, and ordinary subagent behavior remained intact. The before/after screenshots are linked from the PR body. Thanks @saariuslystoned for the report and @markGenhealth for the related ownership analysis. This closes #150402; #122849 remains open for its distinct broader lifecycle work. Existing stored tasks and lifecycle/cleanup policy are unchanged. |
Closes openclaw#150402 Related: openclaw#122849 ## What Problem This Solves Fixes one spawned ACP task appearing twice in Tasks, once as Subagent and once as ACP, even though only one backend execution exists. ## User Impact New ACP child runs have one task card and one canonical task identity to inspect or stop. Existing records are not rewritten. This does not change task retention, restart recovery, stale-task classification, cleanup policy, or session-key adoption. ## Why This Change Was Made The ACP manager already creates the task for the accepted run. ACP spawn now uses the existing Gateway-owned task selector so subagent registration retains the child relationship and controls without creating a second task projection. Ordinary subagent registration is unchanged. Thanks to @saariuslystoned for the report and @markGenhealth for identifying the overlapping ownership problem in openclaw#122849. This narrow duplicate-production fix does not replace or close that broader lifecycle proposal. ## Evidence - Reproduced on main `b16cb8c0cbe3`: the actual Control UI invoked `sessions_spawn(runtime=acp)` through an isolated Gateway and normally registered synthetic ACP backend. One held HTTP work request produced two public task IDs and two visible cards. - On `32a00c1d4d30`, the same flow produced one ACP task ID and one visible card for one backend request. Normal completion succeeded; the remaining card's Stop action cancelled the physical HTTP request and the canonical task. - The public `subagents` tool retained the active ACP child and later listed completed ACP, cancelled ACP, and ordinary subagent children. The ordinary subagent still produced exactly one succeeded subagent task. - The real-registration regression failed on the original producer with the extra task IDs; all 101 tests in the two affected spawn suites pass after the fix. Targeted typed lint, formatting, structural ratchets, and the runtime build pass. The provider and ACP backend are controlled local fixtures. This is actual Gateway/UI and HTTP-boundary proof, not a native Cursor/Codex, live-channel, badge/liveness, or restart-recovery claim. [Inspected before/after screenshots](openclaw#153071 (comment)) show the same Tasks panel with two cards before and one canonical ACP card after. Co-authored-by: Ayaan Zaidi <[email protected]>
…it settle An ACP child launched by sessions_spawn(runtime: "acp") woke its requester twice: once through the subagent completion path and again through the background-task notification of the task row that mirrors the ACP run. The mirrored task now uses a silent notify policy for this launch path only, so the requester gets the single subagent_settle wake. Other ACP launch paths, native subagents, and the default notify policy keep their behavior. Since openclaw#153071 an ACP spawn also keeps only the ACP manager's task row and no runtime "subagent" projection. The requester settle commit still required that projection, so each yielded ACP child threw "subagent completion owner changed before settlement", retried the commit forever, and replayed its settle turn after a Gateway restart. When the run's only task row is ACP-owned, settle the subagent delivery state without a task projection and leave the ACP row to its manager. A child with no task owner at all still refuses settlement. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>


Closes #150402
Related: #122849
What Problem This Solves
Fixes one spawned ACP task appearing twice in Tasks, once as Subagent and once as ACP, even though only one backend execution exists.
User Impact
New ACP child runs have one task card and one canonical task identity to inspect or stop. Existing records are not rewritten. This does not change task retention, restart recovery, stale-task classification, cleanup policy, or session-key adoption.
Why This Change Was Made
The ACP manager already creates the task for the accepted run. ACP spawn now uses the existing Gateway-owned task selector so subagent registration retains the child relationship and controls without creating a second task projection. Ordinary subagent registration is unchanged.
Thanks to @saariuslystoned for the report and @markGenhealth for identifying the overlapping ownership problem in #122849. This narrow duplicate-production fix does not replace or close that broader lifecycle proposal.
Evidence
0b753f1e15b2: the actual Control UI invokedsessions_spawn(runtime=acp)through an isolated Gateway and normally registered synthetic ACP backend. One held HTTP work request produced two public task IDs and two visible cards.32a00c1d4d30, the same flow produced one ACP task ID and one visible card for one backend request. Normal completion succeeded; the remaining card's Stop action cancelled the physical HTTP request and the canonical task.subagentstool retained the active ACP child and later listed completed ACP, cancelled ACP, and ordinary subagent children. The ordinary subagent still produced exactly one succeeded subagent task.The provider and ACP backend are controlled local fixtures. This is actual Gateway/UI and HTTP-boundary proof, not a native Cursor/Codex, live-channel, badge/liveness, or restart-recovery claim.
Inspected before/after screenshots show the same Tasks panel with two cards before and one canonical ACP card after.