Skip to content

fix(discord): accumulate reasoning progress deltas#87339

Open
giodl73-repo wants to merge 1 commit into
openclaw:mainfrom
giodl73-repo:fix-83983-discord-reasoning-deltas
Open

fix(discord): accumulate reasoning progress deltas#87339
giodl73-repo wants to merge 1 commit into
openclaw:mainfrom
giodl73-repo:fix-83983-discord-reasoning-deltas

Conversation

@giodl73-repo
Copy link
Copy Markdown
Contributor

Summary

Fixes #83983.

Discord progress-mode reasoning updates were formatting each reasoning callback with the display Thinking... wrapper before draft-preview merge logic saw it. Since the merge logic treats Thinking.../Reasoning: prefixed text as a full snapshot, Codex app-server delta chunks like "Considering", " plugin", " installation", "!" could replace each other until only the final tiny chunk remained visible.

This keeps reasoning stream payloads raw until pushReasoningProgress() merges delta/snapshot semantics, then applies the existing reasoning display formatter once for the stable progress line.

No config surface or plugin surface changes.

Proof

node scripts/run-vitest.mjs extensions/discord/src/monitor/message-handler.process.test.ts --reporter=dot
# Test Files 1 passed (1)
# Tests 77 passed (77)

node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector.test.ts src/agents/pi-embedded-utils.test.ts --reporter=dot
# Test Files 2 passed (2)
# Tests 117 passed (117)

./node_modules/.bin/oxfmt --check extensions/discord/src/monitor/message-handler.process.ts extensions/discord/src/monitor/message-handler.draft-preview.ts extensions/discord/src/monitor/message-handler.process.test.ts
# All matched files use the correct format.

./node_modules/.bin/oxlint --tsconfig config/tsconfig/oxlint.core.json extensions/discord/src/monitor/message-handler.process.ts extensions/discord/src/monitor/message-handler.draft-preview.ts extensions/discord/src/monitor/message-handler.process.test.ts
# Found 0 warnings and 0 errors.

git diff --check origin/main...HEAD
# passed

git diff --check
# passed

pnpm check:changed
# passed

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: S maintainer Maintainer-authored PR labels May 27, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 27, 2026

Codex review: needs real behavior proof before merge. Reviewed May 29, 2026, 2:49 AM ET / 06:49 UTC.

Summary
The PR moves Discord reasoning stream display formatting from the inbound callback into the draft-preview merge path so progress-mode reasoning deltas can accumulate before rendering.

PR surface: Source -1, Tests +29. Total +28 across 3 files.

Reproducibility: yes. for source-level reproduction: current main formats reasoning before the draft-preview merge, and the merge path treats Thinking/Reasoning: prefixes as snapshots. No live Discord reproduction or after-fix transport proof is attached yet.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add redacted live Discord progress-mode proof showing the reasoning line accumulates in the actual transport.
  • After any related Discord progress PR lands, rebase and confirm the merge result still passes raw reasoning into the draft-preview merge path.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR supplies focused tests and checks only; before merge it needs redacted live Discord progress-mode proof, such as a screenshot, recording, terminal/live output, or logs showing the reasoning line accumulating, with private data redacted. Updating the PR body after adding proof should trigger a fresh ClawSweeper review; if not, a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A live visual proof would materially help review because the changed behavior is a Discord progress draft that unit tests cannot fully demonstrate. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify Discord progress-mode reasoning deltas accumulate into one progress line instead of ending as the last chunk.

Risk before merge

  • [P1] The user-visible Discord progress behavior is still proven only by mocked callbacks and tests, not by a redacted live Discord progress-mode run.
  • [P1] The codegraph comment reports overlapping edits to processDiscordMessage in several related Discord/channel PRs, so merge order or rebase review needs to preserve this raw-then-format reasoning path.
  • [P1] This PR changes visible Discord progress text, so green unit tests alone do not prove that the actual Discord transport renders the accumulated reasoning line correctly.

Maintainer options:

  1. Add live Discord progress proof (recommended)
    Before merge, add redacted proof from a real Discord progress-mode turn showing reasoning deltas accumulating into one progress line instead of ending as the last chunk.
  2. Maintainer supplies equivalent proof
    A maintainer can accept the patch after running an equivalent live Discord smoke and recording the observed progress-draft behavior in the PR verification notes.
  3. Refresh after sibling progress PRs land
    If related Discord progress PRs land first, rebase this branch and re-check that the merge result still passes raw reasoning into the draft-preview merge path.

Next step before merge

  • [P1] Human handling is required because this PR has a protected maintainer label and needs real Discord proof plus sibling-PR merge-order review; no narrow automation repair is identified.

Security
Cleared: The diff only changes Discord TypeScript runtime/test code and does not touch dependencies, workflows, secrets, package metadata, generated artifacts, or code-download surfaces.

Review details

Best possible solution:

Land only after maintainer review has redacted live Discord progress-mode proof and any sibling PR rebase preserves the raw-then-format reasoning behavior.

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

Yes for source-level reproduction: current main formats reasoning before the draft-preview merge, and the merge path treats Thinking/Reasoning: prefixes as snapshots. No live Discord reproduction or after-fix transport proof is attached yet.

Is this the best way to solve the issue?

Yes, the proposed code path is the narrow maintainable fix: keep reasoning payloads raw for merge semantics, then format once for display. The remaining gap is proof and merge-order safety, not an obvious code defect.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 31f3914082df.

Label changes

Label justifications:

  • P2: This is a normal-priority Discord progress rendering bugfix with limited channel scope and no core runtime outage.
  • merge-risk: 🚨 message-delivery: The diff changes how visible Discord progress messages are composed and could regress progress-line delivery if the live transport or sibling merge path behaves differently from the mocks.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR supplies focused tests and checks only; before merge it needs redacted live Discord progress-mode proof, such as a screenshot, recording, terminal/live output, or logs showing the reasoning line accumulating, with private data redacted. Updating the PR body after adding proof should trigger a fresh ClawSweeper review; if not, a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source -1, Tests +29. Total +28 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 10 11 -1
Tests 1 32 3 +29
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 42 14 +28

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs extensions/discord/src/monitor/message-handler.process.test.ts --reporter=dot.
  • [P1] node scripts/run-vitest.mjs extensions/codex/src/app-server/event-projector.test.ts src/agents/embedded-agent-utils.test.ts --reporter=dot.
  • [P1] redacted live Discord progress-mode proof showing accumulated reasoning deltas.

What I checked:

Likely related people:

  • steipete: Current-main blame for the Discord reasoning callback and draft-preview merge path points at Peter Steinberger, and nearby history also shows recent broad Discord/Codex surface touches. (role: recent area contributor; confidence: medium; commits: 59cec74d89ff, 27ae826f6525; files: extensions/discord/src/monitor/message-handler.process.ts, extensions/discord/src/monitor/message-handler.draft-preview.ts, extensions/codex/src/app-server/event-projector.ts)
  • Takhoffman: Recent history shows Tak Hoffman changing Discord status-reaction behavior in the same process handler and tests, which is adjacent to this progress/status surface. (role: adjacent Discord behavior contributor; confidence: medium; commits: 30fc29c9b035; files: extensions/discord/src/monitor/message-handler.process.ts, extensions/discord/src/monitor/message-handler.process.test.ts)
  • scoootscooob: History shows scoootscooob moved the Discord channel implementation into the extensions boundary, creating the current owner surface for these files. (role: feature history contributor; confidence: low; commits: 5682ec37fada; files: extensions/discord/src/monitor/message-handler.process.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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels May 27, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 27, 2026

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@giodl73-repo giodl73-repo force-pushed the fix-83983-discord-reasoning-deltas branch from 6086081 to c626d4d Compare May 27, 2026 21:20
@giodl73-repo
Copy link
Copy Markdown
Contributor Author

Refreshed #87339 onto current main; new signed head is c626d4d2466ff1cb8634e06efcd253d0de4a6874.

Focused WSL validation after the refresh:

  • node scripts/run-vitest.mjs extensions/discord/src/monitor/message-handler.process.test.ts extensions/codex/src/app-server/event-projector.test.ts src/agents/embedded-agent-utils.test.ts --reporter=dot -> 3 files, 194 tests passed
  • ./node_modules/.bin/oxfmt --check extensions/discord/src/monitor/message-handler.process.ts extensions/discord/src/monitor/message-handler.draft-preview.ts extensions/discord/src/monitor/message-handler.process.test.ts
  • ./node_modules/.bin/oxlint --tsconfig config/tsconfig/oxlint.core.json extensions/discord/src/monitor/message-handler.process.ts extensions/discord/src/monitor/message-handler.draft-preview.ts extensions/discord/src/monitor/message-handler.process.test.ts
  • git diff --check origin/main...HEAD
  • git diff --check

This refresh should replace the prior check-guards failure with current-head CI. Remaining ClawSweeper ask is redacted live Discord progress-mode proof. No merge performed.

@BingqingLyu

This comment was marked as spam.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label May 29, 2026
@giodl73-repo giodl73-repo force-pushed the fix-83983-discord-reasoning-deltas branch from c626d4d to 444363d Compare May 29, 2026 06:43
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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Codex Runtime]: Discord progress reasoning stream overwrites prior reasoning chunks

3 participants