Repository navigation
v3: Finish waits for a predecessor's pending transcript; a stream gap is not silence - #26304
Conversation
… is not silence A manual-end cut locked the window as soon as the Finish recording's fast-finish transcript landed. A preceding recording of the same capture (a reconnect after a stream gap) whose batch transcript landed seconds later fell before the locked window, became its own non-manual card and was hidden under the Home word floor. - outline.stretches holds a manual-end cut (at most policy.FINISH_WAIT, 5 min after the cut) while its own recording or a sealed batch predecessor in the same capture origin or within the silence gap still has no transcript; the builder wakes at the wait's end. - An unrecorded interval between two recordings of one capture origin (up to 30 min) no longer counts as silence. - store.load names awaiting predecessors of a fresh cut with one bounded, metadata-only read (at most 8 documents). - Kill switch CONVERSATIONS_V3_CAPTURE_CONTINUITY (default on); counter omi_conversations_v3_finish_held_total. 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: cdaa30573a
ℹ️ 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".
| closing = [g for g in groups if g['lines'][0]['start'] < held_cut and not g['manual_end']] | ||
| if closing: | ||
| closing[-1]['finish_held_until'] = max(until, closing[-1].get('finish_held_until', until)) |
There was a problem hiding this comment.
Prevent ordinary settlement while a Finish cut is held
With the default 300-second lock delay, a held stretch can still lock before finish_held_until: the settlement loop below computes locked from the last speech time without consulting this marker. For example, if the Finish recording's transcript is pending and the only landed fragment ended over five minutes ago, the planner returns finish_held_until in the future but also locked=True, finished=True, and manual_end=False. Unlike the previous manual-end projection, a short fragment is then hidden by visibility.project as below_word_minimum; the service also skips the hold-expiry enqueue because the group is already finished. Make the active hold participate in settlement and wake scheduling, rather than merely removing the manual cut.
Useful? React with 👍 / 👎.
…eech that joins Review of #26304 (cdaa305): - P1, durable Finish: stretches marks every source a held Finish depends on (the finishing recording, and recordings whose speech after the cut waits) with _v3_hold_until; preview_wakes turns the marks into deferred wakes, so the commit keeps them v3_pending until the hold ends and every pass reloads the cut, even when the finishing recording's own transcript never lands. - P1, no early lock or cross-Finish join: the earliest held cut stays a partition boundary. Speech at or after it waits for a later pass, so the window it closes is the last one, and that window stays open (no lock-delay lock, no outline) while its Finish waits. It is held open only when the awaited speech joins it. - P2, only joiners hold: a predecessor must start before the finishing recording, be sealed by the Finish, and join its speech within the silence gap or as the capture it reconnects. The loader reads the finishing recording's capture origin through the existing conversations_recording_lineage index (origin, start before it, end within CAPTURE_GAP_LIMIT of its start), and skips the read when the cut has no origin or is already settled into a locked conversation. - P3, reconnect evidence: a stream gap counts as missing audio only between a capture and its reconnect (same origin, a new recording session, same device when both rows name one), and CAPTURE_GAP_LIMIT drops from 30 to 10 minutes. Tests: production-faithful multi-pass tests (pending-only loading plus the real predecessor read) for each finding; reconcile_at takes an optional loader. Co-Authored-By: Claude Opus 5.5 <[email protected]>
While a cut waits for a predecessor's transcript, the planner groups with the awaited recordings' audio spans in place of their speech (never emitted as lines), so speech the predecessor will bridge (a sync fragment inside it) is not settled apart before it lands. Lab: finish_after_long_reconnect_gap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r-Finish read bound Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
…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]>
…rios, Home route, audio, isolation, view, CI) (#26303) * 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 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: 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]> --------- 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]>
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 storedv3_manual_endcut 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_windowsturned 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 ascut <= now, whether or not the speech before it has landed.:194then 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_togetherwindow flushes them as a fresh window withmanual_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 asbelow_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).outline.reconnected,outline.stream_gap).recording_session_id;client_device_idwhenever both rows name one.outline.CAPTURE_GAP_LIMIT), no longer counts toward the silence gap.outline._held_cuts). A manual-end cut is held while one of these has no transcript yet (policy.awaiting_batch_transcript: batch lane, sealed, norecord_projection_revision, no segments, no failure receipt):v3_pending_sinceis set to the end of the wait, throughpreview_wakes. This keeps the cut durable even when the reconcile that saw it committed nothing else.policy.FINISH_WAIT(5 min) after the cut, and the builder enqueues a wake for then.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)
v3_manual_endon every pass.test_a_finish_whose_own_transcript_never_lands_keeps_its_cut_through_the_wait(production loading); labfinish_transcript_never_landstest_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_jointest_a_predecessor_the_gap_rule_separates_never_holds(45-min same origin),test_a_recording_that_starts_after_the_finish_recording_never_holdslimit(8)starvationtest_the_loader_reads_one_capture_origin_within_the_reconnect_bound,test_incident_with_production_loading_finds_the_unloaded_predecessortest_a_reconnect_gap_is_not_silence,test_a_far_predecessor_holds_the_cut_only_when_the_finish_reconnects_it; labfinish_after_long_reconnect_gapThe 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:
FINISH_WAIT(5 min);users/{uid}/conversations;external_data.recording_origin_id ==origin,started_at <=the Finish recording's start, andfinished_at >=its start minus 10 min;started_at DESC, finished_at DESC,limit 8, projected to 16 metadata fields;conversations_recording_lineagecomposite index (query-shape guardserved: true; no new index).v3_pendingwithv3_pending_sinceat the hold's end, using the existing deferred-wake path.omi_conversations_v3_finish_held_totalshould be nonzero when a reconnect precedes a Finish.omi_conversations_v3_end_to_summary_secondsp50 for manual finishes should not regress. A single-recording Finish takes no hold.CONVERSATIONS_V3_CAPTURE_CONTINUITY=offon 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=offwould disable batch Finish cuts entirely; no existing flag isolates this change.off, or revert this merge.Evidence
Unit tests:
tests/unit/test_conversations_v3_finish_late_predecessor.py, 33 passed; 13 of them fail on cdaa305.service.reconcileandcommit_projectionon the strict Firestore fixture at 300/300 and 900/3600 timing.attach.[A] hidden below_word_minimumplus[F, B] manual_end.Command for the other tests: each file run in its own process via
bin/omi-heavy run -- .venv/bin/python -m pytest -q <file>.test_conversations_v3_*,test_listen_v3_*,test_batch_projection_v3_admission,test_record_close_v3_contractandtest_pipeline_lab_v3_*file: 31 files, all passed.test_firestore_query_shapes636;test_firestore_outside_query_contract31;test_firestore_index_oracle132;test_firestore_runtime_witnesses25;test_firestore_caller_witnesses41;test_firestore_read_site_attribution11.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:
finish_reconnect_switch_offwas added for the run.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.finish_after_reconnect_late_transcriptbelow_word_minimum(160 w)finish_single_recording_fastfinish_after_long_reconnect_gap(6-min gap, longer than the silence gap)finish_transcript_never_landsfinish_reconnect_switch_off(reviewer)With the three
expected_failureblocks removed, all four scenarios pass (exit 0). If #26303 merges first, this PR deletes its scenario'sexpected_failureblock and updatestests/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:
Residuals:
🤖 Generated with Claude Code