Repository navigation
pipeline lab: one local front door for capture → Finish → Home (scenarios, Home route, audio, isolation, view, CI) - #26303
Conversation
A declarative JSON scenario (origins, batch-lane recordings with sessions, stream gaps, scripted synthetic speech, transcript landing, a Finish tap with fast finish, device-sync fragments, env overlay, expectations) runs through the real v3 code on a local emulator in under a minute: python -m testing.pipeline_lab scenario run <file|name>... Events feed the unchanged v3 driver. Real code: capture admission, the Finish branch (retrieve_in_progress_conversation, finish_live_window), _manual_finish_admitted -> promote_manual_end -> fast_finish.run with its privacy fence and writer, transcript writes and wakes, reconcile/planner/ notes/Home visibility. Stand-ins (capture-close job, record admission, batch projection, sync intake) are counted per run and listed in the README with follow-ups. Committed scenarios: finish_after_reconnect_late_transcript (SCA-4385 shape, expected failure on main) and finish_single_recording_fast (passes). Slice 2 importer design in scenario/IMPORTER.md. No production code changes. Refs SCA-4386, SCA-4385 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd67d5e16d
ℹ️ 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".
| if rec.lane == 'batch' and rec.audio[0] <= self.finish.at < rec.audio[1]: | ||
| return rec |
There was a problem hiding this comment.
Determine the Finish target from capture sealing time
When Finish lands after the last audio but before sealed_at, this returns no target even though the runner still has an in_progress recording: _on_seal is what changes its status to completed, so _on_finish selects that recording. Consequently, admission_offset ignores the configured provisional latency and schedules admission at seal plus the default lag instead. For example, audio [0, 40], seal at 50, Finish at 42, and latency 30 schedules the fast transcript at 55 rather than 72, potentially producing incorrect checkpoint verdicts. Use the same capture-open boundary and tie ordering as the event handlers when identifying the target.
Useful? React with 👍 / 👎.
|
|
||
| @property | ||
| def doc_id(self) -> str: | ||
| return 'scn-' + self.label.lower() |
There was a problem hiding this comment.
Prevent case-distinct recording labels from sharing a document
A scenario containing recording labels A and a passes validation because labels permit both cases and the uniqueness check is case-sensitive, but both recordings receive the document ID scn-a. The event handlers consequently write both recordings into the same Firestore document, and Scenario.label_of resolves both to the first label. This silently corrupts the replay and its recording-membership checks rather than rejecting the scenario. Preserve case in document IDs or reject labels whose normalized document IDs collide, including collisions across batch and sync recordings.
Useful? React with 👍 / 👎.
…ever-lands Finish scenarios - ScenarioOps writes external_data.recording_origin_id on batch rows, as listen stamps every generation of one client recording, so the v3 reconnect rule (same origin, new session, same device) is exercised. - finish_after_long_reconnect_gap: the incident's capture with a 360 s stream gap, longer than the 300 s silence gap; only the reconnect rule joins A and B. - finish_transcript_never_lands: fast finish off and B's batch transcript never lands (from the review of #26304); the cut must survive the Finish wait. Both are strict expected failures on main until the v3-finish-late-predecessor fix (#26304) lands. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An aged sync fragment that lands before the Finish cut is stored locks by the ordinary lock delay, a separate rule; the scenario keeps to A and B. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… is not silence (#26304) ## Problem (SCA-4385) The user talked without a pause. The phone lost the stream for about a minute and reconnected, which made recording B in the same capture origin (`external_data.recording_origin_id`) with a new session. The user then tapped Finish. B's fast-finish provisional transcript landed first, and its stored `v3_manual_end` cut and locked the window around B plus a device-sync fragment F. Recording A's batch transcript landed about 15 s later, before the locked window's start. `preserve_finished_windows` turned A's speech into its own finished, non-manual window. That window fell under the Home word floor and was hidden, so the Finish conversation showed only the tail. Root cause, cited at base `571b000f3de`: - `backend/utils/conversations/v3/outline.py:138,173`: the cut applies as soon as `cut <= now`, whether or not the speech before it has landed. `:194` then locks the group. - `backend/utils/conversations/v3/planner.py:732,766-777`: the late lines of A belong to no row (A has no claims on the locked row). A `_keep_unmatched_together` window flushes them as a fresh window with `manual_end=False, finished=True`, because they do not reach the window's last line. - `backend/utils/conversations/v3/visibility.py:35`: that window is finished, not manual, and under the word floor, so it is hidden as `below_word_minimum`. A second shape of the same bug: if a reconcile runs before the Finish recording's own transcript lands (for example the sync fragment lands first), the cut locks the window around the fragment alone. ## Change Kill switch `CONVERSATIONS_V3_CAPTURE_CONTINUITY`, default on, read by the live builder only (backfill and re-derive never use it). 1. **A reconnect gap is not silence** (`outline.reconnected`, `outline.stream_gap`). - Two recordings are one continuing capture only when the rows prove a reconnect: - the same capture origin; - a different `recording_session_id`; - the same `client_device_id` whenever both rows name one. - The unrecorded interval between them, up to 10 minutes (`outline.CAPTURE_GAP_LIMIT`), no longer counts toward the silence gap. - Recorded silence inside either recording still counts. - Ten minutes is twice the default silence gap. That covers an app reconnect (the incident's gap was 64 s; listen's reconnect grace is 120 s) and keeps an hour-later resume under a reused origin apart. 2. **The cut waits for speech that joins it** (`outline._held_cuts`). A manual-end cut is held while one of these has no transcript yet (`policy.awaiting_batch_transcript`: batch lane, sealed, no `record_projection_revision`, no segments, no failure receipt): - its own recording, or - a batch recording that starts before the Finish recording, was sealed at or before the Finish recording's seal, and joins the finished speech, either within the silence gap of it or as the capture the Finish recording reconnects. 3. **A held cut stays a boundary.** It is never dropped while it waits: - The window it closes stays open (not locked, not finished, no notes), whatever its age. - Speech at or after the cut is not planned yet, so a later Finish can never join across it. - The awaited recordings' audio spans keep their place in the grouping as placeholders, never emitted as lines. - The held recordings stay pending: `v3_pending_since` is set to the end of the wait, through `preview_wakes`. This keeps the cut durable even when the reconcile that saw it committed nothing else. - When the transcript lands, the cut applies to all of the speech at once. - The wait ends `policy.FINISH_WAIT` (5 min) after the cut, and the builder enqueues a wake for then. 4. **The loader finds predecessors it did not load** (`database/conversations_v3_finish_predecessors.attach`). See DESIGN for the read. Those rows are never loaded as sources. A single-recording Finish whose transcript has landed is unchanged: nothing is pending, so the cut applies on the same pass and notes start at once. The Home word floor is untouched, and no test depends on its value. ## Review findings (REQUEST CHANGES on cdaa305) | finding | fix | commits | regression tests | |---|---|---|---| | P1: a Finish disappears when its own transcript never lands | The held recordings stay pending until the hold's end. The cut is re-derived from the stored `v3_manual_end` on every pass. | 0793d44 | `test_a_finish_whose_own_transcript_never_lands_keeps_its_cut_through_the_wait` (production loading); lab `finish_transcript_never_lands` | | P1: the hold still allowed locking and joins across two Finishes | The cut stays a partition boundary. Its pre-cut window stays open; post-cut speech is deferred. | 0793d44, b2d3c47 | `test_the_window_a_held_cut_closes_does_not_lock_by_age`, `test_a_held_cut_never_joins_the_next_finish`, `test_a_held_cut_stays_a_boundary_and_later_speech_waits`, `test_a_held_cut_keeps_open_only_the_window_its_speech_joins`, `test_awaited_speech_bridges_the_window_it_will_join` | | P2: a recording that cannot join delayed the first summary | A candidate must start before the Finish recording and join by silence gap or proven reconnect. | 0793d44 | `test_a_predecessor_the_gap_rule_separates_never_holds` (45-min same origin), `test_a_recording_that_starts_after_the_finish_recording_never_holds` | | P2: read bound per cut per load; `limit(8)` starvation | The query uses the origin's lineage index, bounded on both sides, and is skipped for a settled cut. DESIGN states the per-Finish worst case. | 0793d44 | `test_the_loader_reads_one_capture_origin_within_the_reconnect_bound`, `test_incident_with_production_loading_finds_the_unloaded_predecessor` | | P3: the gap rule needed reconnect evidence; lab rows lacked an origin | Evidence is required: same origin, new session, same device. The bound is 10 min. Lab batch rows name the origin, and there is a new 6-minute-gap scenario. | 0793d44; lab follow-up PR (stacked on #26303) | `test_a_reconnect_gap_is_not_silence`, `test_a_far_predecessor_holds_the_cut_only_when_the_finish_reconnects_it`; lab `finish_after_long_reconnect_gap` | The five reviewer probes (`/tmp/omi-review-26304-cases/test_review_probes.py`) each pinned a defect. On this head, each one fails at the assertion that pinned it. ## DESIGN: - **Reads.** - **When the read runs.** Only for a loaded manual-end recording that: - has a capture origin; - has a cut within `FINISH_WAIT` (5 min); - is not yet settled into a locked manual-end conversation. - It never runs when no Finish is fresh, and it is skipped with the switch off. - **The query.** One per such recording per builder pass: - collection `users/{uid}/conversations`; - filters `external_data.recording_origin_id ==` origin, `started_at <=` the Finish recording's start, and `finished_at >=` its start minus 10 min; - order `started_at DESC, finished_at DESC`, `limit 8`, projected to 16 metadata fields; - served by the existing `conversations_recording_lineage` composite index (query-shape guard `served: true`; no new index). - **Cost.** - Per pass: at most 8 documents per fresh Finish. A query that matches nothing is billed 1 read. - **Per Finish:** the query repeats on each pass until the cut settles or the wait ends. The passes in the wait come from the Finish's own landings, the per-minute named reconcile tasks and the hold-expiry wake (at most 7 task names), and each task runs at most 3 passes. The true worst case is 7 x 3 x 8 = **168 documents per Finish**. - Usual case: 2-3 passes (the Finish landing, the predecessor landing, then the cut settles), so 2-24 documents. - Two fresh Finishes loaded together each add their own query. - **Starvation.** A pending predecessor can only be crowded out by eight newer generations of the same origin, each of which ended within 10 min of the Finish. In that case it lands late as it does today. - The existing per-pass loads are unchanged. - **Writes.** - No new fields. - Held recordings keep `v3_pending` with `v3_pending_since` at the hold's end, using the existing deferred-wake path. - A held pass writes the open window as any live pass does. When the predecessor lands, the cut pass writes one Finish row in place of two. - At most one extra named reconcile task per held Finish, at the hold's end. - **Model calls.** - None new. - The incident order loses one outline call and one notes run (the hidden fragment). - The Finish row's notes run once over all of its speech. - **The production number that proves it.** - The number is split Finishes: manual-end v3 Finish conversations that have a hidden, non-manual derived sibling fed by a recording of the same capture origin and starting within 5 min before the Finish row. - Read it on the owner account for 24 h after serving. Target: 0. Baseline: 1 on 2026-11-25 (this incident). - Secondary: `omi_conversations_v3_finish_held_total` should be nonzero when a reconnect precedes a Finish. - Secondary: `omi_conversations_v3_end_to_summary_seconds` p50 for manual finishes should not regress. A single-recording Finish takes no hold. - **Kill switch.** - `CONVERSATIONS_V3_CAPTURE_CONTINUITY=off` on the service that runs the v3 reconcile task (`backend-sync`). It restores the previous cut and silence rules and skips the predecessor read. It takes effect on the next pass. - `CONVERSATIONS_V3_BATCH_MANUAL_END=off` would disable batch Finish cuts entirely; no existing flag isolates this change. - **Rollback.** Set the switch `off`, or revert this merge. - Rows already written keep their boundaries. - Recordings left pending by a hold are reconciled normally on their next wake. - There is no migration. ## Evidence Unit tests: `tests/unit/test_conversations_v3_finish_late_predecessor.py`, 33 passed; 13 of them fail on cdaa305. - They run the real `service.reconcile` and `commit_projection` on the strict Firestore fixture at 300/300 and 900/3600 timing. - A production-loading harness uses the real pending-plus-closure load and the real `attach`. - **Incident order** (F, then B with the cut, then A): one Finish row holding A+B+F, manual_end, visible, locked. - Before the fix this produced the production shape, `[A] hidden below_word_minimum` plus `[F, B] manual_end`. - **Mutation pass:** 12 mutations of the hold, boundary, placeholder, reconnect-evidence, wake and loader rules. All 12 were caught. Command for the other tests: each file run in its own process via `bin/omi-heavy run -- .venv/bin/python -m pytest -q <file>`. - Every `test_conversations_v3_*`, `test_listen_v3_*`, `test_batch_projection_v3_admission`, `test_record_close_v3_contract` and `test_pipeline_lab_v3_*` file: 31 files, all passed. - Firestore guard set, all passed: - `test_firestore_query_shapes` 636; - `test_firestore_outside_query_contract` 31; - `test_firestore_index_oracle` 132; - `test_firestore_runtime_witnesses` 25; - `test_firestore_caller_witnesses` 41; - `test_firestore_read_site_attribution` 11. - Flag and config tests, 326 passed: `test_flag_budget`, `test_flag_docket_retirement`, `test_runtime_env_sources`, `test_config_refactor_w6`. `scripts/check_feature_flag_registry.py`: OK. Pipeline lab, synthetic: - Inputs: #26303 plus its origin follow-up, merged locally and not included here. The reviewer's `finish_reconnect_switch_off` was added for the run. - Command: `python -m testing.pipeline_lab scenario run finish_after_reconnect_late_transcript finish_single_recording_fast finish_after_long_reconnect_gap finish_transcript_never_lands finish_reconnect_switch_off`. | scenario | main + lab | this fix + lab | |---|---|---| | `finish_after_reconnect_late_transcript` | XFAIL: F+B manual (73 w); A hidden `below_word_minimum` (160 w) | XPASS: one row F+B+A (233 w, visible, manual_end) | | `finish_single_recording_fast` | PASSED | PASSED (unchanged) | | `finish_after_long_reconnect_gap` (6-min gap, longer than the silence gap) | XFAIL: A hidden; B alone | XPASS: B+A (230 w, visible, manual_end) | | `finish_transcript_never_lands` | XFAIL: F manual; A hidden | XPASS: F+A (163 w, visible, manual_end) | | `finish_reconnect_switch_off` (reviewer) | XFAIL | XFAIL (old split: the kill switch restores it) | With the three `expected_failure` blocks removed, all four scenarios pass (exit 0). If #26303 merges first, this PR deletes its scenario's `expected_failure` block and updates `tests/unit/test_pipeline_lab_scenario.py::test_incident_scenario_keeps_the_sca_4385_shape_and_expected_failure`. Line-Count-Exception: backend/database/conversations_v3.py | 1506 -> 1508 | the predecessor read lives in its own module (database/conversations_v3_finish_predecessors.py); the loader only gains its import and one call Line-Count-Exception: backend/utils/conversations/v3/service.py | 1498 -> 1506 | the builder passes the kill switch to the planner and enqueues the hold-expiry wake (8 lines); main grew this file past the ceiling after the branch point Not verified: - Production behaviour; nothing is deployed. - What the app shows while a cut is held. The derived row stays an open, live window until the predecessor's transcript lands, at most 5 min. Residuals: - If the predecessor's transcript lands after the 5-minute hold, it still forms a separate card. The late-join path into a locked manual-end row is not changed here. - A device-sync fragment that is already older than the lock delay and lands before the Finish recording's cut is stored can still lock by the ordinary rule. The hold starts once the cut is stored. The lab long-gap scenario therefore has no fragment. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…in' into lane/pipeline-lab-scenarios
…6304 - Incident scenarios: #26304 (6e3204f) landed, so the three SCA-4385 scenarios are plain passes; their expected_failure blocks are gone. - expected_failure names the labelled checks the known bug fails (`checks`); any other failing check is `failed`, not `xfail`. - Reconnect scenarios check membership, visibility and manual end in one expect row, so one Finish conversation must satisfy all of them. - finish_target() treats a batch recording as capturing from its first audio through its seal (tie order runs the tap before the seal) and picks the newest open one, as get_in_progress_conversation does; two open captures with the same start are refused as ambiguous. - Recording and origin ids must be unique ignoring case (they name documents). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b1346cf0d
ℹ️ 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".
| command = [sys.executable, '-m', 'testing.pipeline_lab.scenario.run', '--file', str(path), '--out', str(out)] | ||
| command += ['--clock', clock] | ||
| try: | ||
| done = subprocess.run(command, cwd=BACKEND, env=env, capture_output=True, text=True, timeout=timeout) |
There was a problem hiding this comment.
Resolve scenario paths before changing the child working directory
When the CLI is invoked outside backend with a relative scenario path, resolve() returns that path unchanged and validation succeeds in the caller's working directory, but this subprocess interprets it relative to BACKEND. For example, from the repository root with PYTHONPATH=backend, passing backend/testing/pipeline_lab/scenario/scenarios/finish_single_recording_fast.json points the child at a nonexistent backend/backend/... path, so a valid scenario errors instead of running. Convert input paths to absolute paths before passing them to the subprocess.
Useful? React with 👍 / 👎.
…eat, scenario stack and compare Each scenario process gets its own demo-lab-<run id> Firestore project, a leased Redis database (product bounded clients pointed at it through the lab env), its own blob root, and Typesense writes off; the reset clears only the leased database. Adds scenario stack up|down|status (shared stack with a pid file under the lab root), run.json/verdict.json, --repeat determinism and scenario compare. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tonic and loop time sim (tick=False) freezes the wall clock between driver sets. product_monotonic gives product callers (utils, database, ...) a monotonic and asyncio loop clock that follows the replay: frozen at the virtual instant for a per-event liveness grace (30 s real), then real-time so product polls still end. Late reads are counted. asyncio internals, threading, gRPC and the lab keep real time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rtifacts Allowlist of wall-clock fields (seconds, timings, window, stored_at, ms, cache_hit), random lab ids (llm_call_ids counted, run_id dropped), uuid4 renamed by first sight; compare_runs/semantic_diff report JSON paths only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Overlay model_config.v3.clock: tick restores the ticking clock. The run records its clock mode and late product monotonic reads in v3_driver.json. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The child loads stack/clock.py by path (never the ref's testing tree), freezes at the day's end and reports the clock it actually saw. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…twice, planpass twice) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…x, local recorder interface Cassettes record who produced their words; old cassettes read as vendor. A per-audio index lets a scenario find any cassette recorded for its file. Words may carry a confidence. cassette/local.py defines the local speech-to-text recorder interface and its registration. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uct decoding) record-local runs production's parakeet-tdt-0.6b-v3 checkpoint at ASR_REVISION on CPU through the product's pin_parakeet_decoding and ParakeetWords, in 30 s windows, keyed parakeet_local/...cpu-fp32 with source local. The model stack is an optional extra (requirements-local-stt.txt) in its own venv, never imported by the default lab. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…record-local) A recording or sync fragment may give audio_file instead of speech. Its words come from the STT cassette for that exact audio and pass through the batch or sync lane code (real PipelineWorker, projection_segments, retrieve_vad_segments) before the existing landing calls write them. The result names each transcript's cassette source and which steps were product code. Adds a committed synthetic say fixture, its synthetic cassette, and audio_single_recording_finish. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…header line Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_finish 286 KB, 8.9 s, 16 kHz mono PCM16, regenerated with its cassette by scenario/fixtures/make_synthetic_audio.py. Force-added past the root *.wav ignore, as backend/scripts/fixtures/parakeet_route_synthetic.wav is. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A v3 account's Home is GET /v1/conversations (homeMode auto, X-Omi-Home-Ownership) plus GET /v1/conversations/live; the feed is suppressed for v3 (app/lib/providers/conversation_home_fetch.dart:115, conversations_v3_provider.dart:224). scenario/home.py calls both routes in process over ASGI against the emulator, as the lab uid (dependency override, the hermetic-test seam), after each expect checkpoint and at the end, and writes <scenario>/home.json with the bodies unmodified. New check field on_home reads the route's answer; disagreements with the lab's copy of the visibility rule are listed in home.json. run.py gets a minimal hook. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tory python -m testing.pipeline_lab scenario view <run-dir> [--port N] serves the run directory on loopback (free port by default) with the inspector's access policy: verdict and checks, Home as the route returned it with a snapshot picker and a "Not on Home" group, a timeline with recordings, seals, landings, sync arrivals, gaps, Finish and checkpoints, conversation bars, a detail drawer, the stand-ins, and base/head compare. Falls back to result.json and names each missing file. Stdlib only, no external assets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ck reads as a marker Co-Authored-By: Claude Opus 5.5 <[email protected]>
affected BASE..HEAD maps changed paths to the earliest stage (import closures, an explicit table, run-everything default) and to scenarios. The lanes stages and the chain unit are now cacheable: entries store the files a stage wrote and restore them on a hit; lane stage keys hash only the code they run. Every run reports hit/miss, seconds and LLM calls per stage. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…peline-lab-scenarios
Conflicts: cli.py (view beside stack/compare), scenario/run.py. One Home hook: ScenarioOps holds the HomeRecorder and calls write_home_snapshot before each checkpoint's snapshot; run.py calls it before the final snapshot. The isolation lane's after-checkpoint wrapper and the Home lane's method wrapping are both removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e table Co-Authored-By: Claude Opus 5.5 <[email protected]>
…chet - Stage keys carry the executing lab package's identity (sources, no bytecode). A pinned ref runs this checkout's vendored lab, so the product arm's code key alone could serve artifacts an older harness produced. - A sync fragment's arrives_at of 0 was treated as absent and replaced by the audio end, in the plan and in the row's created_at; use an explicit None check. - test_pipeline_lab_scenario_audio: the record-vendor spend caps are dollars, not clock budgets; name them as locals so the real-clock budget ratchet (test_real_clock_budget_ratchet) does not read budget_usd=0.03 as a 30 ms budget. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b82add2f9
ℹ️ 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".
| errors = [e for e in report.events if e.outcome == 'error'] | ||
| result.update( | ||
| outcome=outcome(scenario, results, error='event errors' if errors else None), |
There was a problem hiding this comment.
Make Home route failures affect the scenario outcome
When either Home route raises or returns an unsuccessful response, the scenario can still report passed or xfail: HomeRecorder.capture catches exceptions, while this outcome calculation considers only driver event errors and explicit expectations. None of the committed scenarios has an on_home expectation, so a consistently broken Home endpoint also passes the repeat check and leaves the new CI scenario suite green. Propagate unsuccessful Home captures into the scenario's error outcome while preserving the captured diagnostics.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in eff4bae. HomeRecorder.failures() lists every capture where either Home route raised or did not answer 200 (list or live). run.py now makes the scenario error when that list is non-empty, even with no on_home check. The failures also appear in result.json's home summary. Tests: test_recorder_keeps_running_when_the_route_cannot_be_built and test_recorder_reports_an_unsuccessful_live_route.
| value = canonical(_read(path), drop=artifact.drop, rename=rename) | ||
| if artifact.unordered and isinstance(value, list): | ||
| value = sorted(value, key=lambda row: json.dumps(row, sort_keys=True)) |
There was a problem hiding this comment.
Normalize unordered rows before assigning UUID ordinals
When unordered JSONL rows first introduce random UUIDs in different orders, assigning UUID ordinals before sorting makes equivalent artifacts compare unequal. For example, two notification rows with distinct payloads and fresh UUID4 IDs produce differences when their write order is reversed: each run assigns uuid4#1 to a different payload, and the subsequent sort cannot repair that association. Establish an order independent of random IDs before assigning their canonical names, while retaining cross-artifact references, so concurrent writes do not cause false nondeterminism verdicts.
AGENTS.md reference: backend/testing/pipeline_lab/AGENTS.md:L33-L35
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in eff4bae. Unordered artifacts are now sorted by their JSON with UUID4s masked before canonical renaming, so ordinals follow the row content, not the write order. Test: test_unordered_rows_with_fresh_uuids_compare_equal_in_either_write_order (two notifications with fresh ids, written in opposite orders, compare equal).
| done = subprocess.run(command, cwd=cwd, env=env, capture_output=True, text=True, timeout=timeout) | ||
| except subprocess.TimeoutExpired: | ||
| return {'scenario': path.stem, 'outcome': 'error', 'error': f'timed out after {timeout:g}s'} |
There was a problem hiding this comment.
Terminate scenario descendants when the run times out
When --stt record-local uses the separate interpreter configured by OMI_PIPELINE_LAB_LOCAL_STT_PYTHON, local_parakeet.Worker starts another process to load and run the model. If the scenario exceeds its timeout, subprocess.run kills only the scenario process, leaving that model worker running without its parent's timeout supervision. A probe through run_one confirms that a spawned worker remains alive after the timeout is reported. This can leave expensive CPU and memory consumers behind, particularly with parallel runs or repeats. Start scenarios in an owned process group and terminate and wait for their descendants on timeout.
AGENTS.md reference: backend/testing/pipeline_lab/AGENTS.md:L70-L71
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in eff4bae. run_one starts each scenario with start_new_session=True, and on timeout stops the whole process group with the existing _stop (SIGTERM, then SIGKILL after a grace period) before returning. The local Parakeet worker uses subprocess.run without a new session, so it is in that group. Test: test_run_one_timeout_ends_the_scenarios_descendants (a hung scenario that started a worker; the worker is gone after the timeout).
- A Home route that raises or does not answer 200 (list or live) now makes the scenario an error, even when no check reads on_home; the failures are listed in result.json's home summary. - determinism: unordered JSONL rows are ordered with their random ids masked before ids are renamed to ordinals, so the same rows written in a different order by concurrent workers compare equal. - scenario run_one starts each scenario in its own process group and, on timeout, stops the whole group, so a local STT worker on its own interpreter does not outlive the scenario. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…CPU guard CI shard 8 failed test_refresh_mode_reruns_and_failed_chain_results_are_not_stored at 1.03 s CPU over the 1.00 s fast-unit limit. The stage-reuse tests that run whole lab pipelines (the lab fixture) and the synthetic-day determinism test (0.90 s locally) move to the slow-marked guardrails job, which still runs on every pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tions The ci-budget hygiene check failed once main grew to 14381 of the 14440 Linux cap. Pipeline Lab Scenarios was budgeted at a 7-minute p50; its first four PR runs took 1m57s-2m39s, so it is budgeted at 3 (+186 instead of +434). The contract-suite path-filter widening adds 320. Forecast 14887; Linux cap 14900, with the rationale appended in the house format. macOS and time-to-signal caps unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 725b527105
ℹ️ 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".
| return StageResult( | ||
| output={'source': 'cassette', 'stt': stt, 'stt_label': stt_label(stt), 'outcomes': outcomes}, | ||
| warnings=warnings, |
There was a problem hiding this comment.
Keep failed transcribe replays out of the stage cache
If a record-lane worker or sync VAD step fails transiently, the lane replay can still exit successfully with an ingest row marked failed. This method turns that into only a warning, but TranscribeStage is now cacheable and has no cache_ok rejection, so the orchestrator stores the failed ingest artifact. Subsequent identical runs restore it and keep using stored production transcripts through chain.entry.apply_ingest instead of retrying the selected replay, even after the transient failure is gone. Reject failed lane outputs from cache storage, as the chain stage already does, while retaining their diagnostics.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7c852d1. The ingest index now records each row's error. TranscribeStage.cache_ok rejects a result with any failure the stage key does not cover (a worker or VAD error), counted as failed_transient. Deterministic failures (no_audio, cassette_miss, lane_not_replayed:*) are still stored, because the key already hashes the audio, the cassette inventory and the STT selection. Recording a missing cassette changes the key. Diagnostics remain in the run warnings. Test: test_transcribe_with_transient_replay_failures_is_not_stored.
…ache A lane replay can exit 0 with conversations marked failed (a transient worker or VAD error); those kept their stored transcript. TranscribeStage now rejects such a result from the stage cache, as the chain stage does, so the next identical run replays again. Diagnostics stay in the run warnings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e cache Follow-up to 48fdd99, which rejected every failed replay and so stopped caching days with a plain cassette miss (three stage-reuse tests). The ingest index now records each row's error; TranscribeStage rejects only failures the key does not cover (a worker or VAD error), while no_audio, cassette_miss and lane_not_replayed are keyed by audio, cassette inventory and STT selection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48fdd99228
ℹ️ 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".
| 'timeline_inputs': keys.hash_files( | ||
| [day_dir / 'timeline.json', day_dir / 'baseline' / 'conversations.jsonl', day_dir / 'audio' / 'index.json'] |
There was a problem hiding this comment.
Include the raw baseline in lane cache inputs
When baseline/raw_conversations.jsonl changes while the timeline, normalized baseline and audio remain unchanged, the transcribe cache key does not change. However, lanes/day.py::replay_day reads that file through load_baseline and uses its language when constructing replay requests and ingest results. A subsequent run can therefore restore stale ingest artifacts rather than replaying the corrected input; the chain's broader corpus hash invalidates its own cache but still consumes those stale transcripts. Include raw_conversations.jsonl in these input hashes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 62cec2a. Lane stage keys now include baseline_languages, a hash of the (id, language) pairs that load_baseline returns (raw rows preferred), because lanes/day.py reads only language from those rows. I didn't hash the whole raw file: other raw fields, such as transcript text, feed only the chain, and test_changed_chain_input_reruns_chain_only keeps that behaviour. test_transcribe_key_follows_cassettes_audio_and_stt_but_ingest_does_not now covers both directions: a changed language reruns transcribe, and an ignored raw field does not.
lanes/day.py takes each conversation's language from load_baseline (raw rows preferred), which the lane cache keys did not cover, so a corrected language could restore stale ingest artifacts. Key on the (id, language) pairs only: other raw fields such as transcript text feed only the chain, which keeps rerunning alone when they change. Codex review on #26303. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI shard 5 measured it at 1.26 s CPU, over the 1.00 s fast-unit limit, once v3 day replays run on the simulated clock by default. It moves to the slow-marked guardrails job, which still runs on every pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI shard 6 measured test_add_day_run_baseline_and_inspector at 1.03 s CPU, over the 1.00 s fast-unit limit. Rather than chase one shard at a time, move every lab test a local scan measured near the limit (whole-pipeline runs, the sample determinism run, the grace-period clock test) to the slow-marked guardrails job, which still runs on every pull request. A rescan at 0.6 s leaves only test_pipeline_lab_core_ledger, which is unchanged from main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8399e91947
ℹ️ 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".
| Artifact('llm_calls.jsonl', drop=frozenset({'at', 'id', 'usd', 'recorded_usd'}), unordered=True), | ||
| # Orchestrator decisions are stamped with real time (``utc_iso``); the decision itself is semantic. | ||
| Artifact('decisions.jsonl', drop=frozenset({'at'}), unordered=True), |
There was a problem hiding this comment.
Account for stage-cache restores in determinism comparisons
When an unchanged day replay hits the new stage cache, orchestrator.RUN_FILES deliberately excludes llm_calls.jsonl and decisions.jsonl from restored artifacts, but this comparison still treats their absence as a semantic difference. Consequently, comparing an executed run with its cached repeat reports nondeterminism even though the conversation and day outputs are identical. A bounded probe through run_pipeline produced complete then cached, with the sole difference llm_calls.jsonl $ (only_a); test_unchanged_rerun_is_all_cache_hits_and_says_so also explicitly asserts that the cached run has no call log. Make the comparison cache-aware so execution-only trace differences do not invalidate equivalent restored results.
AGENTS.md reference: backend/testing/pipeline_lab/AGENTS.md:L33-L35
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 6044960. llm_calls.jsonl and decisions.jsonl are now marked trace=True (execution traces). Because a stage-cache restore does not write them (orchestrator.RUN_FILES), the comparison handles them like this: when both runs have them they are compared, and when only one does they go to traces_one_sided and do not count as a difference. A product output present on only one side still counts as a difference. Test: test_a_cached_repeat_without_execution_traces_compares_equal.
…aces A stage-cache restore does not write llm_calls.jsonl or decisions.jsonl (orchestrator.RUN_FILES), so comparing an executed run with its cached repeat reported nondeterminism on those files alone. They are now marked as execution traces: compared when both runs have them, listed under traces_one_sided when only one does. Product outputs present on one side stay differences. Codex review on #26303. Co-Authored-By: Claude Opus 5.5 <[email protected]>
With --stt record-local through the separate interpreter, the worker wrote the PCM and recognised words to the system temp directory. They now go to an owner-only directory under the scenario lab root (ensure_private_dir), one removed per call, so private audio stays inside the lab root even if the process is killed. Codex review (P1) on #26389. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 604496042c
ℹ️ 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".
| if 'R' in code or 'C' in code: | ||
| index += 1 # the source path of a rename follows; its removal shows up as missing below |
There was a problem hiding this comment.
Include the deleted source of staged renames in code keys
For an in-place replay with a staged rename, this skips the source pathname without recording its deletion. Consequently, staging a new file while retaining the original and staging a rename of the original to that same new file produce identical dirty maps and tree_key() values, despite executing different backend trees. A bounded probe confirmed this collision. The chain cache can therefore restore results from before the source module was removed instead of exercising the renamed code. git status -h documents -z as “terminate entries with NUL”; consume the additional source entry but also mark that source as deleted for renames, rather than discarding it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 35b0ea0. CodeState now records the source path of a staged rename or copy (R/C in either the index or worktree column) with its disk state, so a rename's source reads deleted and "add B beside A" no longer keys like "rename A to B". The same sweep also made the executable bit (mode-only edits), symlink targets and the contents of untracked nested repositories part of the dirty state. Tests in backend/tests/unit/test_pipeline_lab_confinement.py: test_staged_rename_keys_differently_from_an_added_copy, test_mode_only_and_symlink_edits_change_the_code_key, test_nested_repository_contents_are_part_of_the_code_key.
| root.mkdir(parents=True, exist_ok=True, mode=0o700) | ||
| return root |
There was a problem hiding this comment.
Validate existing output roots before writing private run data
When --keep names an existing group/other-readable output tree, such as an unpacked run with 0755 scenario directories, mkdir(..., exist_ok=True, mode=0o700) leaves those permissions unchanged. The subsequent scenario-directory creation does the same, while HomeRecorder.write() creates home.json with ordinary write_text permissions (0644 under the usual umask). Because Home snapshots contain the full transcript and generated content, replaying private audio into that tree exposes it to other local users. A bounded probe confirmed the accepted 0755 directories and 0644 Home artifact. Validate the root with the existing store.ensure_private_dir policy before accepting it, rather than relying on creation mode.
AGENTS.md reference: backend/testing/pipeline_lab/AGENTS.md:L15-L16
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 35b0ea0. --keep (and the scenario child's --out) now go through store.ensure_private_dir. An existing directory that is group/other accessible, owned by someone else or a symlink is refused with a message naming the path, and its mode is left alone. Each reused per-scenario and repeat directory is validated the same way. home.json, result.json, scenario_error.log, called_files.json, stderr.log, run.json/verdict.json/compare.json and the shared stack's files are written 0600 through the atomic helper. Scenario children and the emulators run under umask 077, and output without --keep goes under the private scenario lab root instead of system temp. Tests in backend/tests/unit/test_pipeline_lab_confinement.py: test_keep_into_an_open_existing_directory_is_refused_not_chmodded, test_reused_scenario_directory_must_be_owner_only, test_home_json_result_files_and_verdicts_are_0600, test_scenario_child_refuses_an_open_out_directory, test_keep_creates_owner_only_and_default_output_is_under_the_private_lab_root.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec33ed7d12
ℹ️ 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".
| if cacheable and not refusal: | ||
| artifacts = _changed(before, _snapshot(store.run_dir(run_id))) | ||
| digests = store.cache_put_files(first, key, store.run_dir(run_id), artifacts) | ||
| digest = keys.hash_json(digests) | ||
| artifact_digests[first] = digest |
There was a problem hiding this comment.
Hash upstream artifacts even when cache storage is refused
When TranscribeStage.cache_ok rejects a replay with a transient worker or VAD failure, this branch also skips adding its ingest artifacts to artifact_digests. Downstream cache keys then see only the transcribe summary counts, not the transcripts actually consumed by chain.entry.apply_ingest. If successive runs fail on different recordings but have identical outcome counts, the second run can restore the first run's chain results despite having different ingest transcripts. A bounded orchestrator probe confirmed that the upstream stage reruns with changed artifacts while the downstream stage restores its previous answer. Compute the artifact identity independently of cache-storage eligibility, or prevent downstream cache reuse after an upstream refusal.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 35b0ea0. The orchestrator now snapshots the run directory for every stage that executes and records its artifact digest (sha256 of each file the stage wrote), whether the result is stored or not, so a refused or uncached result still keys downstream stages on what it actually produced. Test: test_refused_upstream_result_still_keys_downstream_on_its_artifacts in backend/tests/unit/test_pipeline_lab_confinement.py: a transient-failure transcribe run with different transcripts but identical counts gives boundaries a new key (miss); the same transcripts again give a hit.
… review Private files: - scenario --keep and the child's --out are validated with ensure_private_dir: an existing group/other readable tree is refused, not chmod-ed; each per-scenario directory is validated too. Default output goes under the private scenario lab root, not system temp. - home.json, result.json, scenario_error.log, called_files.json, stderr.log, run.json, verdict.json, compare.json, the shared stack's stack.json, lock, firebase.json and emulator logs are written 0600 (atomic where possible). - the scenario lab root (default ~/.cache/pipeline-lab) is created owner-only; an open default root left by an older lab is tightened, a configured one is refused. - scenario children and the emulators run under umask 077. - private_subdir creates every missing parent 0700 (mkdir -p used the umask for parents). - the inspector's verdict root, v3 trace rows and v3 smoke's copied overlay go through the same helpers. Cache keys: - CodeState records a staged rename's or copy's source path, the executable bit, symlink targets and nested-repository contents. - refused or uncached stage results still contribute their artifact digest to downstream keys. - ingest stages key on the raw baseline fields a missing timeline.json is built from. - transcribe keys the ambient env values its product STT code can read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
replay_sync_lane wrote owner audio as WAV files into a mkdtemp in the system temp directory when no scratch was given (every caller). Day replays now pass <store root>/tmp/sync and scenarios (and the default) the scenario lab root's tmp/sync, both validated owner-only. Ingest-lane tests point the root at tmp. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35b0ea0494
ℹ️ 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".
| result = replay_sync_lane( | ||
| SyncConversation(rec.doc_id, item.pcm16, utc_iso(start), utc_iso(end), language), | ||
| span=SpanSource(item.cassette), | ||
| file_vad=file_vad, | ||
| stt=stt, |
There was a problem hiding this comment.
Keep sync audio scratch files under the private lab root
For a sync fragment backed by private audio_file data, this call omits scratch, so lanes/sync.py::replay_sync_lane uses tempfile.mkdtemp(..., dir=None) and _source_wav writes the audio into the system temporary directory. Neither the scenario runner nor lab_environment redirects temporary files to the lab root. This violates the lab's explicit audio-confinement policy and leaves private WAV files outside its managed root if the process is killed before the lane's cleanup runs. Pass a validated scratch directory beneath the private lab root.
AGENTS.md reference: backend/testing/pipeline_lab/AGENTS.md:L15-L16
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in acdb973 and 1e7fb4a. scenario/audio.py now passes the sync lane an explicit scratch directory, <scenario lab root>/tmp/sync, validated owner-only. Day replays pass <store root>/tmp/sync. The lane's default, when no caller passes one, is also the private root rather than system temp. Because product code the lab runs (utils/sync, utils/batch_pipeline) makes its own tempfile files, the scenario child, the transcribe replay, record-stt and the chain and v3 entries now also run under store.private_tempdir: tempfile and TMPDIR point at <root>/tmp/product. Tests: test_sync_lane_turns_a_cassette_into_lines (test_pipeline_lab_scenario_audio.py, asserts the work dir), test_sync_lane_work_files_default_to_the_private_lab_root and test_product_temp_files_go_under_the_private_lab_root_for_the_block (backend/tests/unit/test_pipeline_lab_confinement.py).
| def one(job: _Job) -> None: | ||
| out = _private(job.out(root), 'scenario output') | ||
| with isolated_run(peers, slots, timeout + LEASE_GRACE) as isolation: | ||
| result = run_one( |
There was a problem hiding this comment.
Start each scenario execution with fresh output artifacts
When an existing --keep directory is reused, this accepts the previous scenario output without clearing its append-only artifacts. The runner appends to v3_tasks.jsonl, decisions.jsonl, and sink logs, so the new run contains events from earlier executions. In particular, running once without repeats and then rerunning into the same directory with --repeat 2 makes the first repeat contain two executions while the second contains one, falsely reporting nondeterminism. A bounded run_set probe with identical task output reproduced v3_tasks.jsonl $[1] as the sole difference. Reject populated execution directories or initialize fresh artifacts before launching each job.
AGENTS.md reference: backend/testing/pipeline_lab/AGENTS.md:L33-L35
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1e7fb4a. run_set now clears an earlier run from the validated output root before any job starts. It removes every scenario directory (one holding scenario.json, including its repeat-k directories) and run.json/verdict.json/compare.json, never follows symlinks, and leaves everything else, including the started stack's .stack. Clearing happens once, serially, not per job, because a repeat-1 job's directory contains the other repeats. Test: test_reused_keep_directory_starts_each_scenario_with_fresh_output in backend/tests/unit/test_pipeline_lab_confinement.py. Repro: all committed scenarios run once into a --keep dir, then --repeat 2 into the same dir: every scenario passed, with no repeat differences.
… private - run_set clears an earlier run from a reused --keep directory before any job starts (every scenario directory holding scenario.json, plus run.json, verdict.json, compare.json); the stack's .stack and other files stay. Appended artifacts (v3_tasks.jsonl, decisions.jsonl, sink logs) no longer mix runs. - scenario audio passes the sync lane an explicit private scratch directory. - store.private_tempdir points tempfile and TMPDIR at <root>/tmp/product for the scenario child, the transcribe replay and record-stt, and the chain and v3 entries, so the product's own temp files (utils/sync, utils/batch_pipeline) on owner audio stay inside the lab root. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e7fb4afe1
ℹ️ 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".
| for cassette in recorded_for_audio(key.audio_sha256, root): | ||
| if _matches(cassette, key, pinned) and cassette.key.digest not in origin: | ||
| found.append(cassette) | ||
| origin[cassette.key.digest] = 'lab_root' | ||
| if pinned and not found: |
There was a problem hiding this comment.
Discover pre-index cassettes during unpinned replay
When the lab root contains cassettes recorded before this change, an audio scenario without a provider/model pin cannot find them: the old Cassette.save() wrote only the cassette JSON, while this lookup searches only the new by-audio index and restricts its legacy fallback to pinned requests. A bounded probe confirmed that the same existing cassette loads successfully with a pin but is missed without one. This makes default replay fail unnecessarily, or select a synthetic fixture instead of an available vendor transcript. Running record mode does not repair the index either, because Recorder.ensure() returns existing cache hits without saving them. Add a legacy discovery/backfill path so unpinned selection also considers existing cassettes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8664663 (scan with backfill, the smaller of the two options). When the by-audio index has no live entry for an audio hash, cassette/format.recorded_for_audio scans the stored cassettes. A file must contain the hash before it is parsed, and it must sit at its own key path. The scan returns matches oldest first and appends their index rows, so it runs once per audio, and a later record-mode cache hit finds them through the index. Unpinned and pinned replays both see them; the pinned direct-key fallback stays for an index that lists only other keys of that audio. Test: test_unpinned_replay_finds_a_cassette_recorded_before_the_index_and_backfills_it in backend/tests/unit/test_pipeline_lab_scenario_audio.py.
…he index Cassette.save() used to write only the cassette file, so an audio scenario without a provider/model pin missed every cassette recorded before the by-audio index existed (only pinned lookups had a fallback). When the index has no live entry for an audio hash, recorded_for_audio now scans the stored cassettes for that hash (substring filter, then parse and path check) and backfills the index, so the scan runs once per audio. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e paging scenarios (#26389) * pipeline lab: scripted v3 Finish scenarios (slice 1) A declarative JSON scenario (origins, batch-lane recordings with sessions, stream gaps, scripted synthetic speech, transcript landing, a Finish tap with fast finish, device-sync fragments, env overlay, expectations) runs through the real v3 code on a local emulator in under a minute: python -m testing.pipeline_lab scenario run <file|name>... Events feed the unchanged v3 driver. Real code: capture admission, the Finish branch (retrieve_in_progress_conversation, finish_live_window), _manual_finish_admitted -> promote_manual_end -> fast_finish.run with its privacy fence and writer, transcript writes and wakes, reconcile/planner/ notes/Home visibility. Stand-ins (capture-close job, record admission, batch projection, sync intake) are counted per run and listed in the README with follow-ups. Committed scenarios: finish_after_reconnect_late_transcript (SCA-4385 shape, expected failure on main) and finish_single_recording_fast (passes). Slice 2 importer design in scenario/IMPORTER.md. No production code changes. Refs SCA-4386, SCA-4385 Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario rows name their capture origin; long-gap and never-lands Finish scenarios - ScenarioOps writes external_data.recording_origin_id on batch rows, as listen stamps every generation of one client recording, so the v3 reconnect rule (same origin, new session, same device) is exercised. - finish_after_long_reconnect_gap: the incident's capture with a 360 s stream gap, longer than the 300 s silence gap; only the reconnect rule joins A and B. - finish_transcript_never_lands: fast finish off and B's batch transcript never lands (from the review of #26304); the cut must survive the Finish wait. Both are strict expected failures on main until the v3-finish-late-predecessor fix (#26304) lands. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: long-gap scenario tests the reconnect rule alone An aged sync fragment that lands before the Finish cut is stored locks by the ordinary lock delay, a separate rule; the scenario keeps to A and B. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario review fixes; incident scenarios pass after #26304 - Incident scenarios: #26304 (6e3204f) landed, so the three SCA-4385 scenarios are plain passes; their expected_failure blocks are gone. - expected_failure names the labelled checks the known bug fails (`checks`); any other failing check is `failed`, not `xfail`. - Reconnect scenarios check membership, visibility and manual end in one expect row, so one Finish conversation must satisfy all of them. - finish_target() treats a batch recording as capturing from its first audio through its seal (tie order runs the tap before the seal) and picks the newest open one, as get_in_progress_conversation does; two open captures with the same start are refused as ambiguous. - Recording and origin ids must be unique ignoring case (they name documents). Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: per-run isolation, run directory contract, --jobs/--repeat, scenario stack and compare Each scenario process gets its own demo-lab-<run id> Firestore project, a leased Redis database (product bounded clients pointed at it through the lab env), its own blob root, and Typesense writes off; the reset clears only the leased database. Adds scenario stack up|down|status (shared stack with a pid file under the lab root), run.json/verdict.json, --repeat determinism and scenario compare. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: simulated clock mode with replay-following product monotonic and loop time sim (tick=False) freezes the wall clock between driver sets. product_monotonic gives product callers (utils, database, ...) a monotonic and asyncio loop clock that follows the replay: frozen at the virtual instant for a per-event liveness grace (30 s real), then real-time so product polls still end. Late reads are counted. asyncio internals, threading, gRPC and the lab keep real time. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: determinism.py, one definition of a replay's semantic artifacts Allowlist of wall-clock fields (seconds, timings, window, stored_at, ms, cache_hit), random lab ids (llm_call_ids counted, run_id dropped), uuid4 renamed by first sight; compare_runs/semantic_diff report JSON paths only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: v3 day replay runs on the simulated clock by default Overlay model_config.v3.clock: tick restores the ticking clock. The run records its clock mode and late product monotonic reads in v3_driver.json. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: planpass child runs on the lab's simulated clock The child loads stack/clock.py by path (never the ref's testing tree), freezes at the day's end and reports the clock it actually saw. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: determinism tests (jitter sim vs tick, fake-engine day twice, planpass twice) Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: cassette source (vendor|local|synthetic), by-audio index, local recorder interface Cassettes record who produced their words; old cassettes read as vendor. A per-audio index lets a scenario find any cassette recorded for its file. Words may carry a confidence. cassette/local.py defines the local speech-to-text recorder interface and its registration. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: local Parakeet recorder (optional extra, CPU fp32, product decoding) record-local runs production's parakeet-tdt-0.6b-v3 checkpoint at ASR_REVISION on CPU through the product's pin_parakeet_decoding and ParakeetWords, in 30 s windows, keyed parakeet_local/...cpu-fp32 with source local. The model stack is an optional extra (requirements-local-stt.txt) in its own venv, never imported by the default lab. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenarios from audio files (--stt replay|record-vendor|record-local) A recording or sync fragment may give audio_file instead of speech. Its words come from the STT cassette for that exact audio and pass through the batch or sync lane code (real PipelineWorker, projection_segments, retrieve_vad_segments) before the existing landing calls write them. The result names each transcript's cassette source and which steps were product code. Adds a committed synthetic say fixture, its synthetic cassette, and audio_single_recording_finish. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario run prints the repeat number on each report's header line Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: commit the synthetic say WAV for audio_single_recording_finish 286 KB, 8.9 s, 16 kHz mono PCM16, regenerated with its cassette by scenario/fixtures/make_synthetic_audio.py. Force-added past the root *.wav ignore, as backend/scripts/fixtures/parakeet_route_synthetic.wav is. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario Home stage from the product's own Home route A v3 account's Home is GET /v1/conversations (homeMode auto, X-Omi-Home-Ownership) plus GET /v1/conversations/live; the feed is suppressed for v3 (app/lib/providers/conversation_home_fetch.dart:115, conversations_v3_provider.dart:224). scenario/home.py calls both routes in process over ASGI against the emulator, as the lab uid (dependency override, the hermetic-test seam), after each expect checkpoint and at the end, and writes <scenario>/home.json with the bodies unmodified. New check field on_home reads the route's answer; disagreements with the lab's copy of the visibility rule are listed in home.json. run.py gets a minimal hook. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario view, a stateless read-only page per run directory python -m testing.pipeline_lab scenario view <run-dir> [--port N] serves the run directory on loopback (free port by default) with the inspector's access policy: verdict and checks, Home as the route returned it with a snapshot picker and a "Not on Home" group, a timeline with recordings, seals, landings, sync arrivals, gaps, Finish and checkpoints, conversation bars, a detail drawer, the stand-ins, and base/head compare. Falls back to result.json and names each missing file. Stdlib only, no external assets. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: rename a scenario job list the deferred-work marker check reads as a marker Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: affected map, stored stage outputs, per-stage cache report affected BASE..HEAD maps changed paths to the earliest stage (import closures, an explicit table, run-everything default) and to scenarios. The lanes stages and the chain unit are now cacheable: entries store the files a stage wrote and restore them on a hit; lane stage keys hash only the code they run. Every run reports hit/miss, seconds and LLM calls per stage. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: chain phase timings in the stage report; text-mode stage table Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: refresh never takes a stored stage; failed chain results are not stored Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: build affected closures once per test module Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: integrate isolation, Home, audio and clock lanes - One comparison for --repeat and day replays: determinism.compare_runs over SCENARIO_ARTIFACTS (result.json, home.json, v3 tasks, decisions); home.json's updated_at is Firestore update_time (emulator wall clock), allowlisted. - verdict.json carries each recording's transcript source (scripted, synthetic, local, vendor). - scenario view reads run.json, verdict.json rows, repeat-<k>/ directories (nondeterministic state) and compare.json as scenario compare writes it; plain-sentence compare summary; source tags on chips and in the drawer; rail names break only at underscores; timeline labels stack instead of overlapping, one unit style per axis, and the default range holds the Home moment shown; check rows fall back to the check's summary. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario view reads repeats and real compare rows; label layout fixes Nested children flatten fully (transcript tags rendered as text before), labels avoid point glyphs and sit above leader lines; tests for the real run and compare layouts and the repeat route. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario run with no files runs every committed scenario Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: scenario-aware affected, sim-clock chain, true stand-ins, one view command, advisory CI - affected names scenarios from a table (v3 runtime, Finish, fast finish, visibility, Home routes, harness, view: all; audio fixtures, cassettes, lanes: audio scenarios) and from measured reach (scenario/reach.json, written by scenario run --trace-calls + scenario reach); needs no run store. - Classic chain on LabClock 'sim' with product_monotonic; model_config.v3.clock "tick" restores ticking for both replays. run_chain_smoke.sh finds Homebrew openjdk@21; the scenario stack finds firebase in the repo pin or ~/.local/bin, and can use a given Redis and start only the emulator. - Stand-in lines are worded per run from its counters and transcript sources (scenario/standins.py) in result.json, verdict.json, the text report and the web view; audio runs list the audio-to-words steps. - Fake upstream answers Jev /v1/systemone (2xx), so jev_conversation_relevance is cached on re-runs. - view PATH opens the scenario page or the day-replay inspector from the path; scenario summary DIR prints a markdown verdict. - CI: advisory "Pipeline Lab Scenarios" job in backend-hermetic-e2e.yml (every PR and merge queue, skipped summary without a backend change, run directory artifact). Emulator proofs, desktop backend contracts and Static Contracts path filters widened to their suites' static import closures. - Docs: README Start here and scenario sections, lab AGENTS.md repeatability and PR rule, routing lines in backend/AGENTS.md and AGENTS.md; tie-order notes in scenario/spec.py. Co-Authored-By: Claude Opus 5.5 <[email protected]> * checks manifest: exempt a check script named only in the emulator-proofs path filter Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: address Codex review on #26303 - Stage cache: a v3 replay whose arrival or reconcile event raised finishes partial with no failed conversation; cache_ok now rejects it using the v3 driver status carried in the discard summary. The summary also read the driver counts from the wrong level of chain_entry.json; fixed. - Home: annotate_rows finds disagreements after home.json was written at capture; rewrite home.json when new ones are found so the file the web view reads matches result.json. - Web view: an audio_file recording may omit `audio`; take its span and seal from the run timeline's capture_start and seal events instead of drawing a zero-width recording at t0. Sync fragments without `audio` use their arrival. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: second Codex review round and the real-clock budget ratchet - Stage keys carry the executing lab package's identity (sources, no bytecode). A pinned ref runs this checkout's vendored lab, so the product arm's code key alone could serve artifacts an older harness produced. - A sync fragment's arrives_at of 0 was treated as absent and replaced by the audio end, in the plan and in the row's created_at; use an explicit None check. - test_pipeline_lab_scenario_audio: the record-vendor spend caps are dollars, not clock budgets; name them as locals so the real-clock budget ratchet (test_real_clock_budget_ratchet) does not read budget_usd=0.03 as a 30 ms budget. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: third Codex review round - A Home route that raises or does not answer 200 (list or live) now makes the scenario an error, even when no check reads on_home; the failures are listed in result.json's home summary. - determinism: unordered JSONL rows are ordered with their random ids masked before ids are renamed to ordinals, so the same rows written in a different order by concurrent workers compare equal. - scenario run_one starts each scenario in its own process group and, on timeout, stops the whole group, so a local STT worker on its own interpreter does not outlive the scenario. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab tests: mark whole-pipeline tests slow for the fast-unit CPU guard CI shard 8 failed test_refresh_mode_reruns_and_failed_chain_results_are_not_stored at 1.03 s CPU over the 1.00 s fast-unit limit. The stage-reuse tests that run whole lab pipelines (the lab fixture) and the synthetic-day determinism test (0.90 s locally) move to the slow-marked guardrails job, which still runs on every pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ci budget: lab job at its measured p50; Linux cap for the #26303 additions The ci-budget hygiene check failed once main grew to 14381 of the 14440 Linux cap. Pipeline Lab Scenarios was budgeted at a 7-minute p50; its first four PR runs took 1m57s-2m39s, so it is budgeted at 3 (+186 instead of +434). The contract-suite path-filter widening adds 320. Forecast 14887; Linux cap 14900, with the rationale appended in the house format. macOS and time-to-signal caps unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: failed transcribe replays are not stored in the stage cache A lane replay can exit 0 with conversations marked failed (a transient worker or VAD error); those kept their stored transcript. TranscribeStage now rejects such a result from the stage cache, as the chain stage does, so the next identical run replays again. Diagnostics stay in the run warnings. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: keep only deterministic transcribe failures in the stage cache Follow-up to 48fdd99, which rejected every failed replay and so stopped caching days with a plain cassette miss (three stage-reuse tests). The ingest index now records each row's error; TranscribeStage rejects only failures the key does not cover (a worker or VAD error), while no_audio, cassette_miss and lane_not_replayed are keyed by audio, cassette inventory and STT selection. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: key lane stages on the baseline languages replay reads lanes/day.py takes each conversation's language from load_baseline (raw rows preferred), which the lane cache keys did not cover, so a corrected language could restore stale ingest artifacts. Key on the (id, language) pairs only: other raw fields such as transcript text feed only the chain, which keeps rerunning alone when they change. Codex review on #26303. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab tests: mark the v3 day replay e2e test slow CI shard 5 measured it at 1.26 s CPU, over the 1.00 s fast-unit limit, once v3 day replays run on the simulated clock by default. It moves to the slow-marked guardrails job, which still runs on every pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: per-scenario operation budgets; Finish, privacy and Home paging scenarios - scenario/budget.py counts Firestore reads, writes, deletes and no-op writes (a write answered with the document's previous update_time) at the emulator client's GAPIC API, by collection, with each no-op's call site, plus vendor calls (fake gateway requests, fast-finish STT calls, cassette plays). Counts land in result.json, the verdict row, the summary, the text report and a table under the verdict in the web view, and are compared between repeats. Reads through a real-time TTL cache (dream_control) are kept apart. - Scenario format: an optional budget block (each key a budget_<key> check), account (cloud audio off, sync_off_at), seed (Home history in runs), finish.again_at, and recording / finish_response / home_paging checks plus titled, has_notes, home_titled, home_has_notes and holders fields. - Eight new scenarios: next recording opens before the current closes, Finish after a second close (expected_failure: Finish targets the older open window), Finish on a closed conversation on Home, double tap, nothing to finish, cloud audio off, privacy refusal before fast finish (zero STT calls), and Home paging past hidden runs. - Every committed scenario has a budget from its measured counts; reach.json re-measured; CI budget for the advisory job 3 -> 5 minutes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab tests: mark the remaining near-limit pipeline tests slow CI shard 6 measured test_add_day_run_baseline_and_inspector at 1.03 s CPU, over the 1.00 s fast-unit limit. Rather than chase one shard at a time, move every lab test a local scan measured near the limit (whole-pipeline runs, the sample determinism run, the grace-period clock test) to the slow-marked guardrails job, which still runs on every pull request. A rescan at 0.6 s leaves only test_pipeline_lab_core_ledger, which is unchanged from main. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: budgets from the merged head's counts; opt-in write-site trace Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: keep the AI profile refresh's account-document ops out of compared counts Its fenced write lands or not depending on thread timing inside one event (utils/ai_profile_refresh.py -> database/users.py write_ai_user_profile_if_unchanged), which made two scenarios' counts differ between repeats. Shown in ops.racy_ops. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: budget guidance lives in the README (AGENTS.md size ratchet) Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: determinism comparison tolerates one-sided execution traces A stage-cache restore does not write llm_calls.jsonl or decisions.jsonl (orchestrator.RUN_FILES), so comparing an executed run with its cached repeat reported nondeterminism on those files alone. They are now marked as execution traces: compared when both runs have them, listed under traces_one_sided when only one does. Product outputs present on one side stay differences. Codex review on #26303. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: local STT worker files stay under the private lab root With --stt record-local through the separate interpreter, the worker wrote the PCM and recognised words to the system temp directory. They now go to an owner-only directory under the scenario lab root (ensure_private_dir), one removed per call, so private audio stays inside the lab root even if the process is killed. Codex review (P1) on #26389. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: confine private files and close cache-key gaps found in review Private files: - scenario --keep and the child's --out are validated with ensure_private_dir: an existing group/other readable tree is refused, not chmod-ed; each per-scenario directory is validated too. Default output goes under the private scenario lab root, not system temp. - home.json, result.json, scenario_error.log, called_files.json, stderr.log, run.json, verdict.json, compare.json, the shared stack's stack.json, lock, firebase.json and emulator logs are written 0600 (atomic where possible). - the scenario lab root (default ~/.cache/pipeline-lab) is created owner-only; an open default root left by an older lab is tightened, a configured one is refused. - scenario children and the emulators run under umask 077. - private_subdir creates every missing parent 0700 (mkdir -p used the umask for parents). - the inspector's verdict root, v3 trace rows and v3 smoke's copied overlay go through the same helpers. Cache keys: - CodeState records a staged rename's or copy's source path, the executable bit, symlink targets and nested-repository contents. - refused or uncached stage results still contribute their artifact digest to downstream keys. - ingest stages key on the raw baseline fields a missing timeline.json is built from. - transcribe keys the ambient env values its product STT code can read. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: sync lane work files stay under the private lab root replay_sync_lane wrote owner audio as WAV files into a mkdtemp in the system temp directory when no scratch was given (every caller). Day replays now pass <store root>/tmp/sync and scenarios (and the default) the scenario lab root's tmp/sync, both validated owner-only. Ingest-lane tests point the root at tmp. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: fresh scenario output on reuse; product temp files stay private - run_set clears an earlier run from a reused --keep directory before any job starts (every scenario directory holding scenario.json, plus run.json, verdict.json, compare.json); the stack's .stack and other files stay. Appended artifacts (v3_tasks.jsonl, decisions.jsonl, sink logs) no longer mix runs. - scenario audio passes the sync lane an explicit private scratch directory. - store.private_tempdir points tempfile and TMPDIR at <root>/tmp/product for the scenario child, the transcribe replay and record-stt, and the chain and v3 entries, so the product's own temp files (utils/sync, utils/batch_pipeline) on owner audio stay inside the lab root. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: unpinned audio replay finds cassettes recorded before the index Cassette.save() used to write only the cassette file, so an audio scenario without a provider/model pin missed every cassette recorded before the by-audio index existed (only pinned lookups had a fallback). When the index has no live entry for an audio hash, recorded_for_audio now scans the stored cassettes for that hash (substring filter, then parse and path check) and backfills the index, so the scan runs once per audio. Co-Authored-By: Claude Opus 5.5 <[email protected]> * pipeline lab: complete cassette backfill, provenance-blind repeats, arm-relative budget frames - cassette/format.py: the pre-index scan runs until the by-audio index records a backfill marker, so an index holding only newer cassettes no longer hides older unindexed ones. - determinism.py / scenario/audio.py: the STT cassette provenance is reported as cassette_origin and dropped from result.json repeat comparison; the cassette digest and words stay compared. - scenario/budget.py: call sites and racy callers resolve against the product backend that `database` imports from (a compare arm), not the vendored lab's location. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Makes
backend/testing/pipeline_labthe one local tool for checking capture → Finish → Home behaviour before it ships. A scenario (scripted client events, optionally a real audio file) runs through the real v3 product code on a local Firestore emulator and Redis. It gives a pass/fail verdict and the product's own Home answer, viewable in a stateless web page. No credentials, no deploy, about a minute.Folds in #26309 (scenario origins, reconnect-gap and never-lands scenarios, SCA-4386).
Start here
What changed
Scenario mode (
scenario/)Home from the product (
scenario/home.py)GET /v1/conversationsandGET /v1/conversations/livein-process. That is the route a v3 account's Home list uses (app/lib/providers/conversation_home_fetch.dart:115).home.json, and the newon_homecheck is evaluated against it.Audio in (
scenario/audio.py,cassette/)audio_file). Its words come from an STT cassette.--stthas three modes:replay, the default: no calls, fails on a miss;record-vendor: spend-capped, needs credentials;record-local: production's Parakeet checkpoint on CPU through the product'sParakeetWords. This is an optional extra in its own venv (requirements-local-stt.txt). A CPU result is filed assource: localand is never read as a production GPU result.sayvoices) with asyntheticcassette.Isolation and repeatability
demo-lab-<id>), a leased Redis database, and its own blob root.scenario stack up|down|statuskeeps one shared emulator and Redis running per host.--jobs Nruns scenarios at once.--repeat Nfails a scenario asnondeterministicif its results differ between repeats, using one shared field allowlist (determinism.py).scenario compare <base> [--worktree]runs two refs and diffs conversations and Home.model_config.v3.clock: "tick"restores the old ticking clock.Run directory and web view
run.json,verdict.json, and per scenarioscenario.json,result.jsonandhome.json.view DIRserves it read-only on loopback and needs nothing else. A copied directory shows the same page.Cheap parts, cheap whole (
affected.py, stage cache)affectedmaps a diff to the earliest lab stage it reaches and the scenarios worth running. It uses import closure, an explicit table, and measured per-scenario reach (scenario/reach.json). An unmapped backend path means "run everything".CI and docs
backend-hermetic-e2e.yml:scenario run --jobs 4 --repeat 2 --stt replay;affectedand the scenarios it names before a backend PR; an escape in this path gets a scenario before its fix merges";Verification
All runs were on m1-mac-studio, against a local emulator only.
test_pipeline_lab_*.pyfiles, one process per file, all passing.scenario run --jobs 10 --repeat 3: 5/5 passed, no differences between repeats.env -iwith no lab variables: 5/5 passed.scenario compare origin/main --worktree: no difference.make preflightand the pre-push gate pass. The three edited workflows pass actionlint.Not in this PR
/listencapture stage throughlisten_pusher_stack.scenario/IMPORTER.md).🤖 Generated with Claude Code