Repository navigation
SCA-3024: keep a manual finish's cut on audio-only recordings and add a fast first transcript - #26192
Conversation
…s the manual end Mobile captures are server-batch-only: the recording has no transcript when the user taps Finish, so the finalizer closes it through complete_server_batch_capture and never reaches the transcript path that calls changed(manual_end=True). The batch transcript then landed as ordinary speech and the window waited out the silence and lock timers, or stayed live while the pendant kept recording. The terminal transaction now stores v3_manual_end for a client_finalize job on a v3 recording, and re-arms reconcile when the transcript beat the commit. Kill switch: CONVERSATIONS_V3_BATCH_MANUAL_END=off. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…nual end Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…rding, ahead of the batch pipeline A manual finish waited for the batch pipeline's ordered merge and delivery: on the owner account the transcript landed 95 to 474 s after the finish request although the GPU result was ready at 26 to 43 s. When record admission stages a sealed, manually ended v3 recording, transcribe it once through the prerecorded provider for its language and write the result with the existing transcript writer. That marks the recording pending and wakes reconcile; the stored manual end cuts the window, so notes start at once. The batch record projection still owns the canonical transcript and replaces these segments; the writer refuses the fast write once that projection has landed. Default off: CONVERSATIONS_V3_FAST_FINISH is off, on, or a uid: member list. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…-finish runtime cohort Membership is runtime-owned (scripts/rollout_cohort.py --add), so one owner can be admitted in production without a secret, an env change or a roll. The default mode is cohort, which admits nobody until a member is added. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ing lands as one transcript Independent review of the fast first transcript and the manual-end marker: - The completion transaction now stores v3_manual_end_requested. Record admission promotes it to v3_manual_end for a single batch unit; several units project one at a time, and cutting on the first would lock a partial window. - The cohort read moved onto the worker thread; on the event loop a cold membership cache answered False and the pass never started. - The pass starts only after admission commits, once per recording per process, on copies of the unit references. - The row is re-read before the write, so a delete, discard, lock or canonical projection during the provider call wins. - Provisional segments carry no speaker number and the outer lines stretch to the audio span, so the canonical transcript keeps its numbering and its edge lines stay inside the locked window. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ched first transcript The background-task ratchet requires every detached task to say why losing it at SIGKILL is safe. Record admission now awaits the single-unit cut itself, so the detached pass carries only the early provider transcript, and the baseline records that reason. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be07005537
ℹ️ 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".
| and row.get('status') == 'completed' | ||
| and row.get('private_cloud_sync_enabled') | ||
| and row.get('data_protection_level', 'enhanced') in {'standard', 'enhanced'} | ||
| and not row.get('transcript_segments') |
There was a problem hiding this comment.
Decode stored transcripts before checking fast-finish eligibility
For normal Firestore-backed recordings, both current and refresh() in _manual_finish_admitted are raw snapshots, not decoded conversation rows. _prepare_conversation_for_write() stores even an empty transcript as nonempty compressed bytes, additionally encrypted for enhanced privacy, so this condition rejects empty captures and the fast pass is never scheduled for cohort members. Decode the field before checking transcript presence, including during refresh. backend/AGENTS.md explicitly warns that direct Firestore reads return opaque transcript blobs.
AGENTS.md reference: backend/AGENTS.md:L180-L180
Useful? React with 👍 / 👎.
| words = prerecorded_from_bytes( | ||
| pcm, sample_rate=SAMPLE_RATE, diarize=True, attempts=1, encoding='linear16', channels=1, language=language | ||
| ) |
There was a problem hiding this comment.
Authorize managed STT spend before the fast provider call
When a fast pass runs for an owner with exhausted allowance or denied processing consent, committing record admission is not permission to spend: the ordinary batch path subsequently checks batch_admission() in utils/batch_pipeline/admission.py, which delegates to the consent and funding checks in sync_admission(). This direct provider call bypasses those checks, so it can spend Omi's provider credits and materialize a transcript while the canonical unit is held. Apply the shared batch spend authorization immediately before dispatch and skip the optional pass when authorization is refused.
Useful? React with 👍 / 👎.
| segments[0]['start'] = min(segments[0]['start'], first_audio) | ||
| segments[-1]['end'] = max(segments[-1]['end'], last_audio) |
There was a problem hiding this comment.
Keep stretched segment bounds within their source unit
For a multi-unit recording whose first or last unit produces no words, stretching the remaining outer segment across every unit can move its midpoint into an inter-unit gap. For example, units covering 0–10 and 120–130 seconds with speech only in the first produce a provisional segment spanning 0–130. live_projection.replace_record() removes provisional rows only when their midpoint lies inside the projected unit, so neither unit removes this row and canonical speech is appended alongside it, leaving duplicated transcript text. Preserve each segment's source-unit bounds when stretching, or replace provisional rows through explicit unit ownership.
Useful? React with 👍 / 👎.
… fast-finish tests CI charges an import made inside a test to that test's 1 s CPU budget; the first admission-hook test paid for utils.batch_pipeline.live and failed shard 7. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e fast first transcript - F1: re-read the row before any audio is sent to the provider, not only before the write. - F2/F7: a multi-unit recording is cut only after the whole-recording transcript is written. - F3/F5: pad each unit's outer lines by at most 2 s inside that unit, so every midpoint stays in the unit the batch projection replaces. - F4/F8: at most 8 units per pass, two passes at a time per process. - F6: allowlist the three new metric families on the backend-integration scrape. - F9: use the documented trigger resolver, so a legacy force_process job counts. - F10: promotion requires finished_at. - F11: pin the real transcription clock math. - F12: document that the manual-end kill switch also stops the pass. - F14/F15: start_background_task; an unexpected failure is its own outcome. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…te, and act only on this intake's units Release review at be07005 and the batch-custody objection: - Stored transcript segments are compressed even when empty, so a raw row always looked transcribed and the pass never started. Admission now screens on clear fields only and the pass decides on a decoded row. - The pass goes through the shared consent and funding gate (sync_admission, lane batch) before any provider spend. - The hook runs only when the intake answered batch for this binding's own job; busy and completed answers no longer stamp a cut or start a pass. - Owners outside the rollout never take a pass slot. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…of a manually finished recording Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
…e fast first transcript - F1: the provisional write judges the stored row inside its transaction (update_conversation_segments require_row), so a delete, discard or lock committed after the pass's last read still wins. - F2: a single-unit cut promoted after speech already landed leaves the recording pending for the sweep. - F3: an undecodable stored transcript is never treated as empty. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c406738c5b
ℹ️ 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".
|
|
||
| def refresh(): | ||
| # Decoded: an empty stored transcript is not empty bytes. | ||
| return conversations_db.get_conversation(uid, conversation_id, firestore_client=store.client) or {} |
There was a problem hiding this comment.
Recheck account-level privacy before the detached provider call
If an owner disables private cloud sync after admission but before the detached task starts, this refresh still returns the recording's captured private_cloud_sync_enabled=True. The new funding check does not enforce the account's current sync setting, so the pass uploads audio despite the opt-out. The canonical path rejects this exact state in backend/database/batch_pipeline_privacy.py:764–771, where user_sync_enabled=False blocks the recording. Reuse the shared batch privacy/generation authorization before provider dispatch rather than treating a refreshed conversation row as the current privacy grant.
Useful? React with 👍 / 👎.
| if write is None: | ||
| from database.conversations import update_conversation_segments as write | ||
| # False: the canonical record already projected (or the row is gone); the batch transcript wins. | ||
| written = write(uid, conversation_id, segments) |
There was a problem hiding this comment.
Replace provisional text in the derived conversation too
When the fast pass publishes a manually locked derived card before canonical transcription arrives, recording-layer replacement succeeds, but the derived transcript can retain both versions. backend/utils/conversations/v3/planner.py:369–395 preserves the locked card's old segments and appends canonical segments unless they satisfy its duplicate-text predicate. A dependency-free reproduction with fast text “We should meet on Monday” and canonical text “We should meet on Tuesday” produces two overlapping lines in the same card. This affects even a single unit with correctly bounded segments, independently of the earlier midpoint issue. Give fast-owned text a canonical replacement path in the derived card rather than feeding it through append-only preservation.
Useful? React with 👍 / 👎.
| from utils.observability.stt_cap_dispatch import DispatchPath | ||
| from utils.stt.pre_recorded import get_prerecorded_service | ||
| from utils.stt_cap_dispatch import sync_admission |
There was a problem hiding this comment.
Move the new dependencies to module-level imports
The new funded() helper introduces function-local imports, as do _transcribe(), the default writer branch, and _manual_finish_admitted(). backend/AGENTS.md explicitly requires “All imports at module top level — never inside functions.” Hoist these dependencies to module scope, restructuring the dependency boundary if necessary while keeping SDK/client construction lazy.
AGENTS.md reference: backend/AGENTS.md:L168-L168
Useful? React with 👍 / 👎.
| promoted = await run_blocking( | ||
| db_executor, conversations_v3.promote_manual_end, uid, conversation_id, firestore_client=store.client | ||
| ) |
There was a problem hiding this comment.
Keep manual-end promotion recoverable after admission commits
If this promotion exhausts its Firestore retries, the outer catch suppresses the failure even though admit_record_units() has already moved the single-unit job from record_pending to ready. drain_recordings() selects only record_pending jobs, while the builder consumes v3_manual_end, not v3_manual_end_requested, so the stored request is never promoted again. The same gap exists if the process dies between admission and this call. Canonical transcription still completes, but the explicit finish loses its cut and falls back to the silence timers. Commit promotion with admission or retain a durable, retryable promotion obligation.
Useful? React with 👍 / 👎.
…rovisional writer Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 045304a3e3
ℹ️ 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".
| provider = get_prerecorded_service(language)[0] | ||
| allowed, _ = sync_admission(uid, seconds, provider, lane='batch', path=DispatchPath.BATCH_PROVIDER) | ||
| return allowed |
There was a problem hiding this comment.
Apply fresh-lane anti-abuse checks before fast transcription
For an enrolled owner who is hard-restricted or above the daily audio ceiling but still has a funded allowance, this authorization returns True and the fast pass spends provider credits. The canonical fresh-lane authorizer separately checks get_hard_restriction_status() and is_daily_audio_ceiling_exceeded() in backend/utils/batch_pipeline/admission.py:157–171; neither check is part of sync_admission() or its allowance resolver. Consequently, manual finishes can produce paid transcripts while canonical processing is explicitly held for abuse prevention. Reuse the fresh-lane restriction checks before dispatch and skip the optional pass when either refuses.
Useful? React with 👍 / 👎.
| segment['end'] += shift | ||
| # The batch projection allocates speaker numbers after every stored integer id, covered | ||
| # rows included. Provisional rows keep their label and claim no number. | ||
| segment['speaker_id'] = None |
There was a problem hiding this comment.
Preserve unnumbered provisional speakers through storage
On the real persistence path, assigning None does not keep these rows unnumbered: update_conversation_segments() calls _prepare_conversation_for_write(), whose canonicalize_segment_for_storage() derives a numeric ID from the retained SPEAKER_XX label. A provisional SPEAKER_00 therefore persists as ID 0, and replace_record() hydrates that ID before allocating the first canonical voice as ID 1 instead of 0; additional provisional speakers shift subsequent allocations too. This defeats the intended stable canonical speaker numbering. Use a persisted sentinel or provisional ownership marker that canonical allocation ignores, and cover the actual storage normalization rather than only the stubbed writer.
Useful? React with 👍 / 👎.
…nc authorization and privacy generation Goal-owner ruling on SCA-4084 (2026-11-24T05:43Z): the detached pass must enforce the account's current sync authorization and privacy generation before reading audio or dispatching to the provider, and fail closed. The pass now asks the batch privacy fence (tx.check_privacy at the generation admission was granted under) before any audio is read and again at the provider boundary. A missing check, a refusal, an unavailable authority or anything but an explicit True stops the pass with outcome privacy_blocked. Tests cover opt-out after capture, a change while the audio was read, a changed generation, and the authorized path. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts: # backend/deploy/cloud_run_gmp_sync.yaml
The provider-boundary privacy check sat outside the unit loop, so an opt-out during the first transcribe request could still be followed by dispatch of the next unit. Ask before each unit and cover a two-unit pass revoked during the first call (the second unit is never sent). Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5add3211e1
ℹ️ 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".
| started = time.monotonic() | ||
| try: | ||
| # False: the row no longer qualifies, or the canonical record already projected. | ||
| written = (write or _write_fenced)(uid, conversation_id, segments) |
There was a problem hiding this comment.
Revalidate batch privacy when publishing the fast transcript
If the owner disables cloud sync while the last—or only—provider request is in flight, this write still stores the transcript and wakes reconciliation. refresh() reloads the recording's captured sync flag, and _write_fenced() checks only candidate on that row; neither observes the account-level opt-out. A single-unit reproduction returns written even when privacy() becomes false during transcription, whereas the equivalent two-unit case correctly stops before publication. Canonical projection enforces current privacy and the admitted generation transactionally through ProjectionSession.guard() in backend/database/batch_pipeline_projection_session.py; enforce that same fence in this publication transaction so an in-flight result cannot be published after revocation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e9b4936f. The default writer now runs the batch privacy fence (assert_batch_write_allowed at the admitted privacy_generation, allow_token_mint=False) inside its own write transaction, through a new guard hook on update_conversation_segments that runs after require_row and before any write. A refusal writes nothing and the pass returns privacy_blocked. The default writer also refuses to publish when no fence is supplied. Tests: test_an_opt_out_during_the_only_provider_request_publishes_nothing, test_the_default_writer_never_publishes_without_the_fence, and the admission test now checks the fence arguments.
The transcript write judged only the stored row, so an opt-out or a privacy generation change during the last (or only) provider request was still published. The default writer now runs the batch privacy fence (assert_batch_write_allowed at the admitted generation, no token mint) inside its own write transaction via a new guard hook on update_conversation_segments, and refuses to publish without it. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ual-end Conflicts in backend/deploy/cloud_run_gmp_sync.yaml (GMP keep-regex) and backend/docs/listen_pusher_pipeline.mdx: both sides kept (BasedHardware#26198 window-cap metric and docs beside the fast-finish lines). Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e00e2b2c8
ℹ️ 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".
| copied, | ||
| read, | ||
| refresh=refresh, | ||
| cut=None if single else cut, |
There was a problem hiding this comment.
Send a distinct manual-end wake for single-unit fast finishes
If this owner's ordinary reconcile task already completed in the same minute, the fast writer's update_conversation_segments() only calls changed(uid, cid), so triggers.enqueue() reuses that owner-minute task name and enqueue_named_task() skips the duplicate. Passing cut=None removes the separate manual_end_id wake for single-unit finishes: the pass reports written, but Home can still wait for canonical delivery, another change, or the ten-minute pending sweep. Send the manual-end wake after a successful single-unit write too, even though its cut is already stored.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e6b9e50e. For a promoted single unit, admission now passes the cut callback, which calls changed(uid, cid, manual_end=True) and so wakes under the distinct manual_end_id task name. The pass calls it only after a written transcript. Re-setting v3_manual_end is idempotent. A single unit that was not promoted still gets no manual-end wake. Tests: test_admission_cuts_a_single_unit_itself_before_the_pass (a written pass now wakes once) and test_a_single_unit_that_was_not_promoted_gets_no_manual_end_wake.
A promoted single unit already holds its cut, so the pass got no cut callback and relied on the writer's plain wake. That wake shares the owner's per-minute task name and is skipped when a reconcile already ran that minute, leaving Home waiting for canonical delivery or the pending sweep. A promoted single unit now gets the manual-end wake (distinct manual_end_id task) after a written pass; an unpromoted one gets none. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
#26213) ## What changed and why A Finish pressed in the first minute of a mobile recording did nothing. The app showed Processing, no summary arrived, and the row later disappeared. Mobile captures are server-batch-only. The listen session marks `server_batch_audio_received` at the first audio frame and writes `has_content` only when a 60-second archive window commits. A user finish before that commit reached finalization admission with no transcript and no content marker, was answered `no_content`, and the request returned the recording unchanged. The recording stayed open until the socket closed or the quiet timer fired. A pendant keeps streaming, so that could take minutes or never happen. Production readback (2026-11-24, one test account, synthetic speech over `/v4/listen`, then `POST /v1/conversations` with the socket held open): | Recording | Answer to the finish | Finalization job | | --- | --- | --- | | 37 s | `in_progress` (ignored) | `capture_end`, created only when the socket closed 20 s later | | 77 s | `processing` | `client_finalize`, created with the request | For the 77 s recording the session rolled over at once, committed the tail in 2.8 s, and the record sealed 4.4 s after the request. #26192 does not cover the short case: its manual-end marker needs a `client_finalize` job, and none was created. The change: - **Admission** (`_create_or_get_finalization_intent_txn`): a `client_finalize` of a batch-owned row with `server_batch_audio_received` true, no committed audio, an open archive, no reconnect producer and at least 10 seconds of age is admitted. Every other trigger, and every other row, keeps `no_content`. - **Worker** (`finalize_persisted_conversation`): for that job it re-reads the row every 0.5 s for at most 30 s until the session has committed the audio, then registers the recording and closes the capture as before. A row that never gains audio keeps the existing `ServerBatchArchiveNotClosed` retry. No new write: the session's existing rollover commit supplies the audio bounds. Cost is at most 60 extra row reads per early finish. ## Rollout and rollback It rolls out with the fast first transcript: `CONVERSATIONS_V3_FAST_FINISH` (default `cohort`, the `v3-fast-finish` runtime rollout cohort; `on` admits every owner; `off` stops it). With the default, nothing changes for an owner outside the cohort. `CONVERSATIONS_V3_BATCH_MANUAL_END=off` also stops it. A job admitted before either switch still completes. ## Known limits, to settle before `on` - A row with a reconnect producer is not admitted early. `note_server_batch_audio` and `close_server_batch_audio` refuse a producer row once its status leaves `in_progress`, so the session could not commit the audio. The serving listen image predates `LISTEN_BATCH_RECONNECT_ENABLED`, so today's mobile rows carry no producer. When that image ships, this change stops applying to mobile rows until the fence lets the owning token write while the row is `processing`. The same fence would then refuse the tail of a finish after the first window; that is independent of this change. - The session commits with the next frame after the rollover, at the 60-second window, or at teardown. It does not commit on seeing the row leave `in_progress` (`PUSHER_RECORD_CLOSE_NOTIFY_ENABLED` is off). If frames stop while the socket stays open, the audio commits only at teardown and the job spends its retry budget meanwhile. - A `POST /v1/conversations` sent again more than 10 seconds after a finish can cut the successor recording. - The worker wait is keyed on the trigger and the row, not on the cohort. A non-member reaches it only if admission saw content that the worker no longer sees; the effect is the existing not-closed retry up to 30 s later. - In `cohort` mode a cold membership lookup (one Redis read and one point read, cached 60 s) runs inside the admission transaction, for a row that already passed the row checks, the age floor and the kill switch. - A wait that times out is a counted attempt. Before `on`, give it a non-counting retry reason. ## Product invariants affected - INV-DATA-1 - INV-CAP-1 ## How it was verified - New `test_user_finish_first_archive_window.py`: 20 passed. The admission cases run the real admission transaction and lifecycle reducer on `StrictFirestore` (which now models the transaction-bound `photos.limit(1)` probe as a read) and assert the queued job and the row's move to `processing`; a refused finish is asserted to write nothing. It covers the early admission, the rows that stay empty (no audio yet, closed empty archive, not batch-owned, legacy, reconnect producer, seconds-old successor, no creation time), non-user triggers, both switches, the cohort gate, the worker wait, the timeout, a natural end that does not wait, and a deleted row. - Neighbouring suites through `backend/test.sh`: `test_conversation_finalization_jobs`, `test_server_batch_completion`, `test_listen_finalization_cloud_tasks`, `test_record_finalizer_discard_registration`, `test_record_finalizer_photo_registration`, `test_conversation_quiet_finalization`, `test_client_processing_finalize`, `test_conversation_smart_merge_finalizer` and `test_conversations_v3_fast_finish`: all passed. - An independent review of the first revision returned FIX-FIRST. The producer guard, the age floor and the cohort gate answer its findings; the remaining ones are the known limits above. A second review of this revision returned SHIP with the gate at `cohort`. - The 37 s and 77 s production readbacks above were taken before this change. The 37 s case has not been exercised against real services with this change; that readback follows the deploy, on the owner account in the cohort. ## Tests `backend/tests/unit/test_user_finish_first_archive_window.py`. Failure-Class: none Line-Count-Exception: backend/database/conversation_finalization_jobs.py | 3750 -> 3754 | The early admission is decided inside the existing admission transaction, on the snapshot that transaction already holds; four lines on the existing no-content branch.
What changed and why
SCA-3024. On conversations v3, a manual finish (Finish, End, Wrap Up or a pendant double-tap) often never produced a summary on Home, and when it did the wait was minutes.
The branch's first commit is #26188's registry fix (merged 2026-11-24T03:23Z), carried so the pre-push preflight could pass before that merge; its content is already on main.
1. The manual end was lost (on by default)
Mobile captures are server-batch-only: when the user finishes, the recording has audio and no transcript. The finalization worker closes it through
complete_server_batch_captureand never reaches the transcript path that callschanged(manual_end=True). The batch transcript then landed as ordinary speech, so the window waited for five minutes of silence plus the lock delay, stayed live while the pendant kept recording, and a short window was hidden from Home because it carried no manual end.The terminal transaction now stores
v3_manual_end_requestedwhen the finalization job's trigger isclient_finalize. Record admission, which knows the recording's batch units, promotes it tov3_manual_endfor a single-unit recording. Several units project one at a time, and a cut on the first projection would lock a partial window, so those keep today's timers unless part 2 takes them.Evidence, owner account only, metadata only,
ro-prod, 2026-11-24T02:28Z: of the 11 most recent manual finishes of v3 recordings, 9 took theserver_batch_capturebranch and none of those carriedv3_manual_end; most of their derived rows werehome_hidden. The 2 that had a live transcript carried the marker and were visible.2. First transcript ahead of the batch pipeline (default: empty cohort)
Even with the marker, the transcript arrives late. On the owner account's last four manual finishes the GPU result was ready 26 to 43 s after the finish request, and it was delivered to the conversation at 95 to 474 s. The time is in ordered merge and projection discovery (see
2026-11-14-record-post-seal-latency.md).After record admission commits for a manually ended v3 recording,
utils/conversations/v3/fast_finish.pytranscribes every unit once through the prerecorded provider for the recording's language, stores the cut, and writes the result withupdate_conversation_segments. That write marks the recording pending and wakes reconcile, so notes start at once. The batch record projection still owns the canonical transcript and replaces these segments inside each unit span. The writer refuses the fast write oncerecord_projection_revisionis set, and the row is re-read just before the write so a delete, discard or lock during the provider call wins.Skipped: recordings over 20 minutes, partial records, custom STT, locked, discarded and private rows. Every failure is counted and swallowed; admission's result never depends on the pass.
Review history, all fixed on this head:
be07005537(FIX-FIRST, 15 findings, 14 accepted): the row is re-read before any audio is sent to the provider; a multi-unit recording is cut only after the whole-recording transcript is written; provisional edge padding is at most 2 s and stays inside each unit; at most 8 units per pass and two passes at a time; the new metric families are allowlisted on the backend-integration scrape; the legacyforce_processjob shape counts as a user finish; promotion requiresfinished_at.be07005537(VERDICT: FIX): eligibility is decided on a decoded row, because stored segments are compressed even when empty; the pass goes through the shared consent and funding gate (sync_admission, lanebatch) before any provider spend.batchfor this binding's own job.c406738c5b(FIX-FIRST, 3 findings, all accepted): the provisional write judges the stored row inside its transaction; a single-unit cut promoted after speech landed leaves the recording pending; an undecodable stored transcript is never treated as empty.tx.check_privacyat the generation admission was granted under) before any audio is read and again at the provider boundary, and fails closed on a refusal, an error or a missing check (outcomeprivacy_blocked).Cost
Rollout and rollback
CONVERSATIONS_V3_BATCH_MANUAL_ENDdefaults to on. Off (onbackend) restores the previous behavior for later finishes.CONVERSATIONS_V3_FAST_FINISHdefaults tocohort: members of the runtime rollout cohortv3-fast-finish, which is empty until someone is added withscripts/rollout_cohort.py --add(no roll). Ramp: the owner account first, for a production readback of finish to summary seconds; thenonfor every v3 owner. Clean metric:omi_conversations_v3_fast_finish_totalwritten share withprovider_errorandwrite_errornear zero, no rise in v3 rewrites or blocked reconciles, provider spend per manual finish. Expander: Goal: Pipeline owner with David. Done by 2026-12-01.offstops new passes.How it was verified
test_server_batch_completion.py,test_conversations_v3_fast_finish.pyandtest_background_task_ratchet.py: 122 passed. They cover the request marker, promotion, the kill switch, the gate, eligibility, audio layout with gaps, timestamps on the recording clock, the re-fence, every failure outcome, single versus multi-unit handling and a retried admission.admit_recordingorcomplete_server_batch_capture, plus the new file: all passed. The full pre-push preflight, including the backend unit suite, passed atc406738c5bf.No production deploy or serving readback yet. The provider call and the replacement by the batch projection have not been exercised against real services; the owner-cohort step exists to do that.
Product invariants affected
Failure-Class: none
Line-Count-Exception: backend/database/conversation_finalization_jobs.py | 3724 -> 3750 | The manual-end request is written inside the existing terminal transaction that closes an audio-only capture, so it commits with the status change.
Line-Count-Exception: backend/database/conversations.py | 5504 -> 5515 | The provisional transcript write must judge the stored row and the batch privacy fence inside the existing segment-write transaction; one optional predicate and one optional guard on that writer.
Line-Count-Exception: backend/database/conversations_v3.py | 1466 -> 1500 | The manual-end promotion is a v3 recording marker write beside mark_pending, which owns the same fields.
🤖 Generated with Claude Code