Skip to content

test(backend): give the notes-loop deadline test a 0.5s real-clock budget - #23013

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/structure-timeout-real-clock
Oct 21, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/structure-timeout-real-clock

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes main-red "Backend unit guardrails". It has been failing since #22226 (76fee8d), because test_first_attempt_past_the_per_attempt_deadline_still_summarizes patched CONVERSATION_STRUCTURE_TIMEOUT_SECONDS to 0.1s. That is below the 0.5s floor enforced by test_real_clock_budget_ratchet.

The test now uses a 0.5s per-attempt deadline and a 0.75s slow turn. It still proves the same thing: a turn past one per-attempt deadline, but inside the mount's 3× recovery budget, still summarizes. There's no skip, quarantine or allowlist entry.

Verification

  • backend/test.sh over test_conversation_structure_provider_timeout.py and test_real_clock_budget_ratchet.py: 12 passed.

Product invariants affected

None. This is a test-only change.

UI-Evidence: none -- test only

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…dget

#22226's test patched CONVERSATION_STRUCTURE_TIMEOUT_SECONDS to 0.1s, under the
real-clock ratchet's 0.5s floor, turning Backend unit guardrails red on main.
Scale the per-attempt deadline to 0.5s and the slow turn to 0.75s: still past
one attempt and inside the mount's 3x recovery budget.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-10-21T09:19:02.914568Z 1f62393 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.

@Git-on-my-level
Git-on-my-level merged commit 62dc193 into main Oct 21, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/structure-timeout-real-clock branch October 21, 2026 09:40
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
Picks up #23013, which fixes the known-red real-clock budget ratchet on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
Git-on-my-level added a commit that referenced this pull request Oct 21, 2026
…eline (off by default) (#23003)

Legacy-served real uploads can now exercise the record pipeline without
projecting or charging anything to the user. This catches empty-audio
and held-recovery outcomes before the live ramp, using an independent
owner-hash cohort and idle capacity in the existing GPU fleet.

- Ship off: `BATCH_PIPELINE_SHADOW_PERCENT=0`. The lead enables 10%
after the carrying train and watches the first hour; zero stops new
GPU/paid work.
- Shadow jobs never claim the legacy ledger, Redis progress/locks, owner
scheduler rings or conversation documents. The shadow flag fences
projection/publication, user allowance/accounting, live reuse and result
persistence. Transcripts stay in memory; terminal records contain only
hashed-owner outcomes. Audio retains owner encryption, privacy checks
and bounded cleanup.
- At most four idle offers use the existing pool. Busy/expired offers
drop instead of entering a backlog. Shadow never waits behind ordinary
GPU work; paid recovery runs outside pump lanes.
- `BATCH_PIPELINE_SHADOW_PAID_RECOVERY_PER_HOUR=200` is an atomic shared
UTC-hour cap across Modulate and Deepgram, with at-most-once provider
reservations per unit. Exhaustion or unavailable spend authority records
`shadow_paid_skipped` / outcome `paid_skipped`.
- V1 inline uploads and V2 legacy claims use the same isolated handoff.
The CPU env manifest and Helm chart expose the off/capped settings.
Worker-only `BATCH_PIPELINE_SHADOW_RECOVERY_API_URL` targets the
existing recovery role, with its OIDC audience and the GPU principal, so
the terminal policy matches the record lane.

Readout contract:

-
`omi_batch_shadow_outcome_total{outcome=recovered|empty|failed_held|error|dropped|paid_skipped,class=fresh|recent|deep}`
- `omi_batch_shadow_speech_seconds_total{vad=worker|strict,class}`
- `omi_batch_shadow_speech_loss_seconds_total{vad=worker|strict,class}`
(whole-unit VAD speech when no words survive)
- `omi_batch_shadow_gpu_seconds_total`
- `omi_batch_shadow_paid_calls_total{provider=modulate|deepgram}`
-
`omi_batch_shadow_paid_audio_seconds_total{provider=modulate|deepgram}`

Owner concentration comes from hashed `owner_key` terminal records /
`event=batch_shadow_outcome owner_hash=...` logs, never a Prometheus
owner label. The lead owns workspace `fleet_gate.sh --shadow`.

At 10%, no extra GPU nodes are requested. Accepted audio depends on
owner concentration and idle drops. As a conditional list-price
scenario, per 100 eligible audio-hours, 10 shadow hours with 5% Modulate
and 1% Deepgram duration cost about $0.0462 in paid recovery;
all-duration two-provider recovery costs $3.42. The default 200-call
shared cap and <=1h units give a conservative $62.40/hour list-price
ceiling, not a measured vendor bill. Actual Modulate/Deepgram usage must
be reconciled during the first hour. Rates, assumptions, retention and
rollback are documented in
[batch-pipeline-shadow.md](backend/docs/batch-pipeline-shadow.md).

Services for the lead's train: backend sync upload hosts, the existing
batch API/recovery target, batch-pipeline-worker, and
backend/integration hosts that own shared deletion/retention. Carry the
sync GMP collector config, which now retains the six shadow counters.
Apply the four added shadow job/spend TTL policies using the existing
retention operator tool. This PR does not deploy or enable the cohort.
Lead ruling `dbc28b` requires staging-soak synthetic-corpus
qualification on isolated staging (zero user-visible writes, cap, load
drop) before production 10%.

Validation:

- Final 22-file suite: 945 focused unit/ASGI tests passed through
`omi-heavy run -- nice -n 19 env BACKEND_UNIT_TEST_FILE_LIST=... bash
backend/test.sh` after syncing main: real WAL decode and encrypted
staging preserve legacy files; full worker path discards transcripts;
private recovery route never publishes; cohort, cap, duplicate, kill,
admission/load-drop and collector-retention cases.
- `omi-heavy run -- nice -n 19 make runtime-image-source-closure`: all
19 registered images passed.
- Real loopback Firestore emulator: all 3 concurrency tests passed
(shared cap across replicas, duplicate-provider reservation, two
uploads/one offer). No real GPU/provider invocation is claimed.
- Grok full review and delta review completed; all reported findings
addressed. R2's integration-role identity blocker is fixed and rendered
principal/audience tests pass. Under the swarm's two-round cap, lead
ruling `fc7e19` accepted the fixed delta with no third round, merge on
green CI.
- `make preflight` and metadata-only preflight pass on the merged head
(after the shadow admission clients moved onto the database executor).
The pre-push backend pyright lane then caught three shadow-module type
errors; the type-only fix gives 0 errors, the 22-file suite passes
again, and the full pre-push gate passed on the pushed head.
- CI backend shards 4 and 5 then failed 22 sync upload tests with a 500:
once tests replace `utils.sync` in `sys.modules`, the handler's lazy
`shadow_intake` import raised. Both v1/v2 handoffs now go through one
best-effort wrapper that logs `event=batch_shadow_intake outcome=error`
and continues, so the shadow can never fail a legacy upload.
`test_sync_cloud_tasks.py` (187) and `test_sync_v2.py` (182) pass with
the 22-file suite; pyright 0 errors.
- CI on the main-merged head then surfaced three more gaps, all fixed:
live jobs persisted a meaningless `shadow: false` (changing the
`deleted_merged_targets` golden), so live job documents now omit it and
stay identical to main; the six shadow fire-and-forget sites are
baselined in the background-task ratchet with their SIGKILL-safety
reasons; the cohort migration tool inventories `batch-pipeline-shadow`
as legacy-all (no env allowlist ever existed). 60 backend unit files
(all `test_batch_pipeline*`, the CI-failing files and the earlier suite)
pass; pyright 0 errors.
- Known-red on main (`Backend unit guardrails` real-clock ratchet) was
fixed by #23013 and merged in.
- Follow-up under lead ruling `eab308`: once #23004 merges, apply the
shared heavy-owner exclusion predicate (`batch_ramp_owner_load_v1`)
before new shadow offers. Shadow-informed 30-minute holds count only
matched-population windows after that.
- No production account reads, GCP tier, deployment or live acceptance
claimed.

Process exceptions:

- Cross-lane contract publication (`swarm/contracts.md`) came after
implementation rather than before; final rows were published and the
consumer lane acknowledged them.
- Early heavy checks overlapped before the final serial validation.
- Source inspection surfaced an existing allowlist fixture identifier in
tool output. It is not repeated here and was not a production account
read.
- The original agent died on a model-capacity error mid-lane; a resume
agent finished checks and publication from the committed state.

Product invariants affected: INV-MEM-4. The changed runtime manifest
enables no memory route; shadow publication fences prevent canonical
intake or promotion from this experiment.

Line-Count-Exception: backend/routers/sync.py | 3826 -> 3863 | Keep the
minimal best-effort v1/v2 handoffs at the legacy ownership seams; the
implementation lives in dedicated shadow modules.

🤖 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