Skip to content

fix(imessage): recognize bare hex group chat identifiers as chat targets - #99525

Merged
steipete merged 4 commits into
openclaw:mainfrom
MatthewDelprado:fix/imessage-hex-chat-identifier
Jul 3, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
MatthewDelprado:fix/imessage-hex-chat-identifier

Conversation

@MatthewDelprado

@MatthewDelprado MatthewDelprado commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #89235.

Bare 32-character hexadecimal iMessage group identifiers were falling through to phone-number normalization in both direct-send parsing and cron/announce delivery. A real group identifier could therefore become a bogus E.164 target instead of using the existing imsg send --chat-identifier path.

Why This Change Was Made

The identifier shape is produced by imsg for group chats, but it has no explicit chat_identifier: prefix. The final implementation gives that exact bounded shape one plugin-owned normalizer shared by delivery normalization, target parsing, explicit-target detection, and peer-kind inference. Service-prefixed identifiers use the same canonical path; invalid length or non-hex values retain existing handle behavior.

User Impact

iMessage group sends addressed by a bare database identifier now reach the intended conversation instead of being normalized into a nonexistent phone number. Existing explicit chat identifiers, phone handles, and email handles are unchanged.

Evidence

  • Exact rebased PR head: d26dfb57e53e08bb0efd8c74e0191122abb857e7.
  • Focused behavior proof: 129 tests passed (55 cron tests and 74 iMessage tests), including lower/upper-case identifiers, service prefixes, all-digit hex, wrong lengths, non-hex values, parser inference, and the existing chat-identifier send path.
  • Live local imsg 0.12.1 database shape audit: 500 chats inspected; 31 group chats; 20 bare 32-hex group identifiers; zero bare 32-hex direct chats. Only aggregate counts were recorded, and no external message was sent to a private conversation.
  • Final structured autoreview: clean, 0.98 correctness confidence.
  • Screenshots are not useful for this nonvisual target-routing fix; proof is at the identifier, parser, and send-path boundaries.

CI is running on the exact head above and will be required green before merge.

A 32-char hex iMessage group chat identifier (as returned by `imsg` for
group chats) with no explicit `chat_identifier:` prefix fell through to
E.164 phone-number normalization. normalizeE164 strips non-digit
characters and prepends `+`, turning
`7d5297154d5f436d83dbbdf03fcc8fdd` into `+75297154543683038` -- a
bogus phone number. Cron/announce delivery then reported
`delivered: true` while silently sending to a nonexistent recipient.

Detect bare 32-char hex strings in both the send-path target parser
(extensions/imessage/src/targets.ts) and the outbound delivery-target
normalizer (extensions/imessage/src/normalize.ts) and route them as
chat_identifier targets, consistent with how an explicit
`chat_identifier:<id>` prefix already resolves.

Fixes openclaw#89235.
@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 3, 2026
@clawsweeper

clawsweeper Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 11:17 AM ET / 15:17 UTC.

Summary
The PR adds a shared iMessage bare 32-hex target normalizer, applies it to cron delivery normalization and direct target parsing, and adds focused regression tests.

PR surface: Source +53, Tests +39. Total +92 across 5 files.

Reproducibility: yes. at source level: current main routes an unprefixed bare hex iMessage target through phone normalization in cron delivery and the send parser does not treat it as a chat target. I did not run a live macOS iMessage cron job in this read-only review.

Review metrics: 1 noteworthy metric.

  • Implicit iMessage target forms: 1 added. The PR adds an unprefixed bare-hex group target form, which changes iMessage routing classification before delivery.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #89235
Summary: This PR is the open candidate fix for the linked source-reproducible iMessage cron message-loss issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦐 gold shrimp
Patch quality: 🦞 diamond lobster
Result: blocked until stronger real behavior proof 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 terminal output, copied live output, or logs from a real OpenClaw iMessage cron or send path showing the bare hex target resolving and sending as chat_identifier.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body includes tests and an aggregate local imsg database-shape audit, but not redacted after-fix OpenClaw cron/send output or logs showing the bare hex target sent as chat_identifier. 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.

Risk before merge

  • [P1] The PR changes target classification for live iMessage delivery; without after-fix runtime proof, maintainers still have to accept the risk that the real cron/send route does not resolve the bare hex target as the tests assume.
  • [P1] A rare existing contact-name or direct target that is exactly 32 hex characters would now be treated as a group chat identifier, so the runtime proof should confirm the intended group-chat contract is worth that classification change.

Maintainer options:

  1. Require direct iMessage route proof (recommended)
    Ask for redacted terminal output, copied live output, or logs from a real OpenClaw cron or send path showing the bare hex target resolves and sends as chat_identifier before merge.
  2. Accept the bounded source proof
    Maintainers may intentionally accept the focused parser and normalizer fix with the aggregate imsg database audit if live delivery proof is too private to post.
  3. Pause until private proof is available
    Keep the PR open but paused if nobody can safely produce redacted iMessage runtime proof for this transport route.

Next step before merge

  • [P1] No repair job is appropriate because the branch already contains the focused code fix; the remaining action is contributor-supplied live proof or explicit maintainer acceptance of the current evidence.

Security
Cleared: The diff only changes iMessage target parsing and tests; it does not touch CI, dependencies, secrets, auth, package execution, or supply-chain surfaces.

Review details

Best possible solution:

Land the focused plugin-owned normalizer after redacted live OpenClaw iMessage cron or send proof demonstrates the bare hex value is sent as chat_identifier, then let the linked issue close on merge.

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

Yes, at source level: current main routes an unprefixed bare hex iMessage target through phone normalization in cron delivery and the send parser does not treat it as a chat target. I did not run a live macOS iMessage cron job in this read-only review.

Is this the best way to solve the issue?

Yes, the code change is at the right boundary: both direct send parsing and cron delivery normalization need the same iMessage target semantics. The remaining blocker is proof from a real runtime path, not a different implementation layer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5342effebcf7.

Label changes

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded iMessage channel bug where cron delivery can report success while the intended group message is misrouted.
  • merge-risk: 🚨 message-delivery: The diff changes target classification for a live message transport, and runtime proof is still needed to rule out misrouting or false-delivery behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body includes tests and an aggregate local imsg database-shape audit, but not redacted after-fix OpenClaw cron/send output or logs showing the bare hex target sent as chat_identifier. 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 +53, Tests +39. Total +92 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 54 1 +53
Tests 2 39 0 +39
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 93 1 +92

What I checked:

  • Repository policy read: Root AGENTS.md and scoped extensions/AGENTS.md were read fully; the review applied the plugin-boundary and real-behavior-proof rules to this bundled iMessage plugin change. (AGENTS.md:31, 5342effebcf7)
  • Current main cron normalizer misclassifies the reported shape: On current main, unprefixed non-email iMessage messaging targets reach normalizeE164, so a bare 32-character hex value can be normalized as phone-like input before this PR. (extensions/imessage/src/normalize.ts:53, 5342effebcf7)
  • Current main send parser treats bare hex as a handle: Current main only recognizes prefixed chat targets in parseIMessageTarget; an unprefixed bare hex value falls through to the handle path. (extensions/imessage/src/targets.ts:112, 5342effebcf7)
  • Digit stripping matches the linked issue symptom: normalizeE164 strips non-digit and non-plus characters, matching the linked issue's bogus phone-like target for a hex string with digits mixed with letters. (src/utils.ts:56, 5342effebcf7)
  • Existing send path already supports chat_identifier: The iMessage send path already maps parsed chat_identifier targets into the RPC params.chat_identifier field, so this PR works at the parser/normalizer boundary rather than adding a new send primitive. (extensions/imessage/src/send.ts:1023, 5342effebcf7)
  • Cron delivery uses plugin target resolution: Cron delivery resolves delivery.to through channel/plugin target resolution before dispatch, so the iMessage messaging normalizer is on the linked cron failure path. (src/cron/isolated-agent/delivery-target.ts:344, 5342effebcf7)

Likely related people:

  • steipete: Recent history shows repeated work on iMessage normalization and cron/channel target-resolution surfaces, and this PR head also contains maintainer refactors by this account. (role: recent area contributor; confidence: high; commits: 6868cde4d45f, 827b0de0ce74, 63cbc097b5ca; files: extensions/imessage/src/normalize.ts, extensions/imessage/src/targets.ts, src/cron/isolated-agent/delivery-target.ts)
  • gumadeiras: Path history ties the plugin target-resolution heuristic refactor that introduced the iMessage looksLikeId route to this account. (role: target-resolution refactor author; confidence: high; commits: e93412b5ce13; files: extensions/imessage/src/targets.ts, extensions/imessage/src/channel.ts)
  • omarshahine: Recent merged iMessage send and private-API work is adjacent to the chat_identifier JSON-RPC send path reviewed here. (role: recent iMessage send-path contributor; confidence: medium; commits: cc954798f22c, bfccbc3fee9a, 6c35c0d965a0; files: extensions/imessage/src/send.ts)
  • scoootscooob: Current iMessage plugin target and send surfaces date back to the move of iMessage channel code into extensions/imessage. (role: iMessage extension mover; confidence: medium; commits: 0ce23dc62d37; files: extensions/imessage/src/send.ts, extensions/imessage/src/targets.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. P2 Normal backlog priority with limited blast radius. labels Jul 3, 2026
@steipete steipete self-assigned this Jul 3, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label Jul 3, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 3, 2026
@steipete
steipete merged commit 235a5c4 into openclaw:main Jul 3, 2026
114 of 118 checks passed
@steipete

steipete commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 4, 2026
…ets (openclaw#99525)

* fix(imessage): recognize bare hex group chat identifiers as chat targets

A 32-char hex iMessage group chat identifier (as returned by `imsg` for
group chats) with no explicit `chat_identifier:` prefix fell through to
E.164 phone-number normalization. normalizeE164 strips non-digit
characters and prepends `+`, turning
`7d5297154d5f436d83dbbdf03fcc8fdd` into `+75297154543683038` -- a
bogus phone number. Cron/announce delivery then reported
`delivered: true` while silently sending to a nonexistent recipient.

Detect bare 32-char hex strings in both the send-path target parser
(extensions/imessage/src/targets.ts) and the outbound delivery-target
normalizer (extensions/imessage/src/normalize.ts) and route them as
chat_identifier targets, consistent with how an explicit
`chat_identifier:<id>` prefix already resolves.

Fixes openclaw#89235.

* refactor(imessage): centralize bare chat identifiers

* refactor(imessage): centralize bare chat identifiers

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: imessage Channel integration: imessage merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iMessage cron delivery: hex group chat ID stripped to bogus phone number

2 participants