Skip to content

fix(imessage): settle accepted monitor deliveries canonically - #117282

Merged
steipete merged 1 commit into
mainfrom
codex/qa400-imessage-monitor-delivery-settlement
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa400-imessage-monitor-delivery-settlement

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

iMessage's live inbound-monitor direct delivery discarded native provider receipts for successful tool and streamed-block replies, so core could not emit the canonical terminal message_sent observation. When a later native attachment/caption send failed after earlier messages had already become visible, the plugin retained only the latest partial receipt and silently lost the earlier accepted identities/content. A reply containing only hidden assistant tags was sanitized to nothing but returned no typed suppression, leaving the action without either a visible outcome or a recorded intentional non-outcome.

Why This Change Was Made

Replace the obsolete private plural-array delivery abstraction with the single-payload lifecycle its only production caller actually uses. Capture every native send result at its authoritative provider boundary, reuse the existing Plugin SDK receipt/partial-error contracts to aggregate actual accepted identities and visible content, explicitly return the canonical no-visible-result suppression, and let the existing core turn lifecycle own terminal message_sent observation. Never infer thread metadata from the attempted reply: the native transport can fall back to an unthreaded send, and its actual receipt remains authoritative.

User Impact

Successful iMessage tool and streamed-block replies now expose their real provider message IDs, visible content, and exactly one terminal delivery event. If an already-visible native attachment is followed by a rejected caption or a later native failure, all accepted receipts and only the genuinely visible content remain available for failure observation. Replies reduced entirely to hidden assistant tags intentionally send nothing, record the typed suppression, and never emit a false successful delivery event.

Evidence

  • Immutable reviewed commit 58eeffdbe088a142fbf003e26bf3f7fc55e7be94, tree 2a614be2e612f7a349b4bcea61d706413064ed16, sole parent ee320a6e411479a23faa89a75463ff1b15630afc; exactly two existing iMessage production owner/caller files and two existing colocated owner/product test files.
  • Actual baseline at ee320a6e411479a23faa89a75463ff1b15630afc reproduced all three independent failures in one focused owner run: successful chunks returned undefined; a later rejected caption lost both earlier accepted IDs and visible caption content; hidden-tag-only replies returned undefined instead of typed suppression. Seven unchanged owner tests passed while those three failed.
  • Final focused native-owner suite: 10/10 passing; verifies ordered multi-chunk receipt aggregation, multi-attachment nested caption-failure custody, rejected-thread fallback without invented reply metadata, voice/media behavior, echo-cache lifecycle, and typed no-visible-result suppression.
  • Final genuine product-path suite: 4/4 passing, including actual iMessage monitor ingress, actual channel-turn dispatcher/lifecycle, an actual separate native imsg RPC sender, exactly one real message_sent plugin hook for both tool and streamed-block replies, and persisted echo custody in the real state/openclaw.sqlite plugin_state_entries table. Hidden-only payload sends no native message and emits no success hook. A separate independent hostile reviewer reran both suites together: 14/14 passing.
  • Exact focused command: OPENCLAW_VITEST_FS_MODULE_CACHE=0 OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/imessage/src/monitor/deliver.test.ts extensions/imessage/src/monitor.plugin-payload.test.ts; existing-binary four-file oxfmt --check, focused oxlint --threads=1, and git diff --check all pass.
  • Genuine full exact-commit Codex gpt-5.6-sol / high autoreview through P0, P1, P2, and P3: no findings, confidence 0.86. Verified real TruffleHog 3.96.0 Mach-O SHA-256 09c30c73bf4a265942c4a3e1a889833464c01db18fb4e53002220baa3367eb5d; actual scan passed.
  • Four independently hostile final-SHA owner/caller/core/native-provider/SQLite/sibling reviews: WhatsApp 0.99, Feishu 0.99, outside-wave Matrix 0.98, and outside-wave OpenAI/history 0.99; each found zero P0–P3 issues.
  • Latest authoritative main 1f130ce61d62bd99e0912a0d90f351c4c6e8527c does not modify iMessage owners, channel-turn settlement, receipt aggregation, or the relevant Plugin SDK contracts. Newly landed WhatsApp alias normalization is confined to its transport owner; the fresh plugin-state read-only table fix preserves and improves the same SQLite lifecycle without changing writable echo custody. Exact read-only synthetic merge is clean: cd0e18ea2a8884f4e27586cba17c22a2d84680c9.
  • Production delta +84/-44 = +40 lines; Forty net production lines replace an obsolete plural-array owner with one canonical single-payload native send lifecycle, preserve every actual provider receipt and visible partial-delivery subset, explicitly record sanitized no-send outcomes, and opt into the existing core-owned terminal observation. They introduce no new public API/config, retry, fallback, media-root, reasoning-policy, persistence, schema, dependency, or second send path.

@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 4:15 AM ET / 08:15 UTC.

ClawSweeper review

What this changes

The PR replaces iMessage monitor reply delivery’s void result with a structured native receipt, partial-delivery, and intentional-suppression result consumed by the shared channel-turn lifecycle.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep this PR open: the source-level repair is coherent and has no discrete correctness finding, but the required after-fix real iMessage-provider proof is still missing. The new product-path test drives the monitor and lifecycle but replaces the native iMessage RPC client with Vitest doubles, so it cannot independently establish receipt behavior against a real native sender.

Priority: P1
Reviewed head: fde7a611ca8299984512cffed6f6b4e01ff1ba77

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and contract-aligned, but its merge-gating real behavior proof remains mock-only.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body claims native-path coverage, but the inspectable product-path test mocks the iMessage RPC client and returns synthetic send receipts; add a redacted real native-provider transcript, log, or recording before merge. 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.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body claims native-path coverage, but the inspectable product-path test mocks the iMessage RPC client and returns synthetic send receipts; add a redacted real native-provider transcript, log, or recording before merge. 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 5 items Canonical delivery result: The PR changes the iMessage owner from a plural void-returning helper to one payload delivery function that returns a receipt, visible content, or typed no-visible-result suppression; partial failures aggregate accepted native receipts before rethrowing the shared partial-delivery envelope.
Shared lifecycle contract: Current main resolves partial delivery only from the shared channel-delivery result contract, so carrying native receipt facts into that envelope is the correct owner boundary rather than emitting an iMessage-specific terminal event.
Proof remains mock-backed: The new monitor-path test explicitly mocks createIMessageRpcClient and supplies a fake native client whose request method returns a synthetic sent GUID. It exercises product wiring and SQLite echo custody, but not an actual imsg/native-provider send.
Findings None None.
Security None None.

How this fits together

The iMessage monitor receives an inbound native message, runs the agent reply pipeline, and sends each resulting payload through the iMessage transport. The transport result returns to the shared channel-turn lifecycle, which records successful terminal message observations or intentional/partial outcomes.

flowchart LR
  A[Native iMessage monitor event] --> B[Agent reply pipeline]
  B --> C[iMessage delivery adapter]
  C --> D[Native send receipts]
  C --> E[Partial delivery or suppression]
  D --> F[Shared channel-turn lifecycle]
  E --> F
  F --> G[Terminal message observation]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body claims native-path coverage, but the inspectable product-path test mocks the iMessage RPC client and returns synthetic send receipts; add a redacted real native-provider transcript, log, or recording before merge. 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.
  • Resolve merge risk (P1) - The refactor changes the facts supplied to terminal channel delivery observation; merging without a redacted real native iMessage run leaves the authoritative receipt, accepted-ID aggregation, and partial-failure behavior unverified outside mocked RPC responses.
  • Resolve merge risk (P1) - The PR is cleanly mergeable but behind current main; refresh the focused proof against the merge result before landing rather than treating the stale-base status as a code regression.
  • Complete next step (P2) - The remaining merge blocker is contributor-supplied real native iMessage proof, which an automated repair lane cannot create or attest from the mocked test harness.
Agent review details

Security

None.

PR surface

Source +43, Tests +321. Total +364 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 88 45 +43
Tests 2 344 23 +321
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 432 68 +364

Review metrics

Metric Value Why it matters
Delivery result boundary 1 monitor delivery adapter changed from void to structured result The new result becomes the source of truth for terminal delivery observation and partial-send custody.

Merge-risk options

Maintainer options:

  1. Add native-provider proof before merge (recommended)
    Attach redacted after-fix output from a real iMessage monitor/send run that shows the native receipt and the resulting terminal observation, including a partial-send path if safely reproducible.

Technical review

Best possible solution:

Retain the shared-lifecycle design, then attach a redacted real imsg monitor/send transcript or runtime log that demonstrates a successful visible reply, one terminal message_sent observation, and a partial-delivery case preserving earlier accepted IDs.

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

No live reproduction was independently run in this read-only review; source inspection establishes that current main’s iMessage monitor delivery path returns no structured result, and the PR’s focused tests provide a source-level reproduction harness.

Is this the best way to solve the issue?

Yes for the code shape: the PR reuses the existing Plugin SDK receipt and partial-delivery contracts and leaves terminal observation with the shared lifecycle. The remaining gap is evidence, not a need for a parallel iMessage-specific delivery path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6baf4dd15f5d.

Labels

Label justifications:

  • P1: This addresses live channel reply delivery and whether successful replies are observed accurately.
  • merge-risk: 🚨 message-delivery: The patch changes how iMessage receipt, suppression, and partial-delivery facts reach the shared delivery lifecycle.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body claims native-path coverage, but the inspectable product-path test mocks the iMessage RPC client and returns synthetic send receipts; add a redacted real native-provider transcript, log, or recording before merge. 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

What I checked:

  • Canonical delivery result: The PR changes the iMessage owner from a plural void-returning helper to one payload delivery function that returns a receipt, visible content, or typed no-visible-result suppression; partial failures aggregate accepted native receipts before rethrowing the shared partial-delivery envelope. (extensions/imessage/src/monitor/deliver.ts:27, fde7a611ca82)
  • Shared lifecycle contract: Current main resolves partial delivery only from the shared channel-delivery result contract, so carrying native receipt facts into that envelope is the correct owner boundary rather than emitting an iMessage-specific terminal event. (src/channels/turn/lifecycle.ts:58, 6baf4dd15f5d)
  • Proof remains mock-backed: The new monitor-path test explicitly mocks createIMessageRpcClient and supplies a fake native client whose request method returns a synthetic sent GUID. It exercises product wiring and SQLite echo custody, but not an actual imsg/native-provider send. (extensions/imessage/src/monitor.plugin-payload.test.ts:59, fde7a611ca82)
  • Exact branch provenance: The reviewed branch head is a single commit over ee320a6, authored August 1, 2026, and its exact diff is limited to the iMessage delivery owner, caller, and colocated tests. (extensions/imessage/src/monitor/deliver.ts:1, fde7a611ca82)
  • Current-main ownership trail: The current delivery file has substantial recent history from Peter Steinberger and a most-recent main touch by Masato Hoshino, making them the best available routing candidates for the shared iMessage delivery path. (extensions/imessage/src/monitor/deliver.ts:27, a7b4a4735628)

Likely related people:

  • steipete: Peter Steinberger has the largest observed contribution count across the current iMessage delivery and monitor files and authored earlier delivery-path changes in their history. (role: recent area contributor; confidence: high; commits: 0ac7b24d56ca, 9979ee312d43; files: extensions/imessage/src/monitor/deliver.ts, extensions/imessage/src/monitor/monitor-provider.ts)
  • Masato Hoshino: The current-main blame/history trail attributes the latest touch to the delivery owner file to Masato Hoshino. (role: most recent current-main contributor; confidence: medium; commits: a7b4a4735628; files: extensions/imessage/src/monitor/deliver.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted real iMessage monitor/send evidence showing a visible reply, native receipt, and one terminal observation.
  • Refresh the focused proof against the current merge result before landing.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-01T07:35:50.919Z sha 58eeffdbe088a142fbf003e26bf3f7fc55e7be94 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/qa400-imessage-monitor-delivery-settlement branch from 58eeffd to fde7a61 Compare August 1, 2026 08:10
@steipete
steipete merged commit 338a7cc into main Aug 1, 2026
96 of 98 checks passed
@steipete
steipete deleted the codex/qa400-imessage-monitor-delivery-settlement branch August 1, 2026 08:24
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 1, 2026
* origin/main: (41 commits)
  test(ci): update memory helper routing expectation (#117295)
  fix(canvas): emit successful control results in JSON mode (#117297)
  fix(imessage): settle native inbound reply delivery (#117282)
  fix(agents): reject invalid UTF-8 LSP responses (#117271)
  fix(line): centralize card and template message alt text (#117280)
  fix(release): validate candidates before Docker publication (#117252)
  fix(media): validate provider-owned generated media downloads (#117281)
  fix(feishu): restore custom HTTPS API domains (#117278)
  fix(models): reuse prepared plugin metadata (#117131)
  fix(agents): stop fallback after delivered-but-failed attempts (#114628)
  fix(memory): reuse targeted session corpus snapshot (#117247)
  fix(matrix): reconcile durable sends after response loss
  test(release): repair full validation regressions (#116931)
  fix(linux-canvas): report socket watcher fallback (#109502)
  fix(codex): preserve authoritative turn completion (#117185)
  fix(canvas): preserve widgets across derived-name collisions (#117132)
  fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (#117206)
  fix(msteams): prevent duplicate final replies (#116398)
  fix(doctor): session SQLite restore installs an empty session index over the valid archive (#117221)
  fix(plugins): preserve workspace plugins across CLI and control UI (#117265)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main: (41 commits)
  test(ci): update memory helper routing expectation (openclaw#117295)
  fix(canvas): emit successful control results in JSON mode (openclaw#117297)
  fix(imessage): settle native inbound reply delivery (openclaw#117282)
  fix(agents): reject invalid UTF-8 LSP responses (openclaw#117271)
  fix(line): centralize card and template message alt text (openclaw#117280)
  fix(release): validate candidates before Docker publication (openclaw#117252)
  fix(media): validate provider-owned generated media downloads (openclaw#117281)
  fix(feishu): restore custom HTTPS API domains (openclaw#117278)
  fix(models): reuse prepared plugin metadata (openclaw#117131)
  fix(agents): stop fallback after delivered-but-failed attempts (openclaw#114628)
  fix(memory): reuse targeted session corpus snapshot (openclaw#117247)
  fix(matrix): reconcile durable sends after response loss
  test(release): repair full validation regressions (openclaw#116931)
  fix(linux-canvas): report socket watcher fallback (openclaw#109502)
  fix(codex): preserve authoritative turn completion (openclaw#117185)
  fix(canvas): preserve widgets across derived-name collisions (openclaw#117132)
  fix(channels): config validation rejects documented channels.<id>.configWrites on 13 channels (openclaw#117206)
  fix(msteams): prevent duplicate final replies (openclaw#116398)
  fix(doctor): session SQLite restore installs an empty session index over the valid archive (openclaw#117221)
  fix(plugins): preserve workspace plugins across CLI and control UI (openclaw#117265)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: imessage Channel integration: imessage maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L 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.

1 participant