Skip to content

fix(ios): persist voice notes through offline delivery - #101236

Merged
steipete merged 12 commits into
mainfrom
codex/ios-voice-note-durable-outbox
Jul 7, 2026
Merged

steipete merged 12 commits into
mainfrom
codex/ios-voice-note-durable-outbox

Conversation

@steipete

@steipete steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The iOS voice-note composer added in #100946 could lose its only attachment bytes after staging, an ambiguous send, app recreation, or an offline send. It could also retarget an in-progress recording when the selected chat changed, and microphone ownership could overlap with Talk or push-to-talk.

Relates to #100709 and follows up #100946.

Why This Change Was Made

  • Persist voice-note bytes in the existing per-gateway SQLite chat outbox before modern-Gateway delivery, with bounded per-command and total attachment budgets.
  • Pin the captured session, agent, gateway, and routing contract from recording through staging and canonical confirmation.
  • Keep recipient presentation pinned to that captured route, including after canonical history replaces the queued bubble.
  • Make staging a one-shot recorder state so SwiftUI updates cannot consume the same file twice.
  • Queue recordings while offline, preserve ambiguous delivery for reconciliation, and delete durable bytes only after canonical history confirms the user turn.
  • Preserve the established live attachment path for healthy older Gateways that do not support safe replay leases.
  • Serialize voice-note, Talk, push-to-talk, interruption, and background microphone ownership.

User Impact

Voice notes can be recorded and sent while offline, survive reconnects and app recreation, and deliver once without changing chats or disappearing after an uncertain network result. Healthy older Gateways continue to send attachments live; durable offline replay requires a Gateway with the routing-contract capability.

Evidence

  • swift test --filter 'VoiceNoteRecorderTests|ChatViewModelAttachmentTests|ChatTranscriptCacheStoreTests': 66 tests passed.
  • xcodebuild -project OpenClaw.xcodeproj -scheme OpenClaw -configuration Debug -destination 'platform=iOS Simulator,id=F8D0EA37-7040-4FA7-8CFA-BA8841C68E1A' -derivedDataPath build/DerivedData test -only-testing:OpenClawTests/NodeAppModelInvokeTests: 114 tests passed; signed simulator app, Watch app, widget, share extension, and shared packages built successfully.
  • xcodebuild -project OpenClaw.xcodeproj -scheme OpenClaw -configuration Debug -destination 'platform=iOS Simulator,id=F8D0EA37-7040-4FA7-8CFA-BA8841C68E1A' -derivedDataPath build/DerivedData test -only-testing:OpenClawTests/GatewayStatusBuilderTests -only-testing:OpenClawTests/RootTabsPresentationTests: 53 tests passed.
  • node --import tsx scripts/native-app-i18n.ts check: 2,819 entries, unchanged.
  • SwiftFormat lint and git diff --check: clean.
  • Live signed-simulator proof: recorded a 19-second voice note with the Gateway stopped; Send showed one queued row; restarting the Gateway produced one attachment offload and exactly one chat.send; the queued label cleared and one canonical 0:19 voice-note row remained.
  • Fresh structured Codex review of the full branch: no actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added app: ios App: ios size: XL maintainer Maintainer-authored PR labels Jul 7, 2026
@clawsweeper

clawsweeper Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 8:20 PM ET / 00:20 UTC.

Summary
The PR persists iOS voice-note attachments through the shared chat outbox, pins routing and presentation during staging/delivery, updates microphone ownership, and adds focused iOS/shared tests plus native i18n metadata.

PR surface: Other +1222. Total +1222 across 19 files.

Reproducibility: Source-reproducible, not locally executed: current main only queues text-only drafts offline and leaves attachments on the live path, so attachment bytes have no durable replay owner on offline or ambiguous delivery. I did not run the iOS simulator in this read-only review.

Review metrics: 3 noteworthy metrics.

  • SQLite Outbox Schema: 1 version bump, 2 columns added. The PR changes persistent user-state storage, so migration and upgrade behavior matter before merge.
  • Durable Attachment Budgets: 40 MB per command, 50 MB per gateway. The new byte caps bound stored attachment data and are part of the safety contract for offline replay.
  • Shared Swift API Surface: 1 public protocol requirement added. The VoiceNoteAudioCapture injection seam changes in the shared OpenClawChatUI package and should be noticed during compatibility review.

Stored data model
Persistent data-model change detected: database schema: apps/shared/OpenClawKit/Tests/OpenClawKitTests/ChatTranscriptCacheStoreTests.swift, migration/backfill/repair: apps/shared/OpenClawKit/Tests/OpenClawKitTests/ChatTranscriptCacheStoreTests.swift. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Let exact-head iOS/macOS CI finish before landing.
  • Have a maintainer explicitly accept the v6 outbox migration and durable offline attachment scope.

Risk before merge

  • [P1] The PR changes a persistent SQLite outbox schema and stores user voice-note bytes until canonical confirmation, so upgrade/migration proof and exact-head iOS/macOS checks should stay part of the landing gate.
  • [P1] The implementation intentionally broadens offline attachment handling beyond the prior online-only non-goal, so maintainers should explicitly accept that durable attachment scope rather than treating it as incidental bug-fix plumbing.
  • Live GitHub status still had several CI jobs in progress when inspected; this should not block the review verdict, but landing should wait for the exact head to finish the required checks.

Maintainer options:

  1. Land With Migration And CI Green (recommended)
    Maintainers can accept the stored-data and delivery risk after the exact-head iOS/macOS checks and the described live simulator proof remain clean.
  2. Reduce Scope Before Merge
    If generic offline attachment persistence is not intended, narrow the durable path to voice notes and keep other attachments on the current live-only behavior.
  3. Pause For Device Evidence
    If simulator proof is not enough for microphone and reconnect behavior, pause until a redacted physical-device recording or log transcript is posted.

Next step before merge

  • [P2] No narrow ClawSweeper repair is identified; maintainer review should decide the stored-outbox/offline attachment scope and wait for exact-head checks.

Maintainer decision needed

  • Question: Should maintainers land this PR as the durable offline attachment follow-up for iOS voice notes, including the v6 SQLite outbox migration and persist-first handling for pending attachments?
  • Rationale: The patch looks technically coherent, but it changes stored user data and expands the previously online-only attachment boundary, which is a maintainer-owned upgrade and product-scope choice.
  • Likely owner: steipete — He introduced the iOS voice-note feature on current main and is the clearest history-backed owner for deciding the follow-up offline-delivery scope.
  • Options:
    • Land After Exact-Head Checks (recommended): Accept the durable outbox schema and generic pending-attachment persistence once required iOS/macOS CI and the stated simulator proof remain clean.
    • Narrow To Voice Notes First: Ask the branch to restrict durable offline persistence to voice-note attachments if generic offline image attachment queueing is not intended yet.
    • Pause For Stronger Device Proof: Hold the PR until a physical-device recording/send/reconnect proof is attached if simulator microphone proof is not enough for this surface.

Security
Cleared: No concrete security or supply-chain regression was found; the main sensitivity is that voice-note bytes now persist in the existing iOS-protected SQLite outbox until confirmation.

Review details

Best possible solution:

Land the existing durable-outbox approach only after maintainer acceptance of the v6 outbox schema/offline attachment scope and exact-head checks, keeping the older-gateway live-send fallback intact.

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

Source-reproducible, not locally executed: current main only queues text-only drafts offline and leaves attachments on the live path, so attachment bytes have no durable replay owner on offline or ambiguous delivery. I did not run the iOS simulator in this read-only review.

Is this the best way to solve the issue?

Yes, with maintainer acceptance: using the existing per-gateway SQLite outbox is the right owner boundary for durable replay, and the PR preserves the older-gateway live attachment fallback. The main open choice is whether the durable attachment scope should land broadly now or be narrowed to voice notes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4c97aa131195.

Label changes

Label changes:

  • add P2: This is a normal-priority iOS voice-note durability and delivery follow-up with limited blast radius and no released core-runtime outage.
  • add merge-risk: 🚨 compatibility: The PR bumps the per-gateway SQLite outbox schema to v6 and changes how pending attachment data is persisted across upgrades.
  • add merge-risk: 🚨 message-delivery: The PR changes when voice-note/attachment sends are queued, replayed, confirmed, and deleted, which is directly in the message-delivery path.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix signed-simulator proof of recording offline, queueing one row, restarting the gateway, sending exactly once, and reconciling to one canonical voice-note row; no contributor action is needed for the proof gate.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: This is a normal-priority iOS voice-note durability and delivery follow-up with limited blast radius and no released core-runtime outage.
  • merge-risk: 🚨 compatibility: The PR bumps the per-gateway SQLite outbox schema to v6 and changes how pending attachment data is persisted across upgrades.
  • merge-risk: 🚨 message-delivery: The PR changes when voice-note/attachment sends are queued, replayed, confirmed, and deleted, which is directly in the message-delivery path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix signed-simulator proof of recording offline, queueing one row, restarting the gateway, sending exactly once, and reconciling to one canonical voice-note row; no contributor action is needed for the proof gate.
Evidence reviewed

PR surface:

Other +1222. Total +1222 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 19 1529 307 +1222
Total 19 1529 307 +1222

What I checked:

Likely related people:

  • steipete: Current-main history shows the iOS voice-note recorder/composer work was introduced by merged commit b978dcc, and recent ChatViewModel/ChatProTab history also points to Peter Steinberger in adjacent Apple chat work. (role: introduced voice-note feature and recent iOS/chat contributor; confidence: high; commits: b978dcc63bcf, 91d4e8ed8e66; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/VoiceNoteRecorder.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift, apps/ios/Sources/Design/ChatProTab.swift)
  • cxbAsDev: Current-main log and blame for ChatTranscriptCache and ChatViewModel+Outbox point to commit 3f9ee4c on the durable outbox/cache implementation this PR extends. (role: recent durable outbox/cache area contributor; confidence: medium; commits: 3f9ee4c5a11a; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatTranscriptCache.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+Outbox.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dfb7960354

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CHANGELOG.md Outdated

### Fixes

- **iOS voice-note durability:** persist queued recordings and their routing identity through disconnects, app recreation, and canonical-history reconciliation while preventing duplicate staging and overlapping microphone owners. (#100709)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the manual changelog entry

For normal fix/feat work, root AGENTS.md says CHANGELOG.md is release-only and release generation owns it; adding this Unreleased entry can leave duplicate or stale release notes once the release generator derives entries from merged PRs/direct commits. Please remove this line and keep the release-note context in the PR body or squash message instead.

Useful? React with 👍 / 👎.

@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready.

Exact head: 673d825600253bb42b0a17214a90b872d2f74a5b

Proof:

  • Hosted exact-head CI/Testbox gate passed: https://github.com/openclaw/openclaw/actions/runs/28832114793 (55 successful jobs, 4 expected skips, zero failures).
  • swift test --filter 'VoiceNoteRecorderTests|ChatViewModelAttachmentTests|ChatTranscriptCacheStoreTests': 66 passed after the final rebase.
  • xcodebuild -project OpenClaw.xcodeproj -scheme OpenClaw -configuration Debug -destination 'platform=iOS Simulator,id=F8D0EA37-7040-4FA7-8CFA-BA8841C68E1A' -derivedDataPath build/DerivedData test -only-testing:OpenClawTests/NodeAppModelInvokeTests: 114 passed; signed simulator app and companion targets built.
  • xcodebuild -project OpenClaw.xcodeproj -scheme OpenClaw -configuration Debug -destination 'platform=iOS Simulator,id=F8D0EA37-7040-4FA7-8CFA-BA8841C68E1A' -derivedDataPath build/DerivedData test -only-testing:OpenClawTests/GatewayStatusBuilderTests -only-testing:OpenClawTests/RootTabsPresentationTests: 53 passed.
  • node --import tsx scripts/native-app-i18n.ts check: 2,819 entries, unchanged.
  • SwiftFormat lint for all 15 changed Swift files and git diff --check: clean.
  • Fresh structured Codex review of the full branch: no actionable findings.
  • Signed-simulator live proof: with the Gateway stopped, a 19-second recording produced one queued voice-note row; reconnect produced one attachment offload and exactly one chat.send; the queued label cleared to one canonical 0:19 row.

Known proof gap: Linux Testbox cannot execute Apple-framework Swift or iOS simulator tests, so those focused and live checks ran locally on macOS; hosted ios-build and macos-swift both passed.

@steipete
steipete merged commit f95ca90 into main Jul 7, 2026
82 checks passed
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the codex/ios-voice-note-durable-outbox branch July 7, 2026 00:21
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
* fix(ios): persist voice note delivery state

* fix(ios): pin chats during attachment staging

* fix(ios): keep voice notes on captured chat

* fix(ios): keep voice notes durable through staging

* fix(ios): harden voice note lifecycle

* test(ios): satisfy strict concurrency in voice note proof

* fix(ios): keep legacy attachment sends live

* fix(ios): retain legacy drafts during outbox restore

* fix(ios): pin voice note recipient presentation

* fix(ios): preserve confirmed voice note duration

* chore(i18n): refresh voice note source inventory

* chore: leave release notes to release automation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant