Skip to content

fix(discord): balance truncated progress italics#88900

Open
charles-openclaw wants to merge 2 commits into
openclaw:mainfrom
charles-openclaw:fix-discord-progress-italic-truncation
Open

fix(discord): balance truncated progress italics#88900
charles-openclaw wants to merge 2 commits into
openclaw:mainfrom
charles-openclaw:fix-discord-progress-italic-truncation

Conversation

@charles-openclaw

Copy link
Copy Markdown
Contributor

Summary

  • Fixes Discord progress drafts that can show a literal leading underscore when an italic commentary line is truncated.
  • The shared progress-draft formatter now strips an unmatched leading italic delimiter after compaction, matching the existing unmatched-backtick protection.
  • Adds regression coverage for truncated commentary-style progress lines.

Linked context

Closes #88895.

Real behavior proof (required for external PRs)

  • Behavior or issue addressed: Discord streaming.mode: "progress" commentary could render _Checking... literally when line compaction removed the closing _.
  • Real environment tested: local OpenClaw contributor checkout.
  • Exact steps or command run after this patch: focused formatter regression in src/plugin-sdk/channel-streaming.test.ts.
  • Evidence after fix: the regression expects the truncated commentary line to render as Checking whether the Discord progress draft keeps markdown…, without a leading _.
  • Observed result after fix: focused Vitest shard passed.
  • What was not tested: live Discord guild progress-message edit flow.
  • Proof limitations or environment constraints: this contributor environment does not have a safe Discord bot/guild setup for live channel proof.

Tests and validation

  • corepack pnpm exec oxfmt --write --threads=1 src/channels/streaming.ts src/plugin-sdk/channel-streaming.test.ts
  • PNPM_CONFIG_OFFLINE=true corepack pnpm test src/plugin-sdk/channel-streaming.test.ts -- --reporter=dot passed 1 Vitest shard / 29 tests.
  • git diff --check -- src/channels/streaming.ts src/plugin-sdk/channel-streaming.test.ts

Risk checklist

  • User-visible behavior changed: Yes, only for compacted progress-draft text with unmatched leading italic underscores.
  • Config, environment, or migration behavior changed: No.
  • Security, auth, secrets, network, or tool execution behavior changed: No.
  • Highest-risk area: over-stripping underscores in compacted progress text. Mitigated by only stripping when the compacted output has an odd underscore count and starts with _, which matches the broken italic-commentary shape.

Current review state

Ready for maintainer review; no live Discord proof is available from this contributor environment.

@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels Jun 1, 2026
@clawsweeper

clawsweeper Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 1, 2026, 12:09 AM ET / 04:09 UTC.

Summary
This PR adds shared progress-draft cleanup for unmatched leading italic underscores after truncation and regression tests for truncated commentary progress lines.

PR surface: Source +18, Tests +48. Total +66 across 2 files.

Reproducibility: yes. from source inspection, though I did not run a live Discord guild repro in this read-only review. Discord commentary is underscore-wrapped before shared progress-line compaction, and current main only rebalances backticks after truncation.

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 proof showing a truncated commentary progress draft after the fix, using a screenshot, recording, copied live output, or log with private details removed.
  • Update the PR body after adding proof so ClawSweeper can re-review automatically, or ask a maintainer to comment @clawsweeper re-review if it does not.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR currently provides local formatter test output only, while the live Discord progress-message edit flow is explicitly untested. 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 real visible Discord progress draft would materially close the remaining proof gap for this user-visible formatting fix. 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 a Discord progress draft with truncated commentary no longer shows a literal leading underscore.

Risk before merge

  • [P1] The changed behavior is visible in Discord progress drafts, but the PR still has only local formatter-test proof and no redacted live Discord draft screenshot, recording, transcript, or log after the fix.

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared formatter repair after redacted live Discord progress-draft proof confirms truncated commentary no longer renders a literal leading underscore.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No automated code repair is needed; the remaining action is contributor or maintainer-supplied real Discord behavior proof before merge.

Security
Cleared: The diff only changes shared progress-draft string formatting and tests; I found no concrete security or supply-chain concern.

Review details

Best possible solution:

Land the shared formatter repair after redacted live Discord progress-draft proof confirms truncated commentary no longer renders a literal leading underscore.

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

Yes from source inspection, though I did not run a live Discord guild repro in this read-only review. Discord commentary is underscore-wrapped before shared progress-line compaction, and current main only rebalances backticks after truncation.

Is this the best way to solve the issue?

Yes, this is the narrow maintainable fix path: repair the shared compaction boundary where the invalid Markdown is created and cover the important underscore cases. The remaining blocker is proof of the real Discord draft behavior after the patch.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 3b802a7fbc5a.

Label changes

Label justifications:

  • P3: This is a low-severity cosmetic Discord progress-draft formatting fix with focused code changes and no config, migration, auth, or delivery-path change.
  • 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 currently provides local formatter test output only, while the live Discord progress-message edit flow is explicitly untested. 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 +18, Tests +48. Total +66 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 20 2 +18
Tests 1 48 0 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 68 2 +66

What I checked:

  • Repository policy read: Root AGENTS.md and the scoped src/channels and src/plugin-sdk AGENTS.md files were read fully enough to apply the OpenClaw PR review, channel-boundary, SDK-boundary, and real-behavior-proof rules. (AGENTS.md:1, 3b802a7fbc5a)
  • Current main source path: Current main compacts every progress draft line and only removes unbalanced inline backticks, so an underscore-wrapped commentary line can lose its closing marker during compaction. (src/channels/streaming.ts:855, 3b802a7fbc5a)
  • Discord commentary source path: Discord progress commentary wraps each cleaned commentary line in underscores before the shared progress formatter compacts it, matching the linked issue's root-cause description. (extensions/discord/src/monitor/message-handler.draft-preview.ts:473, 3b802a7fbc5a)
  • Preamble routing source path: Discord preamble item events route progress text into pushCommentaryProgress when commentary progress is enabled, which is the runtime entry point for the malformed draft lines. (extensions/discord/src/monitor/message-handler.process.ts:1016, 3b802a7fbc5a)
  • Proposed patch shape: The PR head adds removeUnbalancedLeadingItalicMarker, applies it at both compaction return sites, and keeps the existing backtick repair in the same shared formatter path. (src/channels/streaming.ts:863, e8170be59e97)
  • Regression coverage: The PR adds cases for dropping a dangling leading italic marker, preserving internal underscores such as test_name, and keeping already-closed leading italic spans. (src/plugin-sdk/channel-streaming.test.ts:350, e8170be59e97)

Likely related people:

  • Vincent Koc: Local blame shows commit 91ca036 owns the current shared progress compaction code and Discord commentary underscore wrapping that this PR changes around. (role: recent area contributor; confidence: medium; commits: 91ca03671731; files: src/channels/streaming.ts, extensions/discord/src/monitor/message-handler.draft-preview.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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jun 1, 2026
@charles-openclaw

Copy link
Copy Markdown
Contributor Author

Follow-up pushed in e8170be5 after the ClawSweeper note about underscore handling.

Summary:

  • Replaced the broad underscore-count/remove-all behavior with a narrower leading italic-marker cleanup.
  • Preserves internal underscores such as test_name when compacted commentary loses the generated outer italic marker.
  • Keeps already-closed leading italic spans, e.g. _Reviewed_ ..., intact.

Verification:

  • corepack pnpm exec oxfmt --write --threads=1 src/channels/streaming.ts src/plugin-sdk/channel-streaming.test.ts
  • PNPM_CONFIG_OFFLINE=true corepack pnpm test src/plugin-sdk/channel-streaming.test.ts -- --reporter=dot passed 1 Vitest shard / 31 tests.
  • git diff --check -- src/channels/streaming.ts src/plugin-sdk/channel-streaming.test.ts

Still not live-tested in a Discord guild; this remains local formatter coverage from the contributor environment.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 1, 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.

Re-review progress:

@mugabuga

mugabuga commented Jun 1, 2026

Copy link
Copy Markdown

This PR fixes the behavior I described in the original issue.
Before (2026.5.31-beta.3):
IMG_2462-redacted
IMG_2461-redacted

After (commit e8170be):
IMG_0691-redacted

This PR fixes the previous broken behavior (literal leading _ printing when the trailling _ was truncated) while preserving the italics in the non-truncated thinking.

@charles-openclaw feel free to include in your original post and ask clawsweeper to re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Discord progress commentary renders a literal leading underscore when an italic line is truncated

2 participants