Repository navigation
Conversation
|
Codex review: needs changes before merge. Reviewed July 1, 2026, 2:55 AM ET / 06:55 UTC. Summary PR surface: Source +186, Tests +308. Total +494 across 4 files. Reproducibility: yes. for the blocking review finding: source inspection shows markdown-mode sends call the new normalizer before the existing parser's indented-code branch can preserve literal code-looking content. The user-facing list-rendering goal also has after-fix Zalo Android/Desktop screenshot proof. 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:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Normalize only Zalo markdown prose while preserving every literal/code form the current parser preserves, then let maintainers explicitly accept the channel-specific output change. Do we have a high-confidence way to reproduce the issue? Yes for the blocking review finding: source inspection shows markdown-mode sends call the new normalizer before the existing parser's indented-code branch can preserve literal code-looking content. The user-facing list-rendering goal also has after-fix Zalo Android/Desktop screenshot proof. Is this the best way to solve the issue? No, not yet: the owner boundary is reasonable, but the normalizer must preserve all code forms already supported by parseZalouserTextStyles before this is the best fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b2355ef6a226. Label changesLabel justifications:
Evidence reviewedPR surface: Source +186, Tests +308. Total +494 across 4 files. View PR surface stats
Acceptance criteria:
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
|
|
ClawSweeper PR egg ✨ Hatched: 🌱 uncommon Sunspot Branchling Hatch commandComment Hatchability rules:
Rarity: 🌱 uncommon. What is this egg doing here?
|
|
@clawsweeper Thanks for the careful review. Both P1 and P2 findings were correct - addressed in 11d022974a. P1 - fenced code block preservation 6 new outbound-format.test.ts cases pin the contract:
P2 - textStyles offset safety Real behavior proof Full zalouser suite: 185 passed, 2 skipped (unrelated). Ready for re-review. |
Real Zalo client proof attached@clawsweeper Per the proof request, here are screenshots from the Em Huyen agent (Tingee customer-support bot) running this normalizer in a live deployment against real Zalo clients - mobile and desktop, same conversation. Zalo Android (Capypara.AI group, dark theme): Zalo Desktop (same conversation): What to look at: The bot's reply contains a markdown list with two bullets: Both clients render those two bullets as a tight group with no blank line between them. The original agent output emitted blank lines between each bullet (which is what other channels render best). Without Confirms the fix matches the real client behaviour the PR claims to address. Same fix lands cleanly on both Zalo Mobile and Zalo Desktop because the rendering quirk lives in the Zalo client, not the transport. Screenshots live on a separate |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
c4cb11b to
f15de9e
Compare
|
Heads up on the The knip deadcode shard reports two files as unused: Both are actually imported by This PR is rebased cleanly onto current All other checks pass, including |
|
@clawsweeper re-review The two correctness blockers from the prior verdict are both fixed in the current head (f15de9e85c):
Real behavior proof (Zalo Mobile + Desktop screenshots) is in the PR body and already accepted (proof: 📸 screenshot). |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
f15de9e to
a6e4b46
Compare
|
@clawsweeper re-review Both findings from the last pass are fixed in 3f3da8849c:
New tests pin both: 3 fence cases in outbound-format.test.ts (mismatched marker, shorter run, longer run) and the plain-vs-markdown contract in send.test.ts. Full zalouser suite: 188 passed, 2 skipped. |
|
Heads up: this PR needs to be updated against current |
55f4b5c to
a545877
Compare
|
Rebased onto current The remaining |
a545877 to
d6d2ddb
Compare
|
Rebased onto current The one remaining red check, |
…ering The Zalo personal-account client (mobile + web) renders agent-style markdown poorly in two specific ways: 1. Triple-dash / triple-asterisk horizontal rules (---, ***) render as literal dashes / asterisks on their own line, not as a separator. They add visual noise without conveying structure. 2. List items separated by blank lines render with the blank line preserved, breaking the visual grouping a reader expects from a markdown list. LLM agents commonly emit lists with surrounding blank lines because that is what Slack / Discord / the web playground render best - Zalo is the outlier. Add a normalizeZalouserOutboundText pre-processor invoked at the top of sendMessageZalouser. The transform is conservative: it only matches content that is unambiguously a markdown HR or a blank line inside a list, so plain prose passes through unchanged. It is also idempotent (only removes characters, never adds), so applying it twice is identical to once. Behavior: - Strips lines that are nothing but 3+ dashes / asterisks (with optional leading / trailing whitespace). Leaves surrounding newlines so adjacent paragraphs keep their blank-line break. - Collapses 1+ blank lines BETWEEN, BEFORE, or AFTER list items (-, *, 1.) down to a single newline so the list reads as one block. - Hard cap of 2 consecutive newlines anywhere else (defensive). Tests: 19 cases in outbound-format.test.ts covering identity / passthrough, HR stripping (positive + negative), inter-item blank-line collapse for bullet, asterisk, and numbered lists, edge cases at list boundaries, the hard newline cap, and an idempotency property assertion on a representative agent reply. Verified live against the Zalo client (mobile) on the Tingee deployment where this normalizer was first prototyped as a vendor patch.
Addresses both findings from the upstream review pass on #85039: P1 (confidence 0.91) - the previous version applied HR strip + list blank-line collapse globally, so a markdown reply containing a fenced code block with a `---` line (YAML frontmatter, config snippet, etc.) lost that line. Fix: walk the text fence-by-fence and only normalize prose segments. ``` and ~~~ fences with any info string are recognised and their content passes through verbatim. An unclosed fence treats the tail as code (defensive: don't aggressively rewrite content the user might be reading mid-truncation). P2 (confidence 0.82) - in non-markdown mode, caller-supplied options.textStyles describe offsets into the ORIGINAL text. The transport layer only clamps style ranges, never rebases them, so removing characters from the original text could land styles on the wrong content. Fix: skip normalization entirely when textMode is not markdown AND textStyles is non-empty. Markdown mode is unaffected because parseZalouserTextStyles re-derives styles from the post-normalization text. Tests: - 6 new outbound-format.test.ts cases for fence preservation: triple-backtick + triple-tilde fences, longer fences, lists inside fences, mixed prose-around-fence, unclosed-fence defensive behavior. - 3 new send.test.ts integration cases: end-to-end normalization on list-with-blanks, fence preservation through sendMessageZalouser, and the plain-mode-textStyles skip path. All 185 zalouser package tests pass (2 unrelated skipped).
openclaw's check-lint shard rejects same-line `if (cond) return val;` form and requires explicit braces. Convert 3 occurrences in outbound-format.ts to the braced form. No behavior change; all 41 outbound-format + send.test cases still pass.
Addresses both findings from the second upstream review pass on #85039: P1 (confidence 0.92) - normalization was applied to default/plain sends too. The direct zalouser tool calls sendMessageZalouser WITHOUT textMode, and current main treats those as literal text. Stripping `---` or collapsing blank lines from a literal send corrupts content the caller meant to deliver byte-for-byte. Fix: normalize ONLY inside the `textMode === "markdown"` branch (the agent-reply path - channel adapters already set textMode: "markdown"). Plain sends now pass through untouched, and the markdown branch re-derives styles via parseZalouserTextStyles so caller offsets stay aligned without special-casing. P2 (confidence 0.92) - the fence scanner flipped state on ANY 3+ backtick OR tilde line, so a `~~~` line inside a ``` block (or a shorter run of the same char) wrongly ended the fence and exposed following `---`/list content to stripping. Fix: opener-aware matching mirroring text-styles.ts - record the opener char + length, close only on a bare fence of the SAME char with length >= the opener. Tests: - outbound-format.test.ts: 3 new fence cases (tilde line inside backtick fence stays code; shorter same-char run does not close; longer run >= opener does close and trailing prose re-normalizes). - send.test.ts: markdown-path normalization proven via HR strip (stable under the style parser); plain sends asserted literal both with and without caller textStyles. Full zalouser suite: 188 passed, 2 skipped.
Two polish findings from the third upstream review pass on #85039: P2 (confidence 0.88) - normalizeZalouserOutboundText split only on \n, so Windows-style agent output (`---\r\n`, `- a\r\n\r\n- b`) kept a trailing \r on each line. The $-anchored, [ \t]-only HR / list / fence matchers then failed to fire and the broken spacing / literal HR reached Zalo. Fix: normalize \r\n? -> \n up front, mirroring the markdown style parser in text-styles.ts. Covers CRLF and lone-CR (old-mac) endings. P3 (confidence 0.82) - the zalouser markdown parser treats `+ item` as an unordered list, but the blank-line collapse regexes only matched `-`, `*`, and numbered items. A `+` list separated by blank lines still rendered fragmented. Fix: add `+` to the shared list-item character class in all three patterns, and extend the `after` negative lookahead to exclude `*`/`+` so list-to-list gaps stay with the `between` rule. Tests: 6 new outbound-format.test.ts cases (CRLF bullets, CR-terminated HR, lone-CR; `+` bullets, mixed -/*/+/numbered, prose-to-+-list). Full zalouser suite: 194 passed, 2 skipped.
d6d2ddb to
57012bb
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |


Summary
The Zalo personal-account client (mobile + web) renders agent-style markdown poorly in two specific ways that the zalouser plugin currently passes through unchanged:
Triple-dash / triple-asterisk horizontal rules (
---,***) render as literal dashes / asterisks on their own line - never as a separator. LLM agents emit them as section dividers; recipients see them as garbage.List items separated by blank lines render with the blank line preserved, breaking the visual grouping a reader expects from a markdown list.
- foo\n- barreads as one list;- foo\n\n- barreads as two unrelated items with extra vertical space. LLM agents commonly emit lists this way because Slack / Discord / the web playground render that style best - Zalo is the outlier.This PR adds a
normalizeZalouserOutboundTextpre-processor invoked at the top ofsendMessageZalouser. Block-aware (skips fenced code blocks), idempotent (only removes characters, never adds), style-safe (skips normalization when caller-supplied plain-mode textStyles are present, since the transport layer does not rebase those offsets).Tests
outbound-format.test.ts- 25 cases: identity / passthrough, HR stripping positive + negative, inter-item blank-line collapse for bullet / asterisk / numbered, edge cases at list boundaries, hard newline cap, fenced code block preservation (triple-backtick + triple-tilde, longer fences, lists-inside-fence, prose-around-fence, unclosed fence), idempotency property.send.test.ts- 3 new integration cases: end-to-end normalization on list-with-blanks, fence preservation throughsendMessageZalouser, plain-mode skip with caller-supplied textStyles.Full zalouser package suite: 185 passed, 2 skipped (unrelated).
Real behavior proof
Behavior or issue addressed: Inbound LLM-generated markdown containing a bullet list with blank lines between items rendered on the Zalo personal-account client as visually fragmented paragraphs (one blank line of vertical space between each bullet), instead of as a tight grouped list. Same for
---horizontal-rule lines - they rendered as literal dashes instead of as a separator.Real environment tested: Em Huyen agent (Tingee customer-support bot, Vietnamese) running on the openclaw runtime with
@openclaw/zalouserpaired to a real Zalo personal account, talking to a real Zalo group room (Capypara.AI). Tested on both Zalo Mobile (Android client) and Zalo Desktop (dark theme) on the same conversation, afternormalizeZalouserOutboundTextwas wired intosendMessageZalouser.Exact steps or command run after this patch:
outbound-format.ts+send.tschanges to the running zalouser plugin.@Em Huyền reset loa cho anh.- ...bullets separated by blank lines for its hotline / Zalo OA list).Evidence after fix:
Zalo Android (Capypara.AI group, dark theme):
Zalo Desktop (same conversation):
Both screenshots show the reply with two bullets (
📞 Hotline: 1900 255 567+💬 Zalo OA: Tingee by Heno) rendered as a tight group with NO blank line between them. The agent's raw output emitted blank lines between each bullet - the post-fix normalizer collapses them before they reach the Zalo client.Observed result after fix: On both Zalo Mobile and Zalo Desktop, the two-bullet list renders as one tight visual group. Recipients no longer see contact options fragmented into separate paragraphs.
---HR lines from the same agent are also no longer emitted as literal dashes (covered in the same normalizer pass).What was not tested: I have not run a head-to-head BEFORE / AFTER screenshot pair in the same Zalo conversation - the pre-fix rendering was the live deployment state captured separately in a downstream vendor patch's tracking ticket, which is what motivated this PR. The AFTER screenshots above are from a real deployment with the fix in place. Maintainers with a Zalo test account can reproduce the BEFORE state by reverting
extensions/zalouser/src/send.tsto the pre-PR version and re-sending the same agent reply.Screenshots live on a separate
proof/zalouser-em-huyen-screenshotsbranch on the fork so the upstream merge does not import binaries into openclaw history.Refs
Companion to #84924 (inbound photo support upstream PR). Both came from the same deployment surfacing real rendering gaps in the zalouser plugin.
🤖 Generated with Claude Code