Skip to content

fix(zalo): accept opaque string chat IDs#101548

Merged
steipete merged 1 commit into
mainfrom
codex/fix-zalo-string-chat-ids
Jul 7, 2026
Merged

fix(zalo): accept opaque string chat IDs#101548
steipete merged 1 commit into
mainfrom
codex/fix-zalo-string-chat-ids

Conversation

@steipete

@steipete steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Zalo proactive sends reject valid nonnumeric Bot API chat_id strings before delivery because the channel uses the shared numeric-ID predicate. This closes #57594 and replaces #93689, whose contributor fork is too far behind main to update without publishing thousands of unrelated upstream files.

Why This Change Was Made

  • Zalo's official sendMessage contract defines chat_id as String and uses abc.xyz in its request example.
  • The Zalo send path already forwards chatId as a string; only the pre-send resolver gate is wrong.
  • The fix stays plugin-local and treats normalized nonblank Zalo chat IDs as opaque instead of guessing an undocumented regex grammar.
  • Blank and prefix-only targets remain rejected. Shared target heuristics for other channels remain unchanged.

Contributor credit is preserved from #93689 via Co-authored-by: Goutam Adwant <[email protected]>.

User Impact

openclaw message send --channel zalo --target <chat_id> now accepts valid string IDs such as the reported hex-like values and documented dotted values. Scheduled and scripted proactive Zalo notifications no longer fail with Unknown target solely because the upstream ID is nonnumeric.

Evidence

  • Official contract: https://bot.zaloplatforms.com/docs/apis/sendMessage/
  • Source proof: current main and v2026.6.11 use isNumericTargetId; extensions/zalo/src/send.ts accepts and forwards string chat_id values.
  • Sanitized direct AWS Crabbox: provider aws, lease cbx_c5397d05acbb, run run_763782bdf491, reviewed source head e90bdb95bb69a53e419e8d8b60fc41fb07ec003d.
  • Focused tests: 34 passed across extensions/zalo/src/channel.directory.test.ts, src/infra/outbound/target-normalization.test.ts, and src/infra/outbound/target-resolver.test.ts.
  • Real CLI path: pnpm openclaw message send --channel zalo --target abc.xyz --message test --dry-run --json returned handledBy: "core", to: "abc.xyz", and via: "direct".
  • Targeted oxfmt and git diff --check passed.
  • Structured autoreview: clean, GPT-5.5 high, confidence 0.86.

Live credentialed Zalo delivery was not repeated; #57594 includes successful upstream API responses for the same nonnumeric IDs. The changed surface is the local resolver gate before send.

Closes #57594
Supersedes #93689

@openclaw-barnacle openclaw-barnacle Bot added channel: zalo Channel integration: zalo size: XS maintainer Maintainer-authored PR labels Jul 7, 2026
@steipete steipete self-assigned this Jul 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 680ec03230

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +75 to +76
const target = normalizeZaloMessagingTarget(normalized ?? raw);
return Boolean(target);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip OpenClaw kind prefixes before accepting Zalo IDs

When a Zalo target is entered with OpenClaw's generic kind prefix, e.g. user:49270a5f8f1c66423f0d or group:..., this new predicate treats the whole prefixed string as an id-like Zalo chat id before directory/kind-prefix stripping can run. resolveMessagingTarget then returns the normalized value as the send target, and extensions/zalo/src/send.ts forwards it directly as chat_id, so the API receives user:<id>/group:<id> instead of the raw Zalo chat id. The Zalo session-route code already treats these prefixes as OpenClaw route markers, so the id detector should either reject them for the id-like fast path or strip them before returning true.

Useful? React with 👍 / 👎.

@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready verification:

  • Root cause confirmed on current main and v2026.6.11: Zalo uses the numeric-only target predicate before the direct-send path.
  • Official Zalo sendMessage documentation defines chat_id as String and uses abc.xyz; the existing send path already forwards a string.
  • Sanitized direct AWS Crabbox proof: provider aws, lease cbx_c5397d05acbb, run run_763782bdf491, public networking, no Tailscale, no instance role, no hydration.
  • Focused command: pnpm test extensions/zalo/src/channel.directory.test.ts src/infra/outbound/target-normalization.test.ts src/infra/outbound/target-resolver.test.ts — 34 tests passed.
  • Real CLI path: pnpm openclaw message send --channel zalo --target abc.xyz --message test --dry-run --json returned handledBy: "core", to: "abc.xyz", via: "direct".
  • Exact-head CI: run 28857111252 passed for 680ec032306e79328427d577118684b4c57091ae.
  • Final autoreview: clean on the exact head, GPT-5.5 high, confidence 0.78.
  • Formatting: targeted oxfmt and git diff --check passed.

Known gap: no new credentialed live Zalo send was made. Linked issue #57594 contains successful upstream API responses for the same nonnumeric IDs; this patch changes only OpenClaw's pre-send resolver gate.

This replacement preserves @goutamadwant's code and Co-authored-by credit from #93689; the contributor branch was too stale to update without carrying thousands of unrelated upstream files.

@steipete
steipete merged commit 6b76a30 into main Jul 7, 2026
118 of 121 checks passed
@steipete
steipete deleted the codex/fix-zalo-string-chat-ids branch July 7, 2026 09:59
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

channel: zalo Channel integration: zalo maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zalo channel rejects valid non-numeric chat_id values for proactive outbound sends

1 participant