Skip to content

fix(tasks): scope ACP completion notices to execution instances - #159173

Merged
steipete merged 1 commit into
mainfrom
fix/live2-acp-notify-instance
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/live2-acp-notify-instance

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Two ACP executions can share a requester, child session, and request/run ID while being distinct executions: task creation gives each its own task and flow ID (documented in docs/automation/tasks.md). When execution A finished and a later execution B with the same request ID finished, B's completion notice was never sent or queued. Its task record showed the result, but the requester was never told.

Why This Change Was Made

Completion-notice dedupe (getPeerTasksForDelivery in src/tasks/task-notification-routing.ts) treated every task with the same run ID, runtime, scope, owner, and child session as a duplicate projection of one execution. It grouped A and B together, picked the oldest task as the delivery owner, and marked B's delivery not_applicable.

The dedupe identity now matches the identity task creation already uses: for ACP tasks, peers must also share the backing execution instanceId. Duplicate projections of the same execution still collapse to one notice, non-ACP runtimes are unchanged, and records without an instance ID keep deduping with each other as before. The tasks doc now states that each execution gets its own completion notice.

User Impact

A repeated ACP request (same request ID, new execution) now produces its own completion notification instead of silently finishing. Notices already suppressed by earlier versions are not replayed.

Evidence

  • src/acp/control-plane/manager.background-task.test.ts: new case fails on main (B gets not_applicable instead of session_queued) and passes with the fix.
  • On a Blacksmith Testbox via Crabbox: 218 tests passed across the ACP background-task, task-registry, notification, and ACP-backing suites; node scripts/check-changed.mjs passed.
  • Codex autoreview: scoped-clean ("patch is correct", 0.95).

Production LOC: +11 / −4. Tests: +48 / −25. Docs: +1 / −1.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 26, 2026 20:48
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Sep 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 5:06 PM ET / 21:06 UTC (Revision 2).

ClawSweeper review

What this changes

The branch uses each ACP execution’s stored instance ID when choosing completion-notice peers, adds regression coverage, and clarifies the tasks guide.

Merge readiness

✅ Ready for maintainer review

Current main still suppresses a later ACP execution’s completion notice when it reuses a request ID. The branch addresses that distinct execution and preserves duplicate suppression for the same execution; no actionable patch defect was found.

Priority: P2
Reviewed head: 8107a5d3a8facd2819fe7e717a6a88a5f5608320

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused fix and reported failing-before, passing-after regression provide good evidence for the affected delivery path.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The member-authored PR is exempt from the contributor live-proof gate. Its reported before-and-after test exercises ACP task creation and terminal queuing through the production owners in isolated state; the diff does not change a stored-data contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from the contributor live-proof gate. Its reported before-and-after test exercises ACP task creation and terminal queuing through the production owners in isolated state; the diff does not change a stored-data contract.
Evidence reviewed 6 items Current-main behavior: The main-branch peer selector compares run ID, runtime, scope, owner, and child session, but not ACP execution instance ID.
Introduced fix: The pinned branch compares ACP backing instance IDs while retaining the existing scope checks and unchanged non-ACP comparison.
Delivery path: Terminal delivery calls the peer selector before deciding whether to mark a task not applicable or route its completion to the requester.
Findings None None.
Security None None.

How this fits together

ACP executions create task records that the task registry finalizes. Terminal delivery then chooses whether to send a completion notice directly or queue it for the requester’s session.

flowchart LR
  A[ACP execution] --> B[Task record]
  B --> C[Terminal result]
  C --> D[Choose notification peers]
  D --> E{Same execution?}
  E -->|Yes| F[One completion notice]
  E -->|No| G[Separate completion notices]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +7, Tests +23, Docs 0. Total +30 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 11 4 +7
Tests 2 48 25 +23
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 60 30 +30

Review metrics

None.

Technical review

Best possible solution:

Keep notification deduplication in the task delivery owner, keyed to an ACP execution where its backing identity is available, while retaining legacy-record behavior.

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

Yes. Current-main source shows the peer-selection collision, and the PR reports a manager regression that fails before the fix and passes after it; this read-only review did not execute the test.

Is this the best way to solve the issue?

Yes. The change narrows the existing delivery selector using identity already stored by ACP task creation, with controls for same-instance and legacy duplicates.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b4ed0cc7abed.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A reused ACP request ID can suppress a completion notice, but the affected path is limited to distinct executions sharing that ID.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored PR is exempt from the contributor live-proof gate. Its reported before-and-after test exercises ACP task creation and terminal queuing through the production owners in isolated state; the diff does not change a stored-data contract.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 68b724b adds src/tasks/task-notification-routing.ts:26 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 68b724b355ee; files: src/tasks/task-notification-routing.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-26T20:54:41.111Z sha f0d9a38f33c25ae55440f762f6517b7a1979f3b5 :: needs maintainer review before merge. :: none

Distinct ACP executions can share a requester, child session, and request ID while retaining separate task and flow IDs. Include the persisted ACP instance ID in notification peer selection so an older execution cannot suppress the next completion. Preserve deduplication for same-instance projections and legacy records, and document the notification contract.

On Blacksmith Testbox, the manager regression failed before the fix with not_applicable instead of session_queued for the second execution (1 failed, 10 passed). After the fix, 218 tests across six owner and sibling files passed, along with check-changed and an independent P2 review. The two modified test files passed on one worker in 27.93s Vitest wall / 40.03s wrapper wall; the regression took 827ms and the added duplicate control 738ms. All validation ran remotely; local commit hooks were disabled for the explicitly constrained host.
@steipete
steipete force-pushed the fix/live2-acp-notify-instance branch from f0d9a38 to 8107a5d Compare September 26, 2026 21:01
@steipete
steipete merged commit 047c88d into main Sep 26, 2026
194 checks passed
@steipete
steipete deleted the fix/live2-acp-notify-instance branch September 26, 2026 21:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…claw#159173)

Distinct ACP executions can share a requester, child session, and request ID while retaining separate task and flow IDs. Include the persisted ACP instance ID in notification peer selection so an older execution cannot suppress the next completion. Preserve deduplication for same-instance projections and legacy records, and document the notification contract.

On Blacksmith Testbox, the manager regression failed before the fix with not_applicable instead of session_queued for the second execution (1 failed, 10 passed). After the fix, 218 tests across six owner and sibling files passed, along with check-changed and an independent P2 review. The two modified test files passed on one worker in 27.93s Vitest wall / 40.03s wrapper wall; the regression took 827ms and the added duplicate control 738ms. All validation ran remotely; local commit hooks were disabled for the explicitly constrained host.

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant