Repository navigation
fix(record-seal): drain the unsealed backlog with five repair shards, new recordings first - #25346
Conversation
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Certify deferred retry clocks with record_intake_retry_at, clear the marker on claims and repair wakes, and decide from the live transaction snapshot. Preserve unmarked future clocks during rolling upgrades. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Restore the full urgent/ordinary discovery and checkpoint budgets. Fresh attempts borrow at most half the worker slots after the checkpointed group starts; idle capacity returns to backlog with bounded loans. Certify intake retry wakes only while fresh repair and dead-letter handling are enabled, preserving disabled-flag rows and rollback claim behavior. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Retain merged serving bindings and generated registry updates before the isolated stock-drain change. Failure-Class: FC-batch-fault-domain-head-of-line-poison
…riority Run five disjoint Indexed repair partitions on CPU-only nodes with independent encrypted frontiers, duplicate-index leases and refillable newest-first pages. Preserve urgent/ordinary bootstrap shares and the work-conserving fresh lane. Classify native units before enqueue using canonical finish age, without changing the GPU runtime. Bind the intake kill switch on all owning hosts and provide a CAS-protected CronJob-only patch renderer that preserves live policy and producer gates. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Place each explicit command directly beside its arguments inside the shard branch. This preserves rendered pod behavior and lets the logging entrypoint guard resolve both the single-pod and indexed launches. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Main added the owner-drain diagnostic entry without updating its inventory count. Preserve the budget and tests; reconcile only the declared number of names. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Two independent reviews of Confirmed by the reviewers: the shard key is stable across retries and identical in every pod; frontiers are separated by lane, shard count and index; no producer-token, privacy or retained-tail check was loosened; bindings recompose clean and the intake switch defaults on with its env var absent; the five-node placement arithmetic fits; 508 and 42 tests passed in their runs. Being fixed on this branch:
A delta review follows the fixes. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e41c5f4b02
ℹ️ 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".
| # Render the CronJob only, then use the target-only CAS patch procedure in: | ||
| # backend/docs/listen_pusher_pipeline/changes/2026-11-15-sharded-seal-stock-drain.md |
There was a problem hiding this comment.
Provide a working target-only procedure for policy refreshes
When the serving ramp or final-pass policy changes, the linked procedure cannot refresh the policy map as this section requires. render_stock_drain_patch.py's repair_patch() preserves the live environment and copies only the worker count and an absent fresh switch (lines 53–62), discarding any newly rendered RECORD_SEAL_REPAIR_SERVER_FLAGS. New repair Jobs therefore retain the old map indefinitely, and no-job registrations continue freezing obsolete policy inputs rather than ending the drift described below. Keep the stock-drain patch policy-preserving, but provide a separate target-only CAS procedure for updating the collected policy map.
Useful? React with 👍 / 👎.
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Verified ro-prod Kubernetes v1.35.8-gke.1796000 exposes backoffLimitPerIndex and maxFailedIndexes. Keep single-shard backoff unchanged. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Cap coordination after startup and maintenance; reserve checkpoint/cleanup time. CronJob scheduled minute in the pod name includes cold-node waits. Run projection rebuild after acquiring the coordinator lease. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Existing seal-write assertions now include the durable once-only admission stamp and the separate post-commit ledger transaction; no proof assertion is relaxed. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Snapshot the original spec and image; verify server dry-run/readback against the exact approved spec; rollback only from that verified after state with a fresh resourceVersion. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Fail closed on every owned baseline field before packet preparation, including command, image, resources, deadline, failure policy, mounts, workers and fresh gate. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Read the committed closed source before the fail-open hook so a proven repair can supersede an earlier terminal failure; do not count an existing admission twice. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Replace the old global-abort expectation with the requested per-index isolation; hard deadline and worker identity assertions remain. Failure-Class: FC-batch-fault-domain-head-of-line-poison
…back The stub coordinator now invokes the moved pre-run callback, retaining the exact exception-type/site and private-message assertions. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Keep the real terminal-to-sealed recovery assertion; the strict fixture lacks Firestore update_time, so explicitly supply the newer committed revision. Failure-Class: FC-batch-fault-domain-head-of-line-poison
Preserve deterministic refusal behavior while making the string validation explicit to the canonical typecheck. Failure-Class: FC-batch-fault-domain-head-of-line-poison
…ger state Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0d569e1fe
ℹ️ 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".
| is earlier than Job creation, so it conservatively includes scale-up waits. | ||
| """ | ||
| deadline = started + 1560 # At least 120s before the hard Job ceiling. | ||
| match = re.fullmatch(r'record-seal-repair-(\d{8,})-(?:\d+-)?[a-z0-9]{5}', hostname) |
There was a problem hiding this comment.
Accept the stable hostname assigned to Indexed Job pods
For the Indexed Jobs introduced by the repair chart, Kubernetes sets the pod hostname to <job-name>-<index>, such as record-seal-repair-29912640-2, rather than the randomly suffixed pod name. main() passes socket.gethostname() here, so this regex rejects every repair index's hostname. With KUBERNETES_SERVICE_HOST set, all indexes consequently raise ValueError and exit before acquiring a lease or repairing any recording. Accept the stable Indexed hostname and test that actual hostname form.
Useful? React with 👍 / 👎.
| 'downwardAPI': { | ||
| 'items': [ | ||
| { | ||
| 'path': 'index', | ||
| 'fieldRef': {'fieldPath': "metadata.annotations['batch.kubernetes.io/job-completion-index']"}, |
There was a problem hiding this comment.
Include API defaults in the partition volume receipt
A standard Kubernetes API server adds downwardAPI.defaultMode: 420 and fieldRef.apiVersion: v1 to this new volume. Neither field is included in the packet's expected spec, while check() requires the complete server spec hash to equal afterSpecSha256. Consequently, the mandatory check-object step rejects the server-dry-run result with unapproved server spec delta, preventing the documented target-only deployment from reaching apply. Include these defaults in the constructed and validated partition volume; the current exact comparison also rejects rendered volumes that explicitly supply them.
Useful? React with 👍 / 👎.
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Failure-Class: FC-batch-fault-domain-head-of-line-poison
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6becbf7f0e
ℹ️ 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".
| except Exception: | ||
| # Observability never changes a committed seal's outcome. | ||
| pass |
There was a problem hiding this comment.
Report failures in the new fail-open ledger wrapper
When the committed-source ref.get() times out or raises Unavailable, this handler drops the observation before pipeline_ledger.advance() is called. That bypasses the ledger's existing error counter and warning while the repair is still reported as sealed, leaving the lost observation without a failure event. backend/AGENTS.md requires new fail-open paths to call utils.observability.fallback.record_fallback; emit a bounded fallback here while preserving the successful seal.
AGENTS.md reference: backend/AGENTS.md:L322-L322
Useful? React with 👍 / 👎.
| if result in {'sealed', 'upload_failed_cleared'}: | ||
| observe_record_sealed(store.client, uid, cid, ref, refresh_revision=True, **sealed_observation) |
There was a problem hiding this comment.
Preserve sealed-stage deadlines when re-sealing admitted captures
If a previously sealed capture reconnects before intake completes, it can be reopened and then repaired with admitted=False. This unconditional hook still advances SEALED with the new committed source revision; pipeline_ledger.plan_advance() accepts that higher-revision same-stage write and resets entered_at and the one-hour deadline_at. Unlike seal_record_audio()'s existing once-per-capture gate, this postpones the deadline used by pipeline_ledger_census and can hide overdue captures from the sealed-stage stuck count. Preserve the existing SEALED clock for already-admitted captures while still allowing failed-stage recovery.
Useful? React with 👍 / 👎.
Failure-Class: FC-batch-fault-domain-head-of-line-poison
|
Delta review of Its remaining items and two further automated findings are fixed in |
…ore import pipeline_ledger gained a module-level google.api_core.exceptions import for the fallback reason. Read-path contract tests load this module under minimal SDK stubs that do not define DeadlineExceeded, so the import failed at collection in CI (test_conversation_archive_filter_contract.py). Classify by class name; the reason labels are unchanged. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b11565756
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if observed is False and observation_counts is not None: | ||
| observation_counts['ledger_misses'] = observation_counts.get('ledger_misses', 0) + 1 |
There was a problem hiding this comment.
Surface internally handled ledger failures in repair summaries
If the committed-source read succeeds but the ledger CAS fails before the three-second alarm, pipeline_ledger.advance() catches the exception and returns False (pipeline_ledger.py:542–550), while observe_record_sealed() discards that return and falls through with None. Unlike the now-fixed source-read exception path, this never reaches observe_seal_failure() or this miss counter. In repair children, silent_dependencies() disables the warning and firestore_probe_export.COLLECTORS exports neither ledger nor fallback counters, so the lost observation has no exported repair failure signal even though the repair is logged as sealed. Expose a distinct error outcome, separate from expected duplicate/disabled results, and route it through the shared record_fallback and ledger_misses reporting path.
AGENTS.md reference: backend/AGENTS.md:L322-L322
Useful? React with 👍 / 👎.
|
Two notes on CI. Shard 7 failed on Automated finding on |
About 31,000 pendant recordings are waiting to be sealed before they can be transcribed, and the single repair pod clears about 2,000 an hour. This PR drains that stock about five times faster and makes sure a recording that just ended is always processed ahead of the old ones.
Summary
recordSealRepair.shards=1.RECORD_INTAKE_AGE_PRIORITY_ENABLED(on unless set off).api-pool, not on the GPU nodes. The GPU transcription worker, its image and its Deployment are not changed.Deployed as a target-only JSON patch of the named CronJob (renderer and commands in
backend/deploy/record-seal-repair/), never a chart apply. Privacy, producer-token, retained-tail and custody checks are unchanged; nothing is deleted or re-driven.Not verified before deploy: five-way throughput, node autoscaling and start-up, billed read cost, and how much of the stock is sealable. Estimates below are labelled as estimates.
Details from the authoring lane
A single repair pod drains roughly2k record_pending rows/hour. Five canonical-hash partitions now refill newest pending records continuously, while intake writes RECENT/DEEP priority for old recordings before enqueue. Fresh recordings retain the existing higher class without a GPU worker image roll. Privacy, producer, tail, custody, funding and live-claim checks remain authoritative.
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Capacity disclosure: source shards1 unchanged; prod completions/parallelism1→5. Workers live8 /old checked-in16 →8 per pod,40 total. Fresh maximum4-of8 per pod (4→20 total), work-conserving90s loans; urgent/ordinary and conversation first-group guarantees remain. The1024-row run cap becomes128-row newest-first refill pages, bounded1024 metadata examined/refill and10000 initial scans. Fresh minimum age60/window7200/poll15/retry120 and row maxima270/90 remain. Default-on RECORD_INTAKE_AGE_PRIORITY_ENABLED is fully bound in dev/prod/generated/listen/classification/cohost contracts. False restores legacy classification for newly admitted units. Canonical finished_at age<=600s FRESH,<=604800s RECENT, older DEEP; invalid clocks RECENT. Existing lower classes are never promoted, admitted units unchanged. Stored fresh_capture merge/guard semantics and main's independent guard timer remain intact.
Run/failure disclosure: schedule live5min/source1min→1min, Forbid unchanged. Hard Job deadline1680 unchanged; process cap1560 and scheduled-minute+1620 cap include startup, imports, projection, discovery, maintenance and cleanup. Coordination is min(1500, remaining-30); nested IO limits cannot extend the outer deadline. Lease1800 unchanged; projection rebuild now runs after acquisition. Global parallel backoffLimit0→5, add backoffLimitPerIndex0/maxFailedIndexes5; single-shard backoff0 unchanged. ro-prod server Kubernetes1.35.8 exposes both fields. One failed index no longer kills siblings. Killed owners can still leave one partition idle up to30min (4/5 capacity); synchronized clocks within120s are an exclusion assumption. No unproven Job-name takeover is introduced.
Ownership/discovery disclosure: canonical record hash modulo5 is identical in every leg; encrypted frontiers separate lane/count/index. Malformed pending identities now get exactly one hash(document-id) owner and a counted malformed_pending discovery refusal without constructing a user path or launching proof work. Earlier single-shard code silently skipped them. This is not a new row state: later finite scans retry unchanged metadata. overlap_refused skips duplicate proof work; retry follows owner release/expiry. Only shard0 performs custody maintenance/projection rebuild. Continuous record-seal-worker remains disabled.
Placement: one4CPU request/4CPU limit,4Gi/8Gi pod on GPU/batch pool →five3CPU request/4CPU limit,4Gi/8Gi pods on CPU-only api-pool with required hostname anti-affinity. Aggregate requests4→15CPU and4→20Gi; aggregate limits4→20CPU. Measured occupied GPU-node headroom1.302CPU/2.543Gi cannot fit4Gi. Existing API pool at0 nodes can autoscale to20 n2-standard-4 nodes; five fit the measured daemon-request arithmetic, but actual startup/scheduling is unverified. Repair image has an independent approved CPU pin; GPU artifact/Deployment stay unchanged.
Ledger: successful canonical repair seals atomically stamp record_admitted_at only if absent, then invoke the shared fail-open, deletion-fenced post-seal hook. Repair rereads the committed closed source revision so a proven repair can supersede an earlier failed stage; admission is counted once per capture. Synthetic canonical reads16→20 (committed-source read plus three ledger fences), including ledger write in its own transaction after the seal. At10k seals/h nominal total about1.00M reads/h (~100/seal,$0.51/h). Conservative planning envelope4M/h (~400/seal,$2.04/h at$0.51/million) is an estimate allowing retries/fences, not a billing cap. Conversation/wake/ledger writes20–30k/h at10k seals/h; write pricing is additional and not supplied. Normal admission/fleet traffic, index-entry reads, GCS, CPU-node and vendor spend are separate.
Measured ro-prod00:35Z outcomes:1658 sealed,15 upload_failed_cleared,78 partial_finished,7 privacy_refused,18 budget_exhausted,0 upload_pending;1673/1776 seals/clears94.2%, sealed mean12.74s. Stock00:41Z31319. Estimate8–10k seals/h,2.7–3.6h for a hypothetical27–29k sealable subset; actual sealable remainder unknown. GPU completed588audioh/h around00:39Z; supplied
20% utilization implies2350 spare audioh/h by unverified linear extrapolation. Historical0.38spanh/row implies3800spanh/h demand at10k/h, so RECENT/DEEP may grow. Fresh remains above that queue, subject to an already-running non-preemptible flight. No three-hour transcript/notes promise; provider backlog release stays off.Deploy/rollback: repair-only offline prepare packet saves full private before/after specs, hashes, approved delta and inverse before apply. Required sequence is pre-read→render-only→prepare→server dry-run→exact check-object→private inverse→apply→fresh readback verify. CAS guards UID, resourceVersion and complete spec. Full rollback verifies the after hash and restores the original image, placement, tolerations, resources, schedule, index fields, args, env and mounts. shards=1 is only capacity reduction. Incompatible node selectors, commands, images, budgets, mounts and gates fail before output. Workers stay8; fresh env absent→true or present true unchanged. Live policy map/cohorts/secrets/KSA remain unchanged; policy refresh is separate future work. No full chart apply, GPU roll, RBAC change or lane production write.
Acceptance watch from first Indexed Job creation: +5min fewer than five Running indexes on distinct API nodes with persistent scheduling/pull/no-scale-up errors; any OOMKilled/failed pod/BackoffLimitExceeded/DeadlineExceeded; or two fresh-ready age>300s samples above baseline with count growing. Observe overlap and4/5 capacity. Rollback changes future Jobs; current Jobs remain bounded by1680s.
Validation: all244 unit files importing/exercising touched modules/data plus the new ledger/guard/provenance seams are selected under test.sh isolation/CPU guard. Original urgent/dead-letter/privacy expectations remain. Intentional test changes cover per-index failure policy, moved projection callback, new committed revision read and separate ledger transaction. Counts and exact-head installed hook/typecheck/unit results are recorded in findings-q12b5-review-fixes.md. No push/deploy by this lane; independent review/runtime acceptance remain with the lead.
Product invariants affected
Review
Two independent reviewers read head
e41c5f4b0228in parallel (GPT-6 Luna: shard ownership, lease, priority and custody; GPT-6.1 Sol: chart, target-only patch, placement, cost and bindings). Both returned FIX-FIRST; the design was confirmed (stable shard key, separated frontiers, no custody or privacy check loosened). Fixed in this branch: malformed pending jobs get exactly one shard owner and a counted refusal; repair seals write the lifecycle ledger row through a fail-open hook; a failed index no longer terminates its siblings; the run budget fits inside the Job deadline; the patch tool saves and verifies a full inverse, requires a server dry-run and field comparison, and rejects incompatible input. A delta review of the final head is recorded as a PR comment.Author model: GPT-6.1 Sol; integrated by Claude Fable 5.2.
🤖 Generated with Claude Code