fix(imessage): coalesce split-sends without delaying normal DMs#90795
fix(imessage): coalesce split-sends without delaying normal DMs#90795omarshahine wants to merge 4 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 5, 2026, 8:53 PM ET / 00:53 UTC. Summary PR surface: Source +132, Tests +51, Docs +6. Total +189 across 4 files. Reproducibility: yes. from source for current behavior: current main debounces every opted-in iMessage DM, matching the PR's latency complaint. I did not establish a live Messages reproduction of the delayed or late-payload split-send path. Review metrics: 1 noteworthy metric.
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:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the selective coalescing direction only if maintainers accept the narrowed config contract, then update docs, fix the iMessage monitor mocks/tests, remove the changelog edit, and add redacted real iMessage proof before merge. Do we have a high-confidence way to reproduce the issue? Yes from source for current behavior: current main debounces every opted-in iMessage DM, matching the PR's latency complaint. I did not establish a live Messages reproduction of the delayed or late-payload split-send path. Is this the best way to solve the issue? Unclear until maintainers accept the narrowed config contract. The implementation layer is plausible, but the PR needs docs, tests/mocks, changelog cleanup, and real iMessage proof before it can be considered the best fix. 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 e5d1fadea7e2. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +132, Tests +51, Docs +6. Total +189 across 4 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
|
`coalesceSameSenderDms` previously debounced every DM for the full window (2500ms), so each reply waited out the debounce even when no follow-up was coming. A `Dump <URL>` whose payload row arrived late (e.g. attachment transfer lag) could also miss the window and dispatch as two turns, producing a stray "send me the URL" bubble. Classify each DM instead of holding all of them: - lead-in: a short bare command-style fragment (`Dump`) that plausibly precedes a payload — briefly held. - payload-join: a URL/attachment that completes a pending lead-in — merged into the held lead-in and flushed immediately. - instant: everything else (prose, questions, lone URLs) — zero added latency. Normal conversation now replies instantly; real split-sends still coalesce and flush as soon as the payload row lands rather than waiting out the window. The window now only bounds how long a lone lead-in waits for a follow-up. Adds pure `isIMessageSplitLeadIn` / `iMessageTextHasUrl` helpers in coalesce.ts with unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feaa685 to
fc5899d
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Closing this for now. The selective OpenClaw coalescing heuristic improves latency, but it still guesses from short lead-in text because the Better path: fix I’ll reopen or replace this after the |
…th back-compat (#90858) Gate iMessage same-sender DM split-send coalescing on imsg's structural `balloon_bundle_id` URL-balloon marker (openclaw/imsg#137) instead of timing/ text-shape inference, with a session capability latch and a back-compat path: - URL-balloon marker present -> merge (precise split-send). - Build known to emit balloon metadata (session latch) -> keep non-marker buckets separate (the precision win). - Build that never emits balloon metadata (older imsg) -> preserve the legacy unconditional merge, so split-send users do not regress to two turns. Never merges more than shipped main already did. Verified live end-to-end: the patched gateway, watching a real chat.db via an imsg #137 build, merged a real iPhone-sent `Dump <url>` split-send into one turn. Client-side removal once imsg coalesces upstream is tracked in #91243 (openclaw/imsg#141). Closes #90795
…th back-compat (openclaw#90858) Gate iMessage same-sender DM split-send coalescing on imsg's structural `balloon_bundle_id` URL-balloon marker (openclaw/imsg#137) instead of timing/ text-shape inference, with a session capability latch and a back-compat path: - URL-balloon marker present -> merge (precise split-send). - Build known to emit balloon metadata (session latch) -> keep non-marker buckets separate (the precision win). - Build that never emits balloon metadata (older imsg) -> preserve the legacy unconditional merge, so split-send users do not regress to two turns. Never merges more than shipped main already did. Verified live end-to-end: the patched gateway, watching a real chat.db via an imsg openclaw#137 build, merged a real iPhone-sent `Dump <url>` split-send into one turn. Client-side removal once imsg coalesces upstream is tracked in openclaw#91243 (openclaw/imsg#141). Closes openclaw#90795
Problem
coalesceSameSenderDmsdebounced every DM for the full window (2500ms) before replying, because the monitor couldn't know mid-stream whether a second bubble was coming. Two symptoms:Dump <URL>as twochat.dbrows and the payload row arrives late (e.g. attachment-transfer lag pushing it past the window), the lead-in flushed alone → two turns → a stray "send me the URL" bubble.Fix
Classify each DM instead of holding all of them:
Dump,Save this) that plausibly precedes a payload. Briefly held.Net effect: normal conversation replies instantly; real split-sends still coalesce into one agent turn and now flush as soon as the payload row lands rather than waiting out the window. The debounce window now only bounds how long a lone lead-in waits for a follow-up.
Group chats and the
coalesceSameSenderDms: falsepath are unchanged.Implementation
coalesce.ts:iMessageTextHasUrlandisIMessageSplitLeadIn(heuristic: short, no URL, no media, no terminal punctuation), with unit tests.monitor-provider.tsclassifies each DM (classifyDmCoalesce), tracks pending lead-in keys, tags the debouncer entry, and flushes the merged turn immediately on payload-join. The sharedinbound-debounceflush-then-separate semantics are left untouched (intentional for control commands).Tests
coalesce.test.ts: +7 cases covering URL detection and lead-in classification (bare commands, terminal punctuation, word-cap, payload-carrying, media, empty).🤖 Generated with Claude Code