fix: make native audio messages playable inline - #278
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs real behavior proof before merge. Reviewed September 7, 2026, 3:36 AM ET / 07:36 UTC. ClawSweeper reviewWhat this changesThe PR converts CLI and RPC native voice attachments to validated CAF/Opus audio before sending, with regression tests and documentation. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful, focused fix absent from the supplied main revision and v0.15.1. No blocking code defect was found, but the reported successful playback needs inspectable supporting evidence before merge. Priority: P2 Review scores
Verification
How this fits togetherimsg accepts attachment paths through its CLI and JSON-RPC server, then stages files for the bridge inside Messages.app. Native voice preparation changes the audio representation that Messages receives for inline playback. flowchart TD
A[CLI or RPC attachment request] --> B{Native voice requested?}
B -->|Yes| C[Secure snapshot and CAF Opus conversion]
C --> D[Validate audio format and duration]
D --> E[Messages bridge]
B -->|No| F[Ordinary attachment staging]
F --> E
E --> G[Messages attachment or voice bubble]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep one shared native-voice preparer before bridge dispatch, preserving original files, ordinary attachments, reply metadata, and existing delivery safeguards. Do we have a high-confidence way to reproduce the issue? Unclear independently: source confirms that current main passes MP3 bytes unchanged with the native-audio flag, and the contributor supplies a concrete Mac reproduction, but inline playback was not exercised in this read-only review. Is this the best way to solve the issue? Yes at the code level: shared preparation before bridge dispatch addresses both entrypoints without adding a runtime dependency or duplicating the unrelated receive-side attachment conversion. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 646ea7af9616. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer verification of
This proves the shared preparation path. It does not independently prove the recipient's inline Messages player. This Mac has SIP enabled and no live injected bridge, so no message was sent. The remaining landing gate is inspectable inline-playback evidence from an authorized bridge-enabled Mac and test conversation, tied to this head. The implementation is otherwise a LAND candidate; it stays outside the current patch-release notes until that gate is satisfied. |
Prepare the authorized 0.15.2 patch release with safer bridge startup and reliable local tests. Preserve the Highlights line and contributor credits, date the release notes for 2026-09-07, and synchronize version.env, the generated Swift constant, and bundle versions. The combined fixes passed 753 Swift tests and signed CLI verification. Version metadata validation and independent autoreviews pass. Native audio playback work in #278 remains excluded.
Sending a valid MP3 with
send-attachment --audiocan produce a00:00voice bubble that will not play inline, even though opening the attachment externally plays the audio. The bridge setsisAudioMessage, but currently stages and sends the original bytes unchanged.This prepares native voice attachments as CAF containing Opus before bridge dispatch, for both CLI and RPC. Ordinary file attachments keep their existing behavior.
What changes
AudioMessagePreparerinIMsgCore, selected by CLI--audioand RPCaudio/is_audio/as_voice.afconvert: mono, 24 kHz, 32 kbit/s Opus in CAF. No runtime dependency on ffmpeg or a TTS provider.The container and codec both matter; renaming an MP3 to
.cafis insufficient. Preparation belongs before the bridge call, so every CLI/RPC caller benefits without spawning a converter inside Messages.app. Reply metadata and ordinary attachment sends are unchanged.Reproduce / verify
On a Mac with a working injected bridge, use an existing iMessage chat and a valid MP3 containing a few seconds of audio:
imsg send-attachment --chat "$CHAT" --file /path/to/speech.mp3 --audio --transport dylibBefore: the native bubble can show
00:00and refuse inline playback; opening the file externally works.After: imsg sends the prepared CAF/Opus file. Verify a real duration and audible playback using the play button inside Messages. Omitting
--audiostill sends the original MP3 as a regular attachment.End-to-end verification used this PR's release build directly on macOS 26.6.2,
bypassing the existing transport wrapper. A fresh synthetic 4.95-second MP3
arrived as a native four-second voice bubble; clicking the normal play button
started inline playback and advanced its remaining-time state. The database
recorded
is_audio_message=1, a CAF UTI and a nonempty 28,235-byte attachment.The earlier transport-side reproduction also produced a fresh 16-second TTS
reply whose recipient confirmed audible inline playback.
Validation
make lint: passed; 15 existing size warnings, no serious violations.make test: 754 Swift tests passed, plus documentation and native helper tests. On this Mac with a live bridge, the three test-only injections from fix: make RPC send tests independent of host bridge availability #277 were temporarily applied for the full run and then removed; they are not included in this PR. The Command Line Tools-only installation also needed explicit Testing framework search/runtime paths.make build ARCHES=arm64: passed, including the native helper build.Linux read-core compatibility is preserved with macOS guards; Linux CI remains the validation for that platform.