Repository navigation
fix(batch): let record batch text supersede an automatic discard - #24345
Merged
Merged
Conversation
Desktop batch_live_v1 records are rule- or model-discarded as empty before their batch text lands. replace_record treated every discard as the user's, raising RECORD_TARGET_DISCARDED, a terminal hold the release pass never frees. Prod 11-02: 1,491 units, 126 conversations, 70 owners held since 10-28. An automatic discard (pipeline relevance receipt, no user discard, restore or curation marker) no longer blocks the record replacement; placed text clears the verdict so the scheduled SYNC_UPDATE enrichment reassesses it. The redrive re-checks and the release pass use the same predicate, so the existing release scan frees the stranded cohort. User discards still hold. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Luna r1 P2: a record pass that places no new text on an automatically discarded record still scheduled SYNC_UPDATE enrichment, whose fresh verdict could un-hide unchanged text. Mark that pass repeat-only (a transient marker set after encoding, never stored) so no relevance rerun is queued. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Luna r2 P2s on the no-text path for an automatically discarded record: - a silent pass can remove provisional segments; only skip the relevance rerun when the transcript is unchanged, so a changed one is resummarized; - a pass that would roll over replans an empty set beside the hidden row; keep main's hold for that shape instead. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Nov 2, 2026
…4361) ## Why The held-unit release scan keeps its keyset cursor in memory on the per-instance `Projector`. Every backend-integration instance start (scale-out, roll or recycle) begins again at page one, and an instance never lives long enough to wrap the whole set. Measured on prod with the ro-prod tier, counts only, at 06:55Z 11-02: of **16,932** `quarantine_held` result rows in scan order (`__name__`), release attempts exist only in deciles 0–1. **Deciles 2–9 carry no attempt at all.** The scan examined about 4,750 rows/h, but always the same front rows. Any held unit that becomes releasable, including the 1,491 desktop units #24345 makes releasable, waits indefinitely unless it happens to sort early. ## What - `load_release_cursor` and `save_release_cursor` (`database/batch_pipeline_projection_release.py`) keep the cursor in one `{namespace}_control` doc, `projection_release_cursor`. - The doc has no scheduler fields (`p*_active`, `p*_service`), so the control-shard queries never select it. - `Projector.release_held_scan` resumes from that cursor when its in-memory cursor is empty, which happens on a new instance or after a wrap. It writes the new position after each pass that examined rows or moved the cursor; a wrap writes `None`. - Both helpers are advisory. A failed load starts from the top, and a failed save only repeats rows the next pass re-checks, since release is transactional and idempotent. The scan itself never fails on them. - Concurrent instances may overwrite each other's position. That only repeats or skips ahead within one pass's span, and every instance keeps moving forward. - Cost: one read and one transactional write per pass, about 80 of each per hour. ## Fail-first evidence `test_release_scan_resumes_from_the_durable_cursor_after_an_instance_restart` on `origin/main` `3c329ff7661a`: three fresh scanners all started at `None` (`[None, None, None]`). With the fix they read `[None, 'held-01', 'held-03']`, and the empty page past the end wraps back to `None`. ## Verification (layer: local unit tests, this head) `backend/test.sh` through `bin/omi-heavy`, nice 19, with ambient GCP credentials unset. The file list was the 9 unit files that reference the release scan, serving maintenance or the release module: release, hold recovery, serving, quarantine recovery, merge fresh-first, jobstore shadow seams, revision drain harness, record admission and memories. **All passed.** ## Side effect, intended The scan will also reach 3,329 units held on visible record targets (`provenance_mismatch` holds, 10-29 to 11-01). They already pass every release check but were never examined. Each one re-projects under the ordinary transactional provenance fences. It either lands its batch text, or it re-holds within the existing 3-attempt bound. Audio is untouched. ## After deploy (expected; measured afterwards) At about 4,750 rows/h, one full wrap of about 16.9k held rows takes about 3.6 h. `release_held` summaries should then show the #24345 cohort releasing across every decile, not only the front. Deploy: backend-integration (the scan runs there; backend and backend-sync take it on their next roll). Failure-Class: none Product invariants: INV-DATA-1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Since 10-28, desktop record conversations have been hidden as "empty" while their real batch transcript sat in quarantine with no way out. A desktop
batch_live_v1record finishes with an empty or thin live transcript, and async_updaterelevance pass discards it (empty_transcript,no_content_words, or a jev/model verdict). Hours later the desktop uploads the audio. Batch projection then reachesreplace_record, which treats everydiscardedrow as the user's choice and raisesRECORD_TARGET_DISCARDED, a terminal hold on every lane. The release pass frees a held unit only once its target is no longer discarded, and nothing un-discards a pipeline verdict. Sorelease_heldreportsreleased=0by design.Measured on prod with the ro-prod tier, counts only, at 05:10Z 11-02: 1,491 held units, 126 conversations, 70 owners, all desktop, about 204 h of audio. Every target carries a rule, jev or model
relevance_decision; none was discarded by the user. The bursts that looked like they followed backend rolls were single long recordings. For example, the 04:15Z burst of 97 was one 10.5 h conversation whose 96 backfill units uploaded together. Audio and results are retained, so custody was never lost. The user just can't see the conversation.What
fragment_visibility.is_automatic_discard(row): a stored discard counts as automatic only if its relevance receipt is adiscarddecided by rule, model, jev or deterministic. Two signals mark it as the user's instead:sync_relevance_user_kept:set_conversation_as_discardedwritesFalseand restore writesTrue. It is the only writer ofFalse.jev_discard_restored, or any user-curation marker.replace_record: an automatic discard no longer blocks the batch text. When the pass places new text, it clearsdiscardedandrelevance_decision, so the enrichment pass the projection already schedules (SYNC_UPDATE) reassesses the full record. Sync intake already does this for appended speech (superseded_intake_discard). A pass that places nothing, such as record silence, keeps the verdict.assign_in_transactionand the release pass's_target_restorableuse the same predicate, for record targets only. The release pass that already runs then frees the stranded cohort with no operator step. User discards, and barediscarded=Truewith no receipt, still hold and never release.SYNC_UPDATEenrichment, whose fresh verdict could un-hide unchanged text. That pass is now marked repeat-only, so enrichment is skipped and the verdict stands. The marker is transient: it is set after encoding and asserted never to be stored. A regression test fails without it.Fail-first evidence
The new tests run against
origin/mainb89bb978a59dwithout the fix: 10 failed. That was 4 projection cases and 4 release cases (one per automatic reason) plus 2replace_recordcases. The user-discard guards (7 cases) passed both before and after.Verification (layer: local unit tests, this head)
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST=test_batch_pipeline_hold_recovery.pyandtest_batch_pipeline_live.py, viabin/omi-heavy, nice 19, with ambient GCP credentials unset: 95 passed.scripts/check_conversation_lifecycle_writes.py: passed.release_dryrun.py, read-only): it replicates every release refusal against field-masked reads. Under this predicate, all 1,491 held units would release, and 0 are user discards.Safety
assignafter projection and assert the target doesn't change. Release is refused on a second call and stays bounded byMAX_RELEASE_ATTEMPTS.audio_uriand committedresultare asserted unchanged. Only the quarantined receipt is reset.SYNC_UPDATErelevance step, so real filler is re-discarded by the same rules and model as any sync conversation.Deploy: backend, backend-sync and backend-integration (the projection runs in backend-integration). Once it serves, the release scan reaches every held row within about 75 min: it examined 4,348 rows/h at 04:10–05:10Z, against 5,435 held rows.
Failure-Class: none
Product invariants: INV-DATA-1.
🤖 Generated with Claude Code