Repository navigation
fix: dedupe replies against their resolved delivery thread - #130510
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Compare message-tool deliveries with the channel-owned automatic reply transport before suppressing duplicate output. Preserve explicit thread targets and the existing behavior of channels without a transport hook. Related: #120339.
7e6cbaa to
fa0c1b9
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 8:50 PM ET / August 27, 2026, 00:50 UTC. ClawSweeper reviewWhat this changesThe PR removes two early deduplication bypasses so automatic replies and message-tool sends are compared using the channel’s resolved delivery thread, with regression coverage for flat and threaded destinations. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessThe PR remains necessary: current main still bypasses the channel resolver for implicit replies and missing reply IDs. The proposed repair makes deduplication consult the same existing transport resolver as final delivery, with no concrete patch defect found; it awaits maintainer review and exact-head checks. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe auto-reply pipeline builds final payloads and suppresses content already sent through the message tool. Channel threading adapters resolve where a reply will actually arrive, and that resolved destination must agree with duplicate suppression before the reply is delivered. flowchart LR
A[Incoming channel message] --> B[Reply payload builder]
B --> C[Channel transport resolver]
D[Message-tool delivery evidence] --> E[Route-aware duplicate comparison]
C --> E
E --> F[Automatic reply delivery]
Decision needed
Why: The patch is focused and has no supported code-level blocker, but it changes suppression behavior at a shared delivery boundary and carries the protected maintainer label. Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +89. Total +87 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Land the resolver-owned comparison after the exact head is validated, retaining the generic flat/threaded regression table and the Slack and Mattermost delivery-boundary coverage. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main returns the inbound thread before calling the transport resolver, whereas final delivery calls that resolver with the same routing facts. The new table expresses flat and threaded cases, but this read-only review did not execute it. Is this the best way to solve the issue? Yes. Reusing the existing channel-owned transport resolver gives duplicate suppression the same destination decision as final delivery without adding a parallel API or channel-specific core policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 42112dd86ec3. LabelsLabel 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 (1 earlier review cycle)
|
|
Maintainer decision: land this generic prerequisite separately. The existing channel transport resolver is the correct owner of the destination used for duplicate suppression; the repair removes two premature bypasses, with no new SDK, channel-specific condition, or storage/configuration surface. Production +2/−4 (net −2); tests +102/−13. Verified head: The original flat cases demonstrated both duplicate output and wrongful suppression; both now pass, with threaded controls retained. CI caught an additional inaccurate Slack follow-up fixture, which omitted the real resolver's inherited-thread fallback after first mode clears the reply ID. That failure was reproduced locally and corrected without weakening the exact single-answer assertion or changing production code. Five focused suites now pass: 191 tests. pnpm tsgo:core:test
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/auto-reply/reply/reply-payloads-transport-dedupe.test.ts src/auto-reply/reply/agent-runner-payloads.test.ts src/auto-reply/reply/route-reply.test.ts src/auto-reply/reply/followup-delivery.test.ts src/auto-reply/reply/followup-delivery.channel.test.ts
node scripts/check-changed.mjs -- src/auto-reply/reply/reply-payloads-dedupe.ts src/auto-reply/reply/agent-runner-payloads.test.ts src/auto-reply/reply/reply-payloads-transport-dedupe.test.ts
node scripts/check-changed.mjs -- src/auto-reply/reply/followup-delivery.channel.test.tsClawSweeper's optional rebase rank-up is skipped: the reviewed stack already excludes the landed lifecycle parent, there is no merge conflict, and we are preserving the exact tested head under the repository's drift policy. Its proof-wrapper timeout waited for a full test title that the compact reporter did not print; its embedded logs show all four tests passing twice. That wrapper outcome is not a product failure or live model-tool proof. Known proof boundary: these are owner-boundary tests, not live model-tool execution. The separate flat Buzz feature in #130511 owns the authenticated Gateway/relay placement test and will land only after its own final build and live verification. |
|
Merged via squash.
|
…130510) * fix: dedupe replies against their resolved delivery thread Compare message-tool deliveries with the channel-owned automatic reply transport before suppressing duplicate output. Preserve explicit thread targets and the existing behavior of channels without a transport hook. Related: openclaw#120339. * test: type the resolved reply transport fixture * test: preserve Slack thread fallback in follow-up fixture
Related: #120339. AI-assisted maintainer repair, kept separate from the Buzz presentation feature.
What Problem This Solves
Fixes an issue where a message-tool send can suppress the wrong automatic reply, or leave a duplicate reply, when a channel resolves automatic delivery to a different thread from the incoming message.
Why This Change Was Made
Duplicate suppression now asks the existing channel reply-transport hook for the final destination before comparing it with message-tool deliveries. Two premature bypasses used the inherited input thread or skipped resolution when there was no reply ID. Removing those bypasses gives delivery and duplicate suppression the same owner. Channels without a hook keep their existing inherited-thread behavior.
User Impact
Automatic replies and explicit message-tool sends are compared by where they will actually be delivered. This is a generic prerequisite for flat Buzz replies; it contains no Buzz-specific condition or new SDK contract.
Release-note context: compare message-tool duplicate suppression against the resolved automatic-reply destination.
Evidence
Four cases cover flat/threaded automatic delivery against top-level/threaded tool sends. On the baseline, both flat cases fail and both threaded controls pass; the fix passes all four. The adjacent payload, route-reply, follow-up, and channel-boundary suites pass together: 5 files, 191 tests, rerun successfully on the independently installed native checkout. The Slack fixtures now match the real Slack transport resolver while preserving their expected dedupe assertions. Production delta: 2 additions, 4 deletions (net −2); tests: 102 additions, 13 deletions.
The already-landed lifecycle parent has been removed from this PR's stack; this PR changes only four core deduplication/test paths. The initial full check caught a missing contextual type in the new test fixture; the fixture now satisfies the existing
ChannelThreadingAdaptercontract. Core-test types, 191 focused tests, and changed-file checks pass for the final tree committed as930e3e4c5345b0e2de1d9f57c7944799a13a2738(the full original three-file gate, followed by the complete changed gate for the additional Slack fixture):Hosted CI run 33026603577 exposed a second inaccurate Slack fixture: first-reply mode clears a later explicit reply ID, but real Slack still falls back to the inherited thread. The fixture omitted that fallback. The same failure was reproduced locally; correcting the fixture preserves the exact single-answer expectation and makes all 191 focused tests pass. Production is unchanged by this follow-up. Its changed checks, P0–P2 review, and independent bounded verification pass; final-head CI run 33027771696 completed successfully.
Fresh full-priority source review, the bounded type-fixture review, and independent immutable-head review of the initial repair are clean. The separate Buzz feature in #130511 owns the actual authenticated relay placement proof; the owner-boundary tests here are not live model-tool proof.
Provenance: the two shortcuts were introduced with thread-scoped deduplication in #90943, authored by @sandieman2 and merged by @steipete on June 14, 2026. This repair preserves its cross-thread suppression protection while removing the shortcuts made incorrect by transport-specific reply placement.