fix(discord): apply effective maxLinesPerMessage in live replies#40133
fix(discord): apply effective maxLinesPerMessage in live replies#40133altaywtf merged 5 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes two related bugs where Discord live reply surfaces could ignore the configured
Confidence Score: 4/5
Last reviewed commit: d15fdd1 |
|
hmm i'm still experiencing 17 line splits on discord even with the fixes in this PR applied. It must be another cause for fallback behaviour. I'll have a look at other potential failure modes and update this PR accordingly |
|
found another cause of the issue: issue #41017 fixing that now and rolling it into this PR |
|
@altaywtf mind asking greptile to review this? i've manually tested discord and it looks good from my side |
|
@greptileai review |
|
@altaywtf addressed Greptile's concerns I've been using this patch all day and it works great |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
94295b4 to
da48317
Compare
da48317 to
031d032
Compare
|
Merged via squash.
Thanks @rbutera! |
* main: (33 commits) Exec: mark child command env with OPENCLAW_CLI (openclaw#41411) fix(plugins): expose model auth API to context-engine plugins (openclaw#41090) Add HTTP 499 to transient error codes for model fallback (openclaw#41468) Logging: harden probe suppression for observations (openclaw#41338) fix(discord): apply effective maxLinesPerMessage in live replies (openclaw#40133) build(protocol): regenerate Swift models after pending node work schemas (openclaw#41477) Agents: add fallback error observations (openclaw#41337) acp: harden follow-up reliability and attachments (openclaw#41464) fix(agents): probe single-provider billing cooldowns (openclaw#41422) acp: add regression coverage and smoke-test docs (openclaw#41456) acp: forward attachments into ACP runtime sessions (openclaw#41427) acp: enrich streaming updates for ide clients (openclaw#41442) Sandbox: import STATE_DIR from paths directly (openclaw#41439) acp: restore session context and controls (openclaw#41425) acp: fail honestly in bridge mode (openclaw#41424) Gateway: tighten node pending drain semantics (openclaw#41429) Gateway: add pending node work primitives (openclaw#41409) fix(auth): reset cooldown error counters on expiry to prevent infinite escalation (openclaw#41028) fix(cron): do not misclassify empty/NO_REPLY as interim acknowledgement (openclaw#41401) iOS: reconnect gateway on foreground return (openclaw#41384) ...
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…nclaw#40133) Merged via squash. Prepared head SHA: 031d032 Co-authored-by: rbutera <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf


Summary
Describe the problem and fix in 2-5 bullets:
discordConfigobject, missmaxLinesPerMessage, and silently fall back to the default 17-line chunking even when the effective account config was higher.maxLinesPerMessageandchunkModebefore callingsendDiscordText(...), causing a second re-chunking pass to use defaults.resolveDiscordMaxLinesPerMessage(...)insrc/discord/accounts.ts, switched the live Discord reply surfaces to use explicit runtime value first and then merged effective account config, and threadedmaxLinesPerMessagepluschunkModethrough the reply-delivery fast path so already-valid chunks are not re-split at 17 lines; added regressions for root-level fallback, per-account override, higher-level slash/native reply handling, and fast-path propagation.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
maxLinesPerMessagevalue for the active Discord account instead of falling back to the default 17-line chunking when the runtimediscordConfigobject is partial.channels.discord.maxLinesPerMessagenow applies correctly to live reply paths when no per-account override is set.channels.discord.accounts.<account>.maxLinesPerMessagecontinues to override the root Discord value in live reply paths.deliverDiscordReply(...)fast path now preservemaxLinesPerMessageandchunkModeall the way intosendDiscordText(...), so a chunk that is already valid under the configured limit is not re-split at the default 17-line boundary.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
pnpm devchannels.discord.maxLinesPerMessage: 120; verified account-level override withchannels.discord.accounts.work.maxLinesPerMessage: 80Steps
channels.discord.maxLinesPerMessage: 120and optionallychannels.discord.accounts.work.maxLinesPerMessage: 80.discordConfigobject that omitsmaxLinesPerMessage.deliverDiscordReply(...)and thensendDiscordText(...).Expected
discordConfigomitsmaxLinesPerMessage.Actual
maxLinesPerMessageas missing and fall back directly to the default 17-line limit.maxLinesPerMessageandchunkModebeforesendDiscordText(...), causing a second chunking pass to re-split at 17 lines.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm test src/discord/accounts.test.ts src/discord/monitor/message-handler.process.test.ts src/discord/monitor/native-command.commands-allowfrom.test.ts; confirmed root fallback, per-account override, explicit runtime override precedence, live message-handler preview/finalization, and a higher-level slash/native reply path. Also ranpnpm test src/discord/monitor/reply-delivery.test.ts; confirmed the fast path preservesmaxLinesPerMessageandchunkModeinstead of re-splitting at 17. Ranpnpm buildafter the follow-up fast-path fix.discordConfigomitsmaxLinesPerMessage; explicit runtime value still wins; per-account override beats root config; a reply chunk longer than 17 lines but shorter than the configured limit is not re-split in the fast path.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
6acb57223and0b5d29b46, or restore the previous directdiscordConfig?.maxLinesPerMessagereads in live reply paths plus the previous fast-pathsendDiscordText(...)call.src/discord/accounts.ts,src/discord/monitor/message-handler.process.ts,src/discord/monitor/native-command.ts,src/discord/monitor/agent-components.ts,src/discord/monitor/reply-delivery.ts,src/discord/monitor/reply-delivery.test.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.discordConfig?.maxLinesPerMessageand adds direct plus higher-level regressions around the known failing paths.sendDiscordText(...)but not threaded throughsendDiscordChunkWithFallback(...).src/discord/monitor/reply-delivery.test.tsasserts the fast path forwards bothmaxLinesPerMessageandchunkMode.