Repository navigation
fix(conversations-v3): stop source claims doubling past the 1 MiB limit; size batches on every write - #25714
Conversation
…ument limit A late recording overlapping a finished conversation's start formed a fresh window that time-matched the retained conversation's id before its retained window claimed it, so two planned rows shared one id and each re-added the source's held claims. Claims doubled on every pass until the recording exceeded Firestore's 1 MiB limit and the owner parked on document_too_large. - Seed the planner's used ids with retained windows before matching. - Deduplicate identical claims on every commit and in held spans, so bloated sources shrink. - Log the largest staged document's kind and size on a size InvalidArgument. - A blocked live pass still drains notes for already committed windows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in parked owners' notes - Count each batch's source claim rewrites and lease update against an 8 MiB per-transaction cap alongside the 2 MiB derived-row cap. - Map Firestore's "Request payload size exceeds the limit" to the blocked request_too_large conflict. - Log the blocking cause (paths and ids redacted) and a hashed owner tag. - Backoff and blocked live passes drain notes for rows already committed, except account deletion. - Fix the possibly-unbound `moved` and the staged-size tuple type flagged by pyright. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| async def _drain_blocked(uid, reason): | ||
| if reason in NO_DRAIN: | ||
| return | ||
| try: | ||
| await drain_processing(uid) |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
_drain_blocked skips draining only when the stored or in-pass conflict reason is account_deletion. The new backoff early-return calls this with v3_blocked_reason from the builder lease and never consults account_deletion_blocks_user_work(uid), which is the live fence used by store.load().
If the owner is already parked for another blocked reason (for example document_too_large) and then starts account deletion, scheduled backoff reconciles still drain notes. begin_processing() does not re-check the deletion marker, so process_conversation can send transcript content to LLM providers, and created.deliver() can still fan out webhooks, before store_summary() would refuse the write.
Impact: After a deletion request, conversation transcripts and created-event payloads can still leave the account on this path for the remainder of the backoff window.
Reviewed by Cursor Security Reviewer for commit ea3f50f. Configure here.
… (panel review) - A fresh window starting at a planned row's exact start derived the same start-keyed id; qualify it with its first recording so one id never names two planned rows (F6). - The blocked cause logs only the exception type, size limit and byte counts, never the raw message, which names document paths (F5). - The size log skips deleted rows that are never written (F7); the claim-growth test stubs outline context reads (F4). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…helpers on the event loop Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fault off, cohort canary) (#25726) ## Problem Conversations v3 is on for TestFlight. A pendant capture is a batch-only *recording*. It has no transcript until it seals, and it seals only after 120 s of speech quiet (#25633) or at socket close. In a cafe the speech never pauses for 120 s. Nik's recording `4170f9cf` ran 19:01:54 to 19:35:31Z (33.6 min). His chat ended 19:09:50Z, and its derived rows appeared at 19:40:52 and 19:43:08Z. Home showed nothing for 31 minutes. ## Change (ships OFF) - **Rotation** (`routers/listen/conversations.py` `_v3_rotation_due`, `_rotate_v3_recording`, `_seal_rotated`, `_seal_rotated_recording`; `utils/stt/speech_clock.py` `rotation_due`). A batch-owned row with `recording: true` (the v3 marker) seals at the first 1.5 s speech pause once it is `CONVERSATIONS_V3_ROTATION_MIN_SECONDS` old (default 180), or at `CONVERSATIONS_V3_ROTATION_MAX_SECONDS` (default 300) without a pause. A row never rotates if it is a legacy row, an onboarding capture, has no speech of its own, has a pending client stop (`finalization_reason`), is under an episode `hold`, or is inside the 60 s backoff after a failed rotation. A tick that is already a quiet seal or a producer `boundary_at` takes the existing path. A failed or absent SpeechClock uses only the cap. - **Cut order** (fixes the custody blocker). This is the order `rollover_after_transcript_decode_failure` already uses: 1. Create the successor first. The old row stays `in_progress` and keeps receiving audio until `current_conversation_id` switches. 2. `LiveAudioArchive.retarget(old, successor)` (`utils/other/live_audio_archive.py`), under the archive lock. From then on, any frame still addressed to the old id is appended to the successor. This covers a frame the receiver bound before the switch and appended after it. 3. `finish_recording(old)` flushes and commits the old row's packs. Its custody is then final. 4. Stamp `v3_rotation_cap_seconds`, then run `process_conversation(old)`. The old row is no longer current, so `close_batch_archive` skips the global close, exactly as in the decode-failure rollover. A custody timeout leaves the old row queued and retries it on the next tick (at most 8 queued). After socket close, the old row's armed quiet check and stale recovery own it. A successful seal drops the old producer token, so the 64-token cap is not reached on long sockets. - **Supersede mode** (`create_new_in_progress_conversation(rollover=True, supersede=previous_id)`, `database/listen_continuations.py` `supersede_live_continuation`). - Phone sockets send `client_conversation_id`. Without this mode, the create first resolved the origin's `live_continuation` pointer, which named the still-open current row, and resumed that same row. So a long recording rotated at most once. - In supersede mode the create skips both continuation resumes. - The pointer moves only after the successor is claimed, armed and is `current_conversation_id`, in one transaction. A failed create therefore never leaves the pointer on a dead empty row. - It moves only when the pointer names the retired row, one of this socket's own recordings, or nothing. Otherwise `other_owner` is counted and logged, and another generation's pointer is never taken. - A reconnect resumes the successor. - **Successor failure.** If the create raises, or returns without switching, the current recording is kept. `recording_session_id`, `batch_record_capture`, `recording_session_ids_by_conversation` and the Redis in-progress id are restored, and rotation backs off 60 s (`ROTATION_RETRY_SECONDS`). A `WebSocketException` (ownership changed, or the 64-token cap) is re-raised after the restore, so the socket closes as it would on any other create. - **No rotation on reconnect-protocol rows.** A row carrying `listen_batch_producer` never rotates. Its producer token would fence both the seal retries and stale recovery of an orphan. The flag is unset in prod, so this is inert today. - **Seal retries.** A retired recording stays in `_unsealed_rotations` until `process_conversation` returns True. - Refused seals retry after 15, 30, 60 and 120 s. - Teardown (`routers/listen/runtime.py`, before the current row is handled) runs `drain_rotations` for one last attempt. - On hand-off, the socket drops the producer token, so the cap stays reachable only by live rows. - The row is then left `in_progress` for `LiveConversationController.recover_stale_in_progress` (`routers/listen/conversations.py`). That runs in `process_pending` on the owner's next listen connection, for rows quiet for an hour, and seals through `process_conversation`. - Correction to the previous round: the quiet check armed at creation does not recover a v3 recording. `recovery_admission_refusal` returns `terminal_no_derived`, because `triggers.mark_new` stamps `terminal_no_derived_effects` on every v3 recording. This holds for any crashed v3 socket today, not only for rotation. - Counter: `omi_listen_v3_rotation_total{outcome=rotated|same_row|create_failed|seal_failed|seal_retry|handed_off|other_owner}` through the reason-enum core (`RecordingRotationOutcome`, family `recording_rotation`). - **Builder** (`database/conversations_v3.py` `_mark_successor_pending`). It applies only when the latest spoken recording carries `v3_rotation_cap_seconds`, which only rotation writes. In that case it keeps the stretch open while a later recording is in progress under that cap + 15 s, or processing for under 15 min. With rotation off, no row has the stamp, and the builder behaves exactly as on main. The successor query is `.select()` over 8 metadata fields, limit 8, single-field `started_at` index. It is registered in the query-shape drivers. - **Switches.** - `CONVERSATIONS_V3_RECORDING_ROTATION`: `off` (default), `cohort` (members of the `v3-recording-rotation` rollout cohort) or `on`. - The cohort lives in the `rollout_cohorts` collection. No uid goes in deploy source. - All three envs are in `deploy/runtime_env/_base.yaml` (composed `runtime_env.yaml`) and both listen chart values files, as `off`/`180`/`300`. They are also in `config/feature-flags.yaml`, the rendered registry and `deployment-setting-classification.json`. - Changing any env value rolls backend-listen. Membership changes do not roll (60 s cache). ## Canary for one owner 1. In `backend/deploy/runtime_env/_base.yaml` (gke backend-listen env) and `backend/charts/backend-listen/prod_omi_backend_listen_values.yaml`, set `CONVERSATIONS_V3_RECORDING_ROTATION` to `cohort`. Recompose with `python3 backend/deploy/compose_runtime_env.py`, merge, then roll listen with `gcp_backend_listen_helm.yml` (environment=prod, branch=main, expected_sha, mode=deploy, image_tag). With an empty cohort this is still off for everyone. 2. Write the uid to a private file (0600), then run: `GCP_AGENT_TIER=prod-operator backend/.venv/bin/python backend/scripts/rollout_cohort.py --uid-file <file> --cohort v3-recording-rotation --project based-hardware --environment prod --add --apply` It takes effect within 60 s. To undo, use `--remove`, or set the env back to `off`. The image must contain this PR first: `gcp_backend.yml` mode=build-only, then the listen helm deploy. The builder change is inert until rotation stamps a row, so its deploy order does not matter. ## Checks 1. **Custody at the cut.** The first version of this PR was wrong. It sealed the old row while the socket kept binding frames to it, and `server_batch_audio_closed` is not set while the socket is active (`batch_close.py:46`). With the reconnect flag off, late frames extended a `processing` row's window. With it on, `note_server_batch_audio` refused them and poisoned `uncommitted`. The new order makes it impossible for a frame to join the old row once its seal starts. - Proof: `tests/unit/test_listen_v3_rotation_custody.py`, parametrized with `LISTEN_BATCH_RECONNECT_ENABLED` off and on. - It uses the real `LiveAudioArchive` (durable outbox on the hermetic `remote` bucket), the real `note_server_batch_audio` / `_received` on `StrictFirestore`, and the real `_rotate_v3_recording` → `finish_recording` → `process_conversation` → `close_batch_archive`. - 120 frames are produced concurrently. Each is bound before a yield, like the receiver. One extra frame is bound to the old id and appended after the seal. - Assertions: every frame is committed exactly once; each frame lies inside its own row's window; the sealed window is identical before and after; old frames all precede successor frames; `uncommitted` is empty; the archive did not fail; the old producer token is dropped. - Mutation check: with the retarget line removed, the reconnect-off case fails with the sealed window growing from (1000.00, 1000.46) to (1000.00, 1001.21), and the reconnect-on case never seals. - The receiver's ownership bookkeeping is not retargeted. Its sample ranges (`_note_accepted_frame`) only place live-STT transcripts, which batch-only sockets do not run. The custody ACK checkpoints per-channel frame sequence numbers, not conversation ids. - The test proves the ACK publishes once over retargeted frames, with nothing left pending. It also bounds the skew: the successor's `started_at` equals its `server_batch_audio_start`, which is the frame right after the sealed window, within one 10 ms frame of it. - Not real in this test: `create_new_in_progress_conversation` is a binding-equivalent stub. The real create path is covered by the continuation test below. It creates the server-batch row with yields that stand in for Firestore round trips, then switches `current_conversation_id`. `schedule_finalization` is stubbed to record the window and set `processing`. The full create path needs the recording-session, Redis and calendar stack and was not exercised. - Words: a word that straddles the cut lands whole in one recording's audio, but each recording is transcribed separately, so a word cut by the 300 s cap can be split across two transcripts. Cuts at a 1.5 s pause avoid that. 1b. **Rotation on a phone socket, through the real create path** (`tests/unit/test_listen_v3_rotation_continuation.py`). This uses the repo's `CaptureHarness`: the real `create_new_in_progress_conversation`, real `resolve_live_continuation` on `StrictFirestore`, and `client_conversation_id='original'`. - The old call (no supersede) returns the same row, which reproduces the bug. - Four consecutive rotations give 5 distinct recording ids. The pointer names each new successor in turn, every retired recording is sealed and stamped, nothing is deleted, and nothing is left unsealed. - A reconnect afterwards resumes the last successor. - Mutation check: with `supersede` removed, the test fails with `sealed == []`. - `supersede_live_continuation` refuses a pointer owned by another generation and returns `absent` for a missing origin. 1c. **What the phone does.** The app parses `conversation_session` as `UnknownEvent` and ignores it (`app/lib/backend/schema/message_event.dart`). - A rotation seal sends `memory_processing_started` for the retired recording. That is the same event and the same `process_conversation` → `schedule_finalization` path a quiet seal uses today, so the quiet seal is the precedent. - On that event the client keeps streaming on the same socket. `CaptureController.onMessageEventReceived` (`app/lib/services/capture/capture_controller.dart:4089`) stamps the session's WALs with the recording id (`_finalizeAndStampSession`) and starts a new session. - v3 Home re-reads the list and the live conversation on a capture event, at most every 10 s, instead of adding the recording as a row (`app/lib/pages/conversations/conversations_page.dart:411`). - Difference from a quiet seal: frequency. A batch recording's `memory_created` arrives only after GPU transcription, which takes more than 30 s. So the 30 s fallback runs `_confirmSessionWalsRetained(..., failClosedReason: 'missing_conversation_event')` and auto-syncs the retained WAL for every rotated recording, as it already does after each quiet seal. - Consequence: about one WAL upload per 3-5 min instead of one per quiet-ended recording. These sync pieces then hit the containment issue in check 4. - I read the code. I did not run the 1.0.593 client. 2. **Stitching.** `outline.stretches` splits only on a 5 min gap or a manual cut, so recording boundaries do not split a conversation. `planner.windows/build` copy lines in order across recordings. The finish rule is what could false-split: the commit clears `v3_pending` on an untranscribed live successor. `_mark_successor_pending` handles that for rotation-sealed rows. Tests: `test_untranscribed_successor_keeps_the_stretch_open` (7 cases), `test_a_recording_rotation_did_not_seal_keeps_the_five_minute_rule` and `test_rotated_recordings_stitch_into_one_stretch_in_order`. 3. **Load, for a 1 h continuous capture.** Before: 1 recording and 1 batch unit. After: 12 recordings (300 s cap) to about 20 (180 s + pause). Audio seconds are unchanged. Per recording, there is one more of each: successor create (recording-session open, producer claim, quiet-check arm), finalization request and pusher close, intake claim, admission authorize, batch job and lease docs, merge head, projection, cap stamp. v3 reconcile stays a named task per owner-minute. Unfinished stretches make no LLM call. The builder adds one ≤8-doc metadata query per pass. Default off means no load change until a canary. 4. **Sync bridges.** The reviewer is right. `batch_target_contains` (`utils/sync/live_overlap.py:105-131`) refuses a piece that starts before a target, or ends after a sealed one. Prod sample, Nik, 2026-11-18, metadata only: - 15 of 17 listed live recordings had overlapping WAL pieces. - Of the 18 pieces, 13 sat inside one recording (10 merged, 3 pending). - 5 already span a recording boundary today and stay standalone legacy-layer rows. Examples: `e87bfed2` 18:57→19:33 starts before `4170f9cf`, and `09be1e39` covers three recordings. - With 3-5 min recordings, pieces over a few minutes would stop merging. That is 3 of today's 10 merged pieces (5.5, 5.0 and 30.3 min, including `80484b85` against `4170f9cf`). - What the user would see: a legacy-layer sync card for the same speech next to the v3 derived conversation, once its settling hold ends. The v3 "same text ±2 s" dedupe does not catch two independent transcriptions. - Not fixed here, and a blocker before `on`. The cohort canary should watch for these duplicates. Fleet-wide frequency was not measured: no collection-group index exists to query bridges across owners. 5. **Legacy untouched.** `recording is True` plus `server_batch_owned` is required. Tests: `test_legacy_row_never_rotates` and `test_off_is_the_old_lifecycle` (unset, `off` and empty-`cohort` all keep the main lifecycle, including the quiet seal). The builder gate is the row stamp. 6. **Calendar.** A meeting does not block v3 rotation (`test_a_calendar_meeting_does_not_block_v3_rotation`). v3 conversations come from transcript windows, and `create_new_in_progress_conversation` re-attaches the active meeting to the successor. 7. **Speaker labels.** Batch diarization labels are per unit, so `SPEAKER_0` in recording N is not `SPEAKER_0` in N+1. The owner (`is_user`) and named people (`person_id`) are resolved per recording from embeddings (`utils/conversations/speaker_resolution.py`), so they stay consistent. `recording_carry` copies manual speaker assignments into the successor. What breaks: unnamed voices get different S-numbers every 3-5 min inside one derived conversation, both in the copied transcript and in the outline input. The outline prompt already treats S-numbers as unreliable. Shorter recordings also give speaker resolution less audio per voice. That may lower wearer recognition, which v3 needs before it hides background talk. Not measured. ## Latency, from "conversation ends" to "derived row visible" - **Before** (continuous background speech): unbounded, until 120 s of quiet or socket close, plus batch transcription. Nik's case was 31 min, with about 5 min of transcription for a 33.6 min recording. - **After, for a canary owner:** the first derived in-progress row appears 3-5 min after speech starts, plus transcription of a 3-5 min recording. When the conversation ends, the open recording seals within at most 180 s (usually at the next pause). Notes follow at last speech + 5 min, by the unchanged planner rule. If cafe noise is itself transcribed as lines, the stretch stays open. It is visible live, but auto-notes wait. A Home row within about 1 minute is not delivered here. ## Related David's lane: #25714 and #25659 touch the v3 store and service, not this `load()` tail or `lifecycle_loop`. #25633 introduced SpeechClock. `routers/conversations.py` `get_live_conversation` is not touched. ## Verification - Unit: 4118 passed, 2 skipped. Locally, `test_cloud_run_metrics_egress_workflow` fails on macOS bash 3.2 (empty array under `set -u`), and `test_rollout_cohorts` flakes under xdist but passes alone. Neither touches these files. Earlier round: 3113 passed and 1 skipped across every `conversations_v3*`, `listen_*`, archive, outbox, desktop-batch, cohort, runtime-env, flag and query-shape file, including the new custody and lifecycle cases. - Lifecycle cases cover: process returns False, successor create fails, successor resumes the same row, user_stop, quiet tick, episode hold, producer `boundary_at`, exact threshold boundaries, env tunables, cohort membership, and off equal to main. - `backend/scripts/typecheck.sh`: 0 errors. `scripts/pr-preflight --pr-body-file`: green. - New tests: - seal retry backoff and hand-off; - a raising seal that is retried, and an admitted seal that drops its token; - teardown drain; - failed-create residue restore; - retarget chains A→B→C and the 64-entry eviction; - an orphan left by a crash between create and seal: the real `quiet.arm` / `quiet.run` refuse it (`test_a_rotation_orphan_is_left_for_listen_stale_recovery_not_the_quiet_check`), and `recover_stale_in_progress` seals it on a later connection (`test_a_rotation_orphan_is_sealed_by_stale_recovery_on_a_later_connection`); - runtime teardown awaits `drain_rotations`; - the reviewer's probe as a test: a failed `_persist_policy_and_arm_quiet_check` leaves the pointer on the old row, and the retry moves it; - `own_ids` acceptance; - a `WebSocketException` closes the socket; - the Redis restore; - token pop at hand-off; - no rotation on reconnect-protocol rows. - Not verified: no device capture and no dev or prod run. The custody test stubs the create, while the continuation test runs the real create without a real archive. Line-Count-Exception: backend/routers/listen/runtime.py | 1576 -> 1578 | teardown drains retired v3 recordings before it handles the current row ## Product invariants affected - INV-MEM-4 Cited because `backend/deploy/runtime_env.yaml` changed. The change only adds three backend-listen env entries; memory intake and promotion are unchanged. ## Failure class (fixes) Failure-Class: FC-transport-liveness-read-as-speech-activity 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…me commit stamp (owner livelock) (#25734) ## Summary After #25714 deployed, fleet parks fell from 85 to 6, but the product owner stayed wedged: still parked on `document_too_large`, with 17 rows stuck at `writing`. **Root cause: a multi-batch projection commit treats its own Commit-hook stamp as an external change.** - `home_feed_writer.augment_home_writes` (database/home_feed_writer.py:169) adds a fresh random `home_source_version` to every conversation write at the Commit boundary. When transcript fields change, it also adds `home_content_invalidated`. - After each non-final batch, `commit_projection` reads its own writes back (database/conversations_v3.py:649-682). - **Derived rows:** the readback compares every encoded field with the stored doc. A row rebuilt from a prior carries the prior's `home_source_version` (planner.build merges `**existing`). The hook replaced it, so the check raises `source_changed`. - **Recordings:** the same stamp is not in the readback's owned set. Every recording therefore looks changed and is marked moved. - The result: every pass commits batch 0 and then races. The final batch, which clears pending markers and resets the park, never lands. **Evidence (prod, read-only, owner on `prod-operator`; field names and counts only):** - A 7-minute watch of the owner's documents: every ~70 s a pass takes the builder lease and commits one transaction of 151 documents (68 sources and 83 derived rows). It releases the lease about 1 s later, and batch 1 is never written. Nothing else writes those documents in between. - An in-process replay of the owner's pass, with every writer stubbed: 95 planned rows in batches of [83, 12], no duplicate ids, and every encoded field survives an SDK round trip. - The real `commit_projection`, run against an in-memory copy of the closure without the Commit hook, commits both batches. - The only difference from prod is the hook's stamp. - The unit test below emulates the hook and fails on main. Before #25714 this owner never reached the readback, because batch 0 failed on `document_too_large` first. ### Fix - `home_feed_writer.COMMIT_STAMPED_FIELDS` names the fields the hook stamps. The readback ignores them for both derived rows and recordings. - A test pins that set to what `augment_home_writes` actually adds. - Any other change between batches still conflicts. It now logs `v3 projection readback changed kind=<derived_row|recording> batch=<i> fields=[...]`, with field names only. ### Related findings (not changed here) - **Race-wake enqueue 500s at 22:51–22:53Z** (`triggers.enqueue` → `cloud_tasks.enqueue_named_task:458`) were Cloud Tasks transport errors: `UNAVAILABLE` ("Connection reset by peer") and `DEADLINE_EXCEEDED`. They were not tombstone or ALREADY_EXISTS dedup; that path logs "already enqueued, skipping duplicate" and succeeds. The 500 is the designed fallback: Cloud Tasks retries the task. - **18 rows `completed`/`tile_state=failed`, reason `attempts_exhausted`:** - The notes writer fences its persist on the row's `update_time` (database/conversations_v3_processing.py:38, `summary_source_changed`). - The livelocked builder rewrote every batch-0 row about every 70 s (and earlier this morning). Each rewrite bumps `update_time`, plus the hook's stamp, so in-flight notes lost their fence twice and `begin_processing` failed them (conversations_v3_processing.py:247-249). - Fixing the livelock stops the rewrite storm. These rows stay `summary_retryable` for the client retry. ## Test plan - New `backend/tests/unit/test_conversations_v3_commit_readback.py`, with a fake Commit hook that stamps each write (6 tests): - a 64-row commit that is asserted to split into at least two batches reaches the final batch, clearing pending and the park; - an external change between batches still raises `source_changed`, and the log names the field but no ids. This is covered for a derived-row field and for the recording fence fields `is_locked` and `data_protection_level`; - live speech appended between batches is still marked moved; - the stamped-field set equals what `augment_home_writes` adds, for both a transcript write and a metadata-only write. - Run against unfixed `conversations_v3.py`, 5 of the 6 tests fail. - Change note: `backend/docs/listen_pusher_pipeline/changes/2026-11-19-v3-readback-home-stamp.md`. - The v3 and home-feed unit suites pass. Failure-Class: none 🤖 Generated with [Claude Code](https://claude.com/claude-code)




Summary
Production (backend-sync at 9c88e7f) parked about 64 owners with
v3_blocked_reason=document_too_large, the product owner among them. Their committed windows sat atprocessing/writingand never got notes.The oversized write was a source recording's
claimsarray, not a derived row or the lease doc. Prod reads (byte counts only) found one source recording per affected owner with 8,192–12,290claimsentries (~647–971 KB), all identical copies. Each owner had only 1–30 distinct claims, and the copy counts per conversation were powers of two. On the product owner's account, the recording was 719,204 bytes, of which 647,412 wereclaims(8,195 entries). The next pass doubles that past 1,048,576.Root cause
service.reconcile.plan()(utils/conversations/v3/service.py:243-253):_matchgives the fresh window X's id, because X is not yet inused.existing.get(window['existing_id']), which never checksused.Fix
usedwith the retained windows' ids, so a fresh window can never take the id of a retained finished conversation. The late speech becomes its own window, aspreserve_finished_windowsintends. It no longer overwrites, or is overwritten by, X.commit_projectiondeduplicates identical claims, by (conversation, start, end), on both the normal branch and the moved-source branch. The planner deduplicates held spans. Already bloated recordings shrink to their distinct claims on the next commit that touches them, so no data migration is needed.InvalidArgument, the log names the largest staged document's kind and estimated size, never ids or content:v3 projection write too large kind=<derived_row|recording|builder_lease> bytes=<n> claims=<n> batch=<i> batches=<n>.drain_processing, so windows committed by earlier passes get their notes. It does not drain foraccount_deletion, on-open passes or backfill passes. A failure inside that drain is logged and the pass still answersblocked.No transcript data is dropped. Normal-size owners see the same rows. The one behaviour change is for late speech overlapping a finished conversation's start: it shows as its own conversation, where before its claim pointed at X while X's content dropped it.
Also in this PR (coordinator scope update, 17:50Z)
fixed_write_bytesestimates that per-batch overhead. Batches split on whichever fills first: 2 MiB of derived rows, or 8 MiB of total writes. Before, only the encoded rows were counted.InvalidArgument: Request payload size exceeds the limit(seen 19 times in the 17Z hour as 500s) becomesConflict('request_too_large'), which is inBLOCKED. OtherInvalidArguments still raise.v3 reconcile blocked reason=… owner=<sha256[:12]> cause=<type>: <message>. Document paths and long ids are removed from the message.drain_processingruns for rows that are already committed, so a parked owner'swritingrows still get notes. This uses a newstore.backoff_state, which returns (until, reason). The drain is skipped when the reason isaccount_deletion.Not covered
One owner's pending source recording is 1,048,135 bytes on its own: 848 KB of inline
transcript_segmentsand 168 KB ofaudio_files, with only 3 claims. Any claims update overflows it. Fixing that needs the source transcript offloaded, which is a separate change. With this PR, that owner's log line will namekind=recording.Test plan
backend/tests/unit/test_conversations_v3_claim_growth.py, synthetic data, 16 tests:account_deletionand on-open passes;account_deletion;InvalidArgumentstill raises;Failure-Class: FC-partition-depends-on-arrival-order
🤖 Generated with Claude Code