Skip to content

fix(discord): deliver reasoning replies#95029

Merged
vincentkoc merged 1 commit into
mainfrom
qa-sre-discord-reasoning-delivery-20260619
Jun 19, 2026
Merged

fix(discord): deliver reasoning replies#95029
vincentkoc merged 1 commit into
mainfrom
qa-sre-discord-reasoning-delivery-20260619

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary:

  • Allow Discord to deliver isReasoning block/final payloads instead of dropping them in the message delivery hooks.
  • Format opted-in Discord reasoning replies with the shared markdown-friendly formatReasoningMessage helper and clear the internal isReasoning marker before shared durable outbound delivery.
  • Add regression coverage for both the Discord message-handler boundary and the durable reply-delivery boundary.

Verification:

  • git diff --check
  • pnpm dlx [email protected] --check --threads=1 extensions/discord/src/monitor/message-handler.process.ts extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/monitor/message-handler.process.abort-skip.test.ts extensions/discord/src/monitor/reply-delivery.ts extensions/discord/src/monitor/reply-delivery.test.ts
  • Blacksmith Testbox tbx_01kvgdjkney55xkbmqbr8v9m1x, run https://github.com/openclaw/openclaw/actions/runs/27838962847: corepack pnpm test:serial extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/monitor/reply-delivery.test.ts src/infra/outbound/payloads.test.ts src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.emits-reasoning-as-separate-message-enabled.test.ts passed. Shards: outbound payloads 36 tests; agent reasoning 8 tests; Discord handler/delivery 124 tests.

Fixes #94936

@vincentkoc vincentkoc self-assigned this Jun 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: S maintainer Maintainer-authored PR labels Jun 19, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review June 19, 2026 16:42
@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 19, 2026, 1:15 PM ET / 17:15 UTC.

Summary
The PR removes Discord isReasoning suppression, formats reasoning replies with the shared formatReasoningMessage path before durable outbound delivery, clears the internal marker, and updates Discord handler and delivery tests.

PR surface: Source -12, Tests +20. Total +8 across 5 files.

Reproducibility: yes. source-level: current main emits opted-in reasoning payloads but Discord suppresses payload.isReasoning before delivery. I did not run a live Discord reasoning-model session in this read-only review.

Review metrics: 1 noteworthy metric.

  • Reasoning Delivery Gate Change: 2 suppression guards removed, 1 durable transform added. This is the core message-delivery behavior change reviewers need to validate before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #94936
Summary: This PR is a candidate fix for the canonical Discord /reasoning on message-loss issue; several same-day PRs overlap but none is a merged superseding target.

Members:

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

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Let current-head relevant checks complete or rerun the focused Discord handler and delivery tests on the current SHA.
  • [P2] Add a redacted live Discord transcript if maintainers want transport-level proof before merge.

Mantis proof suggestion
A visible Discord run would materially prove that /reasoning on sends a Thinking message plus the final answer after the formatter change. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis visual task: verify Discord /reasoning on with a reasoning model sends a visible Thinking reply plus the final answer.

Risk before merge

  • [P1] This changes visible Discord message delivery for reasoning payloads, so maintainers should verify the current head sends a Thinking reply plus the final answer without leaking hidden reasoning when /reasoning is off.
  • [P1] The PR body's cited Testbox run is not current-head proof in GitHub, and no live Discord transcript was inspected in this read-only review.

Maintainer options:

  1. Require Current-Head Validation (recommended)
    Wait for the current head's relevant CI/Testbox checks, or rerun the focused Discord handler and delivery tests on the current SHA, before merge.
  2. Add Live Discord Proof
    A maintainer can request a redacted Discord transcript showing /reasoning on emits a visible Thinking reply and final answer if transport confidence is needed.
  3. Accept Unit-Level Proof
    Maintainers may intentionally accept the focused boundary tests without live transport proof because this is a maintainer-labeled, narrow delivery fix.

Next step before merge

  • No ClawSweeper repair lane is needed; the prior formatter blocker appears fixed and the remaining action is maintainer validation before merge.

Security
Cleared: The diff only changes Discord reply filtering/formatting and tests; it does not touch credentials, dependency sources, workflows, permissions, or package-resolution paths.

Review details

Best possible solution:

Land this Discord-boundary fix after current-head validation, keeping the shared reasoning formatter and marker-clearing behavior as the canonical path.

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

Yes, source-level: current main emits opted-in reasoning payloads but Discord suppresses payload.isReasoning before delivery. I did not run a live Discord reasoning-model session in this read-only review.

Is this the best way to solve the issue?

Yes, the latest PR head is at the right Discord delivery boundary: it removes the Discord-only drop guards, reuses the shared formatter, and clears the internal marker before durable outbound send. Current-head validation remains the main merge-readiness gap.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 38807ffba4b2.

Label changes

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 external-contributor real-behavior proof gate does not apply to this maintainer-labeled PR; the body includes focused test claims but no inspected live Discord artifact.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a normal-priority Discord message-delivery bug fix with a narrow channel blast radius.
  • merge-risk: 🚨 message-delivery: The diff changes whether and how Discord delivers isReasoning payloads, so mistakes could still suppress or misformat visible reasoning replies.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 external-contributor real-behavior proof gate does not apply to this maintainer-labeled PR; the body includes focused test claims but no inspected live Discord artifact.
Evidence reviewed

PR surface:

Source -12, Tests +20. Total +8 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 18 30 -12
Tests 3 31 11 +20
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 49 41 +8

What I checked:

Likely related people:

  • vincentkoc: Current blame ties the Discord reasoning suppression and shared formatter lines in this shallow checkout to Vincent Koc, and the current main head is also authored by Vincent Koc on nearby plugin surface work. (role: recent Discord and reasoning-path contributor; confidence: high; commits: ce7f899165, 38807ffba4b2; files: extensions/discord/src/monitor/message-handler.process.ts, extensions/discord/src/monitor/reply-delivery.ts, src/agents/embedded-agent-utils.ts)
  • medns: Merged PR history shows medns authored the May 2026 refactor to preserve raw reasoning stream and push formatting to edge, which is the contract this PR now follows. (role: reasoning formatter/refactor author; confidence: medium; commits: b4d0c7b05d81; files: src/agents/embedded-agent-utils.ts, extensions/feishu/src/reply-dispatcher.ts, extensions/telegram/src/reasoning-lane-coordinator.ts)
  • ubehera: Merged PR history shows ubehera authored recent Discord reply-delivery skip/logging changes in the same handler and adjacent tests. (role: recent Discord handler contributor; confidence: medium; commits: 267bf10f37a0, c40e34764d38; files: extensions/discord/src/monitor/message-handler.process.ts, extensions/discord/src/monitor/message-handler.process.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 19, 2026
@vincentkoc
vincentkoc force-pushed the qa-sre-discord-reasoning-delivery-20260619 branch from 64efcfb to 3441631 Compare June 19, 2026 16:52
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@vincentkoc
vincentkoc force-pushed the qa-sre-discord-reasoning-delivery-20260619 branch from 3441631 to 29f657d Compare June 19, 2026 17:06
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jun 19, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Land-ready proof for the current head 29f657d08519dc400b47a746e8e3aa17ead26563:

  • Fixed the Discord handler-level isReasoning suppression and converted opted-in Discord reasoning payloads through the shared formatReasoningMessage helper before durable outbound delivery, clearing the internal marker before sendDurableMessageBatch.
  • Added/updated coverage in extensions/discord/src/monitor/message-handler.process.test.ts, extensions/discord/src/monitor/reply-delivery.test.ts, and extensions/discord/src/monitor/message-handler.process.abort-skip.test.ts.
  • Local/static proof:
    • git diff --check
    • pnpm dlx [email protected] --check --threads=1 extensions/discord/src/monitor/message-handler.process.ts extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/monitor/message-handler.process.abort-skip.test.ts extensions/discord/src/monitor/reply-delivery.ts extensions/discord/src/monitor/reply-delivery.test.ts
  • Hosted targeted proof: Blacksmith Testbox tbx_01kvgdjkney55xkbmqbr8v9m1x, https://github.com/openclaw/openclaw/actions/runs/27838962847
    • corepack pnpm test:serial extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/monitor/reply-delivery.test.ts src/infra/outbound/payloads.test.ts src/agents/embedded-agent-subscribe.subscribe-embedded-agent-session.emits-reasoning-as-separate-message-enabled.test.ts
    • Passed: outbound payloads 36 tests, agent reasoning 8 tests, Discord handler/delivery 124 tests.
  • ClawSweeper current-SHA review is no longer needs-changes; it is needs-human on 29f657d08519dc400b47a746e8e3aa17ead26563.

Known gap: PR CI early gates are currently queued, not failing. Auto-merge should wait for required checks rather than bypassing them.

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 merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

Reasoning-model thinking (type:"thinking") never rendered on Discord — /reasoning on shows no thoughts

1 participant