Repository navigation
fix(deploy): omit the stale-head canary uid from the Cloud Run manifest - #25696
Conversation
#25679 bound BATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLIST as a literal in the prod backend-integration overlay. test_rollout_cohort_deploy's contract is that the Cloud Run manifest omits private uid bindings so deploys keep the live value (gcloud preserves undeclared env), so main's backend unit suite went red. Remove the literal and its known-gaps exception; the uid is bound on the service at deploy time. Unchanged: the test, #25673's skip code, #25679's regression case, and the GPU worker Helm value. Helm is declarative, so omitting it there would drop the canary on the next upgrade instead of preserving it; that literal keeps its reviewed no-uid-literals exception. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…nd-integration Panel review-20261118t134925-d977: add the key to the drift report's live-managed allowlist like the sibling canary uid allowlists (F4), and give the surviving Helm exception its own removal condition now that the Cloud Run key it pointed at is gone (F2). Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
TRIAGE review-20261118t134925-d977: F1 accept (live value measured and recorded in the PR body; deploys keep it), F2 accept, F4 accept (both in 1592e2b). F3 deferred: |
|
TRIAGE review-20261118t143541-9594 (exact head 1592e2b): SHIP. F1 deferred (same renderer gap as the earlier F3). F2 deferred follow-up: extend the backend-integration fixture in test_check_cloud_run_env_drift.py with a live-only BATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLIST and assert it lands in allowlisted_live_only. |
…ount deletion (#25703) ## Summary Follow-up to #25686. It merged at 2c5a581 while omi-panel `review-20261118t145557-1937` was still running on that head, and that review came back FIX-FIRST. This PR fixes its findings in the backfill drain, undo, re-derive and the operator script. Undo has to be verifiable before the first owner run, so these fixes gate the run. - **Account deletion stops the backfill drain** (F1, blocking). `drain_backfill` checks the account-deletion marker before each notes chunk. Once deletion starts, no transcript goes to the notes model, and the step marks the run blocked with reason `account_deletion`. - **Undo works one connected group per transaction** (F3, F4, F10). A group is the donors plus the copies that claim them. In one transaction, undo reads the group's donors, copies and the copies' deletion tombstones. It then either restores the donors exactly and deletes the copies, or keeps the whole group as backfilled v3. It keeps the group when the owner deleted a copy, shown by a tombstone or by a donor deleted span added after the run. - A delete racing undo can no longer resurface a legacy row. The tombstone is written before the claim release and is read inside the transaction. - Nothing is hidden or shown twice partway through. - A donor with no claim and no new span is restored. Its copy never committed (an interrupted run) or a re-derive retired it. The previous version wrongly kept it hidden. - A kept copy's owed backfill notes move to the live notes marker. The owner's next live builder pass writes them, so an owner with no further capture or app open keeps them pending until then. - **Re-derive** (F5, F6). A donor this run already converted that no rebuilt window claims now blocks the partition (`backfill_donor_unclaimed`) instead of staying hidden with no copy. A re-derived prior copy no longer inherits a stale notes marker. - **Operator** (F7, F8). One owner's blocked plan prints `owner[N] blocked: <reason>`, the script continues with the other owners, and it exits 1. Blocked reasons include an overfull partition, account deletion, an unreadable source and an existing run. - **Partitions** (F11). A gap-free run over the cap is now cut at the latest of equal gaps, so partitions fill up. Before, every row became its own partition with its own outline call. - **Telemetry scope** (F9). Only backfilled v3 copies skip capture-loss and owner-recognition telemetry. Silent-backfill recovery keeps both, as on main before #25686. - **Flag notes** (F12). The `CONVERSATIONS_V3_BACKFILL` registry notes now state the prod backend-sync value and the operator-only gating. Later review rounds on this PR (`review-20261118t171612-b1c4` through `review-20261118t223845-273f`) added these fixes: - **Account-deletion checks.** The drain checks the deletion marker before each batch and row. At model admission, a single-attempt Firestore transaction reads the same customer-data marker that deletion intent writes. This covers both task-only and full notes for backfilled v3 copies. If deletion wins after the row check, the drain releases the lease, preserves the owed notes marker, and blocks the run without incrementing its backfill retry count. The derive loader and the drain read the marker fresh, past the 30-second negative cache, and the fresh read keeps the check metrics. - **Undo, per group:** - The group transaction refuses while any copy holds a notes lease (`notes_in_flight`). - It records undo progress in the run ledger in the same transaction (totals and removed copy ids), so a crash or retry loses nothing. - **Undo, owner deletions:** - Deleting a backfilled copy records its id on the legacy row even when other claims cover the interval, so undo always sees it. - A deleted copy never goes to the notes model. - Copies deleted in the instant undo removed them are listed as `deleted_during_undo_ids`. - **Undo, read bound.** A copy a donor names only by a post-run deleted span or a recorded deleted copy still links the group but is not read, because that donor already keeps the group. Old deletions therefore never push a group over the read bound. Undoing a run that is already `undone` or `undone_partial` reports its record and changes nothing. - **Undo, status.** A run with kept groups or a raced delete ends `undone_partial` (exit 1). The group size bound counts reads, not documents. An undo that fails partway still checks the copies it already removed for a racing delete and records them in the error. `donors_kept_deleted` counts only converted donors that stayed hidden. - **Re-derive and operator.** - Re-derived copies start a fresh notes retry budget. - Only a re-derive blocks on an unclaimed converted donor; a resume carries on. - The operator script reports only Conflicts and an existing run (the typed `BackfillRunExists`) as a blocked owner, and an owner skipped for an active run sets exit 1. - Undo renews its leases inside the per-group error handling, so a lease lost on renew writes the same error record as a failed group. From the 18:30Z smell audit: - **Undo never deletes live capture.** A live builder pass after the run carries the run tag onto a window that also holds recordings captured after the run. Undo now keeps any group whose copy holds a recording outside the group (`kept_live`). It counts `groups_kept_live`/`donors_kept_live` and ends `undone_partial`. - **Known limit, not changed:** donors are selected by `started_at < until`, and `--until` defaults to now. Only completed, non-recording legacy rows qualify (`backfill_legacy_source`), so an in-progress capture is never converted. A legacy conversation that completed just before the run is in scope. Pass an explicit `--until` to leave recent history alone. Rejected on purpose, and tracked as follow-ups (the coordinator agreed with the notes-lock reject, bus a16967): - A shared admission guard for ordinary live v3 and legacy notes remains a follow-up. This change scopes the guard to backfilled v3 copies, including copies whose owed notes move to the live queue after undo. - A lock between the shared delete path (`conversation_tombstones.record_deletion`) and undo. Undo surfaces the race instead, through the raced ids and `undone_partial`. Not changed here: F2 (removal of the `BATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLIST` prod binding). It came from #25696 (jobstore-index's #25679 repair), which was merged into #25686. Its owner and declaration live with that change. ## Product invariants affected - INV-MEM-4 and INV-TASK-2 are unchanged. Backfilled v3 rows still take no memory intake, tasks or Candidates. Kept copies that move to the live notes marker go through the same `historical` seam in `process_conversation`. Failure-Class: FC-irreversible-terminal-hide Line-Count-Exception: backend/database/conversations_v3.py | 1799 -> 1862 | Keep the connected undo transaction with the projection writer and its visibility index. Line-Count-Exception: backend/routers/conversations.py | 3276 -> 3314 | Pass observed row existence through the existing delete paths so undo races return the refresh response. Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3608 -> 3612 | Preserve typed admission failures and scope suppressed telemetry to backfilled copies. Line-Count-Exception: backend/utils/conversations/v3/service.py | 1652 -> 1678 | Check deletion during the paged drain and preserve the processing state when admission is blocked. ## Test plan November 26 verification after merging current main - 97 ordinary backfill tests and 6 prompt-version tests passed. - 1,309 related backend tests passed. - 4 Firestore emulator cases passed, each covering both admission orders. Cases combine immediate and grace-period deletion with absent and cancelled markers. - Backfilled notes use an 8-second SDK request timeout and a 12-second overall admission budget. Slow notes exhaust one backfill retry and cannot settle as success. `tests/unit/test_conversations_v3_backfill.py` passed all 81 tests on the rebased PR head, including the regression that starts deletion after the drain checks and before model admission. Existing coverage includes: - Undo on StrictFirestore: - `test_undo_never_resurrects_a_donor_whose_copy_the_owner_deleted` - `test_a_deletion_racing_undo_keeps_the_group_and_hands_owed_notes_to_live` - `test_an_interrupted_conversion_with_no_claim_is_restored` - the exact-restore and lease tests, now on `undo_backfill_group`. - Undo grouping and ordering: - `test_undo_groups_link_donors_and_copies_including_deleted_copies` - `test_only_a_post_run_deleted_span_counts_as_the_owners_deletion` - `test_undo_holds_both_builder_leases_before_it_enumerates_the_run` - `test_undo_works_one_group_per_call_and_refuses_while_notes_are_in_flight` - Drain: - `test_the_drain_stops_once_account_deletion_starts` - `test_a_step_blocks_the_run_when_the_drain_stops_for_account_deletion` - Re-derive: - `test_a_converted_donor_no_rebuilt_window_claims_blocks_the_partition` - the stale notes marker asserted in the loader re-derive test. - Operator: `test_one_owners_blocked_plan_never_stops_the_others`. - Partitions: partition sizes asserted in `test_a_gap_free_run_over_the_cap_is_a_counted_forced_cut`. Updated pins: `test_owner_recognition_telemetry` and the `test_capture_loss_accounting` harness. The local Firestore emulator verified both admission orders with absent and cancelled markers, for immediate and grace-period deletion. Production was outside this verification. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
What
Restores main's backend unit suite, which has been red since #25679 merged at 10:31Z.
tests/unit/test_rollout_cohort_deploy.py::test_cloud_run_manifest_preserves_live_env_by_omitting_private_bindingsfails on main because #25679 put a uid literal forBATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLISTinto the prodbackend-integrationoverlay. That test is the contract: the Cloud Run manifest omits private uid bindings so deploys keep the live value (gcloud preserves undeclared env vars across deploys).Change
backend/deploy/runtime_env/prod.overlay.yaml: remove the uid literal and leave a comment saying the binding is set on the service at deploy time.backend/deploy/runtime_env.yaml: regenerated withdeploy/compose_runtime_env.py(--checkclean).backend/docs/feature-flag-registry.md: re-rendered (the doc no longer prints the uid).backend/deploy/cross_service_known_gaps.json: remove the now-mootno-uid-literals|prod|cloud_run/backend-integration/...exception.Not changed, on purpose
mergeStaleHeadUidAllowlistand its reviewedno-uid-literals|prod|helm/...exception stay. Helm is declarative, so removing the value would strip the canary from the worker on the next upgrade instead of preserving it. The failing test checks only the Cloud Run manifest, andtest_helm_retains_legacy_fallbacksshows uid allowlists are expected in Helm values.Live value (measured, review F1)
Read-only (
ro-prodagent tier), 2026-11-18 ~14:10Z, key presence only (value not printed):backend-integrationserves 100% onbackend-integration-c6e0bb6-44312783364-1(OMI_BACKEND_RELEASE_SHA=c6e0bb6), and that revision already carriesBATCH_PIPELINE_MERGE_STALE_HEAD_UID_ALLOWLISTwith one uid (from #25679's deploy). Deploys keep it: the action uses--update-env-vars, and the key is in neither its literal--remove-env-varslist nor anyforbidden_env(_remove_env_extra). After this merges, the deploy owner checks presence the same way:gcloud run services describe backend-integration --format=jsonand confirm the key on the revision serving traffic.Also: the key is now in
check_cloud_run_env_drift.LIVE_MANAGED_ENV_ALLOWLISTforbackend-integration(review F4), and the surviving Helm exception names its own removal condition (F2).Deploy note
The canary uid on
backend-integrationmust now be set on the service at deploy time (same class as the other private uid bindings). That is a separate deploy-owner action and is not part of this PR. The canary is inert until a serving image contains #25673's reader.Product invariants affected
backend/deploy/runtime_env.yamlis under its glob. No effect: the change removes one batch-pipeline merge canary uid binding from the backend-integration Cloud Run manifest; it does not change any memory intake, Short-term TTL, consolidation route, or promotion setting.Verification
test_rollout_cohort_deploy.py+test_batch_pipeline_merge_stale_head.py: 44 passed.Failure-Class: none
🤖 Generated with Claude Code