Skip to content

fix(imessage): align final delivery proof with destination history - #185409

Merged
steipete merged 1 commit into
mainfrom
codex/imessage-rich-link-final-delivery
Oct 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/imessage-rich-link-final-delivery

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #182329, #173493

What Problem This Solves

Fixes the iMessage rich-link final-delivery test failing on main and on PRs that select its extension shard.

User Impact

No runtime behavior changes. The test again verifies final native delivery, exactly one successful message_sent hook, SQLite echo persistence, and suppression of hidden tool output against the current delivery contract.

Why This Change Was Made

The breaking commit is 3fe7f1e2a43c33005e7015ec559e1d006df0b8e5 (#182329). It records confirmed outbound payloads through the destination-history owner. When no current local destination binding is available, that owner calls the channel session resolver. iMessage intentionally resolves opaque chat_id selectors through chats.list to distinguish direct chats from groups (#173493, 2a1151addfbf). This is an intentional read after the send, not a duplicate delivery.

The native fixture now supplies the matching direct chat. The assertion requires exactly two RPCs in order: one send to chat 123 with the expected final text, then one chats.list with limit 1000. Extra sends, extra RPCs, and wrong chat IDs still fail. The hidden-output case still requires zero native calls and zero hooks. No production owner, state shape, config, or compatibility path changes. Simplification pass: one existing test updated; production +0/-0, tests +10/-5 (net +5).

Evidence

  • Before the fix, node scripts/run-vitest.mjs extensions/imessage/src/monitor.plugin-payload.test.ts --maxWorkers=1 on unchanged dee511a5cc0ee477037ff9e54c7b0e6b9935a9ba: 1 failed, 2 passed. Final delivery saw send followed by chats.list, violating the old single-call assertion. Wall time 150.41s (cold compiler preparation); test time about 3.73s.
  • After the fix, the same command: 3 passed. Wall time 46.15s; test time 6.38s (final case 6.143s). This existing integration uses the real monitor, dispatcher, native transport adapter, hooks and isolated SQLite; only external native I/O/model output is supplied by fixtures. No new tests or timers added. In CI, the same file passed all 3 tests in 2.486s of test time (final 2.368s), with 56.06s shard wall time including compilation.
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfo: passed.
  • node scripts/run-vitest.mjs extensions/imessage/src/session-route.test.ts --maxWorkers=1: 18 passed, including direct chat selectors, native/configured groups, and unresolved-selector refusal. Wall time 111.16s (cold compiler preparation); tests totaled about 0.12s.
  • node scripts/run-oxlint.mjs --tsconfig test/tsconfig/tsconfig.extensions.test.json extensions/imessage/src/monitor.plugin-payload.test.ts: passed.
  • node scripts/run-format.mts --check extensions/imessage/src/monitor.plugin-payload.test.ts and git diff --check: passed.
  • Codex autoreview: scoped-clean at P0–P2; no accepted/actionable findings.
  • Exact-head CI run 40446394704 on 7e0ecf5034a7f95c5f722dfdffeb4eff36ebfff1: SUCCESS, all 17 non-skipped jobs passed. The changed extension shard ran the repaired test. Both required openclaw/ci-gate check instances passed. Repository watcher: GREEN, zero pending checks; earlier draft-era checks were superseded. No reruns or retry pushes.

No live Gateway, Messages account, or user state was accessed. Native macOS delivery is mocked; this is a test-contract repair, not live platform proof. The breaking commit is attributed from its parent-relative production patch and merged PR contract; a historical checkout/bisect was unnecessary.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage size: XS labels Oct 27, 2026
@steipete
steipete marked this pull request as ready for review October 27, 2026 03:50
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-27T03:50:34.910113Z 7e0ecf5 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Updates the iMessage delivery fixture and expected RPC sequence to include destination-history chat lookup.

Example: A rich-link reply sends “provider-visible ordinary final” to chat 123.

  • Before: The test rejects the subsequent chats.list request despite successful delivery.
  • After: The test permits exactly one send followed by one bounded lookup, while retaining hook and SQLite persistence checks.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct test repair supported by source tracing and successful exact-head CI; behavioral evidence remains an in-process integration with native I/O fixtures.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-contract repair changes no production behavior; supplied evidence exercises the real monitor, dispatcher, hooks, and isolated SQLite with mocked native I/O, and exact-head CI succeeds without claiming live Messages delivery.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: The iMessage extension validation shard fails despite the intended final-delivery behavior.
Reason: The maintainer-authored direction restores useful integration coverage without changing runtime contracts or removing distinct failure checks.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs an obsolete test expectation without changing runtime behavior or weakening delivery checks; no actionable introduced defects were found.

Priority: P2
Reviewed head: 7e0ecf5034a7f95c5f722dfdffeb4eff36ebfff1

Before merge

None.

Findings

None.

Agent review details

How this fits together

The iMessage monitor feeds inbound messages into reply dispatch; confirmed outbound delivery invokes destination-history routing, which may resolve opaque chat selectors through the native transport.

flowchart TD
A[Inbound rich link] --> B[iMessage monitor]
B --> C[Reply dispatcher]
C --> D[Native send]
D --> E[Destination history owner]
E --> F[iMessage chat lookup]
D --> G[Delivery hook and echo persistence]
Loading

Technical review

Best possible solution:

Merge the focused fixture repair while preserving the existing production delivery and destination-history owners.

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

The unchanged main assertion permits only send, while source tracing establishes the subsequent chats.list lookup; the PR reports a matching red-before/green-after run, and exact-head CI succeeds.

Is this the best way to solve the issue?

This is the smallest complete repair: provide the existing lookup owner with a valid direct-chat fixture and retain exact send cardinality, destination, hook, persistence, and suppression checks.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1891d8319638.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 338a7cc adds extensions/imessage/src/monitor.plugin-payload.test.ts:203 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 338a7ccb2f70; files: extensions/imessage/src/monitor.plugin-payload.test.ts)
  • RoboClaw: Raw commit 9564f57 adds extensions/imessage/src/monitor.plugin-payload.test.ts:314 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9564f5783594; files: extensions/imessage/src/monitor.plugin-payload.test.ts)

PR surface

Tests +5. Total +5 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 10 5 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 10 5 +5

Review metrics

Metric Value Why it matters
Production versus test changes Production +0/-0; tests +10/-5 The small increase supplies the existing resolver's native response and preserves an exact single-send trace without adding scaffolding.

Labels

Label changes:

  • add P2: The obsolete expectation fails the selected iMessage extension shard and can block otherwise unrelated PR validation.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The obsolete expectation fails the selected iMessage extension shard and can block otherwise unrelated PR validation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 27, 2026, 12:15 AM ET / 04:15 UTC.

@steipete
steipete merged commit 4876470 into main Oct 27, 2026
208 of 213 checks passed
@steipete
steipete deleted the codex/imessage-rich-link-final-delivery branch October 27, 2026 04:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…penclaw#185409)

Repair the iMessage rich-link final-delivery test's stale single-RPC expectation.

Breaking commit dc60bf2 (PR openclaw#182329) added destination-history recording after confirmed outbound sends. Its fallback invokes the iMessage session resolver, which intentionally resolves opaque chat_id selectors through chats.list to distinguish direct chats from groups (PR openclaw#173493).

Supply the matching direct-chat identity in the native fixture and require exactly one send to chat 123 followed by exactly one bounded chats.list lookup. Duplicate sends, extra RPCs, wrong recipients, missing hooks, missing SQLite echo persistence, and visible hidden tool output remain rejected. Production behavior is unchanged.

Proof: reproduced the original failure on unchanged main, then passed all 3 monitor.plugin-payload tests and all 18 session-route tests locally. Extension-test types, targeted lint, formatting, and diff checks pass. Exact-head CI run 40446394704 passed all 17 selected jobs on 7e0ecf5; the repaired file passed all 3 tests in CI. Codex autoreview was clean, and coordinator review accepted the stricter assertion. No live Gateway or user state was accessed.
steipete pushed a commit that referenced this pull request Oct 30, 2026
* fix(imessage): use a PostgreSQL-safe recovery cursor key

The recovery cursor was keyed by `${accountId}\^@${dbIdentity}`.
PostgreSQL plugin state rejects NUL in keys, so the startup cursor lookup
threw PLUGIN_STATE_INVALID_INPUT and the channel exited on every start.
Key the cursor by a sha256 prefix of the (account, identity) pair, like the
other iMessage plugin-state keys, and adopt a cursor still stored under the
NUL key (SQLite only) once by listing the namespace instead of looking it up.

* ci: re-run against current main (monitor.plugin-payload test fixed by #185409)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…4919)

* fix(imessage): use a PostgreSQL-safe recovery cursor key

The recovery cursor was keyed by `${accountId}\^@${dbIdentity}`.
PostgreSQL plugin state rejects NUL in keys, so the startup cursor lookup
threw PLUGIN_STATE_INVALID_INPUT and the channel exited on every start.
Key the cursor by a sha256 prefix of the (account, identity) pair, like the
other iMessage plugin-state keys, and adopt a cursor still stored under the
NUL key (SQLite only) once by listing the namespace instead of looking it up.

* ci: re-run against current main (monitor.plugin-payload test fixed by openclaw#185409)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: imessage Channel integration: imessage P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant