Skip to content

refactor(auto-reply): centralize delivery deduplication and routing - #119436

Merged
steipete merged 1 commit into
mainfrom
codex/loc-0804-autoreply-luem8u
Aug 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/loc-0804-autoreply-luem8u

Conversation

@steipete

@steipete steipete commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Primary replies, follow-up delivery, and route selection independently repeated message-tool payload deduplication and redundant route-tier predicates. This is part of a maintainer-requested project-wide production LOC reduction campaign.

Why This Change Was Made

Use the canonical route-aware reply dedupe owner for primary/follow-up delivery, remove obsolete private re-export wrappers, and simplify routing buckets that already encode precedence.

User Impact

Reply visibility, threading, account routing, media ordering, source mirrors, and wildcard/exact precedence remain unchanged; removes 129 production lines.

Evidence

@steipete
steipete marked this pull request as ready for review August 5, 2026 02:50
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 5, 2026
@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 4, 2026, 11:03 PM ET / August 5, 2026, 03:03 UTC.

ClawSweeper review

What this changes

This PR centralizes auto-reply message-tool duplicate suppression for primary and follow-up replies, while removing redundant route-resolution predicates.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No actionable regression was found: primary and follow-up reply delivery now share the same route-aware media-then-text dedupe path, and route-tier semantics remain intact. This maintainer-labeled PR should stay open for exact-head build completion and explicit maintainer approval.

Priority: P3
Reviewed head: f9e0e6a9eba022904b14b1e5599e7b99cb49b3e3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The extraction is coherent and preserves the reviewed delivery and route invariants, with final build completion remaining before approval.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-labeled behavior-neutral refactor is not subject to the external-contributor real-setup proof gate; supplied status reports a successful real-behavior-proof check.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-labeled behavior-neutral refactor is not subject to the external-contributor real-setup proof gate; supplied status reports a successful real-behavior-proof check.
Evidence reviewed 6 items Canonical dedupe owner: The extracted helper reconstructs the prior per-payload route decision from payload metadata and applies media filtering before text filtering.
Primary and follow-up callers: Primary delivery retains the transcript-mirror bypass before calling the helper; follow-up delivery passes the same route and sent-message inputs into that helper.
Route-tier equivalence: The removed predicates are enforced by exclusive routing-index buckets, while scope validation and tier precedence remain at selection time; blank account IDs still normalize to the default account.
Findings None None.
Security None None.

How this fits together

Auto-reply turns agent output into channel reply payloads, then applies threading and duplicate suppression before delivery. Route resolution selects the target agent/session from channel, account, peer, and role bindings.

flowchart LR
  A[Agent output] --> B[Reply payload builder]
  B --> C[Threading and route context]
  C --> D[Shared duplicate suppression]
  D --> E[Primary reply delivery]
  D --> F[Follow-up delivery]
  E --> G[Channel and transcript]
  F --> G
  H[Inbound channel route] --> I[Route tier index]
  I --> B
Loading

Decision needed

Question Recommendation
Should this maintainer-requested behavior-neutral refactor be approved after the in-progress build-artifacts check completes on the current head? Approve after build completion: Approve if the current-head build-artifacts check succeeds, since the reviewed extraction preserves the existing owner boundary and filtering order.

Why: The protected maintainer label requires explicit maintainer handling even though direct review found no correctness defect.

Before merge

  • Add real behavior proof - Not applicable: This maintainer-labeled behavior-neutral refactor is not subject to the external-contributor real-setup proof gate; supplied status reports a successful real-behavior-proof check.
  • Resolve merge risk (P1) - The supplied status still showed the exact-head build-artifacts check in progress; approval should wait for that result.
Agent review details

Security

None.

PR surface

Source -129, Tests 0. Total -129 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 6 169 298 -129
Tests 1 2 2 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 171 300 -129

Review metrics

Metric Value Why it matters
Production versus test LOC production -129, tests 0 The refactor removes duplicated delivery and routing logic without expanding the test surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one internal route-aware dedupe helper for primary and follow-up reply owners, retain command delivery's intentionally distinct payload-preserving path, and approve only after the exact-head build succeeds.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one internal route-aware dedupe helper for primary and follow-up reply owners, retain command delivery's intentionally distinct payload-preserving path, and approve only after the exact-head build succeeds.

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

Not applicable: this PR refactors existing reply delivery and routing behavior rather than reporting a standalone failure.

Is this the best way to solve the issue?

Yes: centralizing the identical primary and follow-up filter sequence in the route-aware dedupe owner removes duplicate policy without changing the distinct command-delivery behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a behavior-preserving internal cleanup with no demonstrated user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled behavior-neutral refactor is not subject to the external-contributor real-setup proof gate; supplied status reports a successful real-behavior-proof check.

Label justifications:

  • P3: This is a behavior-preserving internal cleanup with no demonstrated user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled behavior-neutral refactor is not subject to the external-contributor real-setup proof gate; supplied status reports a successful real-behavior-proof check.

Evidence

What I checked:

  • Canonical dedupe owner: The extracted helper reconstructs the prior per-payload route decision from payload metadata and applies media filtering before text filtering. (src/auto-reply/reply/reply-payloads-dedupe.ts:404, f9e0e6a9eba0)
  • Primary and follow-up callers: Primary delivery retains the transcript-mirror bypass before calling the helper; follow-up delivery passes the same route and sent-message inputs into that helper. (src/auto-reply/reply/agent-runner-payloads.ts:303, f9e0e6a9eba0)
  • Route-tier equivalence: The removed predicates are enforced by exclusive routing-index buckets, while scope validation and tier precedence remain at selection time; blank account IDs still normalize to the default account. (src/routing/resolve-route.ts:758, f9e0e6a9eba0)
  • Current-main status: The PR head is not an ancestor of current main, so this work is not already implemented there. (22de30f99821)
  • Feature provenance: The adjacent route-aware dedupe behavior dates to Peter Steinberger's explicit-topic delivery repair; blame attributes the extracted helper to this PR head. (src/auto-reply/reply/reply-payloads-dedupe.ts:390, 7a0a4c5f2a3b)
  • Static validation: The proposed patch has no whitespace errors; supplied status context also reports focused suites and the real-behavior-proof check as successful. (f9e0e6a9eba0)

Likely related people:

  • steipete: The recent topic-delivery repair established the route-aware dedupe owner, and the PR-head helper is attributed to this area of work. (role: introduced the current delivery-dedupe behavior and authored the refactor; confidence: high; commits: 7a0a4c5f2a3b, f9e0e6a9eba0; files: src/auto-reply/reply/reply-payloads-dedupe.ts, src/auto-reply/reply/agent-runner-payloads.ts, src/auto-reply/reply/followup-delivery-payloads.ts)
  • Vignesh Natarajan: The route-index partition relied on by the predicate removal originates in the routing optimization work. (role: routing-index author; confidence: medium; commits: c260e207b299; files: src/routing/resolve-route.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the in-progress build-artifacts check on the current head, then obtain protected-label maintainer approval.

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.

@steipete
steipete merged commit c4dccc6 into main Aug 5, 2026
184 of 191 checks passed
@steipete
steipete deleted the codex/loc-0804-autoreply-luem8u branch August 5, 2026 03:29
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 5, 2026
* origin/main:
  fix(channels): honor explicit preview streaming settings
  refactor(telegram): consolidate outbound contracts and targets (#119438)
  fix(qa): retry transport cleanup and always stop owned labs (#119442)
  fix(mcp): guard stdio stdout frame parsing against oversized-buffer crash (#119379)
  refactor(auto-reply): centralize delivery deduplication and routing (#119436)
  fix(qa): preserve scenario isolation in serial suites (#119439)
  perf(xai): lazy-load optional capability runtimes (#119374)
  refactor(browser): consolidate browser CLI and normalization helpers (#119432)
  fix(qa): require ready transport accounts (#119431)
  refactor(media): share image and video geometry normalization (#119416)
  fix(config): preserve plugin metadata for missing config (#119421)
  fix: retry delivery when outbound adapter is unavailable (#119371)
  fix(cli): retire invalid secret flags and prove doctor recovery (#118926)
  refactor(signal): share outbound and reaction transport (#119415)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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