Repository navigation
fix(discord): honor configured line limits in durable sends - #137969
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 8:16 PM ET / September 11, 2026, 00:16 UTC (Revision 8). ClawSweeper reviewWhat this changesDiscord durable sends defer implicit line limits to the account-aware senders while preserving explicit overrides, legacy webhook calls, and reply-reference scope. Merge readiness✅ Ready for maintainer review This remains a useful, bounded repair: current main and the latest release retain the premature split. Earlier findings are addressed, compatibility is explicitly discussed, and the supplied packaged-Gateway proof supports the changed behavior. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s outbound planner passes replies to the Discord plugin, which turns them into bot or bound-thread webhook messages. Line-limit resolution determines how that text becomes physical Discord messages. flowchart TD
A[Reply text and formatting] --> B[Outbound planner]
B --> C[Discord adapter]
C --> D[Bot sender]
C --> E[Bound-thread webhook sender]
F[Selected account settings] --> D
F --> E
D --> G[Bounded Discord messages]
E --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +20, Tests +277. Total +297 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep account-aware line-limit resolution in Discord’s senders, with explicit formatting taking precedence and legacy webhook omission semantics preserved. Do we have a high-confidence way to reproduce the issue? Yes. Current source shows that a short 20-line durable send with an account limit of 50 is split by the adapter’s implicit 17-line default before reaching the account-aware sender; supplied baseline HTTP traces corroborate this. Is this the best way to solve the issue? Yes. Deferring implicit limits to the existing Discord senders repairs the owning boundary without expanding generic chunker context, while the optional webhook argument preserves existing callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 46f1b8d5cce5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
9f517cb to
d97b25a
Compare
d97b25a to
eace22a
Compare
eace22a to
0ab3bcd
Compare
|
@clawsweeper re-review Maintainer landing requested for this reviewed revision. Refreshing the older review while the native landing checks run. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer landing validation for Existing Fresh paired HTTP-boundary proof, changing only the two production files between frozen baseline
Baseline: 5 failed, 14 passed, all intended split assertions. Restored candidate: 19 passed. Original source bytes and clean working tree verified after restoration. Broader focused run: 132 tests across seven files passed, including legacy webhook calls, default 17, explicit formatting, first/all references, code fences/character cap, partial receipts, retries and timeouts. node scripts/run-vitest.mjs run extensions/discord/src/durable-line-limit.test.ts
node scripts/run-vitest.mjs run extensions/discord/src/durable-line-limit.test.ts extensions/discord/src/durable-delivery.test.ts extensions/discord/src/outbound-adapter.test.ts extensions/discord/src/send.webhook.chunk-limit.test.ts extensions/discord/src/send.webhook.proxy.test.ts extensions/discord/src/send.webhook.timeout.test.ts extensions/discord/src/monitor/reply-delivery.test.tsFresh autoreview: scoped-clean at default P0. Independent compatibility review inspected current main, stable v2026.9.2, legacy callers, bot/media/forum siblings, shared planning, SDK exports and Discord API contract. Main and stable retain the premature adapter split. Source-change evidence: direct commit 5e640b93dae6, April 25, author/committer @steipete, replaced No unresolved non-outdated review threads. The latest ClawSweeper review has no Rank-up moves list; the required age-based refresh is requested. Exact-head hosted CI freshness rerun: https://github.com/openclaw/openclaw/actions/runs/34545340704 . Native prepare/merge will wait for green gates. Real-behavior proof reuses the PR's exact-candidate packaged mock-Gateway runs: bot/account [20], webhook/default [17,3], webhook/account [20], exact text and terminal sent status preserved. This is not a fresh authenticated Discord test. Third-party consumer packages were not run. Existing webhook CI recovery: the old rerun remained queued without jobs; closing/reopening the PR triggered this fresh run on the unchanged tested commit. |
|
Merged via squash.
|
…claw#137969) Co-authored-by: OpenClaw Assistant <[email protected]>
Closes #91860
Related: #120249
What Problem This Solves
Durable Discord replies were split at the adapter's implicit 17-line limit before the selected account's configuration reached the sender. Bound-thread webhook sends also need to preserve the default, configured, and explicit line-limit behavior when planning defers that decision.
Why This Change Was Made
Keep line-limit resolution with the Discord senders. The adapter defers only an implicit limit; explicit per-send formatting still takes precedence. The webhook sender reuses its already-resolved account instead of introducing another configuration resolver. Calls that omit chunk options retain their existing character-only chunking contract.
Reuse the existing reply-reference helpers across physical webhook chunks: implicit first-mode replies attach once, while explicit replies and all-mode retain their existing scope. Preserve already-accepted partial deliveries.
Production changes are limited to two Discord files (+26/-6, net +20 lines). The shared chunker/SDK and configuration schema are unchanged. Existing text preparation, character caps, retry behavior, and timeout ownership are preserved.
User Impact
Bot and bound-thread webhook delivery honor default, root, selected-account, and per-send limits. No configured override still means 17 lines. Structured fallback text receives the same account-aware handling; thread and persona behavior remain intact.
Evidence
0ab3bcd238d2df022afb25a574e9cd5ddb5965b30d25c9b48f68f0bf2a69002184281a6427be69dd1029e3870f23315812565cc02d0504a208173697was clean.pnpm buildpassed on the exact committed candidate; package build metadata matched its SHA.Real behavior proof
Behavior addressed: Premature durable-reply splitting and loss of the webhook default/configured line-limit owner.
Real setup tested: The exact freshly built candidate ran as three isolated ephemeral Gateways using a mock OpenAI-compatible provider and a loopback Discord REST endpoint. This exercises Gateway final delivery through the packaged Discord adapter and bot/webhook senders to actual HTTP POSTs. Dependencies are deliberately mocked; this is not a live Discord test.
Exact steps or command run after this patch: After
pnpm build, ran a temporary QA harness withOPENCLAW_E2E_SKIP_BUILD=1 node scripts/run-vitest.mjs test/e2e/qa-lab/plugins/discord-durable-line-limit.mock-gateway.e2e.test.ts. Each scenario submitted an exact 20-line final reply through the Gateway agent API, waited for terminal delivery, and inspected HTTP bodies. The harness was archived and removed from the checkout afterward; it is not a shipped test in this PR.Evidence after fix:
{ "verdict": "PASS", "candidateHead": "0ab3bcd238d2df022afb25a574e9cd5ddb5965b3", "inputLineCount": 20, "scenarios": [ { "scenario": "bot-account", "observedLineCounts": [ 20 ], "payloadPreservedExactly": true, "terminalDelivery": { "status": "sent", "resultCount": 1 } }, { "scenario": "webhook-default", "observedLineCounts": [ 17, 3 ], "payloadPreservedExactly": true, "terminalDelivery": { "status": "sent", "resultCount": 1 } }, { "scenario": "webhook-account", "observedLineCounts": [ 20 ], "payloadPreservedExactly": true, "terminalDelivery": { "status": "sent", "resultCount": 1 } } ] }Observed result after fix: The three scenarios produced
[20],[17, 3], and[20]lines respectively. All preserved the exact text and reported terminal deliverysent. Both webhook scenarios verified the thread query and configured persona. Loaded adapter/sender hashes were unchanged before and after the runs, and all test listeners were stopped.What was not tested: No production Gateway, real credentials, or live Discord account was used. Media, forum creation, and actual Discord-service acceptance were not tested. Physical reply-reference scope, explicit formatting, code fences, and failure/retry cases are covered by focused regression tests rather than these three packaged-Gateway scenarios.
Reproducible regression coverage
Result: 132 tests across seven files passed. Coverage includes default/root/account/explicit limits, structured fallback text, first/all reply scope, fenced text and the 2000-character cap, already-planned webhook callers, retries/timeouts, and partial outcomes.
Relationship to #120249
The open alternative addresses the same report by expanding shared chunker context. This PR keeps the repair within Discord's senders without expanding the SDK. It updates the existing contribution rather than opening another competing PR.