Repository navigation
fix(v3): set a size-rejected seed aside so the owner's backlog drains; slim recording aliases (SCA-2918) - #26441
Conversation
…; slim recording aliases (SCA-2918) Under afab956, 12 owners stayed parked on document_too_large even with the transcript size cap engaged. The oversize documents are ones the cap does not measure: finished derived rows near 1 MiB from recording-alias legacy_ids (up to 128 superseded source-file ids per file), transcript-heavy rows that predate the cap, and source recordings already at the limit. Because _oldest_pending re-seeds the same recording every backoff, one oversize closure froze each owner's whole backlog (5,388 pending rows > 1 h). - CONVERSATIONS_V3_SIZE_QUARANTINE (default on): a live pass that seeded one pending recording and no unlocked window, and parks on document_too_large, records that seed in the builder lease's v3_size_quarantine (max 64) and re-arms the early attempt. Live loads and the pass chain skip those ids; they stay v3_pending for repair. - CONVERSATIONS_V3_ALIAS_SLIM (default on): recording aliases on derived rows stop copying the source file's legacy_ids. They never match an alias id (uuid5 of recording and file), and playback resolves the original through recording_file_id. Failure-Class: FC-permanent-write-rejection-retried-forever Co-Authored-By: Claude Opus 5.5 <[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: e90067274e
ℹ️ 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".
| if page.seeds[1] or len(page.pending_ids) != 1: | ||
| return None | ||
| return page.pending_ids[0] |
There was a problem hiding this comment.
Exclude independently loaded open windows before quarantining a seed
When the builder lease has an open_id, load() adds that conversation to existing before _select_unlocked() excludes existing IDs from its selection. Consequently, page.seeds[1] can be zero even though an independent open window and its source recordings were loaded alongside the pending seed. If that open window causes document_too_large, this check quarantines the healthy pending recording instead. Subsequent passes retain the same failing open window and quarantine successive healthy seeds, eventually exhausting the 64-entry limit without draining the backlog. Include implicitly loaded open windows in the disqualification, rather than relying only on the explicit unlocked-seed count.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5f60e38, carried to cbee96c. load() now names the documents it pulls in on its own (UnlockedPage.independent): the lease's open window and its direct sources (v3_recording_ids and recording_pieces). When an open window was loaded, a pass quarantines only if Firestore's rejection names an oversize document outside that set. Its Document '…/conversations/<id>' cannot be written because its size … text is parsed in the service, and the id is never logged. An unnamed rejection, such as a property-size error, parks with the usual backoff. I didn't disqualify every pass with an open window: 10 of the 12 parked owners have an open_id, so that would have disabled the fix almost everywhere. Covered by test_an_independently_loaded_open_window_is_never_charged_to_the_seed: the open window, its source and an unnamed rejection are not quarantined, while a named document in the seed's closure is. Without the rule, 3 of its cases fail.
| update[SIZE_QUARANTINE_FIELD] = [*held, quarantine] | ||
| # The backlog behind the set-aside seed is not blocked: let the next seed run without the backoff. | ||
| update['v3_bounded_pending_attempted'] = False |
There was a problem hiding this comment.
Emit degraded fallback telemetry when quarantining a recording
When a recording is newly quarantined, the builder switches from retrying its durable obligation to indefinitely skipping it while continuing other work, but this branch emits no shared fallback telemetry. The existing BLOCKED metric cannot distinguish this degradation from an ordinary size backoff, and a subsequent successful commit clears the blocked lease state despite the quarantined recording remaining unprocessed. The “New fallbacks” rule in backend/AGENTS.md requires utils.observability.fallback.record_fallback; emit a degraded outcome when the quarantine addition succeeds, outside the retriable transaction callback.
AGENTS.md reference: backend/AGENTS.md:L327-L327
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5f60e38. record_blocked calls record_fallback(component='conversations_v3', from_mode='pending_retry', to_mode='size_quarantine', reason='document_size_limit', outcome='degraded') once per park that newly sets work aside. The call comes after the transaction returns, outside the retried callback. conversations_v3 is added to ALLOWED_COMPONENTS. The reconciles_total{outcome="size_quarantined"} domain count stays alongside it. The lease keeps naming the quarantined ids after a later commit clears the park, and the runbook tells readers to count them apart from recovered owners. Covered by test_a_new_quarantine_reports_a_degraded_fallback_once, which fails without the call.
| .stream() | ||
| if doc.id not in recordings and not (skip_terminal and terminal_recording(doc.to_dict() or {})) | ||
| if doc.id not in recordings | ||
| and doc.id not in quarantined |
There was a problem hiding this comment.
Expand continuation lookahead to account for quarantined rows
When quarantined recordings occupy the continuation query's first 33 results, filtering them out here can hide a healthy pending successor within the silence gap. For example, a one-seed load followed in capture order by 32 quarantined recordings and then a healthy recording returns only the seed and quarantined rows from .limit(33), leaving _v3_page_continues unset despite the healthy successor. For older speech, outline.stretches() then locks and publishes the partial window instead of holding it for the remaining page. Increase the lookahead by the quarantine size, as the pending-seed query already does, or page until a non-quarantined successor is found.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 5f60e38. The continuation lookahead is now .limit(33 + len(quarantined)), the same widening the pending-seed query uses. Covered by test_quarantined_successors_cannot_hide_a_healthy_page_continuation: a seed followed by 33 quarantined successors and then a healthy one still sets _v3_page_continues. With .limit(33) it fails.
…p the sweep off set-aside work (SCA-2918)
Release's objection on the seed-only design: skipping one quarantined
recording in the pending query does not isolate it. A later seed that
shares its claimant window loads it back (closures follow
v3_recording_ids and recording_pieces) and hits the same rejection, and
filtering it out of the closure would risk losing claims.
- record_blocked now takes the pass's whole pending closure (seed plus
every pending recording it loaded), all or nothing, up to 64 ids. Closure
loading is unchanged; only seeding, the pass chain and the sweep skip
quarantined rows. A list too full for the closure parks as before.
- The 5-minute sweep reads the builder lease of each stale owner and does
not wake an owner whose only stale pending rows are quarantined.
- A quarantining park counts reconciles_total{outcome="size_quarantined"};
the lease keeps naming the set-aside rows after the park clears, so an
owner recovering is reported apart from work quarantined.
- One three-seed fixture runs the real load, park, early-attempt and
has_pending paths: the shared closure keeps its claims and stays named
as blocked, the independent seed commits, and the sweep stays quiet.
Retained aliases are slimmed and still resolve through playback.
Failure-Class: FC-permanent-write-rejection-retried-forever
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…port quarantines as degraded (SCA-2918) Codex review on #26441: - P1: load() pulls the lease's open window in on its own, so a size rejection can belong to it rather than the pending seed. The page now names those independent documents (open window plus its direct sources). A pass quarantines with an open window loaded only when Firestore's error names an oversize document outside them; an unnamed rejection parks with the usual backoff. - P1: a new quarantine records omi_fallback_total (component conversations_v3, pending_retry -> size_quarantine, document_size_limit, degraded) after the park transaction. - P2: the page-continuation lookahead widens by the quarantine size, so set-aside rows cannot fill it and hide a healthy successor. Failure-Class: FC-permanent-write-rejection-retried-forever Co-Authored-By: Claude Opus 5.5 <[email protected]>
…re boundary (SCA-2918) The async-blocker gate treats any store call from async reconcile as blocking. The id parse is a pure string check, so it lives beside redacted_cause, which already reads store's size marker the same way. Failure-Class: FC-permanent-write-rejection-retried-forever Co-Authored-By: Claude Opus 5.5 <[email protected]>
…2918)
Panel F1: /v1/sync/audio/{conversation_id}/{audio_file_id} resolves a
client's handle by the current id or the alias's legacy_ids
(routers/sync.py), and test_client_aliases_resolve_to_current_source_without_reusing_old_artifact
relies on it. recording_file_id does not cover that lookup, so slimming
aliases would 404 old clients' downloads. The slim leaves this PR, and
CONVERSATIONS_V3_ALIAS_SLIM is removed with it; the planner is back to
main. The quarantine stays. Owners whose oversize row is alias
legacy_ids bloat stay quarantined until a follow-up with a design for
that reader.
Failure-Class: FC-permanent-write-rejection-retried-forever
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: b340f6ed02
ℹ️ 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".
| if page.independent and (oversized is None or oversized in page.independent): | ||
| return () |
There was a problem hiding this comment.
Exclude the open window's transitive closure from seed attribution
When an open window's source recording also has a claim on an oversized finished window, load() follows that claim and loads the finished window on every pass, independently of the pending seed (database/conversations_v3.py:597–615). Although the direct-open-window case is fixed, the new independent set contains only the open window and its direct sources, not this additional claimant. A size rejection naming that claimant therefore passes this check and quarantines a healthy, unrelated pending seed. Subsequent passes load the same oversized claimant and quarantine successive healthy seeds until the list fills, leaving the backlog blocked. Track the independently loaded closure transitively, or otherwise establish that the rejected document belongs to the pending seed's closure before quarantining it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b4e758b, carried to c5984c8. Attribution no longer trusts the direct-source set. A pass quarantines only if all of these hold:
- Firestore names the oversize document;
- that document is on the seed's side: the seed, a row it claims or feeds, or a source the commit writes for those rows;
- it lies outside everything the open window and any unlocked seed reach, transitively over the loaded claims (recording to row) and sources (row to recording, including pieces). That set is
_reached.
Your case is a finished row that the open window's source also claims and the seed shares. It now parks with the usual backoff instead of quarantining the seed. An unrelated seed was never charged, because it isn't on the oversize document's seed side. Tests:
test_nothing_the_open_window_reaches_transitively_is_charged_to_the_seed(unit);test_a_finished_row_the_open_windows_source_also_claims_is_never_charged_to_the_seed(end to end through the realload).
Both fail under the old direct-only veto.
…prune and report the list (SCA-2918) Panel review-20261126t215819-b0d1 and Codex r4713792971 on #26441: - F4: the quarantine set is the seed plus the pending sources the rejected commit writes for the seed's rows (rows it claims or feeds), never every pending the read closure loaded; time siblings are not set aside. - F5 / Codex: quarantine needs Firestore to name the oversize document, and it must be on the seed's side and outside everything the open window or an unlocked seed reaches through claims and sources transitively. Unnamed or unattributable rejections park with the usual backoff. - F3: an unlocked seed beside the pending one no longer disqualifies the pass; only what it reaches is vetoed, so those owners drain too. - F2: each size park prunes held ids that are no longer v3_pending (one field-masked read per held id, outside the transaction); a closure that still does not fit records an exhausted fallback and reconciles_total{outcome="size_quarantine_full"}. - F8: the sweep's per-owner lease read is isolated; a failure logs its type and counts as not quarantined. Failure-Class: FC-permanent-write-rejection-retried-forever Co-Authored-By: Claude Opus 5.5 <[email protected]>
…jection wrote (SCA-2918) The quarantine's attribution data now rides the conflict _commit already raises for a size rejection (Conflict.size_commit), and a helper builds the park's quarantine argument, so reconcile gains no branches: pyright had stopped analyzing it as too complex. Failure-Class: FC-permanent-write-rejection-retried-forever 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: c5984c8774
ℹ️ 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".
| if seed not in recordings or oversized in _reached(page.independent, recordings, existing, planned): | ||
| return () |
There was a problem hiding this comment.
Include independently queried time neighbors in the attribution veto
When an open window's source has an oversized finished window within its time-query margin, load() loads that finished window independently of the pending seed. If the pending seed also claims that window, _reached() misses the independent loading path and this check allows the seed to be quarantined, even though subsequent passes still load the same failing window. The fresh evidence beyond the earlier claims-closure finding is the time-neighbor query in backend/database/conversations_v3.py:646–678: open sources explicitly undergo that query, but its edges are absent from _reached(). Track those independently loaded time neighbors and their closure before attributing the rejection to the seed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ba6fbec.
load() now records which derived rows each recording's time-neighbour query loaded, in UnlockedPage.neighbours. A row is charged to each source window it overlaps, or to every window in a merged interval when it's undated, which errs toward vetoing. _reached() follows these edges as well as claims and sources, so anything the open window or an unlocked seed pulls in by time, plus that row's own closure, is vetoed.
Tests:
test_a_time_neighbour_of_the_open_windows_source_is_never_charged_to_the_seed: the open source's time neighbourdnis the oversize row, and the seed also claims it. The pass parks with no quarantine.test_a_time_queried_row_is_charged_only_to_the_windows_it_overlaps: edge recording and the_reachedtraversal.
Each fails when its guard is reverted.
| except Exception as error: | ||
| # One unreadable lease must not stop the sweep: treat the owner as not quarantined. | ||
| logger.warning('event=v3_size_quarantine_read outcome=error exception_type=%s', type(error).__name__) | ||
| held = frozenset() |
There was a problem hiding this comment.
Record shared fallback telemetry for the sweep's fail-open path
When reading an owner's quarantine fails, the sweep deliberately continues as though no recordings were quarantined and enqueues the owner. This is a new fail-open path, but it only emits a warning, so the shared fallback metric cannot account for these recoveries or distinguish them from normal dispatch. The “New fallbacks” rule in backend/AGENTS.md requires calling utils.observability.fallback.record_fallback; emit it here with an outcome reflecting the continued dispatch.
AGENTS.md reference: backend/AGENTS.md:L327-L327
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ba6fbec.
When the sweep's per-owner quarantine read fails, it still wakes the owner and now calls record_fallback with:
component="conversations_v3"from_mode="size_quarantine_filter"to_mode="unfiltered_wake"reason="unavailable"outcome="recovered", because dispatch continues
conversations_v3, unavailable and recovered are all members of ALLOWED_COMPONENTS, FallbackReason and ALLOWED_OUTCOMES, so nothing is bucketed to other.
test_one_unreadable_lease_does_not_stop_the_sweep asserts that the real omi_fallback_total sample with exactly those labels goes up by one. It fails when the call is removed.
…ount the sweep's fail-open (SCA-2918) load() runs a time-neighbour query for open-window and unlocked sources. A finished row it loads that way loads on every pass, so a seed that also claims it must not be quarantined for it. load records which rows each recording's time query loaded, and _reached follows those edges. The sweep's fail-open quarantine read now records omi_fallback_total under conversations_v3 / unavailable / recovered. Failure-Class: FC-permanent-write-rejection-retried-forever 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: ba6fbec11c
ℹ️ 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 get(self, transaction=None): | ||
| return super().get() |
There was a problem hiding this comment.
Use the strict Firestore fixture for transaction assertions
The new quarantine transaction tests run record_blocked, mark_bounded_attempt, and clear_terminal_pending against this fake, but TxMemory.get() ignores its transaction argument and Tx.update() writes directly without tracking transaction ordering. Consequently, these tests would still pass if a transactional read moved after a write, even though Firestore rejects that sequence. The Firestore transaction-fake rule in backend/AGENTS.md requires the strict fixture for document-reference reads plus updates; use StrictFirestore for these transaction assertions rather than the permissive adapter.
AGENTS.md reference: backend/AGENTS.md:L236-L236
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in be2a61c.
The quarantine's lease state machine (record_blocked, mark_bounded_attempt, clear_terminal_pending, backoff_state and size_quarantined) now runs on StrictFirestore in every test in this file. The permissive TxMemory/Tx fake is gone. load, has_pending and the sweep's queries, which the strict fixture doesn't model, run on MemoryQuery over the same rows, through a key-translating view. So the end-to-end passes still exercise one store.
I checked the guard by inserting a transactional read after the first write:
record_blocked: 15 tests fail withReadAfterWriteError.mark_bounded_attempt: 3 fail.clear_terminal_pending: 11 fail.
None of the code failed under the strict fixture, so the production code is unchanged for this finding.
The fixture gains only the single-field v3_pending mask for the prune's non-transactional BatchGet. test_strict_firestore_transaction.py still passes.
…prune only when on, best effort (SCA-2918) The size quarantine tests drove record_blocked, mark_bounded_attempt and clear_terminal_pending through a permissive fake that ignored the transaction. They now run on StrictFirestore over the same rows load and the sweep query, so a transactional read moved after a write fails them (Codex r4714049853). The fixture gains only the single-field v3_pending BatchGet mask. Pruning now runs only with CONVERSATIONS_V3_SIZE_QUARANTINE on, so off reads nothing extra, and a failed prune read keeps the list, records a degraded fallback and still records the park's backoff (final panel F1). Failure-Class: FC-permanent-write-rejection-retried-forever Co-Authored-By: Claude Opus 5.5 <[email protected]>
…its; one skip condition (SCA-2918) Final panel review-20261126t230842-455c: - F2: a held id was only pruned once it stopped being pending, so a repaired recording stayed held forever. Each id now carries a timestamp (v3_size_quarantine_at) and a 24 h hold; after it lapses the id is seeded again, so a repaired recording commits and a still-oversize one is set aside afresh. The runbook's retry-after-repair step clears both fields (F4). - F6: the sweep and the pass chain skip held ids under exactly the condition load filters on: the switch and CONVERSATIONS_V3_BOUNDED_PENDING both on. - F7, F8, F9: flag summary, three-number readback, has_pending cost stated. Failure-Class: FC-permanent-write-rejection-retried-forever Co-Authored-By: Claude Opus 5.5 <[email protected]>
… pending ids; id-only has_pending (SCA-2918) Exact-head panel review-20261126t235126-337b at dc79de8: - F1: pruning and the quarantine write are gated on size_quarantine_filters(), so with bounded pending off a size park reads and changes nothing extra. - F2: held_quarantine() is the readback's work-quarantined set: ids inside their hold that are still v3_pending, so a landed repair leaves it without a park. - F4: has_pending selects only v3_pending. - F3, F5: the extra lease read per size park and the back-to-back pass bound (one per newly set-aside closure, at most 64) are stated in the cost section. - F6: a park adding nothing leaves the live holds' stamps unchanged (tested). Failure-Class: FC-permanent-write-rejection-retried-forever Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve backend/utils/conversations/v3/service.py: keep this branch's _reconcile_groups helper (Finish SLI held-route observation) and main's size-quarantine helpers from #26441 (SCA-2918) side by side; the two were independent insertions at the same spot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ure-budget Conflicts in database/conversations_v3.py (imports) and utils/conversations/v3/service.py (blocked handler, ladder helpers): both sides kept. A batch-cap conflict retries down the seed ladder; any other budget park, including document_too_large, goes through record_blocked with the size quarantine. New test: a capped listed owner steps down to one seed and that seed's size rejection still quarantines its closure. commit_projection digest re-pinned. Failure-Class: new Co-Authored-By: Claude Opus 5.5 <[email protected]>
Why
With the recovery carrier
afab9560serving 95% of backend-sync, 12 owners stay parked ondocument_too_large. Each has already had its bounded early attempt.The transcript size cap (#26372) is on and engages. The documents that overflow are ones it doesn't measure. I sized them by Firestore's own rules from ro-prod aggregates, with no uids or content read out.
audio_files[].legacy_ids: 0.66 and 0.39 MiB (up to 128 superseded ids per file)transcript_segmentsplus aliases. These rows predate the cap, and locked rows keep their boundaries._oldest_pendingre-seeds the same recording on every backoff, so one oversize closure freezes the owner's whole backlog: 5,388 pending rows older than 1 h.What
CONVERSATIONS_V3_SIZE_QUARANTINE(default on). A live pass can seed exactly one pending recording, then have its commit rejected withdocument_too_large. When that happens,record_blockedmay set work aside inv3_size_quarantineon the builder lease. The write is all or nothing, at most 64 ids, and part of the same park transaction.loadrecords which rows each recording's time-neighbour query loaded (charged to every source window a row overlaps, or all of them if undated), and the veto follows those edges. An unnamed or unattributable rejection parks with the usual backoff.loadover-fetches by the list length), the pass chain (has_pending), and the 5-minute sweep. All three skip under one condition,size_quarantine_filters(): the switch on andCONVERSATIONS_V3_BOUNDED_PENDINGon, since load filters only on a bounded pass. With bounded pending off, the sweep keeps waking the owner. The sweep's per-owner lease read is isolated: a failed read counts as not quarantined, the owner is woken, and the fail-open is recorded asomi_fallback_total{component="conversations_v3",from_mode="size_quarantine_filter",to_mode="unfiltered_wake",reason="unavailable",outcome="recovered"}.v3_pending(landed, deleted or repaired), with one field-masked read per held id outside the transaction. Pruning is best effort: a failed read keeps every held id, recordsomi_fallback_total{component="conversations_v3",from_mode="size_quarantine_prune",reason="unavailable",outcome="degraded"}, and the park still records its backoff. With the switch off there is no prune read at all, so the park reads only its lease, as before.omi_fallback_total{component="conversations_v3",outcome="exhausted"}andreconciles_total{outcome="size_quarantine_full"}. A new quarantine recordsoutcome="degraded"andreconciles_total{outcome="size_quarantined"}.v3_pending. The lease keeps naming them after the park clears.v3_size_quarantine_aton the lease). After that it is no longer skipped: the sweep wakes the owner, seeding picks it up, and a repaired recording commits. One still oversize is set aside again on that attempt with a fresh 24 h hold, which costs one failed pass per id per day. An id with no timestamp isn't held. An operator can retry at once by deletingv3_size_quarantineandv3_size_quarantine_at(or the repaired ids) on the builder lease; the runbook's retry-after-repair step now says so.Cost.
load, so there are 0 new reads per pass; the over-fetch adds at mostlen(quarantine)docs.has_pending's probe limit widens by the held count, which skips only held ids still inside their hold: up to 65 docs (the 64-id cap + 1) where it read 1–3. The probe now uses.select(['v3_pending']), so those are id-only reads, not transcript documents. Owners with nothing held are unchanged.v3_pendingfield per held id, at most 64. With either switch off, nothing extra is read.Not in this PR: alias slimming
The earlier alias slim is removed (panel F1).
/v1/sync/audio/{conversation_id}/{audio_file_id}resolves a client handle by the current id or the alias'slegacy_ids, andrecording_file_iddoesn't cover that lookup. So the 2 owners whose oversize row is aliaslegacy_idsbloat stay quarantined until a follow-up designs for that reader.legacy_idsreaders onorigin/main, outside tests, fromgit grep:backend/routers/sync.py:709: the audio download lookup, by id orlegacy_ids. The follow-up must keep it.backend/utils/other/playback_identity.py:132-133:retain_aliases, the writer that accumulates the last 128 superseded ids on rotation. It runs fromdatabase/conversations.py:2773(the audio_files update) anddatabase/record_projection_rebuild.py:151.routers/staged_tasks.py,utils/memory/legacy_backfill.py,database/memories.pyandutils/memory/knowledge_ledger_migration.py.Rollback
Set
CONVERSATIONS_V3_SIZE_QUARANTINE=offon backend-sync, or redeploy the prior revision. Storedv3_size_quarantineids are ignored while it's off, and nothing extra is read or written.Readback after serving
These are three numbers, never added together. Baseline: 0 of 12 owners recovering, 0 quarantined ids.
document_too_largewhose park cleared and whose pending rows older than 1 h, outside the quarantine, are draining.store.held_quarantine: inside their hold and stillv3_pending, which is what seeding actually skips), owners holding any, and owners whose list is full. A repaired recording that landed leaves this count at once, without another size park. That work stays unrepaired until the oversize document is fixed. It is the repair list, and it includes the 2legacy_idsowners until the follow-up.document_too_largewith nothing quarantined, because Firestore named no document or named one the open or unlocked windows reach. These stay unresolved here and go to repair by the named document where there is one.Quarantined ids identify the recordings to retry after repair; the runbook's retry-after-repair steps stay as written.
Tests
tests/unit/test_conversations_v3_size_quarantine.py, 42 tests. The lease state machine (record_blocked,mark_bounded_attempt,clear_terminal_pending,backoff_state,size_quarantined) runs onStrictFirestore, which rejects any transactional read after the first write. Load,has_pendingand the sweep's queries run onMemoryQueryover the same rows. Moving a read after a write fails 15, 3 and 11 tests in the three transactions respectively. The fixture gains only the single-fieldv3_pendingmask for the prune's non-transactional BatchGet. The three-seed fixture uses the realload,record_blocked,backoff_state,mark_bounded_attempt,clear_terminal_pending,has_pendingandsweepon one in-memory store. It seeds an oversize seed, a second seed sharing its claimant row, and an independent seed. Results:_commitattaches what a size-rejected commit wrote to its conflict (Conflict.size_commit), soreconcilegains no branches (pyright analyzes it).exhausted(F2);load(Codex r4713792971);tests/unit/test_conversations_v3*.py,test_firestore_query_shapes.py,test_repeat_work_cuts.pyandtest_*fallback*.py: 2219 passed, 4 skipped (test_firestore_query_shapes.pyrun on its own: 640 passed, including the declaredhas_pendingprojection).scripts/check_feature_flag_registry.py: OK.Failure-Class: FC-permanent-write-rejection-retried-forever
Line-Count-Exception: backend/database/conversations_v3.py | 2062 -> 2220 | the quarantine belongs with record_blocked and load, which it changes; splitting the builder store mid-incident is out of scope
Line-Count-Exception: backend/utils/conversations/v3/service.py | 1898 -> 2010 | the closure selection sits next to _load_live_batch, and the sweep filter next to the sweep it changes
🤖 Generated with Claude Code