Repository navigation
refactor(auto-reply): deslop auto-reply - #157000
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. |
afbdb9a to
17b148b
Compare
|
Codex review: blocked before merge. Reviewed September 24, 2026, 12:58 AM ET / 04:58 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch consolidates automatic reply command parsing, agent event delivery, follow-up queue bookkeeping, media preparation, and related tests without intending to change user-visible replies. Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open. Current main still has the pre-cleanup auto-reply paths, so the branch has distinct value. The inspected changes and reported exact-head CI reveal no concrete regression; this broad refactor was not independently exercised through a live reply in this read-only review. Priority: P3 Review scores
Verification
How this fits togetherAuto-reply receives channel messages, interprets commands, and starts agent turns. It passes progress and final output through follow-up queues and media preparation to channel delivery. flowchart LR
A[Inbound channel message] --> B[Command and route selection]
B --> C[Agent turn]
C --> D[Follow-up queue]
C --> E[Media preparation]
D --> F[Outbound reply]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one owner for each reply transformation while preserving command authorization, queue ordering, transcript identity, and media delivery through the existing runtime boundaries. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR targets duplicated implementation rather than a reported runtime failure. The inspected current-main files retain the older paths. Is this the best way to solve the issue? Yes: the inspected changes consolidate existing owners and remove forwarding code without establishing a competing capability or storage contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6a6f8a6ecec2. 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 (1 earlier review cycle)
|
17b148b to
2c5ca76
Compare
|
Merged via squash.
|
Brings the branch onto current main; GitHub reported it CONFLICTING. inbound-meta.ts conflicted because main rewrote the helpers this branch had moved out of it: openclaw#157000, openclaw#161129, openclaw#164547 and openclaw#166085 trimmed the file, openclaw#158028 dropped its max-lines suppression, and openclaw#167236 merged the transcript sanitizers into sanitizeTranscriptText. The split is re-applied on main's code rather than on the branch's older copies: - inbound-meta.text.ts holds main's normalizePromptMetadataString, normalizePromptMetadataStringArray, sanitizePromptBody, truncateBodyHeadTail and sanitizeTranscriptText, moved verbatim. - inbound-meta.current-message.ts builds both projections with sanitizeTranscriptText(..., "body") in place of the branch's sanitizeTranscriptBody; the inline projection keeps main's bare header. - inbound-meta.ts is main's file minus the moved helpers. - config/max-lines-baseline.txt takes main's side, which already dropped the inbound-meta.ts entry. The carrier projection stays in its own module: get-reply-run.media-only.test.ts and followup-turn-admission.test.ts mock ./inbound-meta.js with closed factories, and prompt-prelude.ts must not import the projection through them.
What Problem This Solves
Auto-reply repeats parsing, event adaptation, delivery projection, and queue bookkeeping across forwarding layers, increasing the amount of code that must stay consistent. This is a maintainer-requested second-pass cleanup of the auto-reply subsystem.
User Impact
No user-visible behavior change is intended. Reply ordering, channel text, prompt/transcript bytes, command and approval distinctions, public SDK exports, configuration, protocol, and persisted schemas stay unchanged.
Compatibility audit: no config schema, option, default, database schema, serialized-state shape, or migration is changed. In
reply-media-paths.ts, the existingpersistLocalReplyMediaowner and its arguments are unchanged; the extracted helper only shares its result projection. Empty and non-empty payloads retain the samemediaUrl,mediaUrls, attachments, trust metadata, MIME/name fields, and failure metadata. Existing media-path, media-ownership, final-media, and plugin-consumer tests cover these boundaries. The earlier automated compatibility flags did not identify a concrete changed contract and noted an incomplete file list.Why This Change Was Made
Existing owners now handle the repeated work directly:
Evidence
All pre-commit checks passed on the initial candidate
afbdb9a76d28e1b6f04b5aae73cc0454c2a58683in Blacksmith Testbox (tbx_01m38kyvkhdh3vbbrhwhzn8vx4; 4 CPUs, 15 GB). The tracked-source fingerprint matched before and after the full run.node scripts/check-changed.mjs --base origin/main: passed, including all 25 test-type shards, core/scripts lint, formatting, dead-export scans, and zero runtime import cycles.node scripts/run-vitest.mjs <explicit focused and cross-shard paths>: all 20 batches passed, covering 392 selected files: 344 core/cross-subsystem files and 48 plugin consumers. This includestest/scripts/plugin-sdk-surface-report.test.tsand consumers in Discord, Feishu, LINE, Matrix, Mattermost, memory-lancedb, Teams, Signal, Slack, Telegram, and WhatsApp. Batches took 43m52s including initial QA runtime preparation.pnpm plugin-sdk:surface:checkandpnpm plugin-sdk:check-exports: passed. This revision has noplugin-sdk:api:checkcommand; these are the current package-owned surface/export checks.pnpm build: passed in 4m48s. It emitted a non-enforcing isolated Mermaid gzip advisory (1555.8 KiB versus 960.0 KiB); UI inputs are unchanged, and no bundle budget or bundle baseline was altered.git diff --check: passed.Changed-test wall costs on the Testbox runner, each measured with
pnpm test <file> --maxWorkers=1:src/auto-reply/reply/commands-setunset.test.tsqueue.collect.test.tsqueue.collect-transcript.test.tsThe collected-transcript regression itself took 3ms in the focused batch; most standalone wall cost is runtime preparation/imports. After publication, the branch was rebased onto
86c2919245f. The range-diff only drops one superseded one-line cleanup fromagent-runner-failure-reply.ts: main moved that helper to its canonical failover owner. Every remaining cleanup hunk is unchanged. Codex autoreview of that rebased candidate also passed through P2. Its plugin contract job then failed because the typed-hook inventory omittedextensions/qa-lab/index.ts. The exact assertion reproduces on both the PR head and a clean merge-base checkout (86c2919245f); both inputs are unchanged by this PR. Main fixed the inventory in3e53db714d2. The branch is now rebased ontobce21484fa7, with an identical range-diff, and the formerly failing assertion now passes on2c5ca7696bd93421cac48045075312f4a48c6a5e. The final transcript/failover check passed (22 cases across two files). Exact-head PR CI completed successfully for2c5ca7696bd93421cac48045075312f4a48c6a5e(pull_request, matching head SHA).node scripts/watch-pr-ci.mjs 157000 2c5ca7696bd93421cac48045075312f4a48c6a5e --timeout 3600 --interval 120returned GREEN, excluding 15 superseded check contexts. The initial full proof remains the evidence for the unchanged cleanup patch.Production-only reduction: 1,219 lines. The required campaign command also counts the one-line assertion-baseline removal:
Measured with:
Only tests exclusive to the deleted parser adapter were removed; surviving parser behavior remains covered. The existing collected-transcript test now admits the aggregate and rotates the session before resolving the recorder, preserving content/media/mention/settlement assertions while checking the resulting transcript identity. The complete case moved to
queue.collect-transcript.test.tsbecause the line-growth ratchet rejects growth of the existing oversized collection suite; no baseline exception or coverage reduction was used. The regression fails when the retained latest-run reference is removed and passes with the original bookkeeping intact.