Skip to content

test(backend): recognize fresh BYOK lifecycle gauge - #24605

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/lcalarm-inventory
Nov 4, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/lcalarm-inventory

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

The merged lifecycle table still binds the BYOK dwell page to the legacy all-age gauge. #24595 correctly changed that page to the recent-cohort gauge so importing it does not page on known backlog. Their combination leaves main's lifecycle invariant checks red.

This test-only correction points the table at omi_finalization_byok_new_oldest_age_seconds. The AST inventory now derives gauge names from literal PhaseMetrics instances and the real factory's Gauge suffixes. A negative test rejects a prefix not instantiated as PhaseMetrics and a suffix absent from the factory. Every existing assertion and strict expected-failure declaration stays in place.

Only two B1 test/support files change. No runtime code, alert threshold, workflow, production access or deployment changes. Coordinated with B1 owner lcinv for #24600. uicleanup requested this standalone priority fix in ruling4d1372 and explicitly waived Luna review for this test-only delta; lead2 owns merge on green.

Validation: in a fresh worktree based on current main 563e6c240944, canonical backend/test.sh with the explicit two-file list passed 429 tests with 79 inherited strict expected failures at head eaa1316e1624. The same patch also passed 430 tests in the PR2 tree (one additional source-inventory case there). Guarded push passed full preflight and its selected backend unit gate (143 passed,79 inherited strict expected failures). All local checks/push used omi-heavy run -- nice -n 19 with the five GCP credential/project variables unset. Current-head CI is pending. No runtime validation is claimed.

Initiative: capture/transcription/speakers
Failure-Class: none

View guided diff Turn on auto-fix

Use the recent-cohort metric queried by the merged BYOK dwell page.
Expand actual PhaseMetrics instances from source-declared Gauge suffixes,
and reject invented prefixes and suffixes without weakening assertions.

Scoped B1 integration authorized by rulings 6cac95 and cf1a59.
@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-04T14:04:45.036989Z eaa1316 PR opened
ℹ️ 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.

@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.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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

Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
Integrate the seal-repair scheduling fix and current speaker changes before
the final PR2 validation and publication. Preserve the scoped BYOK test
correction shared with priority PR #24605.
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
Build PR2 on the exact standalone #24605 head while lead2 owns its green
merge. The equivalent test correction is already present; preserve the
validated source tree and make the parent relationship explicit.
@Git-on-my-level
Git-on-my-level merged commit 6cf56c7 into main Nov 4, 2026
73 of 75 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/lcalarm-inventory branch November 4, 2026 14:22
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
Import main6cf56c7e unchanged after #24605 fixes the pre-existing BYOK metric
inventory failure. Keep WP-A scoped to its test harness and fixtures.
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 5, 2026
#24609)

WP-C alarms 3+4, following #24595 and built on the exact test-only
correction in #24605.

The finalization observer rotates through three indexed domains: active
jobs, queued mirrors and processing conversations. Each domain retains
its own last bounded page and observation clock. A full jobs page cannot
starve the mirror domains, and another domain's zero cannot reset an
ongoing mismatch. Page, stock and blind queries select the newest
successful observer for each domain before aggregating values, so a
later clear supersedes an older replica's bad snapshot even when
leadership changes between services.

Page only when a retained page has more than 25 recent-job mismatches
for 30 minutes. The job creation timestamp must be within 24 hours and
at or after 2026-11-04 09:27Z. Historical mismatch stock remains agent
tier. A 35-minute freshness budget covers the nominal 15-minute rotation
and the existing bridge delay. Stale checks the freshest observer of
every domain; stale/blind companions and all new UIDs are in the
existing import gate. Rules use the already-triggered resilience JSON;
no workflow edit is needed.

The second alarm reports agent-tier active summary_repair=true stock,
using COUNT capped at 101 to prove stock above 100. It does not claim to
measure retry attempts or cap hits: no numeric retry cap exists in the
source. This is the approved substitute in ruling4256d5.

Read budget and coverage:
- One leader-leased private coordination record; at least 300 seconds
between admitted passes, a 120-second owner lease and one transaction
attempt. Recheck ownership before publishing the cursor or metrics.
- At most 200 source documents, 200 distinct counterparts and two
lease/cursor reads: 402 documents per admitted pass. Three bounded
cursors rotate after every page, including full pages.
- At most 288 admitted passes per day gives a ceiling of 115,776
document reads and 576 state writes, plus up to 288 denied lease reads
per calling observer. These are bounds, not measured spend.
- Only current users/{uid}/conversations/{cid} mirrors count. Exclude
deleted, discarded, merged, deferred and superseded mirrors; skip nested
archives while advancing their cursor. No identifiers enter logs or
metric labels.
- Counts describe a bounded page, not fleet totals. Full pages and
unknown clocks mark incomplete coverage. Missing-job cases cannot prove
fresh entry and stay stock-only. Settled terminal history and processing
rows without job links are outside coverage; sparse drift across pages
can stay below threshold.

Missing clocks, sparse coverage and the actual retry-cap policy remain
owner uicleanup under card:lcalarm-lifecycle-alarms, next 2026-11-04
18:00Z. The observer performs no repair, notification, deletion or
admission/retry leak fix. No live.py or serving.py changes.

Validation: canonical backend/test.sh with the explicit 32-file
integration list passed 1,443 tests with 79 inherited strict expected
failures and three existing monitoring skips at c65d7c1
(source-identical to first published head e34b389). That head's
guarded push passed full preflight, 829 Firestore guards, type checking
and 330 selected backend tests. Luna R1 then identified the
stale-replica false page. The real Prometheus engine regression fails
against those old expressions and passes after correction c3f972d,
including a newer clear, continuing drift, independent legs, stale data
and absent observers. The focused 23-file monitoring/semantic shard
passes 579 tests with three existing skips. The optional engine test
takes PROMTOOL_BIN and performs no download/network/server startup; CI
explicitly skips that engine check if the binary is absent, while
always-on contracts pin the reviewed query. Local correction validation
and its guarded push provide the real engine proof. CI state remains
authoritative in the PR checks; the final independent review is
delta-only under the two-round limit. Every local check/push uses
default omi-heavy run -- nice -n 19 and scrubs the five GCP
credential/project variables. No GCP calls or live validation.

Deploy needed: reconcile the added repair composite and
conversation-group field index; backend/listen and sync emitter train
including the revision-local GMP profile; then existing
metrics-egress/Grafana import. Lead owns every merge and deployment.
Current-head CI must supply stack proof under ruling39e8fe's local
teardown limitation.

Initiative: capture/transcription/speakers
Failure-Class: none

Line-Count-Exception: backend/database/firestore_index_registry.py |
2284 -> 2285 | Register the conversation group field index for the
bounded pair census beside its existing owner.
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