Skip to content

fix(v3): set a size-rejected seed aside so the owner's backlog drains; slim recording aliases (SCA-2918) - #26441

Merged
Git-on-my-level merged 11 commits into
mainfrom
lane/v3-doc-too-large
Nov 27, 2026
Merged

Git-on-my-level merged 11 commits into
mainfrom
lane/v3-doc-too-large

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Why

With the recovery carrier afab9560 serving 95% of backend-sync, 12 owners stay parked on document_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.

Owners Oversize document Size Filled by
2 A finished derived row the seed feeds 0.996 / 0.998 MiB Recording-alias audio_files[].legacy_ids: 0.66 and 0.39 MiB (up to 128 superseded ids per file)
6 A finished derived row the seed feeds 0.95–1.00 MiB transcript_segments plus aliases. These rows predate the cap, and locked rows keep their boundaries.
2 The oldest pending source recording 1.000 / 0.999 MiB The recording is already at the limit, so the claims update can't fit
2 Not among the first 3 seeds or their claimant rows — Elsewhere in the closure

_oldest_pending re-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 with document_too_large. When that happens, record_blocked may set work aside in v3_size_quarantine on the builder lease. The write is all or nothing, at most 64 ids, and part of the same park transaction.

  • Attribution first. Firestore's error must name the oversize document; the id is parsed in the service and never logged. That document must be the seed, a row the seed claims or feeds, or a source the commit writes for those rows. It must also lie outside everything the lease's open window or an unlocked seed reaches through claims, time neighbours and sources, transitively, because those load on every pass. load records 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.
  • The set is the seed plus the pending sources the rejected commit writes for the seed's rows. A seed sharing the oversize row is set aside in the same park. Time siblings of unrelated rows are not.
  • Claims are never filtered. Closure loading is unchanged. Only three paths skip quarantined ids: seeding (load over-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 and CONVERSATIONS_V3_BOUNDED_PENDING on, 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 as omi_fallback_total{component="conversations_v3",from_mode="size_quarantine_filter",to_mode="unfiltered_wake",reason="unavailable",outcome="recovered"}.
  • An unlocked seed beside the pending one no longer disqualifies the pass; only what it reaches is vetoed.
  • The list can't silt up. With the switch on, each size park first prunes held ids that are no longer 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, records omi_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.
  • Telemetry. A closure that still doesn't fit records omi_fallback_total{component="conversations_v3",outcome="exhausted"} and reconciles_total{outcome="size_quarantine_full"}. A new quarantine records outcome="degraded" and reconciles_total{outcome="size_quarantined"}.
  • The early attempt is re-armed, so the next seed runs on the post-park wake.
  • Quarantined rows can't hide a successor: the page-continuation lookahead widens by the quarantine size.
  • Quarantined rows stay v3_pending. The lease keeps naming them after the park clears.
  • A way back after repair. Each id is held for 24 h from when it was set aside (v3_size_quarantine_at on 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 deleting v3_size_quarantine and v3_size_quarantine_at (or the repaired ids) on the builder lease; the runbook's retry-after-repair step now says so.

Cost.

  • The lease read moves earlier in load, so there are 0 new reads per pass; the over-fetch adds at most len(quarantine) docs.
  • For an owner holding quarantined ids, 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.
  • A lapsed hold costs one re-attempt pass per id per 24 h.
  • The sweep adds 1 lease read per stale owner, about 46 against its existing scan of about 14k stale pending rows per sweep.
  • There are 0 new writes; the list rides the park's existing lease update. While pruning is on (the switch and bounded pending on), a size park reads the builder lease once more outside its transaction, plus one v3_pending field per held id, at most 64. With either switch off, nothing extra is read.
  • Back-to-back passes: each newly set-aside closure re-arms the early attempt, buying one more full pass about 5 s later. An owner with many distinct oversize closures can therefore run up to 64 such passes in a row (the id cap), one per newly set-aside closure. After that the list is full and the owner backs off normally. I kept this rather than capping at one closure per task, because the cap would slow the drain for every quarantined owner. The 12 owners' estimate is 1–2 recordings per closure.
  • A one-hop ro-prod estimate puts 1–2 pending recordings in each of the 12 owners' seed closures, well under the 64 cap.

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's legacy_ids, and recording_file_id doesn't cover that lookup. So the 2 owners whose oversize row is alias legacy_ids bloat stay quarantined until a follow-up designs for that reader.

legacy_ids readers on origin/main, outside tests, from git grep:

  • backend/routers/sync.py:709: the audio download lookup, by id or legacy_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 from database/conversations.py:2773 (the audio_files update) and database/record_projection_rebuild.py:151.
  • No reader in sync purge, erasure, legal hold, WAL custody or dedup.
  • Same name, unrelated: local variables or keys in routers/staged_tasks.py, utils/memory/legacy_backfill.py, database/memories.py and utils/memory/knowledge_ledger_migration.py.
  • No app, desktop or web code reads the field.

Rollback

Set CONVERSATIONS_V3_SIZE_QUARANTINE=off on backend-sync, or redeploy the prior revision. Stored v3_size_quarantine ids 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.

  • Owners recovering: owners parked on document_too_large whose park cleared and whose pending rows older than 1 h, outside the quarantine, are draining.
  • Work quarantined: held ids per owner (store.held_quarantine: inside their hold and still v3_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 2 legacy_ids owners until the follow-up.
  • Parking without attribution: owners still parked on document_too_large with 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 on StrictFirestore, which rejects any transactional read after the first write. Load, has_pending and the sweep's queries run on MemoryQuery over 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-field v3_pending mask for the prune's non-transactional BatchGet. The three-seed fixture uses the real load, record_blocked, backoff_state, mark_bounded_attempt, clear_terminal_pending, has_pending and sweep on one in-memory store. It seeds an oversize seed, a second seed sharing its claimant row, and an independent seed. Results:
    • the shared closure is set aside in one park, keeps its claims and its pending markers, and is still named as blocked after the park clears;
    • the independent seed commits;
    • no further pass chains;
    • the sweep doesn't wake the owner while only set-aside work remains.
  • The real _commit attaches what a size-rejected commit wrote to its conflict (Conflict.size_commit), so reconcile gains no branches (pyright analyzes it).
  • Panel and Codex cases:
    • a time sibling is loaded but not set aside (F4);
    • an oversize seed beside an unlocked window drains, and an oversize unlocked window isn't charged to the seed (F3);
    • an unnamed rejection parks with no open window loaded (F5);
    • landed or deleted held ids are pruned and make room, and a full list reports exhausted (F2);
    • one unreadable lease doesn't stop the sweep (F8);
    • a failed prune read keeps the list and still records the backoff. With the switch off, a size park reads only its lease and writes no quarantine change even though a held id has settled, asserted by read count (final panel F1, F3, F5);
    • a lapsed hold is skipped no longer, is set aside again with a fresh hold if still oversize, and is dropped by an unrelated park; a repaired recording commits end to end once its hold lapses (F2);
    • with bounded pending off, the sweep wakes an owner holding a stored list (F6), and a size park reads only its lease and leaves the list alone (exact-head panel F1);
    • the readback counts held, still-pending ids, so a repaired and landed id leaves it without a park (exact-head F2);
    • a park that adds nothing leaves the live holds' stamps unchanged, including beside a dropped lapsed id (exact-head F6);
    • a finished row the open window's source also claims isn't charged to the seed, end to end through load (Codex r4713792971);
    • a finished row the open window's source loads by time, which the seed claims, isn't charged to the seed: the pass parks (Codex r4713922743), and a time-queried row is charged only to the source windows it overlaps;
    • an unreadable lease in the sweep records the fallback under allowed labels, asserted on the real counter (Codex r4713922748);
    • the open window, its source and an unnamed rejection aren't quarantined;
    • fallback telemetry fires once;
    • the continuation is held behind 33 quarantined successors.
  • Mutation checks: each guard fails its own test when reverted. The guards are seed-only quarantine, the sweep filter, the open-window and transitive veto, the time-neighbour edges, the per-window overlap, the unlocked disqualifier, quarantine of every loaded pending, quarantine on an unnamed rejection, pruning, the full-list signal, sweep isolation, the fallback calls, the widened lookahead, prune-only-when-on, the best-effort prune, the hold age, the fresh re-stamp, the lapsed-id drop, the bounded-pending sweep gate, the bounded-pending prune gate, the stamp preservation and the held-pending readback.
  • Via omi-heavy: tests/unit/test_conversations_v3*.py, test_firestore_query_shapes.py, test_repeat_work_cuts.py and test_*fallback*.py: 2219 passed, 4 skipped (test_firestore_query_shapes.py run on its own: 640 passed, including the declared has_pending projection).
  • 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

…; 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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T00:25:35.753717Z f4d271a 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.

@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: 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".

Comment on lines +407 to +409
if page.seeds[1] or len(page.pending_ids) != 1:
return None
return page.pending_ids[0]

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 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Comment thread backend/database/conversations_v3.py Outdated
Comment on lines +307 to +309
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

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 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

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 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Git-on-my-level and others added 4 commits November 26, 2026 16:28
…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]>

@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: 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".

Comment on lines +426 to +427
if page.independent and (oversized is None or oversized in page.independent):
return ()

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 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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 real load).

Both fail under the old direct-only veto.

Git-on-my-level and others added 2 commits November 26, 2026 17:24
…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]>

@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: 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".

Comment on lines +431 to +432
if seed not in recordings or oversized in _reached(page.independent, recordings, existing, planned):
return ()

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 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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 neighbour dn is 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 _reached traversal.

Each fails when its guard is reverted.

Comment on lines +1712 to +1715
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()

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 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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]>

@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: 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".

Comment on lines +188 to +189
def get(self, transaction=None):
return super().get()

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 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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 with ReadAfterWriteError.
  • 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.

Git-on-my-level and others added 3 commits November 26, 2026 18:28
…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]>
@Git-on-my-level
Git-on-my-level merged commit 73079e7 into main Nov 27, 2026
76 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/v3-doc-too-large branch November 27, 2026 00:40
Git-on-my-level added a commit that referenced this pull request Nov 27, 2026
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]>
Git-on-my-level added a commit that referenced this pull request Nov 27, 2026
…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]>
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