Skip to content

fix(discord): honor maxLinesPerMessage for CLI sends - #120249

Closed
clawsweeper[bot] wants to merge 1 commit into
mainfrom
clawsweeper/issue-openclaw-openclaw-91860
Closed

clawsweeper[bot] wants to merge 1 commit into
mainfrom
clawsweeper/issue-openclaw-openclaw-91860

Conversation

@clawsweeper

@clawsweeper clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Carry the existing config and account facts through generic outbound chunker calls.
  • Resolve Discord's effective maxLinesPerMessage in the Discord plugin before line-based splitting.
  • Preserve explicit formatting overrides, character limits, default 17-line behavior, and bound-thread webhook delivery.

Validation

  • Cover a 20-line durable/CLI payload for root, default-account, explicit-account, default-17, and bound-webhook cases.
  • Run the focused outbound and Discord tests, git diff --check, and pnpm check:changed.

Release note

Discord CLI message sends now honor the configured maxLinesPerMessage before they are split.

Fixes #91860

@clawsweeper clawsweeper Bot added clawsweeper Tracked by ClawSweeper automation clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge labels Aug 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added the channel: discord Channel integration: discord label Aug 7, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex review: found issues before merge. Reviewed September 2, 2026, 12:50 PM ET / 16:50 UTC.

ClawSweeper review

What this changes

The PR carries configuration and selected-account context into outbound chunking so Discord CLI sends honor the configured maxLinesPerMessage.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

The PR still fixes the linked Discord CLI chunking bug, but it cannot merge cleanly with current main and leaves a public chunker-context contract undocumented. Rebase and repair it before exact-head review.

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

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair intent is sound, but the historical branch is conflicted and its public contract documentation remains incomplete.
Proof confidence 🌊 off-meta tidepool Not applicable: This bot-authored PR is exempt from the external-contributor proof gate; its focused tests are supplemental and the required action is safe reconciliation with current main.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This bot-authored PR is exempt from the external-contributor proof gate; its focused tests are supplemental and the required action is safe reconciliation with current main.
Evidence reviewed 7 items Current-main bug remains: Current main gives the generic planner only formatting context, so an ordinary CLI send has no configured Discord line limit available before chunking.
Discord default and owner resolution: The adapter receives only formatting context and the Discord chunker defaults to 17 lines, while account configuration is resolved later by the transport and cannot rejoin already split chunks.
Introduced repair follows owner boundary: The PR forwards existing config/account facts through core and resolves the effective line limit inside the Discord plugin, preserving an explicit per-send formatting override.
Findings 1 actionable finding [P3] Document the expanded chunker context
Security None None.

How this fits together

Outbound delivery converts CLI or agent payloads into channel-specific chunks before sending them. This change passes known configuration and account facts from the generic planner to Discord’s chunker.

flowchart LR
  A[CLI or agent payload] --> B[Outbound delivery planner]
  B --> C[Chunker context]
  C --> D[Discord line-limit resolution]
  D --> E[Discord message send]
Loading

Decision needed

Question Recommendation
Should this bot-authored repair be rebased onto the current outbound architecture before merge, or should the linked issue remain open for a new current-main fix? Rebase and repair: Reapply the narrow owner-boundary fix, preserve current-main fallback behavior, document the public context, and request exact-head review.

Why: The branch conflicts across every production seam and current main has material delivery changes that must be preserved; the existing human-review label requires maintainer handling.

Before merge

  • Document the expanded chunker context (P3) - This public raw-adapter context now includes cfg and accountId, but the SDK guide only describes ctx.formatting. This was already requested on the same reviewed head and remains unaddressed; document the optional fields and that explicit formatting wins so plugin authors can safely opt in.
  • Resolve merge risk (P2) - The dirty merge intersects current-main delivery behavior, so resolving conflicts mechanically could drop the newer empty-chunker fallback or reply/delivery safeguards.
  • Resolve merge risk (P1) - The additive public chunker context is undocumented, leaving third-party channel adapters without a stable description of config, account selection, and formatting precedence.
  • Complete next step (P2) - Rebase the repair onto current main, preserve current fallback and delivery behavior, document the expanded chunker context, and obtain exact-head review before merge.

Findings

  • [P3] Document the expanded chunker context — src/channels/plugins/outbound.types.ts:155-158
Agent review details

Security

None.

PR surface

Source +17, Tests +157. Total +174 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 29 12 +17
Tests 4 161 4 +157
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 190 16 +174

Review metrics

Metric Value Why it matters
Production and test delta production +29/-12, tests +161/-4 The production change carries existing request facts across the core-to-plugin boundary; tests cover root, default-account, explicit-account, default-limit, and webhook delivery paths.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #91860
Summary: This PR explicitly presents itself as the candidate repair for the linked Discord CLI line-limit issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Rebase the delivery repair (recommended)
    Resolve the current-main conflicts while preserving fallback and delivery semantics, then document and validate the expanded plugin chunker context.
  2. Pause for a new fix
    Pause this conflicted branch if the intended repair cannot be reconciled without broader contract changes.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Rebase onto current main, preserve current fallback and delivery behavior, document optional cfg and accountId plus formatting precedence in the raw chunker contract, then request exact-head review.

Technical review

Best possible solution:

Reapply the narrow config/account propagation to current main, retain current delivery safeguards, and document the optional raw-adapter context and formatting precedence before exact-head review.

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

Yes—source-reproducible: current main splits through the generic chunker before Discord's selected-account configuration is resolved, reproducing the reported 17-line default path without executing a live send.

Is this the best way to solve the issue?

No as submitted for merge: the intended owner-boundary fix is appropriate, but the branch must be reconciled with current main and document its public adapter contract.

Full review comments:

  • [P3] Document the expanded chunker context — src/channels/plugins/outbound.types.ts:155-158
    This public raw-adapter context now includes cfg and accountId, but the SDK guide only describes ctx.formatting. This was already requested on the same reviewed head and remains unaddressed; document the optional fields and that explicit formatting wins so plugin authors can safely opt in.
    Confidence: 0.98
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is correct
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1623683f478b.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: The PR targets a Discord CLI configuration mismatch with channel-specific blast radius.
  • merge-risk: 🚨 compatibility: It expands the public channel-adapter chunker context and currently conflicts with newer outbound behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Evidence

What I checked:

  • Current-main bug remains: Current main gives the generic planner only formatting context, so an ordinary CLI send has no configured Discord line limit available before chunking. (src/infra/outbound/deliver-core.ts:162, 1623683f478b)
  • Discord default and owner resolution: The adapter receives only formatting context and the Discord chunker defaults to 17 lines, while account configuration is resolved later by the transport and cannot rejoin already split chunks. (extensions/discord/src/outbound-adapter.ts:126, 1623683f478b)
  • Introduced repair follows owner boundary: The PR forwards existing config/account facts through core and resolves the effective line limit inside the Discord plugin, preserving an explicit per-send formatting override. (extensions/discord/src/outbound-adapter.ts:140, f2dc4662d1e7)
  • Public contract needs documentation: The public raw-adapter guide says the optional chunker context carries formatting, while this PR adds optional config and account fields without updating that description. Public docs: docs/plugins/sdk-channel-plugins.md. (docs/plugins/sdk-channel-plugins.md:879, f2dc4662d1e7)
  • Merge result is conflicted: A three-way merge against fetched current main conflicts in all five production repair seams, including current-main empty-chunker fallback behavior; GitHub likewise reports the PR as dirty. (f2dc4662d1e7)
  • Recent ownership history: Recent main work on Discord outbound delivery includes the webhook reply and delivery-outcome repair, supporting routing to the current Discord/outbound owner. Exact source-line introduction could not be verified because required promisor blobs could not be fetched during the read-only history check. (extensions/discord/src/outbound-adapter.ts, 58af1daa457a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • gaoanze888: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Rebase the narrow repair onto current main while retaining resolveTextChunksWithFallback and current delivery safeguards.
  • Document optional cfg and accountId plus formatting precedence for raw channel chunkers.
  • Request one exact-head review after the conflicts and documentation finding are resolved.

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 (4 earlier review cycles)
  • reviewed 2026-08-07T15:47:25.493Z sha f2dc466 :: passed. :: none
  • reviewed August 19, 2026, 7:53 PM ET / 23:53 UTC sha unknown :: found issues before merge. :: [P1] Do not close the CLI issue from the durable-only path | [P3] Document the expanded chunker context
  • reviewed August 19, 2026, 8:06 PM ET / August 20, 2026, 00:06 UTC sha unknown :: found issues before merge. :: [P3] Document the raw chunker context
  • reviewed 2026-08-27T12:17:08.207Z sha f2dc466 :: needs historical verification review before merge. :: [P3] Document the chunker configuration context

@clawsweeper clawsweeper Bot added the clawsweeper:human-review Needs maintainer review before ClawSweeper can continue label Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

🦞✅
ClawSweeper is pausing this repair loop for human review.

Source: clawsweeper[bot]
Reason: - [ ] Resolve merge risk (P1) - The patch additively expands the public ChannelOutboundAdapter chunker context with configuration and account facts; existing plugins remain source-compatible, but the channel-contrac... (sha=f2dc4662d1e72d6a46547ad32ca7dc8a889ffb5a)

Why human review is needed:
ClawSweeper found a blocker that should be resolved or accepted by a maintainer before the repair or automerge loop continues.

What the maintainer can do as a next step:
If the maintainer accepts the current risk and wants ClawSweeper to continue merge gates, comment @clawsweeper approve. If more work is needed, resolve the blocker first, then comment @clawsweeper automerge to re-review and continue. If automation should stay paused, leave clawsweeper:human-review in place or comment @clawsweeper stop.

I added clawsweeper:human-review and left the final call with a maintainer.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 20, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 2, 2026
@anyech

anyech commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fresh reviewer signal from an OpenClaw 2026.9.1 cron/direct-delivery reproduction:

  • Five independent scheduled command payloads of 18–29 lines and 730–1,657 UTF-16 code units, all below Discord's 2,000-character limit, were split into two platform messages at the default 17-line boundary despite maxLinesPerMessage=200 resolving correctly in the Discord adapter.
  • Current source tracing confirms the same pre-send seam addressed by this PR: the generic planner reaches the channel chunker without configuration/account context, while Discord resolves the effective account setting only later in the send path.

This is fresh before-fix evidence only; I did not apply this PR to the deployment. It supports retaining the existing owner-boundary design rather than opening a parallel fix. The least-noisy next step looks like rebasing this focused repair onto current main, preserving the newer outbound fallback/delivery safeguards, documenting the optional chunker context and formatting precedence, and then rerunning exact-head tests/review.

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Superseded by the merged Discord sender-owned repair in #137969: d6be5810d9edfcb606b89f23bccf03e94583694e.

Both PRs address #91860: the durable planner splits at the implicit 17-line limit before the selected Discord account can apply its existing setting. The landed repair keeps that resolution with the Discord bot/webhook senders and preserves explicit overrides and legacy webhook callers without expanding the shared SDK chunker context.

Paired HTTP-boundary proof and compatibility review: baseline has five intended split failures; the landed source passes all 19 boundary cases and 132 focused tests, with fresh CI green. Root/account/default/explicit limits, structured fallback and bound-thread webhooks are covered. The canonical issue is now closed by the merge.

Closing this alternative implementation as superseded. A new report with a concrete durable/CLI or webhook configuration that still splits incorrectly on the landed source would warrant follow-up.

@RomneyDa
RomneyDa deleted the clawsweeper/issue-openclaw-openclaw-91860 branch October 22, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord clawsweeper:autofix Maintainer opted this PR into bounded ClawSweeper-reviewed autofix without merge clawsweeper:autogenerated PR created automatically by ClawSweeper clawsweeper:human-review Needs maintainer review before ClawSweeper can continue clawsweeper Tracked by ClawSweeper automation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord message send ignores maxLinesPerMessage and splits CLI sends at 17 lines

2 participants