Skip to content

fix(discord): honor persona text limits and preserve reply receipts - #144629

Merged
steipete merged 1 commit into
mainfrom
codex/fix-discord-webhook-text-limit
Sep 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-discord-webhook-text-limit

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where thread-bound Discord persona replies could exceed a caller's character limit after mention expansion, even though ordinary bot replies honored that limit. It also fixes missing reply-target metadata in the direct webhook delivery receipts and progress callbacks for chunked replies.

Why This Change Was Made

Both Discord transports now consume the character limit normalized by their existing shared text-preparation owner. The persona adapter forwards the caller's limit through to final webhook chunking, after formatting and mention expansion.

Webhook results now pass each physical chunk's reply reference to the canonical receipt constructor using its current contract. This replaces an ignored legacy property and preserves first-only, all-chunk, and absent reply scope in returned receipts and progress callbacks.

User Impact

Persona replies honor the caller's requested character cap after rendering, with the same normalization as bot replies. Their delivery receipts accurately retain the reply target selected for each chunk. Existing defaults, line limits, and requested webhook reply fields are preserved.

Evidence

  • The character-cap regression failed on the original webhook path while the bot control and 19 sibling cases passed. The repaired bot and webhook paths reconstruct the exact expanded message and keep every wire chunk within the 500-character cap.
  • Direct webhook receipt tests failed before the receipt repair for first-only and all-chunk replies, then passed with matching aggregate and progress-callback metadata. The no-reply control remains covered.
  • All 297 selected tests passed across six files, including durable delivery through the real local HTTP adapters, webhook activity, chunking, and ordinary bot sends.
  • All 25 checks selected by the changed-file gate passed, including extension and test type checks, lint, formatting, and plugin boundaries. A later documentation-only wording correction received its own formatting and diff checks.

Independent review completed two clean passes through P2 on the final source.

Transport proof uses synthetic loopback HTTP servers. It verifies requested webhook fields and receipt metadata; it does not establish whether Discord applies the existing webhook reply-reference field. No live Discord or Gateway send was run.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 docs Improvements or additions to documentation channel: discord Channel integration: discord size: S maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 03:35
@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 Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 11:43 PM ET / September 11, 2026, 03:43 UTC.

ClawSweeper review

What this changes

Makes Discord thread-persona replies honor caller-supplied character limits after formatting and mention expansion, and preserves each chunk’s reply target in delivery receipts.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still lacks both repairs. The patch follows the existing sender and receipt contracts, and no blocking correctness defect was found.

Priority: P2
Reviewed head: b1010579aa5712041aa353558943fed7f25bddd9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful boundary regression coverage and no blocking findings; the reported validation scope is clear.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from the external-contributor proof gate. Supplied evidence exercises durable delivery and the real webhook sender through loopback HTTP, checking caps and receipt metadata; it does not establish live Discord reply rendering.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from the external-contributor proof gate. Supplied evidence exercises durable delivery and the real webhook sender through loopback HTTP, checking caps and receipt metadata; it does not establish live Discord reply rendering.
Evidence reviewed 9 items Current main still needs the repair: Comparing the four production files against fetched main shows the same focused changes as the introduced patch: main does not forward the persona character cap and still supplies the ignored replyToId property to the receipt constructor.
Shared normalization and canonical receipt contract: The bot sender retains its existing finite-number normalization, now shared with the webhook sender. The webhook constructs each receipt from the already-selected physical reply reference, matching createDiscordSendResult and the bot progress callback.
Focused production-boundary regression coverage: The durable test drives registered Discord delivery through real senders and loopback HTTP, checking exact expanded text and a 500-character cap for bot and webhook paths. Direct webhook tests compare requested reply fields with aggregate and progress receipts for first, all, and absent reply scope. These tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

OpenClaw’s Discord plugin turns agent replies into bot messages or thread-persona webhook messages. Its senders format and split outgoing text, then return delivery receipts to shared delivery tracking.

flowchart TD
  A[Agent reply and caller limits] --> B[Discord outbound adapter]
  B --> C[Bot sender]
  B --> D[Thread persona webhook sender]
  C --> E[Shared formatting and mention expansion]
  D --> E
  E --> F[Sender character and line limits]
  F --> G[Discord HTTP delivery]
  G --> H[Per-chunk receipts and progress]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +7, Tests +55, Docs +2. Total +64 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 16 9 +7
Tests 2 56 1 +55
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 74 10 +64

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +7 lines; tests net +55 lines The small production increase forwards an existing limit and reuses its normalization, while the tests cover both transports and three reply scopes.

Technical review

Best possible solution:

Keep final text limits with Discord’s senders and record each physical chunk’s selected reply target through the existing receipt owner.

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

Yes, from source: expand thirty mention aliases under a 500-character caller cap, or inspect receipts for chunked webhook replies. Current main omits the cap and passes a receipt property the constructor does not consume; no runtime reproduction was executed here.

Is this the best way to solve the issue?

Yes. The patch repairs the existing adapter-to-sender handoff and uses the canonical receipt contract, preserving defaults and avoiding another formatting or reply-policy owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs bounded Discord persona chunking and receipt defects without evidence of an urgent widespread outage.
  • 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: The verified repository-admin author is exempt from the external-contributor proof gate. Supplied evidence exercises durable delivery and the real webhook sender through loopback HTTP, checking caps and receipt metadata; it does not establish live Discord reply rendering.

Label justifications:

  • P2: This repairs bounded Discord persona chunking and receipt defects without evidence of an urgent widespread outage.
  • 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: The verified repository-admin author is exempt from the external-contributor proof gate. Supplied evidence exercises durable delivery and the real webhook sender through loopback HTTP, checking caps and receipt metadata; it does not establish live Discord reply rendering.

Evidence

What I checked:

  • Current main still needs the repair: Comparing the four production files against fetched main shows the same focused changes as the introduced patch: main does not forward the persona character cap and still supplies the ignored replyToId property to the receipt constructor. (extensions/discord/src/send.webhook.ts:158, ae94766f288b)
  • Shared normalization and canonical receipt contract: The bot sender retains its existing finite-number normalization, now shared with the webhook sender. The webhook constructs each receipt from the already-selected physical reply reference, matching createDiscordSendResult and the bot progress callback. (extensions/discord/src/send.webhook.ts:227, b1010579aa57)
  • Focused production-boundary regression coverage: The durable test drives registered Discord delivery through real senders and loopback HTTP, checking exact expanded text and a 500-character cap for bot and webhook paths. Direct webhook tests compare requested reply fields with aggregate and progress receipts for first, all, and absent reply scope. These tests were inspected, not executed during this read-only review. (extensions/discord/src/durable-line-limit.test.ts:175, b1010579aa57)
  • Captured proof scope: The supplied PR body reports before/after failures, 297 passing selected tests, and 25 passing changed-file checks. It explicitly limits proof to synthetic loopback HTTP and does not claim a live Gateway or Discord send, or that Discord applies the existing webhook reply-reference field. (b1010579aa57)
  • Latest supplied release lacks caller-cap forwarding: The webhook source at the supplied v2026.9.3 release commit has no caller character-limit option and chunks only with the default character limit. Local release-object inspection failed with a promisor-fetch HTTP 403; the GitHub contents API successfully supplied the source at that exact commit. (extensions/discord/src/send.webhook.ts, 1391f7cd2d40)
  • Verified shared-owner history: Main history and blame identify the shared text-preparation work. Comparing its commit against its raw recorded parent confirms the module was added there; the unchanged rendering line remains at line 20 in the reviewed checkout. (extensions/discord/src/outbound-text.ts:20, 32379732c836)

Likely related people:

  • Peter Steinberger: Raw commit 3237973 adds extensions/discord/src/outbound-text.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 32379732c836; files: extensions/discord/src/outbound-text.ts)
  • anyech: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 7890ce9 into main Sep 11, 2026
211 checks passed
@steipete
steipete deleted the codex/fix-discord-webhook-text-limit branch September 11, 2026 03: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 docs Improvements or additions to documentation 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