Skip to content

fix(record-seal): drain the unsealed backlog with five repair shards, new recordings first - #25346

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

Git-on-my-level merged 35 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/q12-seal-repair

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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 fix: seal pendant recordings again, repair new ones first, stop showing queued recordings as failed #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; supplied20% 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

  • 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

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T04:10:29.781109Z 9b11565 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Two independent reviews of e41c5f4b0228 (GPT-6 Luna on shard ownership, lease, priority and custody; GPT-6.1 Sol on the chart, the target-only patch, placement, cost and bindings) both returned FIX-FIRST. Not merging this head.

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:

  • Code: pending jobs with malformed ids are skipped by every shard without a refusal or count (they need exactly one owner); repair seals do not write the lifecycle ledger row added by feat(pipeline): lifecycle ledger writers for every summary outcome, and a tunable notes hold #25304, which leaves those captures stuck in the operator census; one failed index terminates all five shards (global backoffLimit: 0); the worst-case run budget (1,710 s) exceeds the 1,680 s Job deadline.
  • Deploy tool and operator contract (these gate applying the patch): the documented rollback (shards=1) does not restore the live footprint; the instructions apply without a server dry-run and field comparison; the renderer accepts an incompatible node selector and unexpected values in fields it owns.

A delta review follows the fixes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +90 to +91
# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +154 to +158
'downwardAPI': {
'items': [
{
'path': 'index',
'fieldRef': {'fieldPath': "metadata.annotations['batch.kubernetes.io/job-completion-index']"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread backend/database/record_audio.py Outdated
Comment on lines +123 to +125
except Exception:
# Observability never changes a committed seal's outcome.
pass

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +385 to +386
if result in {'sealed', 'upload_failed_cleared'}:
observe_record_sealed(store.client, uid, cid, ref, refresh_revision=True, **sealed_observation)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Delta review of d0d569e1fe4d (GPT-6 Luna) returned FIX-FIRST; its two blockers were the two the automated review had also found, already fixed in 3d65d50ed330 (real Indexed Job hostname <job>-<index> accepted, tested with literal hostnames) and 6becbf7f0eec (API-server defaults defaultMode: 420 and fieldRef.apiVersion: v1 in the chart and the patch receipt). The reviewer confirmed: per-index failure handling on the rendered chart, prepare accepting both the live CronJob and its state after the first-shipment patch, the approved delta, uid and resourceVersion guards, and a rollback that restores the complete original template; 869 tests passed, none above 0.4 s CPU.

Its remaining items and two further automated findings are fixed in 42da7f7839fc and 9b11565756eb: the post-seal ledger observation is bounded to 3 s and a timeout or failed source read is counted and reported as a fallback without changing the committed seal's outcome; a re-seal of an already admitted capture keeps its SEALED clock; a persistent malformed row is counted once per run; README worker count and cadence corrected. I read those two commits myself against the findings. Not verified before deploy: a server dry-run of the five-pod patch, cold-node start-up, and five-way throughput. Merging on green CI at 9b11565756eb.

…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]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +396 to +397
if observed is False and observation_counts is not None:
observation_counts['ledger_misses'] = observation_counts.get('ledger_misses', 0) + 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Two notes on 636641f367f5.

CI. Shard 7 failed on 9b11565756eb: tests/unit/test_conversation_archive_filter_contract.py could not import DeadlineExceeded, because that test loads database/pipeline_ledger.py under a minimal stub of google.api_core.exceptions and the previous commit had added a module-level import there (main's module has none). 636641f367f5 classifies the error by class name and drops the import; reason labels are unchanged. The failing file, the one other file that stubs the same module, and the ledger, seal and repair test files pass locally.

Automated finding on record_seal_repair.py:397 (a ledger CAS failure inside pipeline_ledger.advance() returns False and is not counted in the repair summary's ledger_misses): accepted as a follow-up, not fixed here. It is a measurement gap in a best-effort observation: the seal itself is committed and reported correctly, advance() already records its own error outcome, and a capture whose ledger row was not advanced remains visible as not-sealed in the ledger census, which is the signal an operator reads. Routing that return value into the repair summary and the exported counters belongs with the ledger's owner (#25304), together with the pusher-side hook that has the same shape.

@Git-on-my-level
Git-on-my-level merged commit e50f1f2 into BasedHardware:main Nov 15, 2026
55 checks passed
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