Skip to content

fix(batch): lease record_pending rows so drain replicas stop duplicating admission - #24587

Merged
Git-on-my-level merged 2 commits into
mainfrom
fix/record-drain-lease
Nov 4, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
fix/record-drain-lease

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Requested by David

New recordings are stuck in batch record admission, before transcription and titles. At 09:00Z there were 5,418 record_pending rows (5,365 due), and the number was rising. Every backend-integration replica's drain loop selects the same oldest-100 page. A row's available_at only moves after the first replica finishes with it. So about 21 replicas each repeat the same chunk listing, download and staging for every row, and only one of them can win the intake CAS. The other copies add Firestore contention (1,807 FirestoreContentionExhausted in 30 min). The per-replica shuffle (#24500) and per-process busy_owners (#24506) only reorder work inside each process.

The drain now claims each selected row in a transaction before admission. The claim sets a bounded lease, available_at = now + RECORD_DRAIN_LEASE_SECONDS (default 900 s, bounded 60–3600). Other replicas' due pages then move past that row. A failed admission releases its own lease into the ordinary 60 s retry. A deferral written during admission, or a newer lease taken by another replica, is kept. If a worker crashes, its row becomes due again when the lease ends. Admission authority is unchanged: the intake/partial CAS still decides, and rows are never expired. Rollback: set RECORD_DRAIN_LEASE_SECONDS=60 to shorten the lease, or revert this PR.

The retry log now adds reason= for ValueErrors. Only literal lowercase phrases are logged; anything else is logged as other. This lets us measure the remaining refusal classes. A read-only barrier check on the 500 rows the drain selects found 426 (85%) already pass require_record_audio_barrier. So most of the ~3k ValueErrors per 30 min come after the barrier, and right now the log drops the message.

Evidence (ro-prod, metadata and counts only): event=batch_drain_pass over 15 min = 56 passes on revision 01532, 100 rows each, avg 339 s, max 857 s. Firestore count aggregation: record_pending 5,418 total, 655 enqueued in the last 60 min.

Validation: pytest tests/unit/test_batch_pipeline_live.py test_record_partial.py test_record_admission_review_fixes.py test_batch_pipeline_serving.py test_batch_pipeline_scheduler.py: 296 passed. New tests: three concurrent replicas admit each of 8 rows exactly once; a row leased by another replica between selection and claim is not admitted; failed admission returns to the 60 s retry; the reason log never includes non-static text. These are local results; no deployed effect is claimed.

Failure-Class: FC-drain-rate-equals-arrival-rate

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…ing admission

Every backend-integration replica selected the same oldest-100 record_pending
page. A row's available_at only moved after the first replica finished, so
~21 replicas re-did the same listing, download and staging for each row and
the backlog grew (5,418 rows at 09:00Z, 56 passes/15 min averaging 339 s).

Claim each selected row in a transaction with a bounded lease
(RECORD_DRAIN_LEASE_SECONDS, default 900 s, 60-3600) before admission, so
other replicas' due pages move past it. A failed admission releases its own
lease to the ordinary 60 s retry; a crashed worker's row is due again when
the lease ends. The retry log now names static ValueError reasons
(anything else is `other`) so the remaining refusal classes are measurable.

Failure-Class: FC-drain-rate-equals-arrival-rate

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@cubic-dev-ai cubic-dev-ai 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.

5 issues found across 3 files

Confidence score: 3/5

  • In live.py, the privacy check on a lease claim can raise BatchPrivacyBlocked outside the handler, aborting the entire drain pass for a fenced row. Handle that exception around the claim.
  • In live.py, a long admission can outlive the lease and let another replica repeat downloads and staging. Renew the lease during admission or enforce a duration bound.
  • record_drain.py adds a lease setting that is not wired into the backend-listen deployment, so deployed drains keep the 900-second default and operators cannot apply the documented override.
  • The tests in test_batch_pipeline_live.py leave two behaviors unverified: the lowercase ValueError case does not reach the other classification boundary, and the concurrency test does not ensure all replicas select the page before admission starts. Use an eligible error message and add a selection barrier.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/utils/batch_pipeline/live.py">

<violation number="1" location="backend/utils/batch_pipeline/live.py:433">
P1: The new claim can abort the entire drain pass for a privacy-fenced row. `FirestoreTransaction.flush()` privacy-checks this lease write before admission, but the `BatchPrivacyBlocked` handler only surrounds `admit_recording`, so the exception escapes `drain_one()` instead of setting `privacy_blocked` and allowing the remaining rows to drain; catch the claim-time privacy block and handle it through the same pass-level path.</violation>

<violation number="2" location="backend/utils/batch_pipeline/live.py:450">
P2: A legitimate long admission can outlive this lease and become due while its original worker is still running, causing another replica to repeat downloads and staging. Renew the lease while admission runs, or enforce a processing bound that is shorter than the maximum lease.</violation>
</file>

<file name="backend/config/record_drain.py">

<violation number="1" location="backend/config/record_drain.py:24">
P2: This new lease setting is not wired into the `backend-listen` deployment environment, so deployed drains always use the 900-second default and operators cannot apply the documented `RECORD_DRAIN_LEASE_SECONDS=60` rollback through the managed runtime configuration. Add the variable to the runtime manifest/config-map source and regenerate the manifest.</violation>
</file>

<file name="backend/tests/unit/test_batch_pipeline_live.py">

<violation number="1" location="backend/tests/unit/test_batch_pipeline_live.py:324">
P2: This concurrency test does not guarantee that all replicas select the page before admission starts, so it can pass without detecting duplicate admission when the claim is missing. Add a selection barrier in the fixture, then release admission only after all three drains have completed their due-page selection.</violation>

<violation number="2" location="backend/tests/unit/test_batch_pipeline_live.py:364">
P2: This case does not verify that unknown lowercase `ValueError` messages are classified as `other`; its punctuation and digits make the regex reject it before the allowlist boundary is tested. Add a `ValueError` whose entire message matches the accepted lowercase character set, such as `synthetic-private`, and assert that it produces `reason=other` without exposing the message.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread backend/utils/batch_pipeline/live.py Resolved
now = time.time()
if latest.get('state') != 'record_pending' or latest.get('available_at', 0) > now:
return None
lease = now + lease_seconds

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: A legitimate long admission can outlive this lease and become due while its original worker is still running, causing another replica to repeat downloads and staging. Renew the lease while admission runs, or enforce a processing bound that is shorter than the maximum lease.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/utils/batch_pipeline/live.py, line 450:

<comment>A legitimate long admission can outlive this lease and become due while its original worker is still running, causing another replica to repeat downloads and staging. Renew the lease while admission runs, or enforce a processing bound that is shorter than the maximum lease.</comment>

<file context>
@@ -418,11 +430,29 @@ async def drain_one(segment):
+        now = time.time()
+        if latest.get('state') != 'record_pending' or latest.get('available_at', 0) > now:
+            return None
+        lease = now + lease_seconds
+        latest['available_at'] = lease
+        tx.put('jobs', segment, latest)
</file context>

Comment thread backend/utils/batch_pipeline/live.py Resolved

def record_drain_lease_seconds() -> int:
"""How long a selected row stays invisible to other replicas' drain pages."""
return max(60, _drain_setting('RECORD_DRAIN_LEASE_SECONDS', 900, 3600))

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: This new lease setting is not wired into the backend-listen deployment environment, so deployed drains always use the 900-second default and operators cannot apply the documented RECORD_DRAIN_LEASE_SECONDS=60 rollback through the managed runtime configuration. Add the variable to the runtime manifest/config-map source and regenerate the manifest.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/config/record_drain.py, line 24:

<comment>This new lease setting is not wired into the `backend-listen` deployment environment, so deployed drains always use the 900-second default and operators cannot apply the documented `RECORD_DRAIN_LEASE_SECONDS=60` rollback through the managed runtime configuration. Add the variable to the runtime manifest/config-map source and regenerate the manifest.</comment>

<file context>
@@ -17,3 +17,8 @@ def record_drain_batch() -> int:
+
+def record_drain_lease_seconds() -> int:
+    """How long a selected row stays invisible to other replicas' drain pages."""
+    return max(60, _drain_setting('RECORD_DRAIN_LEASE_SECONDS', 900, 3600))
</file context>

raise ValueError('retained capture tail not durable yet')

monkeypatch.setattr(live, 'admit_recording', admission)
# Three replicas select the same page before any admission finishes.

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: This concurrency test does not guarantee that all replicas select the page before admission starts, so it can pass without detecting duplicate admission when the claim is missing. Add a selection barrier in the fixture, then release admission only after all three drains have completed their due-page selection.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_batch_pipeline_live.py, line 324:

<comment>This concurrency test does not guarantee that all replicas select the page before admission starts, so it can pass without detecting duplicate admission when the claim is missing. Add a selection barrier in the fixture, then release admission only after all three drains have completed their due-page selection.</comment>

<file context>
@@ -290,12 +292,95 @@ async def admission(store, pending):
+        raise ValueError('retained capture tail not durable yet')
+
+    monkeypatch.setattr(live, 'admit_recording', admission)
+    # Three replicas select the same page before any admission finishes.
+    await asyncio.gather(*(live.drain_recordings(store) for _ in range(3)))
+    assert sorted(admitted) == [str(i) for i in range(8)]
</file context>

'error,reason',
[
(ValueError('retained capture tail not durable yet'), 'reason=retained_capture_tail_not_durable_yet'),
(ValueError("invalid literal for int() with base 10: 'synthetic-private'"), 'reason=other'),

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: This case does not verify that unknown lowercase ValueError messages are classified as other; its punctuation and digits make the regex reject it before the allowlist boundary is tested. Add a ValueError whose entire message matches the accepted lowercase character set, such as synthetic-private, and assert that it produces reason=other without exposing the message.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_batch_pipeline_live.py, line 364:

<comment>This case does not verify that unknown lowercase `ValueError` messages are classified as `other`; its punctuation and digits make the regex reject it before the allowlist boundary is tested. Add a `ValueError` whose entire message matches the accepted lowercase character set, such as `synthetic-private`, and assert that it produces `reason=other` without exposing the message.</comment>

<file context>
@@ -290,12 +292,95 @@ async def admission(store, pending):
+    'error,reason',
+    [
+        (ValueError('retained capture tail not durable yet'), 'reason=retained_capture_tail_not_durable_yet'),
+        (ValueError("invalid literal for int() with base 10: 'synthetic-private'"), 'reason=other'),
+        (RuntimeError('synthetic-private'), 'reason=-'),
+    ],
</file context>

…ed refusal reasons

Luna R1: a claim write can meet the privacy fence; treat it like an admission
refusal so the worker continues. Log only exact known ValueError phrases.

Failure-Class: FC-drain-rate-equals-arrival-rate

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

Copy link
Copy Markdown
Member Author

jam fix: merges only in the lead's jam train

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 4, 2026 13:03
@Git-on-my-level
Git-on-my-level merged commit 030ea19 into main Nov 4, 2026
56 of 58 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/record-drain-lease branch November 4, 2026 13:03
@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T13:09:10.102647Z 2156aea Draft marked ready
ℹ️ 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.

@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: 2156aea75d

ℹ️ 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 +22 to +24
def record_drain_lease_seconds() -> int:
"""How long a selected row stays invisible to other replicas' drain pages."""
return max(60, _drain_setting('RECORD_DRAIN_LEASE_SECONDS', 900, 3600))

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 Document the recording-admission lease contract

This introduces RECORD_DRAIN_LEASE_SECONDS and changes recording-admission retry and crash-recovery timing, but the commit contains neither a pipeline change note nor an update to the pipeline's environment contract. backend/AGENTS.md requires a same-PR note for audio/transcription lifecycle changes, and the change-note README places environment variables and their defaults in backend/docs/listen_pusher_pipeline.mdx. Add the note and document the lease's default, bounds, and recovery behavior so operators can distinguish an actively leased recording from a stalled admission.

AGENTS.md reference: backend/AGENTS.md:L164-L164

Useful? React with 👍 / 👎.

from utils.batch_pipeline import live

monkeypatch.setenv('RECORD_DRAIN_CONCURRENCY', '4')
store = MemoryStore()

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 Cover competing drain claims with the Firestore emulator

For the cross-replica contention incident this change addresses, this test uses MemoryStore, whose run() serializes entire callbacks under an RLock; it never exercises the production FirestoreStore.run() transaction retries or commit-time privacy checks. Repository-wide searches of the test suites found no emulator coverage of drain_recordings or the new lease. backend/AGENTS.md explicitly requires emulator coverage first for incidents involving contention. Add an emulator regression with independent drain instances competing for the same due rows, verifying that only the winning claimant reaches admission and that losing transactions leave its lease intact.

AGENTS.md reference: backend/AGENTS.md:L232-L232

Useful? React with 👍 / 👎.

Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
PR #24587 merged to main while A1 CI was running. Verify its real two-replica
case trips strict XPASS, then retain it as a green regression. Keep the four
remaining leak cases strict and preserve the original pre-fix red proof.
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
Reject cleared or mutated alias deadline evidence and independently census
persisted entries for every deadline-bearing machine. Check positional
setdefault state values and literal aliases. Preserve the bounded span patch
through a pinned returned-key proof with portable AST fingerprints.

The 12 review reproductions and the extra source-alias case failed before
the fixes. Valid stamped-entry, rebuilt-payload, null-debt exit and contract
mutation controls prevent blanket rejection or unverified exemptions.

Refresh the source snapshot at main 563e6c2. Remove two stale
record_pending metric/page xfails supplied by #24595; #24587 admission
leases still do not stamp an overall pending-dwell deadline.

Local backend/test.sh: 926 passed, 68 strict xfails. Unmasked audit:
exactly 68 AssertionErrors, no unexpected or CPU guard failures.

Main integration is separate (bd6cdcb); compatibility commit372ccb1a61e0
is the inspected cherry-pick of peer6201ba0. Lead acceptance under0d2137
and exact-head green CI are required before merge. No third review.
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
…ress case

#24587 moved the privacy fence into the drain's lease claim, so the privacy
block can surface at read_pending as well as admit. The contention fixture
is load-sensitive (it admitted cleanly in some runs), so CI accepts exactly a
named-transaction contention stop or a clean full admission.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
#24597)

## What changed and why

Adds WP-A's hermetic lifecycle simulator to the existing listen/pusher
stack. It drives production custody, registration, admission,
scheduler/worker, merge, projection and recovery-summary persistence
over a disposable Firestore emulator and local encrypted synthetic
audio. GPU and summary-provider leaves are synthetic.

Includes credential/project/network refusal, persisted job-clock aging,
exact seal/register/admit faults with fired events, and a real pusher
process-death control. The existing gauntlet runner includes the
simulator and retains its diagnostics. No workflow or CI-budget edits.

## Product invariants affected

none

## How it was verified

- Canonical `backend/test.sh` with a list containing
`test_lifecycle_sim_unit.py`, `test_listen_pusher_stack_ci_wiring.py`
and `test_listen_lifecycle_emulator_harness_wiring.py`: **65 passed**
(49 helper, 15 CI wiring, 1 lifecycle wiring) on current main plus this
candidate.
- `backend/testing/lifecycle_sim/run.sh --keep`: **3 passed, 4 strict
xfailed**. Latest main-integration rerun: added module wall **65.308
seconds**; standalone Firebase wrapper **99.365 seconds** (earlier
run137.699/164.04). Below the three-minute target without a budget
change.
- Physically removed the four remaining xfail decorators locally:
exactly four final `LifecycleInvariantError` failures and all three
controls passed, with no setup/proof/transport errors. Original source
restored byte-for-byte; SHA-256
`a7f24418cc832294cf3651c2fdc14966f4884f1fa9641e56dc6eb16fc3fec370`.
Unmarked source is never pushed.
- Ordinary push gates run with ambient GCP variables removed, default
shared slot counts and background priority. Earlier head `c7b54f3`
passed 33 preflight checks, 49 helper tests and all 62 CI checks; it was
intentionally held because main advanced during CI.
- Full local gauntlet attempts encountered unchanged teardown `killpg`
EPERM. A detached main `773c4ced` baseline instead hit a different
REST-finalization `ReadTimeout`; no common cause is claimed. Lead ruling
`bcb72a` authorizes publication with this local limit disclosed and
requires the fresh CI **Listen Pusher Stack Gauntlet** to pass before
merge.

Current main `6cf56c7` was integrated unchanged as `38a04386`. The stale
BYOK metric inventory caused the same file failure on earlier main and
ce5 CI. The exact-file local comparison reproduced both alert assertions
on ce5; main #24605 passes143 tests plus79 expected table gaps. After
importing that fix unchanged, local gates pass208 tests plus79 table
xfails, and the simulator passes3 controls plus4 strict xfails. The PR
diff remains only 19 harness/test/doc paths, with no production or
`.github` changes. Dependencies did not change.

## Tests

The happy control verifies the actual decrypted provider title/overview
after real transcript projection and summary persistence. The typed
dead-producer control kills a real local pusher after its production
barrier persists a live token.

The two-replica admission test originally failed on the earlier main
with:

`record_pending entered admission concurrently on 2 replicas; expected
one lease owner`

That exact pre-fix proof is archived. Fix #24587 merged while A1 CI was
running. On current main the unchanged test produced **strict XPASS**,
with both other controls passing and four remaining xfails. Only then
was its obsolete marker removed. It is now an ordinary green regression.
This proves the source fix; no production deployment/health claim is
made.

The four remaining strict failures accept only the final invariant
assertion:

1. `sealed capture has no registration after sweeper and no-job
recovery` — freshtitles no-job-after-seal fix, no PR yet.
2. `successful re-upload remains failed and outside custody` —
freshtitles failed-upload retry fix, no PR yet.
3. `finalization completed with zero batch results and no re-armed
generation` — ordering fix from lead ruling `a50c5b`, no PR yet.
4. `conversation completed while audio was open and its upload session
remained pending` — ordering fix from `a50c5b`, no PR yet.

The ordering cases use real durable admission, leases, fanout and
completion. Result arrival must leave actionable finalization or a new
generation; stranded leases/failures and stale conversation projections
do not satisfy the invariant.

Lead ruling `1c8084` preserves the green dead-producer control: supplied
incident evidence contains aggregate counts without the leaking token
payload shape. The original fleet shape remains unproven; no failure is
manufactured.

## Review corrections and decision

Preserves the existing single-runner CI wiring contract; forwards only
supported lifecycle options; resolves relative state roots once; cleans
only owned automatic roots on refusal; retains caller roots/diagnostics;
reserves bounded producers before suspension; and checks reservation
identity before cancellation cleanup. Boundary selectors explicitly have
conversation scope, while legacy session-write selectors retain their
four-field contract.

Both Luna reports remain `FIX-FIRST`. The sole remaining round-2 P2 was
manually reviewed and closed by lead `uicleanup` in ruling `cf4b50`.
After the current-main admission promotion, ruling `4894ba` extends that
closure to exact `ce5e8dca`, authorizing merge only after fresh CI is
green/CLEAN, with no round 3. Ruling `1da2bd` extends the same closure
to exact `38a04386`: the lead verified a pure main merge and
byte-unchanged simulator/unit test; fresh CI green/CLEAN remains
required. No Luna `SHIP` verdict is fabricated.

## UI evidence

UI-Evidence: none -- emulator test harness only

## Failure class (fixes)

Failure-Class: none

## New guards

The lifecycle incident exposed obligations lost at
seal/registration/admission and finalization ordering. This shared
simulator is WP-A's primitive for WP-B real-store invariant coverage,
with strict expected failures that cannot swallow fixture or transport
errors. No production repairs, GCP calls, user-data reads/writes,
feature flips or deploys occur in this PR.
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
## What changed and why

Harden the lifecycle guards so an inventory refresh cannot hide a new
unstamped entry or an unmodeled state. Clearing a job and rebuilding it
from an alias now invalidates old deadline evidence; mutated aliases and
opaque patches cannot restore it. A separate census compares persisted
entries with the declarations for every deadline-bearing machine.
Positional setdefault values and literal aliases enter the
state-vocabulary check.

Valid stamped rebuilds, declared entries and debt-clearing exits remain
accepted. The existing span-only patch has a checked four-field return
contract with portable AST fingerprints; source changes, overlapping
keys and shadowed names fail the proof. This remains bounded source
analysis, not whole-program execution or runtime liveness acceptance.

Preserve the existing changed-file test coverage and select scheduler
regressions. Recognize actual PhaseMetrics instances using Gauge
suffixes declared by the real factory. Use the fresh-cohort BYOK gauge
queried by its page. The source audit at main563e6c240944 also removes
the two stale record_pending metric/page xfails supplied by #24595;
#24587's admission lease still leaves an overall pending-dwell deadline
gap.

The table has 54 rows and 66 remaining clause-specific gaps, plus 2 pure
synthetic ordering counterexamples (68 strict xfails). Expected failures
allow AssertionError only. The report tracks each remaining dependency;
simulator-backed transition/shadow/property rows remain B2 after merged
WP-A and rollout-owner go.

## Product invariants affected

none

## How it was verified

From the product checkout, use the durable file list in the workspace
evidence record:

```bash
unset GOOGLE_APPLICATION_CREDENTIALS CLOUDSDK_CONFIG CLOUDSDK_CORE_PROJECT CLOUDSDK_AUTH_ACCESS_TOKEN_FILE GOOGLE_CLOUD_PROJECT
export BACKEND_PYTEST_WORKERS=1
BACKEND_UNIT_TEST_FILE_LIST="$TASK_WORKSPACE_ROOT/data/run-2026-11-04-lifecycle-invariants/evidence/backend-unit-files.txt" "$TASK_WORKSPACE_ROOT/bin/omi-heavy" run -- nice -n 19 bash backend/test.sh
```

`TASK_WORKSPACE_ROOT` is the verified omi-workspace checkout. Dated
evidence: `data/run-2026-11-04-lifecycle-invariants/README.md`. The
six-file gate was rerun after integrating main through `c8304ee6e8cd`;
its two new finalization writers and bounded queued entry are
registered. A later main integration adds #24544's reviewed Home status
projection to the inventory. Before that one-value snapshot refresh, the
local writer suite reproduced exactly one failure for `home_read.py`;
afterward the unchanged six-file gate passes again.

With five cloud credential/project variables unset and one worker,
backend/test.sh passed 926 tests with 68 strict xfails across the two
lifecycle files and four existing selector/ratchet controls. The 23
targeted regression/control cases passed. The unmasked invariant run
produced exactly 68 AssertionErrors and 201 passes; the exact case set
matches 66 KNOWN_GAPS + 2 ordering cases, with no unexpected or CPU
guard failures. Timing and slot limits were unchanged.

Before the fixes, 12 review reproductions failed (3 setdefault cases,
clear+alias, 8 deadline-bearing states). An additional mutated
source-alias case also failed. Canonical patch-proof fingerprints match
under Python 3.11.15 and 3.14.6.

These are source/unit checks without network or GCP. Exact-head fullCI
and rollout-owner acceptance are required before merge.

## Tests

Payload writer/value/key/alias/duplicate inventory; state vocabulary;
all-class entry census; deadline mutation lifetime; verified patch
boundary; positive entry/rebuild/exit controls; selector coverage
preservation; source-defined metrics; clause-specific strict xfails;
pure synthetic ordering controls.

## UI evidence

UI-Evidence: none -- test infrastructure only

## Failure class (fixes)

Failure-Class: none

## New guards

Lifecycle source changes cannot silently add the covered payload forms,
persisted entries or literal state values without revisiting the
declared contract. Source-derived metrics stay tied to their committed
alert expressions.

## Tracking

Owner: lcinv. ANX card:lcinv-lifecycle-invariants under
capture/transcription. No product/.github/firmware/account-data changes
and no deploy needed.
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