Skip to content

fix(reply): deduplicate rendered side-question replies correctly - #129304

Closed
steipete wants to merge 1 commit into
mainfrom
codex/qa-followup-structured-dedupe-20260825
Closed

steipete wants to merge 1 commit into
mainfrom
codex/qa-followup-structured-dedupe-20260825

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Compare the user-visible rendered /btw reply before suppressing already-sent follow-up text.
  • Preserve genuinely new side questions even when their ordinary base text was previously sent by a message tool.
  • Keep existing fuzzy duplicate matching and the previously repaired pin, location, interactive, and presentation contracts intact.

Root cause

The shared auto-reply/follow-up deduplication owner compared only raw base text, while /btw prepends a separately visible question and answer. It could therefore suppress a brand-new side question entirely, or fail to recognize already-rendered /btw output. The existing command-delivery sibling already uses the canonical externally rendered representation.

Validation

  • Authentic production follow-up through the actual channel/durable-outbound boundary previously recorded zero deliveries for a new /btw side question.
  • Additional regressions cover already-rendered exact and fuzzy duplicates and preserve ordinary text, required operations, media, locations, and interactive replies.
  • Six focused reply/follow-up/channel/command sibling suites: 281 tests passed with one preexisting skipped case.
  • Focused type-aware lint, repository formatter, changed-lane classification, git diff --check, and fresh independent Codex autoreview must pass on the final exact diff.
  • Production growth is limited to importing the existing canonical renderer; no protocol, config, persistence, or security changes.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 25, 2026
@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR compares the rendered /btw side-question reply with prior message-tool sends so an already-sent answer does not suppress a new question.

Example: A side question asks “What changed?” after a message tool sends “The image is ready for review”.

  • Before: The follow-up is discarded because its answer text was already sent.
  • After: The channel receives “BTW\nQuestion: What changed?\n\nThe image is ready for review”.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful owner-level work with meaningful harness coverage, limited by an unresolved containment regression and mock-only behavior evidence.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes
User problem: A new side question can disappear because its answer repeats text already delivered by a message tool.
Reason: Preserving a separately visible question repairs an established delivery contract. Prior merged contributions establish area ownership and the existing intent to preserve unsent content.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 3 items remain

This PR remains useful: current main and the latest stable release retain the reported behavior, and related work does not supersede it. The previously reported duplicate-delivery finding remains unresolved; the maintainer label also prevents cleanup closure.

Priority: P2
Reviewed head: 14ef3be7cea4a897e929b33ddcd08e4c36556e6e

Before merge

  • Preserve containment matches for already-rendered side replies (P2) - For a same-route prior send of Here is the answer:\nBTW\nQuestion: What changed?\n\nThe image is ready for review and the complete report is attached., the corresponding side-question payload now survives because normalized equality fails. The existing containment rule suppresses this already-delivered answer, and the complete rendered reply occupies more than half of the send. Retain containment when the prior send includes the full rendered reply and add a wrapper regression. Applying the bidirectional helper unconditionally would suppress the new-question long-answer case already covered by this PR. This is the previously reported, still-unfixed finding.
  • Complete next step - Resolve the reported merge conflict using current main's renderer location and retain its existing delivery-accounting behavior.
  • Explain or restore the original intent of src/auto-reply/reply/reply-payloads-dedupe.ts: text duplicate predicate - fix(agents): stop messaging dedupe from dropping final replies that quote a short tool send #118178: Use proportional containment to preserve substantial new answers while retaining suppression of short wrappers and restatements.

Findings

  • [P2] Preserve containment matches for already-rendered side replies — src/auto-reply/reply/reply-payloads-dedupe.ts:422-426

Provenance

Tests

  • Missing end-to-end proof: Show after-fix side-question delivery and wrapped-rendered-repeat suppression through a real channel or qualifying mock-gateway run; base/head failures were not independently executed here.
Agent review details

How this fits together

OpenClaw prepares agent replies for delivery to messaging channels. Its shared deduplication layer checks prior sends to the same conversation before passing remaining replies to channel delivery.

flowchart LR
  A[Agent reply payload] --> B[Render side question]
  C[Prior message-tool sends] --> D[Match conversation route]
  B --> E[Compare delivered text]
  D --> E
  E --> F[Preserve remaining content]
  F --> G[Channel delivery]
Loading

Technical review

Best possible solution:

Use the canonical renderer and shared comparison owner to retain containment when a prior send includes the complete rendered reply, while preserving newly visible questions.

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

Yes, source establishes the path: a same-route tool send of the answer suppresses a new side-question payload on current main. The introduced equality comparison also retains wrapped rendered duplicates; neither scenario was executed in this read-only review.

Is this the best way to solve the issue?

No. Rendering before comparison is the correct owner-level direction, but equality loses established containment behavior; using the bidirectional helper unchanged would instead suppress new questions with long answers.

Full review comments:

  • [P2] Preserve containment matches for already-rendered side replies — src/auto-reply/reply/reply-payloads-dedupe.ts:422-426
    For a same-route prior send of Here is the answer:\nBTW\nQuestion: What changed?\n\nThe image is ready for review and the complete report is attached., the corresponding side-question payload now survives because normalized equality fails. The existing containment rule suppresses this already-delivered answer, and the complete rendered reply occupies more than half of the send. Retain containment when the prior send includes the full rendered reply and add a wrapper regression. Applying the bidirectional helper unconditionally would suppress the new-question long-answer case already covered by this PR. This is the previously reported, still-unfixed finding.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7089be259960.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +12, Tests +62. Total +74 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 18 6 +12
Tests 2 62 0 +62
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 80 6 +74

Review metrics

Metric Value Why it matters
Production versus test LOC production +18/-6 (net +12); tests +62/-0 Rendered-text handling belongs in the existing shared owner; the added tests cover new questions and rendered repeats without adding production test seams.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The item addresses a bounded reply-suppression bug and retains a concrete duplicate-delivery regression.
  • merge-risk: 🚨 message-delivery: Normalized equality can deliver a side-question reply again when a prior same-route send contains its complete rendered text inside a short wrapper.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The shared change affects whether Telegram users receive a visible side-question reply or a duplicate, which the Telegram Test Server can observe.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (5 earlier review cycles)
  • reviewed 2026-08-25T12:13:36.642Z sha 14ef3be :: found issues before merge. :: [P2] Preserve fuzzy matches for rendered side-question replies
  • reviewed 2026-08-25T12:55:25.562Z sha 14ef3be :: needs changes before merge. :: [P2] Preserve fuzzy matches for rendered side-question replies
  • reviewed 2026-08-29T03:33:22.505Z sha 14ef3be :: found issues before merge. :: [P2] Preserve fuzzy matches for rendered side-question replies
  • reviewed 2026-09-04T17:39:51.480Z sha 14ef3be :: blocked before merge. :: [P2] Preserve fuzzy matches for rendered side-question replies
  • reviewed 2026-09-25T20:57:26.885Z sha 14ef3be :: blocked before merge. :: [P2] Preserve containment matches for already-rendered side replies

Reviewed October 9, 2026, 10:37 AM ET / 14:37 UTC (Revision 6).

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Replaced by #174869, now merged as 4464c57dcdbdabaeeeea14112d6935aeed70edaf.

The replacement preserves this PR’s intent at the current shared deduplication owner: compare the complete canonical side-question rendering, so a new question is not lost merely because its answer was already sent, while an already-delivered short answer is suppressed. Ordinary replies retain fuzzy matching; route scoping, non-text content, and terminal-delivery callbacks are unchanged.

Verification: 139 focused tests passed (one existing skip), fresh independent review found no actionable defects, and exact-head CI 38985068830 completed with 42 successful jobs and 28 skips. I independently reconstructed the merge from its actual parent and reviewed head; the tree exactly matches the landed commit and is contained in main. No live external messages were sent.

@RomneyDa
RomneyDa deleted the codex/qa-followup-structured-dedupe-20260825 branch October 22, 2026 05:30
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. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants