Skip to content

Fix live recorder locate race, back-to-back tailing, failure counts, and newest-first upload order - #269

Open
silviot wants to merge 1 commit into
mainfrom
fix/recorder-poststop-followups
Open

silviot wants to merge 1 commit into
mainfrom
fix/recorder-poststop-followups

Conversation

@silviot

@silviot silviot commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up fixes for live recorder precomputation, post-stop recovery, and sidecar sync ordering on top of #268 (D-1202):

  • Newest-first sidecar uploads (SyncPlanner.kt, SyncPlannerTest.kt): plan .cwx transcript sidecar uploads from newest copied recording to oldest (state.recordings.asReversed()) so recent recordings become browsable on the recorder first even across multi-session uploads.
  • Short/stopped/split locate recovery (RecorderLiveTailer.kt): prevent locateActiveEntry from throwing RECORDER_MISSING when a live recording finishes or rotates between GETLEN and listing refresh, handle sub-header (<= 44 B) finalization safely, and propagate FinalizedImport(downloaded, failed, noteId).
  • Back-to-back live tailing & post-stop accounting (RecorderLiveTailer.kt, RecorderSync.kt): keep tailing newly started live recordings via mayUploadTranscripts(address, pong), await async transcript completion on resumed liveHeaderPending post-Stop downloads, delegate non-LATER verifiedLiveOffset failures to downloadFailed, run retryAfterHold even after live tailing, fix postTailDownloads counting when live finalize fails, and fold failed / postTailDownloads into +XREC:SYNC.
  • Tests & Docs (RecorderLiveRecoveryTest.kt, FakeRecorder.kt, docs/recorder-sync.md): add beforeStat test hook and 6 regression tests covering short/stopped locate, back-to-back tailing, transient finalize failure, post-stop async transcript wait, deleted live partial cleanup, and newest-first sidecar ordering; update docs/recorder-sync.md.

Hardware Verification

Tested end-to-end between Pixel 8 (Android 17 / API 37, io.codemyriad.cassini.talk.debug at 43de74ee) and SL6801 (silviot/voice-recorder-hw-bt-usb d0f878a, temporary BT=1 BENCH=1 mode=rec secs=65 delay_s=6 sync_s=90 rec_ch=1 rec_dsp=0 rec_vor=0, production flash restored afterward):

  • Pixel 8 device smoke (scripts/device-smoke.sh --annotation CiSmoke): 50 of 50 tests passed in 127.238 s.
  • Live BT sync & screen-off Stop-to-transcript round-trip:
    • 63.989 s recording (REC_0083.wav, 2,043,948 B), 1,800,576 B (~88.1%) pulled live via GETS before Stop with live VAD/diarization precomputation running under screen-off power state (ov=0, comp=0, lost=0, sd_err=0).
    • Stop to .cwx committed & +XREC:SYNC,0: 39,024 ms (BENCH bgsync st=done ms=39024, REC_0083.cwx 2,404 B CWX1, Wake sync finished: Done(downloaded=1, uploaded=2, skipped=0, deviceRecording=false, failed=0)).

Checks

  • ./gradlew detekt ciTest passes. On macOS or Windows: ./gradlew detekt and the tests without the pixel comparison pass (see CONTRIBUTING.md). CI does the pixel comparison.
  • ./gradlew :app:lintDebug :data:lintDebug :ui:lintDebug passes.
  • The CI checks that are not in Gradle pass (see "Run the tests" in CONTRIBUTING.md).
  • Screenshot goldens: I recorded them on Linux x86_64 and examined each changed PNG, or no golden changed.
  • Device tests: if the change touches recording, playback, services, models or native code, I ran scripts/device-smoke.sh on this device and Android version: Pixel 8, Android 17 (API 37)
  • Verbatim engine code: scripts/check-verbatim.sh passes, and I recorded each reviewed change in scripts/check-verbatim.baseline.
  • Documentation: I updated the documents that the change affects (README.md, docs/, CHANGELOG.md, PRIVACY.md), and scripts/check-links.sh passes.
  • Each commit has a Signed-off-by line (git commit -s, see CONTRIBUTING.md).
  • The change contains no model weights, private recordings, transcripts or voiceprints.

Device safety

CAUTION: Do not run the Gradle connected* or managed-device tasks, adb uninstall io.codemyriad.cassini.talk or adb shell pm clear io.codemyriad.cassini.talk on a device with data that you want to keep. They erase the app data and the downloaded models.

…and newest-first upload order

Signed-off-by: Silvio Tomatis <[email protected]>

This branch has not been deployed

No deployments
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