Repository navigation
fix(sync): retain phone custody for unresolved batch partials - #24335
Conversation
Return processing/batch_unit_held until all units resolve, while projected transcripts remain visible. Pace held polls at five minutes and pin phone retention, real projection and wire contracts with a shared response golden. Failure-Class: FC-audio-cleanup-before-durable-custody
Add the required internal-only mobile changelog fragment for test changes.
There was a problem hiding this comment.
6 issues found across 12 files
Confidence score: 3/5
- In
intake.py,durable_statusreturns 409 for explicit deletion of a partial upload, so the phone can keep its WAL instead of releasing it. Restore the deletion exception. - The custody tests can pass without proving the behavior they cover:
test_sync_poll_limit.pypreloads the expected hint,test_batch_pipeline_held_custody_firestore.pydoes not assert the held unit stays unresolved, andtest_batch_pipeline_quarantine_recovery.pynever callsdurable_status. Make these tests exercise and assert those behaviors. backend/testing/sync_cloud_tasks_stack/README.mddescribes held uploads differently from the serving contract inbackend/docs/batch-pipeline-serving.md. Update the canonical contract to match the new scenario.- The
kind: noneentry inapp/changelog/unreleased/20261102-held-custody-contract-tests.jsonsuppresses a release note for a production custody fix that changes phone behavior. Add a concise, user-facingchangeentry.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/tests/unit/test_sync_poll_limit.py">
<violation number="1" location="backend/tests/unit/test_sync_poll_limit.py:148">
P2: This fixture pre-populates `poll_after_ms` with the expected value, so the `backoff='false'` cases pass even if `with_poll_hint` fails to add the five-minute custody hint. Remove the field from the fixture so every parameterization requires the helper to produce `300000`.</violation>
</file>
<file name="backend/tests/unit/test_batch_pipeline_quarantine_recovery.py">
<violation number="1" location="backend/tests/unit/test_batch_pipeline_quarantine_recovery.py:1349">
P2: This test does not exercise the behavior named by the test: it only verifies that the helper rejects a partial ledger. Call `durable_status` with an intake containing the projected sibling and a simulated deletion privacy failure, then assert it does not return an ACK; otherwise a regression in the actual status path can pass unnoticed.</violation>
</file>
<file name="backend/tests/integration/test_batch_pipeline_held_custody_firestore.py">
<violation number="1" location="backend/tests/integration/test_batch_pipeline_held_custody_firestore.py:49">
P2: This test does not verify the unresolved unit’s custody state. Assert that `results/{held}` remains absent or `projection_state == 'quarantine_held'` (and is not completed) so the test fails if partial completion releases the held audio.</violation>
</file>
<file name="backend/testing/sync_cloud_tasks_stack/README.md">
<violation number="1" location="backend/testing/sync_cloud_tasks_stack/README.md:117">
P2: This new scenario contradicts the canonical serving contract, which still documents `completed`/`poll_after_ms: 0` and WAL acknowledgement for held uploads. Update `backend/docs/batch-pipeline-serving.md` in the same change so operators and client owners do not follow the obsolete custody behavior.</violation>
</file>
<file name="app/changelog/unreleased/20261102-held-custody-contract-tests.json">
<violation number="1" location="app/changelog/unreleased/20261102-held-custody-contract-tests.json:2">
P2: `kind: none` suppresses the release note for a production custody fix that changes phone behavior. Replace it with a concise, user-facing `change` entry.</violation>
</file>
<file name="backend/utils/batch_pipeline/intake.py">
<violation number="1" location="backend/utils/batch_pipeline/intake.py:160">
P2: Explicit deletion no longer terminates a partial upload: `durable_status` rejects its privacy exception here and returns 409, so the phone keeps the WAL despite the contract's explicit-deletion release path. Add a deletion-specific cleanup/terminal path that proves all affected IDs are user-deleted before releasing custody, without treating unresolved audio as a successful completion.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| @pytest.mark.parametrize('backoff', ['true', 'false']) | ||
| def test_held_custody_poll_is_paced_even_with_open_surface_or_generic_backoff_off(monkeypatch, surface_open, backoff): | ||
| monkeypatch.setenv('SYNC_POLL_BACKOFF_ENABLED', backoff) | ||
| status = {'status': 'processing', 'reason_code': 'batch_unit_held', 'poll_after_ms': 300000} |
There was a problem hiding this comment.
P2: This fixture pre-populates poll_after_ms with the expected value, so the backoff='false' cases pass even if with_poll_hint fails to add the five-minute custody hint. Remove the field from the fixture so every parameterization requires the helper to produce 300000.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_sync_poll_limit.py, line 148:
<comment>This fixture pre-populates `poll_after_ms` with the expected value, so the `backoff='false'` cases pass even if `with_poll_hint` fails to add the five-minute custody hint. Remove the field from the fixture so every parameterization requires the helper to produce `300000`.</comment>
<file context>
@@ -139,3 +139,11 @@ def test_server_backoff_http_wire_and_open_surface(poll_client, monkeypatch):
[email protected]('backoff', ['true', 'false'])
+def test_held_custody_poll_is_paced_even_with_open_surface_or_generic_backoff_off(monkeypatch, surface_open, backoff):
+ monkeypatch.setenv('SYNC_POLL_BACKOFF_ENABLED', backoff)
+ status = {'status': 'processing', 'reason_code': 'batch_unit_held', 'poll_after_ms': 300000}
+ assert poll_limit.with_poll_hint(status, surface_open=surface_open)['poll_after_ms'] == 300000
</file context>
| status = {'status': 'processing', 'reason_code': 'batch_unit_held', 'poll_after_ms': 300000} | |
| status = {'status': 'processing', 'reason_code': 'batch_unit_held'} |
| row(client)['recovery_state'] = 'failed_held' | ||
| ProjectionStore(store).complete_partial(binding, 101, PARTIAL_ACCOUNTING) | ||
| assert ( | ||
| _deleted_conversation_status( |
There was a problem hiding this comment.
P2: This test does not exercise the behavior named by the test: it only verifies that the helper rejects a partial ledger. Call durable_status with an intake containing the projected sibling and a simulated deletion privacy failure, then assert it does not return an ACK; otherwise a regression in the actual status path can pass unnoticed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_batch_pipeline_quarantine_recovery.py, line 1349:
<comment>This test does not exercise the behavior named by the test: it only verifies that the helper rejects a partial ledger. Call `durable_status` with an intake containing the projected sibling and a simulated deletion privacy failure, then assert it does not return an ACK; otherwise a regression in the actual status path can pass unnoticed.</comment>
<file context>
@@ -1330,9 +1332,25 @@ def test_partial_status_answers_completed_with_held_span(setup):
+ row(client)['recovery_state'] = 'failed_held'
+ ProjectionStore(store).complete_partial(binding, 101, PARTIAL_ACCOUNTING)
+ assert (
+ _deleted_conversation_status(
+ ledger_row(client, binding), {'lane': 'backfill', 'total_files': 1}, binding.job_id
+ )
</file context>
| assert len(rows) == 1 and rows[0]['status'] == 'completed' | ||
| assert rows[0]['transcript_segments'] and rows[0]['sync_content_revision'] == 1 | ||
| assert batch.ledger.get().to_dict()['status'] == 'partial' | ||
| assert job.get().to_dict()['recovery_state'] == 'failed_held' |
There was a problem hiding this comment.
P2: This test does not verify the unresolved unit’s custody state. Assert that results/{held} remains absent or projection_state == 'quarantine_held' (and is not completed) so the test fails if partial completion releases the held audio.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/integration/test_batch_pipeline_held_custody_firestore.py, line 49:
<comment>This test does not verify the unresolved unit’s custody state. Assert that `results/{held}` remains absent or `projection_state == 'quarantine_held'` (and is not completed) so the test fails if partial completion releases the held audio.</comment>
<file context>
@@ -0,0 +1,51 @@
+ assert len(rows) == 1 and rows[0]['status'] == 'completed'
+ assert rows[0]['transcript_segments'] and rows[0]['sync_content_revision'] == 1
+ assert batch.ledger.get().to_dict()['status'] == 'partial'
+ assert job.get().to_dict()['recovery_state'] == 'failed_held'
+ assert not lane.published
+ assert lane.loads == [good]
</file context>
| running, with zero projected completion and no result/error even after a killed | ||
| paid call whose outcome is unknown, then `completed`); a failing paid recovery settles `failed_held` and | ||
| polls `failed` with `poll_after_ms: 0` without re-paying; worker SIGTERM drain; | ||
| polls `processing/batch_unit_held` with `poll_after_ms: 300000` without re-paying |
There was a problem hiding this comment.
P2: This new scenario contradicts the canonical serving contract, which still documents completed/poll_after_ms: 0 and WAL acknowledgement for held uploads. Update backend/docs/batch-pipeline-serving.md in the same change so operators and client owners do not follow the obsolete custody behavior.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/testing/sync_cloud_tasks_stack/README.md, line 117:
<comment>This new scenario contradicts the canonical serving contract, which still documents `completed`/`poll_after_ms: 0` and WAL acknowledgement for held uploads. Update `backend/docs/batch-pipeline-serving.md` in the same change so operators and client owners do not follow the obsolete custody behavior.</comment>
<file context>
@@ -114,7 +114,8 @@ one paid recovery despite duplicate/late deliveries (the status route reports
running, with zero projected completion and no result/error even after a killed
paid call whose outcome is unknown, then `completed`); a failing paid recovery settles `failed_held` and
-polls `failed` with `poll_after_ms: 0` without re-paying; worker SIGTERM drain;
+polls `processing/batch_unit_held` with `poll_after_ms: 300000` without re-paying
+or acknowledging phone custody; worker SIGTERM drain;
worker SIGTERM + SIGKILL after grace → lease expiry → replacement completes;
</file context>
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "kind": "none" | |||
There was a problem hiding this comment.
P2: kind: none suppresses the release note for a production custody fix that changes phone behavior. Replace it with a concise, user-facing change entry.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/changelog/unreleased/20261102-held-custody-contract-tests.json, line 2:
<comment>`kind: none` suppresses the release note for a production custody fix that changes phone behavior. Replace it with a concise, user-facing `change` entry.</comment>
<file context>
@@ -0,0 +1,3 @@
+{
+ "kind": "none"
+}
</file context>
| if not isinstance(result, dict) or not ( | ||
| (ledger.get('status') == 'completed' and is_valid_completed_sync_content_result(result)) | ||
| or (ledger.get('status') == BATCH_PARTIAL_STATUS and is_valid_partial_sync_content_result(result)) | ||
| ledger.get('status') == 'completed' and is_valid_completed_sync_content_result(result) |
There was a problem hiding this comment.
P2: Explicit deletion no longer terminates a partial upload: durable_status rejects its privacy exception here and returns 409, so the phone keeps the WAL despite the contract's explicit-deletion release path. Add a deletion-specific cleanup/terminal path that proves all affected IDs are user-deleted before releasing custody, without treating unresolved audio as a successful completion.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/batch_pipeline/intake.py, line 160:
<comment>Explicit deletion no longer terminates a partial upload: `durable_status` rejects its privacy exception here and returns 409, so the phone keeps the WAL despite the contract's explicit-deletion release path. Add a deletion-specific cleanup/terminal path that proves all affected IDs are user-deleted before releasing custody, without treating unresolved audio as a successful completion.</comment>
<file context>
@@ -149,14 +149,15 @@ def _held_status(jobs: list[dict]) -> tuple[str, str | None] | None:
if not isinstance(result, dict) or not (
- (ledger.get('status') == 'completed' and is_valid_completed_sync_content_result(result))
- or (ledger.get('status') == BATCH_PARTIAL_STATUS and is_valid_partial_sync_content_result(result))
+ ledger.get('status') == 'completed' and is_valid_completed_sync_content_result(result)
):
return None
</file context>
|
Luna round 1 reviewed exact head The one minor finding is stale wording in The full gauntlet's contention retry-ceiling failure was independently reproduced on clean unmodified |
## Why #24335 found three `durable_status` branches that told phones `completed` while batch units were still held. Released phones read `completed` as permission to mark the WAL synced and later age-delete their only independent copy. Each branch was found by reading code, about 12 days after it shipped (lane `artifactmissing`; risk review E4). A golden per branch would not catch a fourth. ## What Tests only. No runtime change. - **Backend property test** (`backend/tests/unit/test_batch_pipeline_custody_property.py`). It enumerates every per-unit job state: - in flight (`ready`/`leased`/`retry`/`result_ready`); - committed, committed-but-held (#23932) and committed-recovered; - each quarantine recovery state; - an open operator intent (`speech_redrive`, `terminal_disposition`, `silence_disposition`). It covers one-unit uploads and unordered two-unit pairs (`durable_status` has no order dependence), beside every ledger shape (as admitted, partial, `completed` with `held_audio`, valid `completed`) and both settings of `BATCH_PIPELINE_HELD_TERMINAL_STATUS_ENABLED`. It asserts the answer is `completed` only when every unit is committed with no recovery or operator work owed. - **Shared fixture** (`backend/tests/fixtures/custody_status_shapes.json`). It pins every `(status, reason_code, poll_after_ms)` the sweep produces, split into resolved and unresolved. A new backend answer fails the backend test until it is added there. - **Phone test** (`app/test/unit/custody_status_shapes_test.dart`). It replays each unresolved answer through `syncJobTerminalPolicy` and real `LocalWalSyncImpl` reconciliation, and checks that a 14-day-old WAL is never acknowledged, never marked synced and never age-evicted. Only the resolved `completed` answer may acknowledge. - A one-paragraph pointer in `CONTRACT.md` and a `kind:none` mobile changelog fragment. **Assumption, stated in the test:** a valid `completed` ledger is the projection's own all-units receipt, and is authoritative over job rows (`test_status_is_durable_and_completed_result_is_authoritative`). It is paired only with all-terminal units. If projection ever wrote `completed` early, this test would not see it; that needs its own projection-side property. ## Fail-first evidence - The backend property test was run against the pre-#24335 `backend/utils/batch_pipeline/intake.py` (`f520a2c92e687`, swapped in locally, then restored). It **fails**: 175 unresolved uploads answered `completed` with the switch on, and 165 with it off. That covers the partial-ledger branch and `_held_status`. - The phone test with the pre-#24335 answer (`completed`/`batch_unit_held`/0) added to the unresolved fixture **fails** on both the policy check and real reconciliation (1 acknowledgement where 0 is expected). ## Verification (layer: local unit tests, this head) - `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_batch_pipeline_custody_property.py`, via `bin/omi-heavy`, nice 19: **3 passed**. CPU time is about 0.4 s per sweep, under the 1.0 s guard; the sweep is cached between tests. - `flutter test test/unit/custody_status_shapes_test.dart test/unit/held_partial_custody_test.dart test/unit/sync_job_terminal_policy_test.dart`: **18 passed**. Deploy: none (tests only). Product invariants: INV-DATA-1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
BasedHardware#24335 found three durable_status branches that answered `completed` while units were still held, each caught by reading code, about 12 days after it shipped. One golden per branch would not catch the fourth. The new backend property test enumerates every per-unit job state (in flight, committed, committed-but-held, each quarantine recovery state, open operator intents) for one- and two-unit uploads, beside every ledger shape and both held-terminal kill-switch settings, and asserts `completed` only when every unit is terminal. Against the pre-BasedHardware#24335 intake.py it fails with 282 (switch on) and 266 (switch off) unresolved uploads answering `completed`. Every answer it can produce is pinned in a shared fixture. The phone test replays each unresolved answer through syncJobTerminalPolicy and real WAL reconciliation, and checks that 14-day-old bytes survive. A new backend answer therefore cannot reach phones without that check; adding the old `completed/batch_unit_held` answer makes the phone test fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…00 retry loop (#24362) ## Why `POST /v2/batch-pipeline/recover-quarantine` has been returning about 200 500s an hour on backend-integration since 04:20Z 11-02 (integ500 report). The cause is a fixed set of quarantined units whose retained-audio manifest fails `source_audio.materialize` validation (`invalid retained audio slice`, `retained audio slice exceeds capture`). The check reads the same stored bytes every time, so it can never pass. The bare `ValueError` escapes as a 500, Cloud Tasks retries it five times, the sweep re-wakes the unit on its lease, and the loop repeats forever. No vendor call is made (the failure is before any provider step), and no audio is deleted, but it is chronic 5xx noise that a roll guard can trip on, and those units never settle. Measured on prod (ro-prod tier, counts only): - 07:15:54Z: 14 recovery intents are `prepared`, never started, with 10 or more wakes each (12 with 50+). That matches integ500's estimate of a small fixed set. **Inference:** a deep wake count is a proxy; it does not prove each one has a bad manifest. - None of those intents was prepared after the 03Z hour, and the error rate has been flat at ~200/h from 05Z to 07Z. So it is a fixed set being retried, not new bad manifests being written. ## What - `source_audio.materialize` raises `InvalidRetainedManifest` for the structural checks. It is a `ValueError` subclass, so every other caller is unchanged. The checks: - a non-JSON body, or a wrong shape: references null or not a list, a non-object reference, a missing digest or slice field, a non-string path, or context that is not an object. The shape is checked before any source read (Luna r1 P2). - a binding mismatch, or no references; - an empty or overlapping slice, or a slice beyond its source or the capture. - `source_audio.validate_reference` (the real reader's first step, before any storage read) raises it when a reference has no path, a non-string path, a path outside its owner/conversation scope, or a missing or non-positive generation (Luna r2 P2). - A reference outside the admitted buckets keeps its plain `ValueError` and retry path on purpose. The allowed set comes from deploy configuration, and a misconfigured bucket must not mass-hold units. - The projection walk's disposition is unchanged: `payload_contract_violation` matches by `isinstance(ValueError)`, and the exact-type checks only identify Firestore contention. `error_type` log tokens and the batch-replay exception key now name `InvalidRetainedManifest` instead of `ValueError`; the replay test and the exception taxonomy are updated to match. - `QuarantineRecovery._recover_steps` catches it around `fetch_audio`, before any paid start. The new `RecoveryStore.hold_invalid_manifest` moves the prepared intent to `failed_held` with `recovery.refusal = {'reason': 'invalid_retained_manifest'}`. It is fenced like `hold_duration_limit`: same token, never started, same audio URI, no result, no lease. - The delivery answers 2xx (`{"status": "failed_held"}`). `failed_held` is outside `recovery_candidates`, so neither a Cloud Tasks retry nor the sweep wakes it again. - The manifest and its sources stay in place, and phones keep custody under #24335. A changed source digest, or any other download error, keeps its existing retry path. ## Fail-first evidence Run before the source change, the new test file failed at collection: `origin/main` `3c329ff7661a` has no typed manifest error. The pre-fix 500 on this route comes from the integ500 prod tracebacks (`ValueError` at `source_audio.py:116`/`118`). I did not replay the ASGI case against unmodified main. ## Verification (layer: local unit tests, this head) `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST`, via `bin/omi-heavy`, `nice -n 19`, ambient GCP credentials unset, `OMI_ENV_STAGE=offline`: - `test_batch_pipeline_invalid_manifest_hold.py`: **28 passed**. It covers: - five invalid slice or binding manifests; - nine malformed shapes, with no source read; - eight out-of-scope references through the real `read_reference`; - an unconfigured bucket, which keeps the retryable error; a valid manifest, a digest change kept off the new path, ASGI 2xx with the refusal recorded and no STT, delete or persist call, no re-prepare after the hold, a generic `ValueError` still giving 500 with the intent left prepared, and the token, URI and started fences. - Neighbouring suites, **all passed**: - `test_batch_pipeline_quarantine_recovery.py` (137) - `test_batch_pipeline_prepared_independent.py` (33) - `test_batch_language_recovery.py` (125) - `test_record_partial.py` (63) - `test_batch_pipeline_boundary_geometry.py` (55) - `test_record_seal_rules.py` (21) - `test_batch_pipeline_leaf_timings.py` (8) - `test_batch_replay.py` (18) - `test_batch_pipeline_live.py` (43) - `test_retention_contract.py` (22) - `test_batch_projection_exception_taxonomy.py` (3) - `test_empty_capture_recovery.py`: 61 passed and 7 failed, all on `Could not find Opus library`. That is native libopus missing on this host: the same 7 fail identically in an unmodified checkout. CI is the authority for that file. ## Rollout Deploy: backend-integration (it serves the recover-quarantine target). After it serves, each of the ~14 looping units settles on its next delivery, and recover-quarantine 500s should drop to near zero within one wake lease. Rollback: revert this PR. Units already held stay `failed_held` and keep their audio; a later reviewed operator plan can reopen them. Dollars: under $1/day (GCS class-B reads and CPU only). This is a correctness and alerting fix, not a margin cut. Failure-Class: FC-batch-fault-domain-head-of-line-poison Product invariants: INV-DATA-1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Partial batch uploads currently report
completedwhile units remain held. Phones treat that status as permission to release their independent audio copy. Keep these uploads nonterminal (processing/batch_unit_held) until every unit resolves, while their already projected conversations remain visible.Five-minute polling applies even with the Sync surface open or generic backoff disabled. Existing clients retain uploaded WALs without re-uploading or consuming retry budget. This retains phone storage until recovery; there is no new audio eviction or server mutation.
Validation: failing status and poll regressions captured before implementation; final selected backend shard (192 tests), Flutter custody/policy tests (15), real Firestore transcript visibility test (1), and Firestore/simulator store conformance (79 passed, 44 skipped) pass. Shared response golden exercises real phone reconciliation with a 14-day-old WAL and 31-minute wait; actual poller enforces the five-minute hint. Postgres and non-applicable simulator concurrency cases skipped, so Postgres is not claimed.
Full Sync Cloud Tasks stack (
--only all) ran twice with fresh state. Every process-level batch scenario, including two workers and failed recovery custody, passed both times. The embedded Firestore shard-spread test failed both times at its contention-retry ceiling: scheduler shard40 logged two retries versus a ceiling of one (test_batch_pipeline_shard_spread_firestore.py:90); four other embedded checks passed. This is a retry-count assertion, not duplicate leases. A fresh, unmodifiedorigin/mainworktree at0c096df862cebcb9444107d3fddaba17b35cc15creproduces the same failure (one failed/four passed). No scheduler code or assertion was changed and no gate was bypassed. The lead is routing the pre-existing gate failure separately.Deployment: lead rolls backend, backend-sync and backend-integration together. No operator apply or data repair in this PR. Source rollback restores unsafe partial acknowledgement; preserve this custody contract in later fixes. Polling ceiling is 288 calls/job/day at continuous activity versus 4,320 at 20 seconds; actual phone byte growth remains unmeasured.
Product invariants: INV-DATA-1, INV-CAP-1, INV-MEM-1, INV-MEM-4.
Failure-Class: FC-audio-cleanup-before-durable-custody
UI-Evidence: none -- status/custody protocol change; persisted transcript visibility is verified through real Firestore projection and phone custody through hermetic consumer tests.