Skip to content

feat(batch): reversible no-speech terminal for stale batch-live captures - #25042

Closed
Git-on-my-level wants to merge 1 commit into
mainfrom
lane/nospeech
Closed

Git-on-my-level wants to merge 1 commit into
mainfrom
lane/nospeech

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

What / why

Stale status=in_progress, record_lane_owner=batch_live_v1 captures are
near-empty. The 2026-11-10 strict-VAD census
(data/run-2026-11-08-pipeline-refactor/orphan-tiers-2026-11-10.md) found
99.2% of a 385-row stratified sample had under ten seconds of speech, with
0.000 speech hours. The existing orphan repair would park them, not recover
anything, and paid STT would spend money on silence. David's ruling (relay-cl1
GO 320bdf; ff0427 item 3): spend $0 on transcription and give them a reversible
terminal "no speech" state.

This PR adds that state, its strict-VAD classification, a digest-approved
operator tool with an undo mode, and a default-on operator kill switch. It
changes no serving config, IAM, timer, dispatcher or live.py, and it adds no
scheduled or automatic apply.

Product invariants

None affected. scripts/pr-preflight --suggest reports no required invariant
citation for the changed paths.

Tuning

  • NO_SPEECH_TERMINAL_ENABLED (default on, ops_kill, fail-open): the operator
    kill switch. False makes the tool refuse every apply and undo. It is read
    only by the operator tool; no serving path reads it.
  • SPEECH_LIMIT_SECONDS new: 10.0. The strict-VAD threshold. Exactly 10.0 s is
    has_speech; below 10.0 s is no_speech.
  • MAX_RAW_OBJECTS new: 4096. The per-row raw-live object cap.
  • MAX_AUDIO_SECONDS new: 7200. The per-row decoded audio cap.
  • Discovery limit new: 128 (range 1..128), newest-first, paced by
    --pace-seconds (0.1..60). Raw-live listing page_size new: 200. No new
    scheduler.

New states / exits

State: no_speech, named in the no_speech_terminal marker. The close stamps
the reviewed hidden terminal shape (status=completed, discarded=true,
terminal_no_derived_effects=true) and saves the prior status, discarded
and terminal_no_derived_effects values in the marker.

Exit: restore_no_speech (operator undo), which restores those fields exactly
and deletes the marker. Nothing deletes a conversation row or an audio object.

Every disposition names its exit in EXITS:

Disposition Exit
no_speech, no_retained_audio operator undo restores original fields
has_speech normal batch pipeline
retained_audio_unmeasured, decode_failed operator review
privacy_blocked operator re-run after consent
not_candidate, barrier_mismatch, already_registered existing lifecycle owner / normal batch pipeline
already_marked operator undo
state_changed, proof_refused, read_error, write_error operator re-run
disabled operator re-run after enablement

Verification

Local, synthetic, no cloud IO. All commands ran with
GOOGLE_APPLICATION_CREDENTIALS, CLOUDSDK_* and other credential-file
overrides removed, OMI_ENV_STAGE=offline, through the workspace
bin/omi-heavy where the run was heavy.

  • tests/unit/test_no_speech_terminal.py: 29 passed. Covers the
    classification threshold, byte-for-byte close/undo, refusal of foreign or
    changed rows, no deletion path, privacy/decode rows left untouched, Home
    hiding, and the kill switch (including the operator CLI refusal).
  • tests/unit/test_lifecycle_state_table_writers.py: 1,733 passed.
  • tests/unit/test_check_conversation_lifecycle_writes.py: 15 passed.
  • Firestore guard set (test_firestore_query_shapes,
    test_firestore_outside_query_contract, test_firestore_caller_witnesses,
    test_firestore_runtime_witnesses, test_firestore_index_rules,
    test_firestore_query_contract, test_firestore_field_indexes) plus
    test_lifecycle_invariants, test_lifecycle_properties_wiring,
    test_terminal_relevance, test_conversation_quiet_finalization,
    test_record_orphan_repair and test_no_speech_terminal:
    1,418 passed, 86 xfailed (the 86 xfails are the existing strict
    lifecycle-invariant baseline).
  • scripts/check_feature_flag_registry.py: OK.
  • scripts/check_conversation_lifecycle_writes.py: passed.
  • git diff --check: passed.

No staging apply, production dry-run, recovered transcript or Home acceptance
is claimed. This is local code/transaction evidence.

Tests

  • backend/tests/unit/test_no_speech_terminal.py (new).
  • backend/tests/support/lifecycle_writer_inventory.py and
    backend/tests/support/firestore_outside_query_drivers.py updated for the
    new reviewed writer and operator query.

UI-Evidence

none -- backend change only unless Home rendering changes. Home rendering does
not change: the row is hidden by the existing indexed discarded == false
filter and by its completed status, and the detail endpoint's existing
visibility predicate is unchanged.

Failure-Class

Failure-Class: new

FC-irreversible-terminal-hide: a terminal hide for a stale capture must
preserve every audio byte and content field, record the prior lifecycle fields,
and expose an undo that restores them exactly. The guard surface is
backend/tests/unit/test_no_speech_terminal.py (byte-for-byte close/undo, no
deletion path, refusal of foreign or changed rows).

Rollback

Set NO_SPEECH_TERMINAL_ENABLED=false to stop new applies and undos. Run the
tool's --undo mode with the private ledger to restore any closed page exactly.
No audio or row deletion is involved, so rollback never needs a storage
operation. The new index is additive and inert if the tool is not run.

View guided diff Turn on auto-fix

Add a digest-approved operator tool that classifies stale in-progress
batch-live captures with the repository's strict local VAD and parks
near-empty ones in a reversible no_speech terminal. Audio and content are
kept; the marker saves the prior lifecycle fields and the operator undo
restores them exactly. No scheduled or automatic apply exists.
Git-on-my-level added a commit that referenced this pull request Nov 10, 2026
…#25060)

## What / why

Supersedes #25042 (split per custody review). L6a provides the
lifecycle-owned reversible no_speech storage transition, exact restore,
existing Home hiding and writer inventory. L6b #25063 supplies the
operator. No decoder, automatic caller or production operation is
included here.

## Product invariants

Preserve all row/audio/content bytes. Snapshot lifecycle field presence
and values; close requires expected update_time and canonical row/user
privacy. Restore refuses foreign runs, changed generations and invalid
closed shapes. Quiet checks remain untouched by close/restore. Existing
Home discarded filtering hides closed rows; compliance/export retains
access.

## Pre-review dispositions

- A P1-1 fixed: close mirrors batch_pipeline_privacy's three-way
batch-live fence (uses_custom_stt, absent/false row
private_cloud_sync_enabled, false user flag), in the write transaction.
Row-level regression cases cover all three row shapes.
- A P1-2 fixed: close_no_speech and restore_no_speech are lifecycle-only
methods. Added direct-call rejection and atomic-hidden-close exemption
guard tests. The restore lifecycle submodule is secret-free; its narrow
tripwire exception permits only restore_no_speech, and lifecycle.py
re-exports that intent.
- A P2-1 / B P1-2 storage half fixed: missing/empty/None SDK write
results return committed_revision_unknown, never raise after the hide.
L6b records and resolves that outcome through the private marker and a
current-revision fence.
- A P2-5 resolved deliberately: restore remains unblocked by privacy
admission. It restores the owner's existing row without audio reads or
new cloud work; an opt-out after close must not strand that row hidden.
Run/revision/shape fences still apply, with a regression test.
- A P2-8 partially improved: Home visibility uses actual close output;
merged-row refusal is covered; the post-commit test blocks actual client
reads/transactions; the no-delete test checks retained audio and the
fake delete list.

Follow-ups (non-blocking review P2s): A P2-2 storage-level kill switch;
P2-3 full recovery-admission/protected-content/account-deletion parity;
P2-4 deterministic orphan-finalization-job fence; P2-6 prior-marker
value validation; P2-7 bounded uid/cid validation; remaining P2-8
malformed snapshot, wrapper, repeated-restore and RFC3339 fidelity
cases. These are not implemented by this batch.

## Tests

Repository backend/test.sh via omi-heavy, offline with credential
overrides removed: test_no_speech_terminal.py,
test_check_conversation_lifecycle_writes.py,
test_lifecycle_state_table_writers.py,
test_batch_privacy_conversation_fence.py and
test_conversation_quiet_finalization.py. Final result: 1,920 passed
across five files, including 28 storage cases and 18 lifecycle guard
cases. Full preflight and full pre-push hook passed; exactly one normal
push for this fix batch, without force or skipped hooks.

## UI-Evidence

none — no UI code change; actual closed-row visibility is covered
locally.

Failure-Class: new

FC-irreversible-terminal-hide is introduced by the overall PR and
guarded by the storage and lifecycle suites.

## Rollback

Stop new callers; restore unchanged closed rows with their matching
run/revision (L6b can resolve missing receipts from the private ledger),
then revert code. Never delete rows/audio. Restore stays available after
privacy opt-out and does not initiate cloud work.
Git-on-my-level added a commit that referenced this pull request Nov 10, 2026
…25063)

## What / why

Supersedes #25042 (split per custody review). Depends on L6a #25060, now
merged into main. Current origin/main
(85de198) was merged normally before
this coverage fix (both independently added feature flags retained in
the merge conflict); no rebase or force-push.

Strict local VAD, bounded newest-first discovery and digest-approved
plan/apply/undo close stale batch-live captures reversibly. The operator
requires complete versioned audio coverage before silence
classification, isolates row refusals and recovers receipt loss while
keeping undo independent of audio secrets/clients. No automatic caller
or production operation is authorized.

## Product invariants

Preserve row/audio/content bytes, prior-field presence snapshots, exact
revision/run/shape fences, row/user privacy and the approved privacy
generation inside the close transaction, counts-only CLI output, bounded
newest-first pages and content-free dispositions. Known committed
revisions keep their original exact fence. Complete sample coverage and
byte-identical overlap deduplication precede VAD. Only missing/unknown
receipts resolve the current matching marker before a
current-revision-fenced restore. An edit between that read and restore
refuses the write. Undo never starts audio, transcription or new cloud
work.

## Pre-review dispositions

- Second Luna FIX-FIRST at f13bab4 / DeepSeek P2-4 fixed:
generation/metageneration-fenced raw listing snapshots must prove the
entire timezone-aware row started_at/finished_at interval from versioned
capture_start/capture_end, explicit gap_count=0 and decoded mono 16 kHz
PCM frame counts. Canonical filename timing is the fallback for
capture_start. The retained sample-range union helper limits total
missing coverage (boundaries plus interior holes) to 20 ms / 320 frames.
Identical overlap samples are included once; conflicting overlaps,
unknown timing, gaps and unexpected out-of-range objects return
coverage_incomplete with operator_review exit and aggregate counts. VAD
only runs on the proven timeline. Apply reproof repeats the proof on its
fresh listing, including added objects, before ledger preparation. Empty
raw/legacy listings also refuse; historical no_retained_audio plans are
non-actionable. Missing listing size/metageneration and failed download
preconditions also refuse coverage. The first local Luna delta found the
metadata race; it is fixed by passing the listing snapshot to canonical
read_reference, with tests using the actual reader to assert both
generation preconditions. Tests exercise gaps with no write, complete
coverage, identical and conflicting/contained overlaps,
numeric-string/filename timing, missing timing/internal gaps, cumulative
tolerance and added/missing objects between plan and apply.

- Luna FIX-FIRST at 2fc15c2 fixed: the operator passes the approved
privacy generation through the lifecycle intent into
close_no_speech/_close_txn. The transaction reads the canonical hashed
privacy authority before writing and refuses privacy_changed on
mismatch, including consent revoke/re-enable after reproof. Optional
None preserves L6a direct-caller behavior. Regression runs actual
reproof, changes generation at ledger preparation, and proves no
conversation write/receipt. Matching, absent-generation-zero and
omitted-generation contracts are also tested.

- B P1-1 fixed: upload_pending and privacy_skipped have exits.
Disposition/exit validation is inside the row failure boundary; unknown
labels normalize to proof_refused. Mixed-page tests preserve later
actionable rows and counts-only reporting.
- B P1-2 / custody P2#1 / A P2-1 fixed: storage returns
committed_revision_unknown when the SDK omits its result, and the ledger
records it distinctly. Undo includes prepared-only entries, re-reads the
row, proves marker.run_id plus
completed/discarded/terminal_no_derived_effects, and fences restore on
the current revision. Known receipts remain exact-revision fenced. Tests
cover actual empty write_results, prepared-only crash recovery,
foreign/changed shapes and a concurrent edit after resolution.
- Custody P2#2 / B P2-6 fixed: undo requires neither ENCRYPTION_SECRET
nor a storage client. The CLI loads planning/audio dependencies only
after choosing the non-undo path. Restore uses the lightweight
lifecycle-owned intent. Fresh-process tests remove the secret and block
all network/audio dependency loading.
- B P2-7 fixed by an explicit one-ledger-per-page contract: exclusive
creation remains, reuse cannot overwrite a partial ledger, and recovery
uses the old page's ledger before replanning with a new path. No
append/resume behavior is added.
- B P2-14 fixed: table tests cover wrong tiers, emulator refusal,
page/pace bounds, missing apply approval/ledger, forbidden undo cursors,
identical cursor files, undo dry-run, ledger mode/symlink/existing-path
refusals.
- A P1-1/P1-2 and P2-5 are included through L6a: canonical close
privacy, lifecycle tripwire, and deliberately privacy-unblocked owner
restore. A's improved no-delete assertions also resolve B P2-12's
ineffective mock.

Follow-ups (non-blocking review P2s): B P2-1 absent-owner-document
defense; P2-2 discovery age cutoff; P2-3 last-scanned cursor progress;
P2-5 pre-extend memory budget; P2-8 undo offsets if ledger bounds ever
change; P2-9 restored-event receipts; P2-10 finished_at convention;
P2-11 server close timestamp; P2-13 end-to-end raised-privacy fidelity;
remaining P2-15 broad unexpected/receipt-fsync error classification
(prepared recovery is now available); P2-16 re-decode duration/cost
disclosure. L6a's remaining P2-2/3/4/6/7/8 are listed in #25060. These
are not implemented by this batch.

## Tests

This coverage batch runs backend/test.sh through omi-heavy with
credential overrides removed and offline providers:
test_no_speech_coverage.py, test_no_speech_operator.py,
test_no_speech_terminal.py, test_record_partial.py,
test_source_audio_listing.py and test_record_orphan_repair.py. Result:
270 passed (19 coverage, 57 operator, 32 storage, 67 partial-retained, 8
source listing, 87 orphan repair). Both fresh-process secret-free undo
modes remain covered. Full local preflight passed all 43 checks. Luna
delta on 93ac677: SHIP, no concrete remaining findings; read-only
source review, no tests run by the reviewer and no merge approval. Full
pre-push hook passed, including all 108 storage/operator/coverage tests.
Exactly one normal push in this coverage batch; no force or hook skips.

## UI-Evidence

none — no UI code change; existing Home filtering is covered with actual
closed rows.

Failure-Class: FC-irreversible-terminal-hide

FC-irreversible-terminal-hide is defined by merged L6a and guarded by
both no-speech suites, including the transaction privacy-generation race
regression.

## Rollback

Disable new closes with NO_SPEECH_TERMINAL_ENABLED=false. Keep it false
while using --undo --apply with each private page ledger.
Prepared-only/unknown receipts resolve the matching marker; known
revision conflicts require separately reviewed manual recovery,
preserving unrelated edits and all audio/content. Revert code only after
restoring rows. No production apply is authorized here.

## Capacity numbers and state exits

Operator bounds carried from #25042: MAX_AUDIO_SECONDS initial 7200;
MAX_RAW_OBJECTS initial 4096; discovery limit initial 128 (range
1..128); GCS page_size initial 200; pace initial 0.5 seconds (range
0.1..60). Speech threshold remains strictly below 10 seconds. New fixed
coverage policy: TOLERANCE_FRAMES initial 320 (20 ms at 16 kHz),
cumulative across boundaries and interior gaps; zero prior coverage
checks are replaced by mandatory complete-coverage proof. No runtime
tuning flag is added. No serving capacity change.

State no_speech exits through restore_no_speech. Outcome
committed_revision_unknown exits through private-ledger marker
resolution and fenced restore. coverage_incomplete exits by operator
review and only a fresh coverage-proven plan can become actionable;
empty-list no_retained_audio plans no longer close rows. Upload-pending
rows stay untouched for operator review; privacy-skipped rows exit by
operator rerun after consent.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Closing as superseded by #25060 (merge 8a9f00b, reversible no-speech storage with exact restore — L6a) and #25063 (merge 1fa8f3d, strict-VAD no-speech operator with disabled undo — L6b), which carry this no-speech-terminal work forward as reviewed pairs. Lead2 ruling c3535e. Branch left intact.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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