Skip to content

fix: dedupe replies against their resolved delivery thread - #130510

Merged
steipete merged 3 commits into
mainfrom
codex/fix-reply-transport-dedupe
Aug 27, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/fix-reply-transport-dedupe

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

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 ChannelThreadingAdapter contract. Core-test types, 191 focused tests, and changed-file checks pass for the final tree committed as 930e3e4c5345b0e2de1d9f57c7944799a13a2738 (the full original three-file gate, followed by the complete changed gate for the additional Slack fixture):

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.ts

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.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: buzz size: XL maintainer Maintainer-authored PR labels Aug 26, 2026
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.
@steipete
steipete force-pushed the codex/fix-reply-transport-dedupe branch from 7e6cbaa to fa0c1b9 Compare August 27, 2026 00:00
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed docs Improvements or additions to documentation channel: buzz size: XL labels Aug 27, 2026
@steipete
steipete marked this pull request as ready for review August 27, 2026 00:22
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. 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. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 8:50 PM ET / August 27, 2026, 00:50 UTC.

ClawSweeper review

What this changes

The 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 provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The 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
Reviewed head: 930e3e4c5345b0e2de1d9f57c7944799a13a2738
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative production repair with relevant resolver and immediate/queued regression coverage; merge readiness depends on exact-head checks.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned PR is exempt from the external-contributor proof gate; its body supplies focused test evidence, while the pending checks remain a normal merge gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned PR is exempt from the external-contributor proof gate; its body supplies focused test evidence, while the pending checks remain a normal merge gate.
Evidence reviewed 6 items Current-main bug remains: Current main returns the inbound thread before consulting the channel resolver for implicit replies, and skips the resolver when no reply ID exists; either shortcut can compare against a different destination than delivery uses.
Narrow owner-boundary repair: The PR removes only those shortcuts and calls the existing resolver whenever configuration and a resolver are available.
Delivery uses the same resolver contract: Final routing passes configuration, account, inbound thread, reply ID, explicitness, and delivery policy to the channel resolver before outbound send.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 99.22 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.5s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 11.8s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 2730ms (slowest: built plugin control-plane loads 2262ms)

OpenClaw 2026.8.1 (930e3e4) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile ‹name›     Use a named profile (isol
… output truncated …

Assertions:

  • PASS expect_output: Usage: openclaw

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned reply-delivery semantics repair land once the exact-head checks complete? Land after exact-head validation: Merge once the current head’s required checks confirm the transport-aware deduplication contract.

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

  • Resolve merge risk (P1) - This changes message-delivery suppression semantics across the two adapters implementing reply-transport resolution; exact-head CI remains in progress and should complete before landing.
  • Complete next step (P2) - No mechanical repair is indicated; this protected maintainer-owned PR needs normal exact-head validation and maintainer judgment.
Agent review details

Security

None.

PR surface

Source -2, Tests +89. Total +87 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 4 -2
Tests 3 102 13 +89
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 104 17 +87

Review metrics

Metric Value Why it matters
Production versus test delta production −2 lines, tests +89 lines The bug repair removes two production bypasses while adding focused immediate and queued delivery regression coverage.

Merge-risk options

Maintainer options:

  1. Validate the exact head before merge (recommended)
    Let the pending exact-head checks complete, preserving the resolved-destination tests for immediate and queued replies.
  2. Pause for broader transport proof
    Defer landing if maintainers require additional real channel evidence beyond the resolver and boundary tests.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Wait for required exact-head checks to pass, then retain the transport-aware deduplication regression coverage.

Technical review

Best 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.

Labels

Label justifications:

  • P2: Incorrect duplicate suppression can create a duplicate reply or suppress the intended automatic reply, but the report establishes a bounded channel-delivery defect.
  • merge-risk: 🚨 message-delivery: Merging changes the route identity used to suppress automatic replies for adapters that resolve reply transport.
  • 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-owned PR is exempt from the external-contributor proof gate; its body supplies focused test evidence, while the pending checks remain a normal merge gate.

Evidence

What I checked:

Likely related people:

  • sandieman2: Authored the earlier merged route-scoped deduplication work identified by the provided PR context and local commit metadata. (role: feature introducer; confidence: high; commits: c67dc59b02b0; files: src/auto-reply/reply/reply-payloads-dedupe.ts)
  • steipete: Authored the repair head and is identified by local blame on the current deduplication owner boundary. (role: recent area contributor; confidence: high; commits: 930e3e4c5345; files: src/auto-reply/reply/reply-payloads-dedupe.ts, src/auto-reply/reply/reply-payloads-transport-dedupe.test.ts)

Rank-up moves

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

  • Let the pending exact-head checks complete before landing.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-27T00:29:18.575Z sha c23f68c :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

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: 930e3e4c5345b0e2de1d9f57c7944799a13a2738. CI run 33027771696 completed successfully. Full-priority review, independent review of the three-file repair, and the bounded final fixture review are clear.

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.ts

ClawSweeper'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.

@steipete
steipete merged commit b13993a into main Aug 27, 2026
206 of 208 checks passed
@steipete
steipete deleted the codex/fix-reply-transport-dedupe branch August 27, 2026 01:14
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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