Repository navigation
refactor(acp): make reply projector single-dispatch - #120560
Conversation
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 8:39 AM ET / 12:39 UTC. ClawSweeper reviewWhat this changesThis PR makes the ACP reply projector serve one logical dispatch by removing projector-local terminal settlement and per-turn pipeline recreation. Merge readinessKeep open for normal maintainer review. The exact head has no source-level correctness finding, but the mandated local Codex dependency inspection could not be completed because Priority: P2 Review scores
Verification
How this fits togetherACP session events pass through the reply projector into the channel delivery coordinator. The outer ACP dispatcher owns final success and error settlement after the manager completes one logical dispatch. flowchart LR
A[ACP session manager] --> B[Runtime events]
B --> C[Reply projector]
C --> D[Channel delivery coordinator]
D --> E[Outer dispatch settlement]
E --> F[Visible reply]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -24, Tests -21. Total -45 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one dispatch-scoped projector and one outer settlement path, then revalidate the cited Codex terminal ordering in an environment that contains the required sibling source checkout. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a lifecycle cleanup rather than a report with an independently reproducible failure; source inspection establishes the affected dispatch path. Is this the best way to solve the issue? Yes for the OpenClaw owner boundary: the manager retries before output and the outer dispatcher already owns settlement, so restoring projector-local reset would recreate duplicate lifecycle ownership; Codex terminal ordering remains unverified locally. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e5d4fe02a46a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
|
Resolved the retry-boundary finding in the PR description and evidence without changing the head. A temporary manager→projector boundary harness passed in both live and final-only modes: two backend attempts, forwarded I am intentionally not restoring projector reset/recreation: recoverable attempts are internal to one logical dispatch, text/tool output already disables retry, and the previous implementation already delivered the losing attempt’s status before resetting. Discarding losing-attempt statuses would require a separate typed manager policy, not projector-local terminal ownership. @clawsweeper re-review |
|
Maintainer decision recorded in the PR body: retry statuses are dispatch-scoped. Identical statuses dedupe across recoverable attempts, distinct statuses remain ordered, and outer settlement owns the single final reply. I also completed the required direct current Codex-source inspection: core emits its terminal completion only after turn completion/final-message collection, and app-server publishes the corresponding final The requested committed retry-contract test is intentionally left to the already separate repair-sweep task #17. Task #18 is the frozen two-file projector cleanup and requested negative test delta; adding the manager owner surface here would collapse the explicitly reserved task boundary. The temporary two-mode manager→projector proof remains documented in Evidence. @clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Land-ready maintainer proof for exact head
Known proof gap: no credentialed external live ACP smoke was run. Deterministic manager/projector/dispatcher boundary proof, direct dependency source inspection, and exact-head CI are used; no live proof is claimed. |
|
Merged via squash.
|
What Problem This Solves
OpenClaw’s ACP reply projector still modeled reuse across multiple turns even though production creates one projector per logical dispatch and the outer dispatcher already settles output on success and failure. That duplicated lifecycle ownership let terminal events recreate streaming state inside the projector and kept an unsupported multi-turn test as policy.
This is an ownership cleanup with one narrow observable retry-status change. It does not claim to fix #92199, supersede the retained-text behavior discussion in #119589, or harden malformed third-party terminal streams.
Why This Change Was Made
The projector now owns one block-reply pipeline for its single dispatch lifetime. Projector-local terminal flushing, turn-state reset, pipeline recreation, and the artificial reused-projector test are removed;
tryDispatchAcpReplyremains the canonical success/error force-flush owner.A forced flush already clears the projector idle timer, drains the coalescer timer and buffers, and awaits ordered delivery. Modern ACPX separates live events from terminal results, while legacy terminal normalization and recoverable backend attempts remain manager-owned.
Rejected alternatives:
User Impact
Normal reply text and tool delivery are unchanged. During the supported recoverable pre-output retry path, visible status projection now follows the logical dispatch instead of each backend attempt:
The previous implementation already delivered the losing attempt’s status before resetting; this change removes duplicate/early status delivery rather than newly retaining hidden reply content.
b14a6861fd98e956b24e892f06be899b40e4a943Maintainer Decision
Dispatch-scoped retry statuses are the intended contract for this cleanup. Recoverable backend attempts are internal to one logical OpenClaw dispatch; identical visible statuses dedupe across attempts, distinct statuses remain ordered, and outer settlement produces one final reply.
A committed manager retry-contract test is intentionally not added here. Task #18 is the frozen two-file projector lifecycle cleanup with the requested test delta; the separate repair-sweep task #17 owns retry-boundary contract coverage. Adding that third owner surface here would collapse the task boundary the sweep explicitly reserved.
Direct current Codex-source inspection was completed at
3aae5d885bac39c1262491aa3fd100dfd8b3919f: core emitsTurnCompleteonly after turn completion and final-message collection (tasks/mod.rs); app-server handles that terminal event and publishesturn/completed(bespoke_event_handling.rs, completion builder). No supported producer needs projector reuse across separate logical turns.Evidence
Focused lifecycle and boundary suite:
Result: 6 files passed across 3 routed shards; 485 tests passed.
Boundary proof through the real
dispatchReplyFromConfig→ ACP hook → dispatch/projector → channel dispatcher seam:node scripts/run-vitest.mjs \ src/auto-reply/reply/dispatch-from-config.test.ts \ -t "coalesces tiny ACP token deltas into normal Discord text spacing"Result: passed. The production route consumed multiple deltas plus the terminal event and emitted one correctly coalesced reply after outer settlement.
Recoverable-retry proof used a temporary, uncommitted Vitest harness wiring the real
AcpSessionManagerto the production projector, then removed the file before publication:Result: 2 tests passed, one for each delivery mode. Both observed two backend attempts and the forwarded sequence
status → error → status → status → text_delta → done. The first and identical retry status produced one visible status, the distinct status remained ordered, the transient error was not delivered, and outerflush(true)produced exactly one final reply.Additional proof:
Result: formatting, whitespace, typechecks, changed-file lint, dead-export scans, plugin boundaries, database-first guards, and runtime cycle checks passed. Remote proof backends were unavailable, so the trusted-source local fallback ran per repository policy; no credentialed external ACP smoke is claimed.
Review: