Skip to content

fix(app): retain pendant audio across reconnect WAL flush - #22995

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/capture-test-fix
Oct 21, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/capture-test-fix

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Problem and result

Pendant packets arriving during a reconnect could be appended to the WAL buffer after its old contents were drained, then erased by onAudioCodecChanged after disk I/O. This is a product audio-loss bug, not a polling fixture bug. Seal the complete old pendant tail and advance codec and device identity synchronously before the flush; packets arriving during I/O stay in the new buffer under the new source's custody. The pendant capture caller supplies identity at this boundary because native BLE continues delivering during the flush. Phone capture starts only after its flush and identity update both finish, so its existing ordering and protected spine oracle remain unchanged. Reuse the existing pendant custody construction and preserve the phone chunk/tail policy.

The existing capture_live_recovery_test packet count and three-second recovery bound are unchanged. New barrier tests force the exact I/O interval on same-codec reconnects and codec changes, then read the durable index and files to prove every packet appears exactly once, in order, under the correct codec.

Causal evidence

Verification

All local checks run through /Users/dazheng/workspace/omi/bin/omi-heavy run -- nice -n 19.

  • Baseline: bash test.sh test/services/capture/capture_live_recovery_test.dart (138 protected spine tests and 17 capture recovery tests passed).
  • Red: the new same-codec write-barrier regression against unmodified main fails 60 expected / 50 actual.
  • Green after source-identity correction: flutter test test/unit/local_wal_durability_seam_test.dart test/unit/local_wal_sync_test.dart test/unit/local_wal_live_custody_test.dart test/unit/local_wal_sync_session_generation_test.dart test/unit/local_wal_sync_owner_uid_test.dart test/services/capture test/services/wals, 633 passed. Includes same-codec and changed-codec write barriers, two-pendant ring custody during flush, exact file payloads, session generation fencing and unchanged live recovery assertions.
  • flutter test --dart-define=OMI_DEV_CONTROLS=1 test/spine: 138 passed after the correction.
  • scripts/pr-preflight --pr-body-file ...: 25 checks passed. OMI_PR_BODY_FILE=... make preflight: 25 checks passed. Push hooks also run without bypasses.

This is source-level and hermetic disk evidence. No physical-device run or production account data was used. A read-only App Store Connect check on 2026-10-21 confirms iOS 1.0.568 build 1423 is still WAITING_FOR_REVIEW, release MANUAL; public iOS is 1.0.566 build 1417. Codemagic identifies iOS1423 and Android1471's source as fbb197a6bf4fb56b432280140beb6c8c797e5927, containing #22873 and the vulnerable clear. The existing rollout receipt 6ad848373ac160f4685c9479 at 05:06 UTC confirms Android 1.0.568/1471 advanced from 1% to 10% production. Public Play still lists 1.0.567, so the listing alone missed staged exposure. The later internal 1.0.569 candidates (iOS1427, Android1475; source bbede22e1e4) also contain the vulnerable code. Field-loss prevalence was not measured. A rebuilt mobile artifact is needed; no backend deployment is needed.

Review follow-through

  • Round 1 full Grok review: SHIP at 6fc768e8375.
  • Automated P1: moving codec before I/O must also move device identity. A two-pendant write barrier reproduces missing ring evidence on the first head; the fix moves codec/device together for the pendant caller and checks exact old/new device, codec, ring, epoch and frame counts.
  • The unchanged stop/ingress race noted as minor in round 1 is tracked in Guard WAL stop against ingress arriving during flush #22996. This PR changes the automatic reconnect/source boundary.

Product invariants affected

  • INV-CAP-1: preserve every admitted pendant packet across automatic reconnect and WAL source changes, including arrivals during durable writes.

Failure-Class: new

UI-Evidence: none -- WAL buffering and hermetic regressions only; no UI change.

Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2756 -> 2764 | extract one synchronous pendant-sealing primitive shared by tail drain and source rollover so asynchronous flushes cannot erase later arrivals or bind them to the previous device

Seal the old buffer and advance the codec boundary before awaiting I/O.
Prove same-codec and codec-change rollover with a blocked index write and
exact payload checks from durable audio files.

Failure-Class: new
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T08:01:37.422991Z 101ccdf New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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: 6fc768e837

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

Publish the incoming device alongside its codec before awaiting flush.
Pass device identity from both production capture callers and force a
two-pendant handoff during index I/O to verify ring and connection evidence.

Failure-Class: new
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Round 1 full review: SHIP at 6fc768e (Grok, review.sh ledger). The unchanged stop/ingress concern is tracked in #22996. The valid automated P1 has a reproduced two-device barrier (both Opus modes lose new ring evidence on the first head); the correction now moves device identity together with codec, updates both production callers and the forwarding spy, and checks old/new device, codec, ring, process epoch and durable frame counts. Expanded checks are running before the round-2 delta push.

Only pendant ingress continues during codec-flush I/O. Keep the phone
recorder's existing codec-then-identity ordering: its native capture starts
after both complete. Restore the protected spine oracle unchanged.

Failure-Class: new
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Round 2 delta review at 101ccdf: VERDICT SHIP, no P0/P1 findings. Review cap complete (round 1 full, round 2 source-identity delta). Two-device barrier reproductions and 633 WAL/capture + 138 protected spine checks pass; protected oracle remains unchanged. The automated source-identity finding is fixed and its thread resolved. Waiting for the final Dart and Android emulator jobs before merge_on_green.

@Git-on-my-level
Git-on-my-level merged commit dedbea3 into main Oct 21, 2026
44 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/capture-test-fix branch October 21, 2026 08:22
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
Picks up #22995 (P17 capture_live_recovery fix) and main through 31756b9,
which includes #22877 episodes (d6b734b; prod deploy freeze until the
EPISODES_PERCENT=0 overlay lands, staging allowed per lead 88c5cd).

Conflicts:
- utils/sync/cap_hold_recovery.py: main's optional recovery cohort (#22991) and
  pacing metrics (#22970); module gates on recovery_admission_enabled. Kept
  integration's lane-returning _selected_lane, funded-processing reservation
  and batch hand-off.
- main.py / app_roles.py: kept the B8 role-map mount; Mount(episodes) added in
  main's position (between pending_work and commitment_followup).
- .github/ci-budget.yaml: six rationale strings carry both sides' notes.
- config/feature-flags.yaml: both sides' rows; registry re-rendered.
Adaptations: 8 label-debt entries (episodes/memory-source/held-content metrics,
owner lane 14); test_summary_delivery first-import case allowlisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
Follow-up to #22999 (Android rollout brake). Adds `BRAKE_ACTION=stage`
to the manual Codemagic `android-rollout-brake` workflow, so a fixed
build can replace a halted production rollout at an explicit small
fraction. Merge after #22999.

Why: David approved halting Android 1.0.568 (1471) and fast-tracking the
fixed 1.0.569 (1477), which carries the pendant reconnect audio-loss fix
from #22995. `mobile-store-promote` cannot be used for this: its Android
path defaults to `status=completed`, which is 100% at once.

What `stage` does:
- Inputs: `BRAKE_VERSION_CODE` (new code),
`BRAKE_SUPERSEDES_VERSION_CODE` (halted code), `BRAKE_USER_FRACTION`, a
one-line `BRAKE_NOTES_LINE`, and `CONFIRM=brake`. Inputs are validated
before any authentication or edit.
- Refuses unless production holds the superseded code as `halted` beside
completed releases only (no drafts or other staged releases), the new
code is not already on production, the new code sits alone on internal
or alpha under exactly one marketing version newer than the halted one,
the fraction does not exceed the halted fraction, and the halted release
has no country targeting.
- Writes one `inProgress` release at the requested `userFraction` in
place of the halted one. Completed releases stay byte-identical. The
release name carries the daily train's gate receipt (`1.0.569 (gate
YYYY-MM-DD-HHMM)`), so the ladder can advance it later.
- Notes copy the halted release's What's New and append
`BRAKE_NOTES_LINE` to en-US and to every locale holding the identical
English text. Real translations stay unchanged, and Play's 500-character
limit is enforced before writing.
- Uses the existing commit path: exact update-response match, then
`ERROR_IF_IN_REVIEW` commit, then a full-track readback in a fresh edit.
Prints `BRAKE_RESULT action=stage ...`.
- Halt/resume/status behaviour is unchanged. The commit/readback block
moved into a shared helper.

The only `.github/` change refreshes the two whole-document Codemagic
digests in
`.github/scripts/fixtures/codemagic_workflow_contract/v1.json`, under
lead ruling `0f4368`. A scratch check confirmed every other workflow is
semantically identical and only three env vars were added to
`android-rollout-brake`.

Validation: `backend/tests/unit/test_mobile_rollout_brake.py` now has 24
fake Play tests (11 new), all passing, plus
`.github/scripts/test_check_release_process_guards.py` (121 total
passed). Stage tests cover the exact written track, notes, gate-receipt
name, call sequence, refusal for every non-halted status, unexpected
production or source state, fraction above the halted one, bad inputs
before authentication, update/readback mismatches, and a status read of
the staged release.

Fixes found during live use (each refused before opening any Play edit):
- Codemagic rejects an empty env var value, so `BRAKE_NOTES_LINE` has no
yaml default and is passed per build.
- Play's Android notes are one line of entries joined by "; " (from
`mobile-changelog` android_notes; 1471 held 486 characters). The stage
keeps whichever shape Play holds and replaces the last entry when
appending would pass 500 characters. The refusal names both lengths.
- The anonymous GitHub API read from Codemagic's shared runners failed 3
times. The workflow now also loads the existing read-only
`mobile_release_admission` group, and the check sends its `GITHUB_TOKEN`
when present.

Live use (store-fasttrack lane, David-approved fast-track; lead answer
`0142bb` for the notes):
- status `6ad88707d7f84e6126bb0274`: `BRAKE_RESULT action=status
versionCode=1471 status_before=halted status_after=halted
userFraction=0.1`
- stage `6ad8a05789e6dfa249fca407`: `BRAKE_RESULT action=stage
versionCode=1477 status_before=absent status_after=inProgress
userFraction=0.01 supersedes=1471 superseded_status=halted
superseded_userFraction=0.1 name='1.0.569 (gate 2026-10-21-1123)'`
- status `6ad8a0d948119fac6ce8b698`: `BRAKE_RESULT action=status
versionCode=1477 status_before=inProgress status_after=inProgress
userFraction=0.01`

Both GitHub Play writer workflows remain disabled; re-enabling is the
release lead's call.

Product invariants affected: INV-AUTH-1, INV-DATA-1, INV-BETA-1 (the
shared Codemagic file matches these guards; the change only adds env
vars to the Android production brake workflow and preserves all existing
desktop auth, routing, signing, and Beta workflows).

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/23030?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/23030?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23030&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant