Skip to content

feat(batch): per-route, per-language delivered share with a baseline alarm (SCA-2117) - #25262

Merged
Git-on-my-level merged 10 commits into
mainfrom
agent/m1-studio-opencode-deepseek-v4/627328b52b9a
Nov 14, 2026
Merged

Git-on-my-level merged 10 commits into
mainfrom
agent/m1-studio-opencode-deepseek-v4/627328b52b9a

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

The 2026-11-13 Japanese provider-STT miss went unseen for about a week because every batch delivery signal was fleet-wide or counted from the commit side. A provider unit that never leaves vendor_held has no result row, so a commit-based ratio cannot see it. This adds the missing signal: of recordings admitted, the share whose transcript reached the user within the 5-minute target, split by STT route and language, with a per-language baseline alarm.

Contract

Done-true

  • Backfilled data shows the 2026-11-13 Japanese dip on the Japanese row:
    python -m scripts.batch_pipeline_delivered_share_report --project based-hardware --from 2026-11-13T00:00Z --to 2026-11-14T00:00Z --step 900 --baseline-from 2026-11-06T00:00Z --baseline-to 2026-11-12T00:00Z
    prints the per-cell table and the firing cells.
  • The alarm fires in a drill: python -m scripts.batch_pipeline_delivered_share_report --drill runs the hermetic simulator healthy and with the Japanese provider route down, prints provider/ja 36/36 1.000 then 0/36 0.000, and reports FIRING provider/ja. Pinned by tests/unit/test_batch_pipeline_delivered_share_contract.py.
  • Core Features gains the row Did the user get a transcript? reading the new gauges.

Production acceptance belongs to the release owner after independent exact-head review: retained 2026-11-13 Japanese dip, deployed Core Features signal read, and live alarm drill. The synthetic drill does not close acceptance. No additional production reads until the operator query budget is declared.

Must-not-change

  • Admission, merge order, projection order, delivery, retention and privacy are unchanged. ProjectionStore.acknowledge already updates the result row and already reads the job row; this adds one job write carrying a first-delivery timestamp and a boolean. No new transaction, retry or fence.
  • enqueued_at, stt_route, policy and projection_binding are only read.
  • No transcript, audio, user id or email is read, stored, printed or exported. The sample reads job metadata only; the report prints counts.
  • Missing, failed or empty samples never produce a healthy zero. A failed page clears counts and ratio; counts expire at scrape time after 600 s.
  • The Postgres batch store is untouched: monitoring-only read of the Firestore job namespace the serving leader already owns.

New state and its readers

Field Writer Readers
jobs.delivered_at ProjectionStore.acknowledge, same transaction as projection_state=completed utils/batch_pipeline/delivered_share, the report script
jobs.delivered_in_target same same; only True is a positive delivery signal

Both are additive. Rows written before this change carry neither, so the live share reads zero delivery for one cohort after deploy and then recovers. No older reader selects an unknown field. Rollback is a revert; the fields become inert.

Tuning

MIN_VOLUME new: 20 admitted units per 15-minute cohort. No prior value existed because this cell is new; below the floor the alarm cannot fire, and the drill's 36-unit Japanese cohort clears it.

Sampling cost

delivered_share_page walks {namespace}_jobs for the census vocabulary minus record_pending, admitted 20 to 5 minutes ago, ordered by enqueued_at, capped at 5,000 metadata rows. One page per 300 s on the maintenance leader. The at-cap cost is 1,440,000 reads/day/environment; the normal 2026-11 cohort is ~2,800 units (~800k/day). The read budget is declared in .github/firestore-collection-budgets.json. A saturated page sets omi_batch_pipeline_delivered_share_truncated and covers the oldest rows only.

BATCH_PIPELINE_DELIVERED_SHARE_ENABLED=off (also false/0/no) stops the page and hides every gauge. Default on, helper-backed, with a flag-budget entry.

Alert

omi-batch-delivered-share-language (agent tier, 30m pending, omi-tier-silent): a cell fires when its share is below 70% of its own 7-day peak while at least 20 units were admitted in the cohort. The peak, not an average, keeps a sustained dip from lowering the baseline under itself for the length of the outage; after seven days of a total outage the baseline decays and the runbook requires a human update.

Verification

Local unit tests: query shape and driver registration, aggregation, language/route bounding, delivery stamp (including replay stickiness), acknowledge job write, collector cadence/expiry/kill switch, backfill receipt fallback, alert and dashboard contracts, flag budget, Firestore index manifest, and the hermetic drill.

Failure-Class: none

View guided diff Turn on auto-fix

Review fixes under SCA-2249

The exact-head review at 6fe54735a2 found that configurable backfill steps could overlap or skip the fixed 900-second query cohort, and that selecting whole receipt-part maps exceeded the declared metadata boundary. This revision rejects every step except 900 and requires nonempty target and baseline ranges aligned to UTC quarter hours before creating a client. Historical cohorts count [start, end), including boundary admissions exactly once.

Receipt reads select only completion state, summary persisted timestamp and part count. A legacy completed receipt without a summary timestamp gets a second read selecting explicit projection_parts.<index>.persisted_at leaves. Part keys are numeric strings, so the literal projection_parts.persisted_at mask would miss them. Unsupported counts or incomplete timestamp leaves abort the report. The declared upper bound is now two result reads per unstamped job; no conversation/speaker identifiers, whole receipt maps, audio or transcript payloads are selected. The operator must still declare the full target and baseline query budget before production reads.

The failed CI shards on 6fe54735a2 were diagnosed from run 43602269386:

  • Shard 7/8: the newly appended combined alert object lacked the split export's indentation, violating the existing byte-identity contract. Copied its exact split representation; alert semantics are unchanged.
  • Shard 4/8: assertions passed, but cold projection-fixture setup consumed 1.06 seconds in the test call, exceeding the existing 1-second CPU guard. Setup now uses a pytest fixture. The same real acknowledge/replay operations and all assertions remain, with no duration-limit or allowlist change.

Focused validation for 6cfd272d0976487db4e13b944788fd544e25e6a5: 36 backfill contract tests (including the simulator drill), 17 delivered-share tests, and 8 notification contract tests passed. The acknowledge test also passed in isolation with the CPU guard enabled. Tests pin rejected steps/partial target and baseline windows before client creation, adjacent-cohort boundaries, SDK field-mask projection excluding unrelated receipt fields, and fail-closed incomplete legacy receipts.

SCA-2249's posted ruling is to fix exactly these findings and ship without another review; it does not waive production acceptance. No manual nightly/whole-CI rerun, production read, credential change, merge or deployment was performed. Release-owner acceptance remains the retained 2026-11-13 Japanese dip, deployed Core Features signal and live alarm drill. Preserve blocked state until those are evidenced.

Push validation: all selected preflight checks, type checking (zero errors), and the bounded pre-push gate passed on 6cfd272d0976487db4e13b944788fd544e25e6a5 using the locked worktree environment with no gate overrides. GitHub reports the published head mergeable; its new CI run is not used as production acceptance.

Current-main integration correction

CI run 43607943059 failed shard 3/8 at test_budget_file_declares_scope_and_count: its merged test tree contained 284 flag names but declared 283. Both branch and main separately declared 283 names correctly; a clean merge-tree reproduction confirmed that the independent additions combined without updating the shared count. Merged main ef42ee8f44e0dd47afd4f2f2e583716499be45be without conflicts and reconciled the count to 284. All 24 flag-budget tests pass. No test or budget threshold was weakened. The SCA-2249 review ruling and release-owned production acceptance remain unchanged.

Published head 3a2e440054677906ff438257f69fa76427375f70: normal selected preflight, type checking, and bounded pre-push gate passed without overrides. GitHub reports this head mergeable. New CI results have not been collected. Hold renewed through 2026-11-14T18:00:00Z for release-owner production acceptance.

Git-on-my-level and others added 10 commits November 13, 2026 23:39
…alarm (SCA-2117)

The 2026-11-13 Japanese provider-STT miss went unseen for about a week because
every batch delivery signal was fleet-wide or counted from the commit side. A
provider unit that never leaves vendor_held has no result row, so a commit-based
ratio cannot see it.

- ProjectionStore.acknowledge stamps jobs.delivered_at and
  jobs.delivered_in_target in the transaction that sets projection_state=completed.
  The job row is already read by the session; the stamp is sticky on replay.
- database/batch_pipeline_delivered_share walks one bounded job-metadata page
  (census states minus record_pending, admitted 20 to 5 minutes ago, capped at
  5,000 rows) and utils/batch_pipeline/delivered_share publishes the per-cell
  ratio, admitted and delivered counts, truncation and sample age on the
  maintenance leader every 300 s.
- Core Features gains the 'Did the user get a transcript?' row; Grafana rule
  omi-batch-delivered-share-language fires when a cell falls below 70% of its
  own 7-day peak with at least 20 admitted units.
- scripts/batch_pipeline_delivered_share_report backfills a past window from
  retained results and runs a hermetic drill that shows the Japanese dip and
  fires the alarm.

Measurement only: no admission, merge, projection order, retention or privacy
behaviour changes. BATCH_PIPELINE_DELIVERED_SHARE_ENABLED=off stops the page.
…CA-2117)

Review finding 1: the cohort page streamed full job documents, which carry
owner_id, owner_key, conversation_id, projection_binding ids and result.audio_uri,
while the change note claimed no user id is read. The query now projects
segment_id, enqueued_at, state, stt_route, policy.stt_route,
projection_binding.language, delivered_in_target and delivered_at, so the claim
is true and the page payload shrinks.

Also drops the unused ROUTES and BASELINE_SECONDS constants (the rule's 7-day
range is pinned by the contract test) and states the 20-unit/15-minute volume
floor in the runbook.
Bind baseline arguments to the fields consumed by the report, reject partial baselines before reads, and restrict result reads to receipt fields. Exercise the actual CLI with and without baseline windows.

Failure-Class: none
Co-authored-by: multica-agent <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit c5cf5a2 into main Nov 14, 2026
73 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m1-studio-opencode-deepseek-v4/627328b52b9a branch November 14, 2026 16:04
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