fix(zalo): accept hex-like chat_id values in targetResolver#90859
fix(zalo): accept hex-like chat_id values in targetResolver#90859xzh-icenter wants to merge 1 commit into
Conversation
The Zalo Bot API accepts both numeric and hex-like chat_id values. However, targetResolver.looksLikeId was using isNumericTargetId, which only accepted 3+ digit strings. This caused the CLI to reject valid hex chat IDs with 'Unknown target'. - Replace isNumericTargetId with isZaloTargetId in the Zalo plugin - isZaloTargetId accepts numeric (3+ digits) and hex-like (16+ chars) - Add unit tests for the new validation Fixes openclaw#57594
|
Codex review: needs real behavior proof before merge. Reviewed June 7, 2026, 11:38 AM ET / 15:38 UTC. Summary PR surface: Source +14, Tests +38. Total +52 across 2 files. Reproducibility: yes. The linked Zalo issue shows concrete CLI failures for hex Review metrics: none identified. 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the plugin-local Zalo predicate, but make it validate the normalized target value or strip Zalo prefixes, add bare and provider-prefixed hex tests, and include redacted CLI or live-send proof. Do we have a high-confidence way to reproduce the issue? Yes. The linked Zalo issue shows concrete CLI failures for hex Is this the best way to solve the issue? No. The plugin-local fix is the right layer, but the best fix must honor 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 66b91d78feb3. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +14, Tests +38. Total +52 across 2 files. 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
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Closing this PR to reduce backlog. The change being made is not a high-priority real bug fix, and having too many open PRs reduces chances for maintainer review. Will focus on fewer, higher-quality contributions going forward. |
fix(zalo): accept hex-like chat_id values in targetResolver
Problem Description
The Zalo channel's
targetResolver.looksLikeIdwas usingisNumericTargetIdfrom the plugin-sdk, which only accepts strings matching/^\d{3,}$/. However, the Zalo Bot API returns chat IDs that are hex-like strings (e.g.5a0b1c2d3e4f5a6b). When users tried to useopenclaw message send --channel zalo --target <hex-id>, the CLI rejected it with:This behaviour was reported in #88664.
Changes
isNumericTargetIdwith a customisZaloTargetIdfunction inextensions/zalo/src/channel.ts.extensions/zalo/src/channel.target.test.ts.isZaloTargetIdlogic:truefor numeric strings of 3+ digits (preserving original behaviour).truefor hex-like strings of 16+ hex characters ([a-f0-9]{16,}, case-insensitive).falsefor all other inputs (including empty, too short, or non-hex characters).Real behavior proof
Behavior or issue addressed: Zalo Bot API hex chat IDs rejected by CLI targetResolver, causing
Unknown targeterror for valid chat IDs.Real environment tested: Node.js v24.14.1, logic validated against the
isZaloTargetIdfunction extracted from the source. Zalo Bot API documentation confirms hex chat_id format (openimuser IDs use hexadecimal strings).Exact steps or command run after this patch:
Evidence after fix:
Terminal output from running all validation cases:
Observed result after fix:
isZaloTargetIdcorrectly accepts:123456→true5a0b1c2d3e4f5a6b→true5A0B1C2D3E4F5A6B→true5a0b1c2d3e4f5a6b→trueAnd correctly rejects:
12,abc123,a1b2c3d4xgz12345678901234(contains 'g')zalo:123,hello, ``What was not tested: Not tested against a live Zalo Bot API endpoint (no Zalo developer account available). The validation is against the documented Zalo API chat_id format.
Proof limitations or environment constraints: Container memory constraints prevent running the full vitest test suite. The functional logic is verified by direct Node.js execution of the extracted
isZaloTargetIdfunction against all defined test cases — 14/14 pass.Test verification
The new test file
extensions/zalo/src/channel.target.test.tscovers:Risk checklist
openclaw message send --target <hex>looksLikeIdcheck; actual target resolution is handled downstream by the Zalo API[a-f0-9]only, avoiding false positives on common words or special formatsCurrent review state
@clawsweeper re-reviewFixes #88664