Repository navigation
refactor(auto-reply): consolidate reply preparation and command flows - #166685
Conversation
|
Codex review: blocked before merge. Reviewed October 7, 2026, 4:20 PM ET / 20:20 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR consolidates private reply preparation, command handling, delivery, and lifecycle helpers and prevents ACP session lookup from throwing when optional channel configuration is absent. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. The earlier wrapper-inventory defect is repaired, and source inspection does not support the previous generic config/default blocker. No blocking introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s automatic reply pipeline receives channel messages and commands, prepares session and agent inputs, and delivers responses. These helpers coordinate execution, cancellation, session updates, and delivery settlement. flowchart TD
A[Incoming messages and commands] --> B[Reply preparation]
B --> C[Session and authority checks]
C --> D[Command handling]
C --> E[Agent execution]
D --> F[Reply delivery]
E --> F
F --> G[Delivery settlement]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep shared private owners for reply preparation and settlement while preserving command values, lazy imports, live authority checks, and session persistence contracts. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: fetched main dereferences absent channels when ACP reset lookup receives an omitted account and channel configuration. This review did not execute that path. Is this the best way to solve the issue? Yes. The inspected shared helpers retain existing inputs, reset semantics, authorization predicates, and persistence operations; optional chaining repairs the ACP defect without adding configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e73028f81cda. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Share ACP setter parsing, target resolution, dispatch, and replies while preserving alias-specific validation, ordering, and exact user-facing text. Keep prompt reconstruction with the context that owns its inputs and carry the complete envelope through admission. Share directive acknowledgement payload construction without changing metadata-bearing replies. Remove 144 net production lines. Adapt one internal test fixture (+6 lines) with all assertions unchanged. Validation: 361 focused tests across 13 files; lint-suppression tests; zero runtime and Madge cycles; check-changed including core/test typechecks, lint, guards, and dead-export scans on Blacksmith Testbox; independent P2 review.
1a4ecf1 to
32271a3
Compare
…b [step 4/5] Upstream "consolidate reply preparation and command flows" (openclaw#166685). Eight conflicting files; the semantic ports: - agent-runner-run-params.ts (auto-merged upstream builder): the shared buildFallbackCandidateTurnParams now carries the feature's hookTrigger override (`turn.hookTrigger ?? heartbeat/user`), so both the embedded and CLI candidates keep it. The candidate hunks take upstream; the embedded candidate keeps the feature's continuation options (drainsContinuationDelegateQueue, continueWorkOpts, requestCompactionOpts) and drops the prepareAssistantTranscriptMessage line upstream moved into the builder. - agent-runner-execution.ts: upstream collapsed the fallback loop into one `cycle`. The feature's continueWorkRequests / compactionTraceparent / rawContinuationText join the post-loop destructure, and the hook trigger keeps the override. - agent-runner-execute.ts: `cfg` is restored to the input destructure for the feature's context-pressure evaluation (upstream switched to `...context`). - get-reply-run-admission/-execute.ts: upstream's promptBodies. The admission result keeps the feature's managedSystemEventDeliveries. Execution takes only media/inboundMediaIndexes up front, because the text bodies are re-read after the feature's system-event refresh. - agent-runner-result-payloads.ts: both sides added an identical isPayloadLaneEnabled; one copy is kept. - normalize-reply.ts: both imports kept. - Deleted upstream modules: agent-runner.ts (a re-export) and reply-media-paths.runtime.ts. The feature's imports and tests move to agent-runner-run.js and reply-media-paths.js. The media-only test drops upstream's removed runtime mock (its cancelContinuationTimer stub has no live target). Checks: typecheck clean for core and every core test shard plus extensions-test. Canonical runner: 93 of 94 agent-runner* / get-reply-run* / normalize-reply* / crosssession-gate files green. The remaining file, agent-runner.runreplyagent.e2e.test.ts, needs CI's prepared-runtime route and is covered by the Gate 2.5 delta's e2e lane. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
…upstream's rename Upstream openclaw#166685 (0abba2b) deleted src/auto-reply/reply/agent-runner.runtime.ts. get-reply-run-helpers.ts now lazy-loads ./agent-runner-run.js. The feature's tsdown entry, which keeps that runner in the unified graph so continuation's singleton state is shared (a split chunk can silently drop continue_work tool calls), still named the deleted file, so the build failed with UNRESOLVED_ENTRY. Typecheck and vitest never build dist, so the absorb sweep missed it; 🍃's Gate 2.5 e2e lane (prepare-vitest-runtime) caught it. The entry now names src/auto-reply/reply/agent-runner-run.ts. Checks: `pnpm build:strict-smoke` passes. dist has one auto-reply/reply/agent-runner-run.js entry, and the only dynamic import of it is import("./auto-reply/reply/agent-runner-run.js"), so there is no duplicated runner chunk. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jhynq2GVpzuVQQieebEubg
…openclaw#166685) * refactor(auto-reply): consolidate command and prompt preparation Share ACP setter parsing, target resolution, dispatch, and replies while preserving alias-specific validation, ordering, and exact user-facing text. Keep prompt reconstruction with the context that owns its inputs and carry the complete envelope through admission. Share directive acknowledgement payload construction without changing metadata-bearing replies. Remove 144 net production lines. Adapt one internal test fixture (+6 lines) with all assertions unchanged. Validation: 361 focused tests across 13 files; lint-suppression tests; zero runtime and Madge cycles; check-changed including core/test typechecks, lint, guards, and dead-export scans on Blacksmith Testbox; independent P2 review. * refactor(auto-reply): consolidate reply and command flows * refactor(auto-reply): retain explicit SDK formatter input * fix(auto-reply): preserve protected wrapper dependencies
What Problem This Solves
Reduces duplicated production code throughout reply preparation, command handling, delivery, and lifecycle management. Also fixes ACP reset-target lookup throwing when the optional channel configuration is absent.
User Impact
The refactor preserves existing commands, reply text, config keys, public contracts, persisted shapes, authorization, cancellation, and replay behavior. The adjacent ACP fix uses the existing default-account fallback instead of throwing. No migration or operator action is required.
Why This Change Was Made
Shared cores now own repeated prepared runtime/skill inputs, command variants, delivery settlement, and formatting. Callers keep explicit differences and the original checks around asynchronous work. Redundant state derives from its existing owner, and retired private forwarding modules have complete caller/mock cutovers that retain lazy loading.
The lane implemented and measured a largest-first pass over 418 production files during a two-hour implementation window. Net production reduction after both conflict-only integrations and the boundary repair: 1,589 lines (2,525 added / 4,114 removed), excluding tests, fixtures, test support, generated files, and declarations. This excludes overlapping cleanup independently landed on main. Concrete shared-core trials that added 9, 14, or 15 lines were rejected; a four-line type reduction was reverted to retain an explicit public SDK declaration. Measurements and the per-file coverage log are retained in the lane artifacts.
Evidence
typeofaliases, the shared token helper, and the generic count mapper. Those source differences were inspected; public input/output contracts remain unchanged. The boundary repair moves the private helper out of the protected token module. No API acknowledgement or baseline override was used.checks-node-changed-compact-small-10andchecks-node-compact-small-2: deletingdelivery-hints.tsbroke the protected PR-wrapper inventory, failing 16 provisioning cases and six extraction cases. The correction restores all three touched protected dependencies byte-for-byte to main and moves the shared token helper to a private leaf. The inventory and tests are unchanged, and the protected-inventory diff is empty.undefined, with the existing 30-test command suite confirming override removal.