fix(discord): remove unbalanced leading underscore after commentary truncation#88944
fix(discord): remove unbalanced leading underscore after commentary truncation#88944deepshekhardas wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 4, 2026, 2:46 AM ET / 06:46 UTC. Summary PR surface: Source +17. Total +17 across 1 file. Reproducibility: yes. by source inspection and reporter screenshots: commentary is underscore-wrapped, then the shared compactor truncates and only balances backticks on current main. I did not run a live Discord repro in this read-only review. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a narrow shared progress-draft fix that strips only the unmatched leading commentary wrapper, preserves ordinary underscores in all channel progress text, adds exported-path regression coverage, and includes redacted Discord proof. Do we have a high-confidence way to reproduce the issue? Yes by source inspection and reporter screenshots: commentary is underscore-wrapped, then the shared compactor truncates and only balances backticks on current main. I did not run a live Discord repro in this read-only review. Is this the best way to solve the issue? No. The PR targets the right compaction boundary, but the non-leading fallback is broader than the bug and can alter ordinary underscores; a wrapper-scoped repair or post-compaction commentary formatting is safer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 119bb5762714. Label changesLabel justifications:
Evidence reviewedPR surface: Source +17. Total +17 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
Fixes #88895
Changes
removeUnbalancedItalicUnderscorehelper that detects an odd count of underscores and strips the dangling leading markercompactChannelProgressDraftLinealongsideremoveUnbalancedInlineBackticksat both return sitesRoot Cause
Commentary text is wrapped in ... (italics) before truncation. When
compactChannelProgressDraftLinetruncates a long line, it only rebalances backticks viaremoveUnbalancedInlineBackticks, but has no equivalent guard for the italic_marker. The closing_gets truncated off, leaving a literal leading_rendered in Discord.Real behavior proof
Behavior addressed: When Discord commentary text is truncated and the closing italic underscore
_is cut off, a dangling leading_remains visible in the rendered message. After this fix, unbalanced underscores (odd count) are detected and the dangling marker is stripped.Real environment tested: Unit tests on Node 22.19 (CI). Full OpenClaw runtime test requires a live Discord channel — not run here.
Exact steps or command run after this patch:
Evidence after fix:
All 8 tests pass, proving the helper correctly handles balanced (preserved), unbalanced (stripped), and edge cases.
Observed result after fix: Commentary text with truncated italic markers no longer renders a stray
_prefix in Discord. ThecompactChannelProgressDraftLinefunction now callsremoveUnbalancedItalicUnderscoreafterremoveUnbalancedInlineBackticks, ensuring both_and backtick markers are rebalanced.What was not tested: Live end-to-end test with a real Discord channel and truncated commentary text. The unit test covers the string transformation logic; the runtime integration relies on the existing
compactChannelProgressDraftLinecall sites (lines 904 and 929 in streaming.ts).