Skip to content

fix: transcribe retained audio through explicit partial finishes - #24188

Merged
Git-on-my-level merged 17 commits into
mainfrom
lane/sealpartial
Oct 31, 2026
Merged

Git-on-my-level merged 17 commits into
mainfrom
lane/sealpartial

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

After 30 minutes, recordings whose tail or proof size cannot be certified can transcribe retained audio with an explicit partial marker. Complete seals, producer fences, audio custody, and hard-3 thresholds are unchanged. Encrypted continuation plans use at most 128 siblings per page and 300 seconds/256 references per unit, with 8,192-entry source/coverage and 8 MiB plan bounds.

Every partial pass now fills only spans without existing text, including the first generation. It preserves unannotated transcripts and edits without correction metadata; overlap or ambiguous alignment keeps the original text. Completed coordinators claim their hourly poll transactionally before listing, so stale scheduler snapshots across serving replicas do no storage I/O. They retire after 24 hours without inventory change, retaining audio, coverage and partial status. A new producer upload revision lets the existing repair pass reopen a retired coordinator. Unsignalled storage-only arrivals after retirement need separately authorized operator recovery.

Recorded BYOK policies are refused and counted at initial finish and during late continuation. Discard and payer state are checked before retained audio/plan reads and again at atomic intake. The CI fixes classify the server-authored partial metadata, use a closed outcome enum, omit the partial-only binding field from ordinary work so the frozen pre-E1 constructor remains compatible, and correct the deadline test's assumption that all eight requests must start before a 30 ms timeout.

Validation: 496 unique backend cases across 14 focused files through backend/test.sh under TZ=UTC and omi-heavy. The final stage-policy/intake/partial selection passed 119 overlapping cases, including the stale-scheduler poll fence. Strict Firestore transaction and real staging/intake/worker fixtures cover preservation, hourly scheduling, 24h retirement, producer-revision repair reopening, and payer/discard races. All 22 donor-projection cases pass with stored bindings decoded through their wire defaults. The hermetic listen/core-flow e2e passed 15 cases; wrapped make preflight passed all 68 checks. These are local checks, not production acceptance. Optional generated API wire metadata remains additive; UI behavior is unchanged.

Lead owns merge and all deploys. Keep recordSealRules.partialEnabled=false while rolling pusher; require rollout completion and an authoritative PodList count of zero old-image instances, including terminating instances. Roll all CPU admission/projection hosts and API, then worker/repair. Drain old or enabled repair Jobs before enabling the existing partial switch for new Jobs. No new rollout flag, workflow, production write or capacity added. The paired collector patch remains lead-owned.

Two full-suite Flutter failures also receive test-only fixes: boot preference cleanup waits for both getter-triggered quarantine records and joins the journal before deleting its directory; phone-mic safety-copy tests await the actual scheduled drain or durable notification instead of 60/150 ms sleeps. A held-disk completer proves the WAL remains in memory until I/O is released. The canonical targeted app/test.sh run passed 138 protected spine tests plus all eight selected Flutter cases, without a timeout increase or app behavior change.

The safe false negative where later complete proof does not upgrade a partial row, and held pages waiting on the existing redrive path, remain follow-ups per lead scope.

Includes the test-only shared-main fixture fix from #24195 at 855231d. After #24192 extracted the freshness helper, two test files still patched the router function and returned superseded before their upload-fence assertions. The patch targets the current helper and changes no assertion or production behavior. Independent integration validation passed all 120 cases across the four affected playback test files.

Product invariants affected: none (repository selector).
UI-Evidence: none
Only generated wire DTOs change on clients; there is no UI behavior change.
Failure-Class: new
Line-Count-Exception: backend/database/conversations.py | 4627 -> 4638 | Preserve coordinator-owned partial receipts across stale processing writes.
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1716 -> 1717 | Carry partial continuation text-preservation authority into the existing transactional assignment.

Keep complete seals and producer fences strict. Admit stored audio through an
explicit partial barrier after 30 minutes, then serialize bounded worker pages
and recognize newly durable sample ranges without replacing prior user text.

Failure-Class: new
Apply the reference ceiling after subtracting recognized coverage. Reconstruct
all missing frames while retaining at most one source per materializer call;
reuse never crosses bucket, path, generation or PCM digest identity.

Failure-Class: new
Regenerate the app-client OpenAPI and wire DTOs. Preserve the original partial
reason across late upload-revision refreshes for closed-label repair counts.

Failure-Class: new
@mintlify

mintlify Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Oct 31, 2026, 7:39 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 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-31T21:49:43.176413Z 6909eed 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.

Fill only empty text spans on every partial pass, retire unchanged completed
coordinators after a bounded hourly watch, and reject BYOK/discarded work
before continuation reads and intake. Preserve the partial marker and audio.

Repair can reopen retirement after a new upload revision. Pin the safety,
scheduling, payer and discard races with strict transaction tests, and fix
the model/binding/metric and deadline CI contracts without bypasses.

@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: 08289f2e7f

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

incoming['_batch_replace_live'] = {
'start': item.capture_at,
'end': item.capture_at + item.duration_seconds,
**({'preserve_existing': True} if binding.partial_record else {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve existing text for partial silence results too

When a partial unit produces silence or no_recoverable_speech, Projector._assign() calls assign_record_silence() instead of this branch. That helper constructs _batch_replace_live without preserve_existing, so replace_record() deletes existing, unannotated transcript segments whose midpoints fall inside the unit. Consequently, a partial recovery can erase previously saved text, including edits without correction metadata, rather than only filling empty spans. Propagate the partial-preservation flag through the silence path as well and cover that outcome with a regression test.

Useful? React with 👍 / 👎.

Ordinary bindings intentionally omit the partial-only false default for
rolling compatibility. Decode the stored binding before comparing its
semantic fields, while explicitly checking the wire extension is absent.

@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: 5bebc05711

ℹ️ 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 mark.get('version') == 1
and mark.get('reason') in REASONS
and mark.get('upload_revision') == row.get('record_upload_revision')
and mark.get('finished_at') == row.get('finished_at')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the partial barrier valid when projection extends the record

When retained audio extends beyond the conversation's stored finished_at, projecting it invalidates this barrier: live_projection.replace_record() advances the conversation's finished_at but leaves record_audio_partial.finished_at unchanged. This also happens for silence results, whose incoming finish is the unit's audio end. Subsequent admit_recording() and update_run() calls then reject the barrier, preventing the coordinator from acknowledging the completed page or admitting subsequent pages until seal repair refreshes the marker. Use an immutable finalization anchor for this comparison, or update the marker atomically when projection extends the record.

Useful? React with 👍 / 👎.

Git-on-my-level added a commit that referenced this pull request Oct 31, 2026
…off (#24189)

## Problem and change

At four active close calls, pusher refused admission before submitting a
write, then counted that refusal as a finish/seal failure and advanced
the exponential retry ladder. Retained drain workers could consequently
wait 30–60 seconds for capacity that had already returned.

Count pre-write refusals in
`omi_pusher_record_close_refusals_total{reason="admission"|"outstanding"}`
and retry them after 0.5–2 seconds of jitter without advancing the
failure ladder or finish/seal failure metrics. Preserve the existing
outstanding-cap metric. Actual write exceptions retain the existing
exponential backoff. The four active calls, twelve outstanding calls,
thirty-second deadline, drain cap and receive queue wait remain
unchanged. Tokens clear only after successful durable writes.

The closed-socket ownership predicate includes `close_retry_at`, so a
seal-only admission retry retains its worker after the token clear
succeeds or on an empty reconnect. Successful retirement clears that
scheduling state.

## Validation

- `TZ=UTC BACKEND_PYTEST_WORKERS=1
BACKEND_UNIT_TEST_FILE_LIST=/Volumes/Ephemeral/scratch/closeadmit/tests.txt
/Users/dazheng/workspace/omi/bin/omi-heavy run -- nice -n 19 bash
backend/test.sh`: 109 passed across record barrier executor, pusher
queue wait, record seal and the existing reason-label guard tests. Real
barrier and strict Firestore cover admission versus real write failures,
retry suppression, retained tokens, and a fifth close completing after
one of four held slots frees. Real-router cases also cover seal-only
refusal past socket drain, same-worker retention and eventual seal for
empty reconnects and successfully cleared tokens.
- Offline real-barrier cost probe with pending token-clear sets, sixty
virtual one-second drain scans: 32 workers/one close used 0.09 ms CPU
per simulated second; 235 workers/one close used 0.73 ms; 32 workers/128
closes used 5.85 ms (under 0.6% of one core). This measures
scheduling-path CPU only. Refusals submit no write, task or timer; the
existing drain loop yields one second per scan. Even the 128-close case
has bounded retry work, rather than a tight loop.
- `TZ=UTC /Users/dazheng/workspace/omi/bin/omi-heavy run -- nice -n 19
bash backend/testing/e2e/run.sh -q --tb=short -k
'listen_pusher_wire_contract or listen_stt'`: 20 passed, 165 deselected.
Real backend routes and wire contract against hermetic dependencies; not
live production acceptance.
- `TZ=UTC BACKEND_PYTEST_WORKERS=1
/Users/dazheng/workspace/omi/bin/omi-heavy run -- nice -n 19
scripts/pr-preflight --lane local --pr-body-file
/Volumes/Ephemeral/scratch/closeadmit/pr-body.md`: all 34 selected
guards passed.

## Release acceptance

Lead owns merge and pusher deployment, alongside #24188. No production
access or writes in this lane. After the new release serves, compare
aggregate five-minute rates of
`omi_pusher_record_close_refusals_total{reason="admission"}`,
`omi_pusher_record_barrier_failures_total{stage=~"finish|seal"}`, and
`pusher_receive_work_stalled_handlers{stage="drain"}`. A positive
admission rate directly establishes contention; declining real
failure/drain stock tests its operational impact. A quiet window cannot
prove the prior wave's cause.

Failure-Class: none

No existing failure-class definition matches pre-dispatch semaphore
contention being charged as a storage write failure; this scoped change
adds the typed boundary and behavioral guard without expanding the
registry.
Join the phone-mic timer's real callback future and hold storage admission
open to verify durability assertions wait for I/O, instead of guessing at
completion with millisecond sleeps. Await the lifecycle durable notification.

Wait for both getter-triggered quarantine records and the journal queue
before removing the boot test directory, preventing a concurrent rename
from racing recursive cleanup. No app runtime behavior or timeout change.
Recording drain runs on every serving instance, outside the maintenance
leader's reconcile call. CAS the hourly poll before listing so stale or
concurrent scheduler snapshots do not each list the same inventory.

Reuse the existing privacy-fenced coordinator transaction and retain the
hourly schedule if listing fails. A stale-snapshot regression verifies the
claim is durable before I/O and a second snapshot does not list again.
@Git-on-my-level
Git-on-my-level merged commit cffaaee into main Oct 31, 2026
63 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/sealpartial branch October 31, 2026 22:58
Git-on-my-level added a commit that referenced this pull request Oct 31, 2026
…ial offsets (#24197)

## Summary

The five-minute repair sweep repeatedly listed producers for unchanged
partial coordinators, including retired ones. Read the coordinator and
partial barrier before producer inventory and skip unchanged rows. A
changed upload revision still obtains fresh producer proof and uses the
existing transactional refresh/reopen path, retaining prior coverage.

Initial partial projection now applies the same alignment checks before
and after clock shifting as a non-empty transcript. Invalid or
negative-offset incoming segments are omitted; valid segments still fill
empty spans and existing text remains intact.

For an unchanged row at 288 repair attempts/day: **zero
producer-inventory reads/day**, down from 288. The cheap check uses two
document reads/attempt (coordinator + row), or 576/day, plus the
existing discovery read (288/day if visited every sweep). Revision
changes require one inventory read per attempted refresh; retries remain
fenced by fresh proof. No inventory claim is made for other producers or
CPU storage polling.

## Validation

- Heavy/nice/UTC `backend/test.sh` with `BACKEND_PYTEST_WORKERS=1` and
exact file list: `test_record_partial.py` **63 passed**,
`test_record_seal_cluster_repair.py` **64 passed**.
- The real per-row repair path is invoked 288 times for both pending and
retired coordinators, counts zero inventory calls, then counts one after
a producer upload revision and verifies reopening with coverage and
transcript preserved.
- Initial empty-transcript alignment cases cover clock-shifted negative
starts, zero duration, nonfinite ends, unplaced/unknown alignment and a
valid segment.
- Heavy/nice/UTC `bash backend/testing/e2e/run.sh -k 'listen_stt or
core_flow_expansion' -q --tb=short`: **15 passed, 170 deselected**.
- Heavy/nice/UTC `scripts/pr-preflight --pr-body-file ...`: **36
selected checks passed**. Ordinary wrapped `git push` exited zero; its
enforced backend typecheck reported **0 errors**, runtime-image source
closure and selected backend suites passed. GitHub CI is the remaining
full authority.

No GCP access, production mutation, audio deletion, workflow change,
flag/default change, `partial_record` semantic change or hard-3 change.
Lead owns merge and deployment. Images: `batch-pipeline-worker` for
record-seal-repair; all CPU admission/projection hosts (`backend`/listen
today, including backend API and worker roles where split) for
projection. No pusher-specific code changed; retain the lead's #24188
release order.

Failure-Class: FC-completeness-proof-starves-retained-transcription
UI-Evidence: none
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