fix(agents): avoid duplicate generated media fallback#89220
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 1, 2026, 5:05 PM ET / 21:05 UTC. Summary PR surface: Source +15, Tests +100. Total +115 across 2 files. Reproducibility: yes. Current-main source shows target media URLs are marked as targeted before target matching, which makes a targetless target record able to block global media evidence and allow a duplicate fallback. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow dedupe fix after maintainer review accepts the targetless current-chat telemetry contract and the mismatched-provider safety coverage. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows target media URLs are marked as targeted before target matching, which makes a targetless target record able to block global media evidence and allow a duplicate fallback. Is this the best way to solve the issue? Yes. The PR fixes the dedupe decision at the generated-media fallback boundary and reuses the existing sourceDeliveryTargetsMatch contract, with positive and mismatched-provider regression coverage. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against f8491b0fcf12. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +15, Tests +100. Total +115 across 2 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
|
|
Live proof from the latest iMessage run has been added to the PR body.
CI on this PR is green at |
|
Landed via squash merge.
Thanks @omarshahine. |
Treat targetless current-chat message-tool media telemetry as delivered for generated-media completion dedupe while preserving fallback delivery for mismatched provider/account/thread evidence. Real behavior proof was added from the live iMessage generated-image run: inbound id 5805, exactly one outgoing media reply id 5806, and no follow-up generated-image fallback. Co-authored-by: omarshahine <10343873+omarshahine@users.noreply.github.com> Reviewed-by: @lobster
Treat targetless current-chat message-tool media telemetry as delivered for generated-media completion dedupe while preserving fallback delivery for mismatched provider/account/thread evidence. Real behavior proof was added from the live iMessage generated-image run: inbound id 5805, exactly one outgoing media reply id 5806, and no follow-up generated-image fallback. Co-authored-by: omarshahine <10343873+omarshahine@users.noreply.github.com> Reviewed-by: @lobster
Summary
Verification
./node_modules/.bin/oxfmt --check --threads=1 src/agents/subagent-announce-delivery.ts src/agents/subagent-announce-delivery.test.tsnode scripts/run-oxlint.mjs src/agents/subagent-announce-delivery.ts src/agents/subagent-announce-delivery.test.tsnode scripts/run-vitest.mjs src/agents/subagent-announce-delivery.test.ts-> 92 tests passedgit diff --check.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main-> clean, no accepted/actionable findingsReal behavior proof
Behavior addressed: generated-media completion fallback no longer sends a duplicate
The generated image is ready.copy when the message tool already delivered media to the current chat but telemetry omitted an explicittotarget.Real environment tested: local macOS Messages/iMessage private API with the LaunchAgent gateway running the rebuilt dist that included this patch.
Exact steps or command run after this patch: Sent this real iMessage:
Ok generate a new image now of a Lobster ready to launch like a Rocket into space.Then inspected/opt/homebrew/bin/imsg history --chat-id 3 --limit 30 --attachments --jsonand~/.openclaw/logs/openclaw.log.Evidence after fix: iMessage DB shows inbound request id
5805at2026-06-01T20:55:49.931Z, followed by exactly one outgoing generated-image reply id5806at2026-06-01T20:57:14.450Zwith one PNG attachment (upload.png,2360236bytes) and text🦞 Here’s the rocket-launch lobster image.The next latest generated-image run before this patch showed duplicate fallback messages such asThe generated image is ready.; the post-fix run has no such follow-up fallback after id5806.Observed result after fix: requester confirmed the generated-image turn delivered once. Gateway log for the same turn shows the final source reply was suppressed under
sourceReplyDeliveryMode: message_tool_onlyafter media delivery (textChars=0 media=1) and the dispatch completed successfully in about 84s.What was not tested: CI cannot exercise real Messages.app delivery; live proof is from the local macOS iMessage setup and the requester's observation.