Repository navigation
fix(agents): preserve ACP lifecycle ownership - #122849
markGenhealth wants to merge 1 commit into
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. |
Prevent ACP observer rows from creating native subagent task projections or owning delivery and session cleanup. Reconcile legacy ACP mirrors through canonical task liveness and defer destructive cleanup after a lost decision. Refs GEN-6353
e3fdebf to
0defd41
Compare
|
Codex review: needs real behavior proof before merge. What this changesThe PR makes spawned ACP children registry observers while assigning delivery and cleanup to ACP tasks. Example: Spawn run-acp-observer in agent:codex:acp:child.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open: it retains distinct, maintainer-engaged ACP lifecycle work, but both prior completion defects remain and its Tasks-based implementation needs adaptation to current main. Priority: P1 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe shared spawn pipeline registers child topology; ACP executes externally, while registry completion, delivery, persistence, and maintenance determine the child’s visible lifecycle. flowchart TD
A[Sessions spawn] --> B[Shared spawn pipeline]
B --> C[ACP manager]
B --> D[Registry observer]
C --> E[External harness]
C --> F[Canonical ACP task]
F --> D
D --> G[Topology and child controls]
Technical reviewBest possible solution: Integrate ACP terminal observation through its current lifecycle owner, preserve native recovery fencing, and remove dependencies on the retired Tasks runtime. Do we have a high-confidence way to reproduce the issue? The reviewed head deterministically sets the flag that rejects ordinary observer completion; no runtime reproduction was executed, and current main has retired the original task-maintenance half of the report. Is this the best way to solve the issue? The ownership distinction is useful, but this is not the best complete fix: it reuses a native recovery terminal fence and observes only ACP activity, whereas the existing ACP owner should supply terminal facts directly. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 989d76f74947. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +71, Tests +215, Docs +1. Total +287 across 13 files. Added test files: 1. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (8 earlier review cycles)
Reviewed October 17, 2026, 8:14 PM ET / October 18, 2026, 00:14 UTC (Revision 9). |
|
Coordination for the current This contribution does not change ACP lifecycle ownership, ACP tasks or spawn, wait/terminal classification, completion delivery, cleanup, or persistence. Your PR remains canonical for ACP lifecycle ownership; I will not push to its branch or add a competing ACP implementation. The shared-file overlap is the liveness/view predicate, so later composition should use the existing owner-aware predicate while preserving this PR's distinct contract. The repair is integrated on current main and is completing changed-base qualification. I found no current public write reservation on this exact head. If there is an active reservation that intersects this narrow accounting scope, please identify its file boundary and checkpoint. No author acceptance is assumed. |
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 - Reproduced on main `0b753f1e15b2`: 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](#153071 (comment)) show the same Tasks panel with two cards before and one canonical ACP card after. Co-authored-by: Ayaan Zaidi <[email protected]>
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]>
|
Thanks for the PR. We're closing older pull requests that have gone stale against current This draft has had no commits since 2026-08-12 and still needs real behavior proof. Please open a fresh PR against current main if this ACP ownership change is still needed. |
Summary
acptask owner while retaining a topology/control observer in the subagent registrysubagenttask projections, terminal delivery obligations, or child-session cleanup authorityFixes GEN-6353.
What Problem This Solves
An ACP spawn created the canonical
runtime=acptask, then the shared spawn pipeline registered the same run as a native subagent. The mirror's sweeper checkedgetAgentRunContext, which never represented external ACP liveness, so it false-failed after the stale grace and ran session-scoped cleanup. Task maintenance later treated only the process-local ACP turn marker as backing evidence, marked the canonical task lost after its grace, and could close the one-shot session in that same pass.The observed production intervals match those two grace periods plus sweep cadence.
Design
Patterns found and retained:
Patterns intentionally not used:
AgentRunContextliveness, because Codex/ACP has a separate durable thread/session identity and resume contractEvidence
pnpm test src/agents/subagents/registry/subagent-delivery-state.test.ts src/agents/subagents/registry/subagent-registry-run-launch.test.ts src/agents/subagents/registry/subagent-registry-sweeper-recovery.test.ts src/agents/subagents/registry/subagent-run-liveness.test.ts src/agents/subagents/spawn/acp-spawn.test.ts src/tasks/task-registry.test.tspnpm tsgopnpm tsgo:testoxlintandoxfmt --checkpnpm check:changedcould not run because the local Crabbox binary failed its built-in version/help sanity check; the equivalent scoped formatting, lint, type, and focused test checks above passed.