Skip to content

fix(discord): retain attachment-only reply context - #126204

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-discord-attachment-replies
Aug 19, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/fix-discord-attachment-replies

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where replying to an attachment-only Discord message omitted the referenced message context, so the model received the media without a useful quoted-message identity.

Why This Change Was Made

Keep hydrated attachment/sticker-only references as typed reply context and project message ID/sender metadata even when the referenced text body is empty. Visibility and self-quote gates remain unchanged.

User Impact

Discord replies to images or other attachment-only messages now preserve the referenced sender/message context and media association.

Evidence

  • 102 focused Discord/inbound metadata tests passed.
  • node scripts/check-changed.mjs passed.
  • Autoreview clean.
  • Production LOC +16/-7 (net +9); tests +75.
  • AI-assisted; maintainer reviewed the implementation and proof.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 19, 2026 05:39
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: S maintainer Maintainer-authored PR labels Aug 19, 2026
@clawsweeper clawsweeper Bot added 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 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 6:44 PM ET / 22:44 UTC.

ClawSweeper review

What this changes

The PR retains Discord reply identity and referenced attachment or sticker media when the replied-to message has no text body.

Regression provenance

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

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness finding: the patch repairs the reply-context producer and preserves existing visibility and self-quote gates. This maintainer-owned, protected PR should remain open for explicit maintainer review after exact-head CI completes.

Priority: P2
Reviewed head: dc817b01216543e366691e490bf8d4458299a68d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-backed repair with useful boundary tests and no blocking review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work, so the external-contributor real-behavior-proof gate does not apply; exact-head CI remains required before landing.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work, so the external-contributor real-behavior-proof gate does not apply; exact-head CI remains required before landing.
Evidence reviewed 5 items Current-main manifestation: Current main rejects a hydrated referenced message when its resolved text is empty, before the existing lazy referenced-media resolver can run.
Owner-boundary repair: The PR permits visible attachments or stickers to form reply context, while the existing inbound-context path still applies visibility and self-quote suppression before projecting reply fields and media.
Focused behavioral coverage: The added Discord process test exercises an attachment-only referenced message through dispatch and asserts reply ID, sender, absent body, referenced-media message ID, and one fetch; the prompt test verifies body-less reply metadata is rendered without creating an empty reply block.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/discord/src/monitor/message-handler.process.session-routing.test.ts

Result: FAIL (partial) — step 2 expect_output Test Files: expected terminal output was not visible within 30 seconds: "Test Files"

runner@runnervmzvulz:/tmp/clawsweeper-live-proof-126204-TYjTrp/target$ node scripts/run-vitest.mjs extensions/discord/src/monitor/message-handler.process.sessio
n-routing.test.ts
[test] starting test/vitest/vitest.extension-discord.config.ts
node scripts/run-vitest.mjs extensions/discord/src/monitor/message-handler.process.session-routing.test.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126204-TYjTrp/target

[vitest] still running with no output for 30000ms (test/vitest/vitest.extension-discord.config.ts).











































Assertions:

  • FAIL expect_output: Test Files

How this fits together

Discord inbound processing hydrates a referenced message, applies reply visibility and self-quote policy, then passes reply metadata and media through the shared inbound-context builder to the agent prompt. The change preserves context for media-only referenced messages.

flowchart LR
  A[Discord reply event] --> B[Hydrated referenced message]
  B --> C[Reply context eligibility]
  C --> D[Visibility and self-quote gates]
  D --> E[Shared inbound context builder]
  E --> F[Agent prompt metadata]
  E --> G[Referenced media facts]
Loading

Decision needed

Question Recommendation
May this protected maintainer-owned Discord fix land once exact-head required checks are green? Land after exact-head CI: Merge the focused fix once required checks complete successfully on dc817b0.

Why: The maintainer label and maintainer authorship require an explicit human merge decision despite the clean code review.

Before merge

  • Resolve merge risk (P1) - Production code is net +9 lines for the newly represented media-only reply state; this is justified by preserving typed reply identity and media association, but should remain limited to that owner-boundary representation.
  • Complete next step (P2) - Protected maintainer-owned PR awaiting explicit merge judgment and exact-head CI; no mechanical repair is indicated.
Agent review details

Security

None.

PR surface

Source +9, Tests +75. Total +84 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 16 7 +9
Tests 2 75 0 +75
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 91 7 +84

Review metrics

Metric Value Why it matters
Production vs test LOC production +16/-7 (net +9); tests +75 The added production state is confined to reply-context eligibility and metadata projection; tests cover both dispatch and prompt rendering.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/auto-reply/reply/inbound-meta.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused owner-boundary repair after exact-head CI is green; no separate core or plugin API path is needed.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused owner-boundary repair after exact-head CI is green; no separate core or plugin API path is needed.

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

Yes, from source: current main drops an empty-body referenced message at extensions/discord/src/monitor/reply-context.ts:29, and the added dispatch fixture supplies that exact attachment-only shape.

Is this the best way to solve the issue?

Yes. Extending the existing Discord reply-context producer and shared metadata projection is narrower and more maintainable than adding a parallel channel or core path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 841f25eae629.

Labels

Label justifications:

  • P2: This fixes a bounded Discord inbound-context regression with no evidence of broader runtime or delivery failure.
  • 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 is maintainer-authored work, so the external-contributor real-behavior-proof gate does not apply; exact-head CI remains required before landing.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the current-main reply-context introduction and the proposed repair; blame ties the affected guard to that prior work. (role: recent reply-context owner; confidence: high; commits: 7c1779e6e3a8, dc817b012165; files: extensions/discord/src/monitor/reply-context.ts, extensions/discord/src/monitor/message-handler.context.ts, src/auto-reply/reply/inbound-meta.ts)

Rank-up moves

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

  • Wait for required exact-head CI checks to complete green before merge.

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 (2 earlier review cycles)
  • reviewed 2026-08-19T05:46:40.633Z sha 31caa6d438481511b41745dcfdb017e2ee59f0aa :: needs maintainer review before merge. :: none
  • reviewed 2026-08-19T11:41:40.322Z sha 391d185 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/fix-discord-attachment-replies branch 2 times, most recently from 1917005 to 391d185 Compare August 19, 2026 09:05
@steipete
steipete force-pushed the steipete/fix-discord-attachment-replies branch from 391d185 to dc817b0 Compare August 19, 2026 22:39
@steipete
steipete merged commit 2fe6c02 into main Aug 19, 2026
222 checks passed
@steipete
steipete deleted the steipete/fix-discord-attachment-replies branch August 19, 2026 22:55
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR 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