Skip to content

fix: seal pendant recordings again, repair new ones first, stop showing queued recordings as failed - #25335

Merged
Git-on-my-level merged 15 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/q12-integration
Nov 15, 2026
Merged

Git-on-my-level merged 15 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/q12-integration

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Pendant recordings stopped sealing when they ended, so they waited hours to days for transcription and showed as failed on Home. This PR fixes the leak that caused it, gives new recordings a fast repair path, and stops Home presenting a queued recording as a failure.

An earlier revision of this branch also changed sync upload filename parsing; that change was removed (the main upload path already normalizes those names), and the branch has no diff under backend/utils/sync, backend/utils/request_validation.py or backend/routers/sync.py.

What was wrong (measured 2026-11-14, ro-prod, counts only)

  • 35,000 jobs sat in record_pending; of pendant recordings that ended 20:20-21:00Z only 7-13% were sealed.
  • Pusher processes had been up since 11-12. A drain that had cleared its own producer token retried the seal forever while another producer's token remained in record_upload_sessions. Those drains held the 64 retained worker slots; once full, fresh drains were cancelled and left their tokens behind. 20:00-20:10Z: 303 capacity refusals on 18 of 20 pushers, 161 abandonment overflows, 0 completed drains.
  • A same-image rolling restart at 21:02-21:08Z took omi_pusher_record_close_refusals_total{reason="outstanding"} from ~295,600/h to 0 and the sealed share of recordings ended 21:10-21:16Z to 64%. Without a code change the slots refill.
  • The repair CronJob walks a frozen horizon, so recordings that arrive during a pass wait for the next one; ordinary job discovery waits 1,800 s.
  • Home stamps a deadline 2 h after finalization and presents the row as failed once it passes, with "Try Again", although the recording is only queued.

Changes

  1. Pusher: bound seal-only retries (backend/utils/pusher_record_barrier.py). After six producer_pending refusals, and only once this drain's own token and pending clears are gone, the drain releases its local slot. The other producer's token and the unsealed row are untouched and are left to the repair job. Kill switch PUSHER_RECORD_SEAL_PENDING_RETRY_BOUND_ENABLED (on unless set off).
  2. Record-seal repair: fresh lane (backend/utils/batch_pipeline/record_seal_cluster_repair.py, record_seal_repair.py, chart). Newest-first lane for recently ended recordings; a proven seal sets the intake job's available_at=0 in the existing seal transaction. Producer, retained-tail, privacy and provider checks are unchanged. Kill switch recordSealRepair.freshEnabled / RECORD_SEAL_REPAIR_FRESH_ENABLED, bound on the repair CronJob and seal worker and on every host that runs the intake drain which reads it (Cloud Run backend, backend-sync, backend-sync-backfill, backend-integration; GKE backend-listen; the batch worker Deployment variants through the same chart value).
  3. Home: queued is not failed (backend/utils/conversations/transcribing_hold.py, home_step.py, backend/utils/episodes/home_read.py). A recording still waiting for transcription stays "Transcribing…" for up to HOME_TRANSCRIPTION_MAX_AGE_SECONDS (24 h) from when the server started waiting for it (the pending clock, never capture end, so late-arriving audio is not presented as failed on arrival; a new upload revision restarts the bound, a read never does); already stamped rows are healed at read time with no write and no extra read; explicit failures (status=failed, record_upload_failed, dead letter) still present as failed; no summary retry is offered before a transcript exists. Kill switch HOME_TRANSCRIPTION_QUEUE_HOLD_ENABLED.

Capacity disclosure (record-seal repair tuning)

Before/after, at the live workers=8 (the checked-in production overlay says 16; the split scales):

  • fresh_workers: before 0, after at most 4 of 8 (8 of 16), borrowed only from ordinary execution capacity and returned when the fresh queue is empty; the discovery budget, the ordinary-job reserve max(1, allocation//4) and urgent-deadline ordering are unchanged, and all 8 slots run backlog when nothing is fresh. Ordinary loans and fresh attempts have row_seconds 90; initial pending-job, urgent and ordinary attempts keep 270.
  • fresh max_rows: before 0, after 128 per page, at most 2 pages per 15-second poll. Legacy sweep MAX_ROWS stays 1024.
  • First attempt for a new job: before 1,800 s minimum age, after 60 s.
  • Fresh attempt bound: new: 90 s, retry spacing 120 s. Legacy attempts keep 270 s. Run budget stays 1,500 s.
  • CronJob schedule: before every 5 minutes, after every 1 minute, concurrencyPolicy: Forbid unchanged.
  • Extra reads: at most 61,440 projected document reads per hour while the CronJob is active.
  • Pod CPU and memory limits unchanged. No pipeline state added. Backlog release stays disabled.

Review

Two independent reviewers read the combined diff at the same head in parallel. Round one returned FIX-FIRST: the pusher kill switch had no deployment binding, the Home anchor ignored ISO-string timestamps, the Home switch did not restore the previous fallback exactly, the fresh-repair switch did not reach the continuous worker, and the seal's intake wake could clear a live intake claim. All five are fixed in this branch (a3fe7d1dcc63, 743bf5223bc5) and the cohost gate now names the owners of the new switches. Final verdicts for the exact head are recorded as PR comments.

Product invariants affected

  • INV-MEM-4: backend/deploy/runtime_env.yaml and overlays gain HOME_TRANSCRIPTION_QUEUE_HOLD_ENABLED and HOME_TRANSCRIPTION_MAX_AGE_SECONDS for the services that present Home rows; the generated manifests are regenerated and their checks pass.

Validation

  • First CI run on this PR failed six unit shards on existing tests (repair budget invariants, an intake stamp written with the flag off, Home deadline tests, a rendered pusher binding contract). The designs were corrected, not the tests: the fresh lane is now work-conserving, the stamp is written only when it can be used, and the Home bound is anchored on the pending clock. Old-rule expectations are kept as kill-switch-off cases.

  • Pusher: 104 focused tests passed (test_record_audio_seal.py, test_record_barrier_executor.py, test_pusher_queue_wait.py).

  • Repair: 86 affected unit files (5,831 passed), the seven Firestore guard files.

  • Home: 190 affected test files; the 10 changed test files pass (695 tests).

  • Repository preflight on the combined head and CI are reported on the PR.

  • Not verified before deploy: production seal latency and the five-minute end-to-notes outcome. They are read back from production right after the roll.

Rollout and rollback

Services to roll: Cloud Run backend, backend-integration, backend-sync and backend-sync-backfill (Home presentation env), GKE backend-listen and prod-omi-pusher, and the record-seal repair CronJob and seal-worker env (target-only: the chart also carries the GPU transcription worker, whose image and pods are not to be rolled by this change; its Deployment template gains one env entry that takes effect at its next ordinary release). On by default, no bake.

Rollback, per change: PUSHER_RECORD_SEAL_PENDING_RETRY_BOUND_ENABLED=false; recordSealRepair.freshEnabled=false with recordSealRepair.schedule="*/5 * * * *" AND RECORD_SEAL_REPAIR_FRESH_ENABLED=false on the Cloud Run services and backend-listen (two configuration sources; set both); HOME_TRANSCRIPTION_QUEUE_HOLD_ENABLED=false.

Author models: GPT-6.1 Sol (three lanes), integrated by Claude Fable 5.2. Independent reviews at the exact head are recorded as PR comments.

Failure-Class: new

Adds FC-queue-sla-presented-as-terminal-failure. Also instances of FC-record-producer-outlives-socket-drain and FC-batch-fault-domain-head-of-line-poison.

🤖 Generated with Claude Code

Git-on-my-level and others added 9 commits November 15, 2026 04:09
Failure-Class: FC-record-producer-outlives-socket-drain
Failure-Class: FC-batch-fault-domain-head-of-line-poison
Accept a single _u<ASCII digits> tail by recovering its numeric capture
stamp through the existing plausibility policy. Keep raw names and signed
manifest claims instead of renaming uploads, so storage and content keys
retain both members of a collision pair. Carry clock runs through decoded
WAVs and retain drain compatibility after new admission is switched off.

Register the default-on SYNC_COLLISION_SUFFIX_ENABLED kill switch and
cover malformed/future/early clocks, paired staging, content identity,
batch decode, VAD segments, coverage derivatives and admission rollback.

Failure-Class: FC-sync-capture-time-zero-tolerance
Failure-Class: FC-rollout-flag-absent-from-a-cohost-of-its-code-path
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
# Conflicts:
#	backend/tests/unit/test_render_backend_runtime_env.py
…st gate

The cohost env-diff gate must know which process owns each new switch:
SYNC_COLLISION_SUFFIX_ENABLED is listen-side sync admission only, and
PUSHER_RECORD_SEAL_PENDING_RETRY_BOUND_ENABLED belongs to the pusher's drained
recording worker. A missing binding is rejected.

Failure-Class: FC-rollout-flag-absent-from-a-cohost-of-its-code-path

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The type checker does not narrow through type(x) in (int, float); use
isinstance. Behaviour is unchanged: a bool reads as an age of about now
and falls outside the fresh window.

Failure-Class: none

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Independent review 1 of 2 (GPT-6.1 Sol, xhigh; scope: Home label change and every deploy/config surface in the diff).

VERDICT: SHIP
HEAD: b3ee029c9458b... (full: b3ee029c94580ce929e7daa91e17c47f464bcbe0)

Round one at 42e35f7 was FIX-FIRST (pusher kill switch had no deployment binding; ISO-string anchors bypassed the capture-end bound; Home switch off did not restore the previous fallback exactly; fresh-repair switch did not reach the continuous worker). All four are closed. Verified by the reviewer on the merged head: 742 tests across Home, runtime-env sources and rendering, flag budgets, cohost enforcement, request validation and repair charts; generator and registry checks; generated runtime env matches the merged overlays; Helm renders for prod, dev and staging including the fresh-switch rollback; the line-count exception passes.

Roll targets named by the reviewer: Cloud Run backend, backend-integration, backend-sync, backend-sync-backfill; GKE backend-listen, pusher; the record-seal-repair image and CronJob, and the record-seal-worker env binding with its IO left disabled. No GPU transcription worker roll.

The second review (GPT-6 Luna, xhigh; custody and concurrency of the pusher, seal-repair and sync filename changes) will be posted here for the same head.

The main V2 upload path already canonicalized every nonempty collision
name before capture-time validation and content hashing. Restore that
unconditional legacy mapping and signed-manifest matching instead of
minting raw-name identities that miss prior repair and dedupe owners.
Keep unrenamable aliases refused, and retain direct/internal parser support.

HTTP normalization is identical with SYNC_COLLISION_SUFFIX_ENABLED on or
off, so old/new retries and rollback share the same ledger key. Cover old
owner retry, polling, artifact repair, new-to-old identity and paired files.
Correct the earlier main-path diagnosis and rollback documentation.

Failure-Class: FC-derived-audio-identity-churn
Restore the Q12-G code and tests to main 3980a40 and remove its parser switch from all registrations and deployment bindings. The main V2 upload path has normalized collision names since 7b1a455, so the proposed extension does not address a demonstrated user-facing failure. Preserve every other quality-push switch and binding.

Failure-Class: none
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
Anchor the bounded Home and episode wait to the server pending stamp, recover older pending starts from their stamped deadline, and use creation only without either stamp. Offline capture age must not fail newly arrived audio.

Pin legacy deadline behavior with the kill switch off, refresh every affected projection and deploy contract expectation, and move lazy batch replacement imports into fixture setup for the CI CPU guard.

Failure-Class: FC-queue-sla-presented-as-terminal-failure
Git-on-my-level added a commit that referenced this pull request Nov 14, 2026
…ight (#25338)

Reverts #25285 (merge `3980a409cb9b`, SCA-2190) so that main is
deployable tonight. No judgement on the change itself: it is to be
re-landed by its owner once its serving prerequisites are met.

## Why

- The cost lead's 20:46Z finding (binding per the release owner on
SCA-2283, 22:25Z): #25285 is not inert with `privacy_checks_shadow` at
0. With the default `bpp_owner_memo` at 100, the new owner memo serves
privacy decisions without the shadow window it was meant to have first.
- Because of that, tonight's backend train is pinned to `71c79e796a85`
(the parent of this merge) and no later main SHA is admissible. That
blocks every PR merged after it, including the fix for pendant
recordings that stopped sealing (#25335).
- The release owner recommended this reviewed revert as the way to make
later source trees admissible. The cost lead keeps ownership of the
privacy prerequisite and the re-land.

## What it does

`git revert -m 1 3980a40`, nothing else. The 24 files that #25285
changed are byte-identical to their content at `71c79e796a85`; nothing
merged after #25285 touches them. No flag, env, chart or index change
beyond what the revert restores
(`backend/deploy/firestore_read_levers_manifest.json` returns to its
previous content).

## Validation

- `git diff 71c79e7 HEAD -- <the 24 files>` is empty.
- Repository preflight and CI are reported on the PR. An independent
exact-head review is posted as a PR comment.

## Rollback

Re-land #25285 (revert this revert) once its prerequisites and GO are in
place.

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/25338?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Bind the default-on fresh repair switch on all five main.py hosts and every
GPU worker Deployment variant using the existing shared chart value. Pin the
independent dead-letter flag and source classifications in runtime/render tests,
and document the coordinated chart/Cloud Run/listen rollback.

Describe the Home wait as a nonrenewing, per-revision server-pending bound, with
inferred pending and creation fallbacks and no lifetime guarantee.

Failure-Class: FC-rollout-flag-absent-from-a-cohost-of-its-code-path
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Independent review 2 of 2 (GPT-6 Luna, xhigh; scope: custody and concurrency of the pusher and record-seal repair changes).

VERDICT: SHIP
HEAD reviewed: 2b16900

No BLOCKER or SHOULD findings. Notes from the reviewer: the withdrawn sync filename change is fully removed (no diff under backend/utils/sync, backend/utils/request_validation.py or backend/routers/sync.py against main; the switch is gone), so its earlier content-identity blocker does not apply; in record_seal_cluster_repair.py the initial backlog group is attempted before fresh work, fresh concurrency is capped at half the workers and borrowed work is bounded to 90 s, so the urgent-first backlog keeps its share; in live.py retry markers require both switches, a future intake clock without a marker is preserved, and the seal transaction re-reads the claim state before waking intake.

Round history, for the record: round one at 42e35f7 was FIX-FIRST (a seal's intake wake could clear a live intake claim: fixed in 743bf52); round two at b3ee029 was FIX-FIRST (content identity in the sync filename change: resolved by withdrawing that change in 9787615).

The current head bb0ceac7e26c425d5e7d8f23bde7cb2286696dce adds one commit after this verdict, bb0ceac7e26c, which changes configuration bindings, tests and one docstring only (no file under backend/utils, backend/database or backend/routers). The settings reviewer's exact-head verdict for that head follows.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Independent review 1 of 2, final exact-head verdict (GPT-6.1 Sol, xhigh; scope: Home presentation change and every deploy/config surface).

VERDICT: SHIP
HEAD: bb0ceac

No remaining BLOCKER or SHOULD findings. The round-three blocker is closed: the fresh-repair and dead-letter controls reach all five serving cohosts in dev and prod. Home wording matches the per-revision admission-clock behaviour.

Notes from the reviewer:

  • GPU rollout boundary: backend/charts/batch-pipeline-worker/templates/deployment.yaml:142 adds exactly one env entry to the GPU container; rendered images and every other field are unchanged. The source change is inert until applied; a future full chart apply changes the pod-template hash and triggers a Recreate rollout. For this release: patch the CPU targets only and preserve GPU images and pods.
  • Immediate rollback of the fresh repair lane needs active-job handling: the CronJob template controls future Jobs; existing Jobs keep their environment.
  • Complete rollback of the fresh lane sets recordSealRepair.freshEnabled=false and the four Cloud Run plus listen bindings false. Partial states preserve custody and active-claim checks but do not fully disable the feature (chart off, serving on: fresh repair and wakes stop, retry certification continues; chart on, serving off: new certification stops, fresh repair continues).

Verified by the reviewer: 626 tests across 10 files; generator, registry, dev/prod runtime and workflow, cohost and config-reference checks; prod/dev/staging renders and a GPU manifest comparison.

Roll targets: Cloud Run backend, backend-sync, backend-sync-backfill, backend-integration; GKE backend-listen, pusher; target-only CPU record-seal-repair CronJob and record-seal-worker (enablement preserved). No GPU rollout.

Round history: 42e35f7 FIX-FIRST (four config findings), b3ee029 SHIP, 2b16900 FIX-FIRST (fresh-repair switch missing on backend-integration), bb0ceac SHIP.

# Conflicts:
#	backend/tests/unit/test_home_transcribing_hold.py
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Exact-head confirmation after merging main (GPT-6.1 Sol, xhigh).

VERDICT: SHIP
HEAD: d0d81ab

d0d81aba1875 is a merge of main 8614ee4cad33 (#25337, #25311, #25326, #25312) into the previously approved bb0ceac7e26c. One conflict, in backend/tests/unit/test_home_transcribing_hold.py: main (#25312) moved a test's lazy imports to module level and this branch had put them in a fixture for the same CPU-guard reason; resolved by taking main's version. The reviewer verified the resolution and the auto-merges, ran 657 focused tests and the generator checks on this head, and found no interaction with the newly merged changes that needs a change here.

CI note for the previous head bb0ceac7e26c (run 43652252401): one shard failed on the fast-unit CPU-time guard only, tests/unit/test_pipeline_sim_vendor_drills.py::test_holds_never_outlive_the_outage_by_more_than_one_redrive[3600.0] at 1.11 s against 1.00 s; the file is not touched by this PR. CI is re-running on the merged head.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Correction to my CI note above: the failing check is not a runner flake, and I am not merging past it.

tests/unit/test_pipeline_sim_vendor_drills.py::test_holds_never_outlive_the_outage_by_more_than_one_redrive[3600.0] has now failed the fast-unit CPU-time guard on two consecutive heads (1.11 s at bb0ceac7e26c, 1.12 s at d0d81aba1875, limit 1.00 s). On main's own runs the same test takes 0.32 s (4efe47a64740) and 0.63 s (8614ee4cad33); on this branch it took 0.88 s on the earlier head that passed (2b1690066827). So this branch makes the pipeline simulation roughly twice as CPU-expensive. The test file is untouched by the PR, but the code it simulates (intake, seal and deferral in the batch pipeline) is not.

That may be test-only cost or a real per-job cost added to a production loop. It is being profiled against main now; the PR stays unmerged until the cause is attributed and removed. No test budget or allowlist will be edited.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Second correction, with the evidence this time: the failing check IS runner variance, and I am merging past it as a named flake.

tests/unit/test_pipeline_sim_vendor_drills.py::test_holds_never_outlive_the_outage_by_more_than_one_redrive[3600.0] against the 1.00 s fast-unit CPU guard, shard 6/8, from the CI logs of ten runs tonight:

Head What CPU s
71c79e796a85 main 1.13 (main's own run failed on it)
3980a409cb9b main 0.44
671dd470e337 main 0.61
4efe47a64740 main 0.32
8614ee4cad33 main 0.63
9ff0ab1bb9a6 main + unrelated revert 0.68
b3ee029c9458 this branch 0.67
2b1690066827 this branch 0.88
bb0ceac7e26c this branch 1.11
d0d81aba1875 this branch 1.12

Main alone ranges from 0.32 s to 1.13 s. My earlier comment compared two main samples with three of ours and concluded the branch was slower; with ten samples that does not hold. A profiling run of the single test on this head and on a main checkout measured 0.40 s CPU on both, with identical call counts (1.511 s versus 1.529 s under cProfile), and no function changed by this PR executes during the measured call. The 15 unit files around the changed modules pass (613 tests) and the canonical typecheck has 0 errors. Evidence: workspace data/run-2026-11-15-quality-12h/q12-l-cpu-investigation.md.

Every other check on d0d81aba1875eb51680420368a126ba378a74a82 is green and both exact-head reviews are SHIP (above). No test, budget or allowlist was edited. The test itself deserves the same treatment #25312 gave its neighbours; that is not part of this PR.

@Git-on-my-level
Git-on-my-level merged commit d1fb900 into BasedHardware:main Nov 15, 2026
53 of 55 checks passed
Git-on-my-level added a commit that referenced this pull request Nov 15, 2026
… new recordings first (#25346)

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

- **Five repair pods instead of one.** The record-seal repair CronJob
runs as five Indexed pods; each owns the jobs whose id hashes to its
index, so no two pods read the same audio. Source default stays one pod;
the production overlay selects five. Rollback is
`recordSealRepair.shards=1`.
- **Newest first, no per-run cap.** Each pod keeps refilling from the
newest pending jobs until its existing 1,500 s deadline, instead of
stopping at 1,024 candidates.
- **New recordings stay ahead.** Each pod keeps the fresh lane from
#25335. At intake, a recording's units are now classed by when the
recording ended (fresh up to 10 minutes, recent up to 7 days, deep
beyond), so a bulk-sealed old recording cannot outrank one that just
ended. Kill switch `RECORD_INTAKE_AGE_PRIORITY_ENABLED` (on unless set
off).
- **CPU-only placement.** The pods run on the CPU-only `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
implies~2350 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

- INV-MEM-4: env changes bind only native audio queue age priority.
Canonical memory intake, consolidation, promotion receipts, privacy
fences and graph/projection authority retain their existing paths. No
memory promotion or fast-track route.

## Review

Two independent reviewers read head `e41c5f4b0228` in 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](https://claude.com/claude-code)
Git-on-my-level added a commit that referenced this pull request Nov 15, 2026
…ntake on seal (#25352)

When a pendant recording ends it must be sealed before transcription can
start. After tonight's leak fix (#25335) recordings do seal, but slowly:
at 04:42Z about a fifth of recordings were sealed within a quarter of an
hour of ending, and most seals arrived later through the repair job.
This PR ships the two parts of the fast-seal work that are verified, and
stages the third off.

## Summary

- **ON: playback discovery moves out of the audio drain**
(`PUSHER_RECORD_CLOSE_FAST_PATH_ENABLED`). Optional playback listing no
longer blocks the drain that seals a recording; it runs in a bounded
background coordinator, with a durable marker so it is rebuilt if it
does not finish. When someone opens a recording whose playback list is
still pending, the audio URL endpoint builds it on demand for that one
recording (consent checked before any storage listing; 8 s bound;
coalesced per recording with a cooldown and per-user limits) instead of
answering empty, because shipped clients do not poll on an empty list.
- **ON: a pusher-side seal wakes the intake job in the same
transaction** (`PUSHER_RECORD_SEAL_WAKE_ENABLED`), never clearing a live
intake claim.
- **OFF by default in code, inert when off: the acknowledged close
handshake** (`PUSHER_RECORD_CLOSE_NOTIFY_ENABLED`), in which listen
tells the pusher a recording ended. Five review rounds found a new
concurrency defect each time; the last two (a frame in flight in the
receiver attributed to the next recording after the previous one
committed; an unbounded wait when the next recording is never created)
are not fixed. With the switch off, listen offers no capability and
sends nothing, and the pusher takes the existing close path. Ramp
conditions are below.

What this does not do: it does not deliver the roughly one-minute seal.
With the handshake off a recording still waits for an existing close
signal; how much of the 8 to 10 minute seal time the two ON changes
remove is unmeasured.

## Details from the authoring lane

Pendant record sealing still needs the verified playback and intake
scheduling fixes while close-v2 awaits complete rollover custody proof.
Ship playback deferral and atomic intake wake ON; stage close-notify
OFF, including its code default for image-only GKE rolls.

## Shipping subset and invariants

INV-MEM-4. PUSHER_RECORD_CLOSE_NOTIFY_ENABLED defaults off via
default_off and is explicitly false on pusher, backend-listen and Cloud
Run backend/backend-sync/backend-sync-backfill/backend-integration, in
dev and prod. Listen offers no capability, sends no prepare/commit, and
allocates no pending-close/boundary inventories. The pusher allocates no
PusherCloseState, advertises nothing, and uses existing closure. The
finalization controller skips the new notification callback entirely.
Cohost equality remains enforced. No account data, production write,
push or deploy is performed here.

PUSHER_RECORD_CLOSE_FAST_PATH_ENABLED and
PUSHER_RECORD_SEAL_WAKE_ENABLED remain default on. Playback deferral is
in the durable projection worker for existing socket-end, legacy
finalization and header-rollover drains, including their timed uploads;
it does not depend on close-v2. The marker must commit after verified
readback/upload before the producer can close. Native sealing
independently calls the claim-safe wake helper in the seal transaction;
only completed, fresh, matching record_pending retries/due jobs wake.
Live claims, foreign jobs, privacy refusals, partial audio and pending
producer tokens remain fenced. The ledger observer runs strictly
afterward and cannot undo the wake. The intake retry-marker writer must
serve before a future certified retry can be woken; old unmarked future
claims remain untouched.

## Close-notify ramp: staged, not fixed

The experimental true path still has two reviewed blockers: a frame
waiting inside awaited raw archive append can retain X in the archive
but reach pusher under Y, outside X's committed watermark; and successor
persistence can leave a prepared close deferred indefinitely. Default
off makes the deferral/freeze unreachable; it does not claim to fix the
opt-in protocol.

Before any opt-in: capture one binding per dequeued frame and reuse it
for archive and pusher acceptance; count X's in-flight receiver frames
and wait for them before commit; bound deferral and hand off to
proof-based repair without sealing early, clearing a foreign token or
closing the stream. Add the critical test with a frame paused inside
awaited archive.append while successor persistence switches binding.
Repeat prepare/flush/commit, reconnect, teardown, delayed/failed
successor and accepted-tail custody tests. Keep prepare-only EOF fenced
without a final watermark.

Ramp owner Q12-A with the quality lead as expander: synthetic dev,
consenting-owner dedicated canary, then fleet only after independent
custody/concurrency approval. At each step require no new stream
1011/accepted-byte mismatch, bounded pending-close age/count and no
producer_pending/admission growth attributable to the feature; measure
close-to-seal and prepared-uncommitted EOF rates. Review by 2026-11-16;
absent the proofs, remain off and report the missed ramp. Existing
no-protocol clients and incapable peers continue the old close path; no
special rollout order is required for this staged subset.

## Honest latency expectation

There is NO approximately-60-second end-to-seal promise with notify off.
A Cloud Tasks finalization sends no pusher close signal on the existing
path. A continuing stream may still wait minutes, or indefinitely during
a successor/socket stall, for a legacy finalization request, header
rollover or socket end. Once such a close is observed, the durable
worker checks every 1 second and forces the remaining batch out; normal
completion should be seconds plus mandatory custody/readback/upload,
durable marker and Firestore transaction time, rather than waiting for
synchronous playback discovery. The open-record batch timer remains 60
seconds. Network/storage failures and other producers can still extend
it. The previous 8-10-minute median may persist for records lacking a
close signal. The measured shares attributable to missing close
notification versus playback discovery are UNMEASURED; no split or new
fleet percentile is claimed.

## Validation

Local final head 9023e68;
main65f46cce8306 merged in02704e643b8e5. Explicit count298 equals
len(names), registry/runtime regenerated, line-count exceptions
recomputed against65f46 (pusher2050->2174;runtime1545->1547). Seal
timestamp stays in the existing conversation patch; certified intake
wake remains the other update in the same transaction, followed strictly
by the ledger observer. Main's intake/repair stage stamps are preserved.

226 affected unit files exercised, including slow cases: final unique
outcomes10922 passed,19 skipped,86 expected xfails. The broad run
initially exited1: the helper-budget test retained its old ops_kill
assertion, and the pre-existing60-pack slow stress exceeded the1.00s CPU
guard (1.40s in parallel). Test-only9023e681ee34 now asserts the staged
rollout/default-off/review/ramp contract. Both affected files reran
serially at final head:131 passed with the unchanged guard, stress0.97s.
No marker/allowlist/guard change. Full-run source head02704e and final
source are identical; only that test contract differs. Complete original
failures and rerun logs remain in the record.

Default-absent matrix7 passed; native seal/wake14 passed including
atomic record_sealed_at and later ledger failure; cross-service
contract33 passed/3 skipped. Existing fast-path blocked-worker test
covers notify-absent legacy finalization and header rollover, plus
staged opt-in coverage. Installed hook PASS at
2026-11-15T05:56:07.928561+00:00 on exact final head: 2119 pytest
passes,28 deselected; canonical backend/scripts/typecheck.sh0
errors,84166 warnings,0 informations; all56 preflight gates and pinned
formatting passed. Commands/manifests/logs/identities are
q12-a-subset-run.py consumers|hook through omi-heavy; rerun used the
same test.sh guard with one worker.

No new fast test exceeded0.4s. Existing validator/lifecycle tests
reached0.46/0.41s; manual slow stress remains near the1s budget and
hit1.40s under parallel load, so retain the CI CPU risk disclosure.
Emulator integration services, new-head remote CI/review, production
seal time, RSS and actual spend are unverified. No GCP tier/production
access, push or deploy.

## Capacity and cost

Before, optional close discovery shared 128 storage threads with an
unbounded queue. After, WORKERS=2, MAX_CONVERSATIONS=128, MAX_PATHS=2048
process-wide for optional discovery, zero queued executor calls; marker
persistence uses two workers and 32 queued calls. Mandatory storage 128
and record-barrier 16 workers/64 queue are unchanged. MAX_CLOSES
initial128 and CAPABILITY_OPCODE new:204 are staged protocol constants;
disabled connections allocate neither protocol inventories nor
pending-close state. Existing demand repair bounds stay two
active/process, one active/user, 32 attempts/process and four/user per
rolling60s, 30s failure/empty cooldown, 1024 negative-history keys, 8s
caller wait. Started timed-out work retains its bounded slot until
completion. Four extra lazy optional pusher threads/process (68 across17
processes if used); RSS unmeasured.

Per recording with B uploaded drain batches and P admitted empty
playback repairs: B owner point reads and B marker writes; one job read
per eligible seal attempt plus at most one wake write; one marker read
and one metadata readback per admitted repair, plus consent preflight
and strict rebuild/projection reads; at most one version-conditional
debt retirement delete on success. Joined/cooldown/refused demand
attempts add no IO. At sustained10000 recordings/hour,240000/day and ten
seal attempts mean2.4M job reads/day, not1M. Read
envelope240000*(B+10+2P+R)/day, R includes privacy/rebuild reads; not
measured spend or a billing cap. Existing cold/demand-build consent
ordering remains a separate owner follow-up; the new request repair
preflights before encoded/raw listing.

## Rollback

Keep PUSHER_RECORD_CLOSE_NOTIFY_ENABLED=false everywhere; do not enable
it as rollback. To disable the shipping optional playback change, set
PUSHER_RECORD_CLOSE_FAST_PATH_ENABLED=false on pusher, backend-listen
and all four Cloud Run hosts; pusher-only off leaves reader-side repair
active. Set PUSHER_RECORD_SEAL_WAKE_ENABLED=false on pusher to restore
polling. Keep PUSHER_RECORD_SEAL_PENDING_RETRY_BOUND_ENABLED=true. GKE
tonight is image-only: code defaults control absent env; targeted env
patches, not unapplied chart values, control rollback.

Failure-Class: FC-record-producer-outlives-socket-drain

Line-Count-Exception: backend/routers/pusher.py | 2050 -> 2174 |
Preserve existing custody ownership while making disabled protocol
construction impossible; no close-v2 work runs by default.
Line-Count-Exception: backend/routers/listen/runtime.py | 1545 -> 1547 |
Bind the staged notification callback beside the existing finalizer;
controller does not call it while notify is off.

## Review

Four review rounds (GPT-6 Luna and GPT-6.1 Sol) and the automated Codex
review. No audio-overtake path was found in the handshake's
prepare/freeze/commit sequence itself; the defects found were around it
(rollover, teardown, retries, bindings) and in the playback path
(pending list invisible to shipped clients, consent checked after
discovery, unbounded on-demand retries, missing fallback telemetry), and
are fixed except the two rollover defects named above, which is why the
handshake ships off. A final review of this head, checking that the
handshake is inert when off and that the two ON changes stand alone, is
recorded as a PR comment.

Author model: GPT-6.1 Sol; integrated by Claude Fable 5.2.


Final review (GPT-6 Luna, head 9023e68) found one remaining difference
from main with close notify off: `audio_bytes_send()` bound an implicit
audio run to the current conversation at acceptance instead of at flush.
Fixed in 3d16e80 (the binding applies only when notify is enabled)
with a staged-off test that fails without it. Two tests that exceeded
the CI CPU guard were made cheap (staged-off matrix; sibling probe page
size is now the named constant `RECORD_SIBLING_PROBE_ROWS`, same value
160).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant