Skip to content

SCA-2918: Per-owner holdout for conversations v3 new intake - #26440

Merged
Git-on-my-level merged 6 commits into
mainfrom
lane/v3-holdout
Nov 26, 2026
Merged

Git-on-my-level merged 6 commits into
mainfrom
lane/v3-holdout

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

This adds a per-owner holdout for Conversations v3 new intake. When CONVERSATIONS_V3_STAGE moves from beta to all (SCA-2918), operators can return specific heavy owners to legacy intake without rolling a revision.

  • New rollout cohort conversations-v3-holdout (config/rollout_cohorts.COHORT_ENVS, runtime membership only, no env fallback).
  • Stage admission (conversations_v3_enabled) is unchanged. A new v3_intake_held_out(uid) is asked only after stage admission succeeds, and only where new intake is decided:
Path Held-out owner gets
triggers.mark_new: listen in-progress create, sync ingest, batch projection Legacy: no recording marker on new rows. This is the same state as an owner whose capable marker lapsed. A listen v3 rotation successor (supersede → create_in_progress_conversation(v3_continuation=True) → mark_new(continuation=True)) continues the capture in flight and stays v3.
manual_cuts.record_end / ends_around (end_open_conversation experiment) Experiment-off End handling, paired with mark_new
Home list Legacy read mode (show_held, offset paging, header legacy). Existing v3_derived cards stay visible. held_for_notes never matches recording/v3_derived rows, so this adds only the new legacy pieces, which v3 Home would hide for the whole capture.
GET /v1/conversations/live An existing active v3 window is still served (v3:true). The answer is v3:false only after a complete lookup finds no active window (conversations_v3_live.live_window_lookup returns (window, complete)). A lookup capped by READ_CAP keeps serving v3 and counts record_fallback(feature_flags, v3_holdout→v3_live, lookup_cap).
Finish, episodes, builders Stage admission, so existing v3 work drains on the v3 path. For a confirmed held-out owner only (conversations_v3_enabled and v3_intake_held_out resolved True), while a legacy (non-recording) row is in progress, a Finish naming a different id runs finish_live_window(named_only=True) first. It closes only the named window or its just-sealed capture: request_named_finish(strict=True) refuses with named_superseded instead of moving to a newer capture, and there is no unnamed or recording fallback. The legacy row stays in progress. For non-members, and when membership is unavailable, the Finish path is unchanged. Ordinary named Finish keeps today's supersession recovery. A miss, or an unnamed Finish, runs the legacy Finish unchanged (Release, SCA-2918 01a219af-06ec).
  • Unknown membership (read error, timeout, cold cache, full cache) fails open. The runtime resolver raises RolloutCohortUnavailable for this cohort (the pattern go-finalization uses), and admission records record_fallback(component='feature_flags', from_mode='v3_holdout', to_mode='admitted', reason='unavailable', outcome='degraded'). Failing closed would flip every owner's new captures during a Firestore hiccup. Caveat: a cold cache can still admit a held-out owner.
  • scripts/rollout_cohort.py takes --cohort choices from COHORT_ENVS, so --cohort conversations-v3-holdout --add|--remove works with no script change. A test covers the dry run.
  • Docs: runbook section docs/runbooks/conversations-v3.md#per-owner-holdout, pipeline change note, and a feature-flag registry entry (regenerated).

DESIGN on SCA-2918: 01a219a9-7d22-7731-b179-920e5699cebd, revised in reply to Release's objection 01a219aa-02d0: 01a219ae-5f58-7352-8356-010f7d8d3417. Do not merge before DESIGN: OK.

Reads

The membership read is the existing per-uid rollout_cohorts/{uid} document behind the 60 s process cache (utils/rollout_cohorts._TTLReads). It is shared with every other cohort check for that uid. It is read only for stage-admitted owners at the sites above, and by /live only when there is no active window: at most 1 read per uid per process per 60 s. Owners who are not admitted already read this document today through the conversations-v3 cohort fallback.

Kill switch and rollback

  • Kill switch: CONVERSATIONS_V3_HOLDOUT (default on). It is a no-op until an operator adds an owner, because the cohort starts empty.
  • Rollback: set CONVERSATIONS_V3_HOLDOUT=off (skips the check and its read), or empty the cohort (scripts/rollout_cohort.py --remove). Allow about 60 s for the cohort cache plus up to 120 s for the capability cache. Stored rows never change layer, and existing v3 recordings keep draining.
  • Proving number: held-out owners get zero new recording-marked rows once the serving writers have resolved membership (after the add plus about 3 min), excluding rows whose admission recorded the v3_holdout fallback.

Tests

New in backend/tests/unit/test_conversations_v3_contract.py:

  • test_holdout_keeps_stage_admission_for_existing_v3_work: a member is still stage-admitted at all/beta/cohort (Finish, episodes and builders reach v3 work).
  • test_intake_with_known_membership: a non-member's new row is marked recording; a member's is not.
  • test_intake_with_unavailable_membership_admits_and_records_fallback
  • test_holdout_env_off_ignores_cohort_and_skips_read (off/false/0/no)
  • test_kill_switch_wins_without_a_holdout_read
  • test_holdout_added_mid_capture_serves_the_active_window_then_legacy: the capture in flight keeps its marker, the next row is legacy, /live serves the active window without a membership read, then answers v3:false.
  • test_holdout_removed_mid_capture_readmits_the_next_row
  • test_existing_v3_work_drains_for_a_held_out_owner: finish_live_window still cuts the active window; record_end records no cut.
  • test_named_v3_finish_closes_its_window_while_a_legacy_row_is_in_progress (endpoint-level mixed state: the named window is cut, and the legacy row is neither finalized nor changed)
  • test_unnamed_finish_beside_an_old_v3_window_still_finalizes_the_legacy_row (also covers naming the legacy row itself)
  • test_named_finish_miss_falls_back_to_the_legacy_finish
  • test_named_finish_beside_a_v3_recording_in_progress_keeps_today_path
  • test_named_finish_override_is_a_no_op_unless_holdout_is_confirmed (non-member, and unavailable membership: today's Finish, no window read)
  • test_holdout_live_keeps_v3_when_the_window_lookup_is_capped (capped lookup: v3:true and one lookup_cap fallback, emitted as lookup_cap now that it is a FallbackReason member; complete lookup: v3:false)
  • test_live_read_with_nothing_open_stops_at_its_cap_and_logs extended: live_window_lookup returns (None, False) when capped and (None, True) when a short scan is empty
  • test_rotation_successor_stays_v3_for_a_held_out_owner (test_listen_v3_rotation_continuation.py: real listen rotation; only the successor create carries v3_continuation, and it stays recording), plus a unit check that mark_new(continuation=True) marks a held-out owner's successor
  • test_strict_named_finish_never_moves_to_a_later_capture (now also asserts FINISH_NO_POINTER{named_superseded} on the named-only miss) (test_episodes_finalize_paths.py, both owner shapes: no writes, no enqueue; the existing test_named_finish_cuts_capture_that_sealed_after_the_named_window still covers ordinary recovery)
  • test_held_out_owner_reads_legacy_home_with_v3_cards_and_held_pieces: the Home route switches to show_held=True with the legacy header, and a v3_derived card and a held legacy piece are both visible in that mode.
  • test_runtime_resolver_reports_unknown_holdout_membership: an unknown holdout membership raises, other cohorts keep a plain miss, and a stored true admits.
  • test_rollout_cohort_script_accepts_holdout_cohort
  • The existing test_switch_is_per_owner_not_device cohort mock is now key-aware.

Local: bin/omi-heavy run -- bash test.sh tests/unit/test_conversations_v3_contract.py passed (116). The changed-files selector picks about 3,100 files through the import graph of config/rollout_cohorts.py, which is CI's job. Locally I ran the selector's 88 files that reference admission, cohorts, triggers, manual cuts, /live, Home or the flag registry (BACKEND_UNIT_TEST_FILE_LIST): all 88 files passed, 0 failed. After the second review round, 54 unit files (contract, Finish, /live, listen rotation and lifecycle create, fallback-reason enumerations, test_firestore_query_shapes.py) all passed, 0 failed. Before that, the 28 unit files that cover Finish and /live (finish_live_window, process_in_progress_conversation, request_named_finish, FINISH_NO_POINTER, get_live_conversation, live_window, conversations_v3_live) all passed, 0 failed. test_episodes_finalize_paths.py passed (106). test_firestore_query_shapes.py passed (640) with the new live_window_lookup driver and the strict neutral on request_named_finish. scripts/check_feature_flag_registry.py is OK, and scan_import_time_side_effects.py reports 0 violations.

Follow-up (not in this PR)

The same mixed state, a legacy in-progress row beside a new v3 window, also happens for an ordinary (not held-out) owner who is mid-recording when the stage flips from beta to all. This PR deliberately leaves that owner's Finish path unchanged; a named-window Finish there still finalizes the legacy row first. It needs its own fix and its own regression.

Product invariants affected

none

Line-Count-Exception: backend/routers/conversations.py | 3326 -> 3358 | the holdout must sit at the /live window lookup, the Home read-mode decision and the named Finish branch in this router; splitting the router is out of scope for a pre-flip kill switch
Line-Count-Exception: backend/routers/listen/conversations.py | 1501 -> 1503 | the rotation successor must tell the lifecycle create it continues a v3 capture (SCA-2918 F3); the flag belongs at this one create call

🤖 Generated with Claude Code

Owners in the new `conversations-v3-holdout` rollout cohort keep legacy
intake for new captures at every stage, so operators can return specific
heavy owners to legacy at `all` without rolling a revision.

Stage admission (`conversations_v3_enabled`) is unchanged. The new
`v3_intake_held_out` is asked only after admission and only at new-intake
sites: `triggers.mark_new` (in-progress create, sync ingest, batch
projection), manual cuts, Home's read mode (legacy; v3 cards stay visible),
and `/live` when no active window exists. Finish, episodes and builders
keep stage admission, so existing v3 work drains.

Unknown membership fails open: the runtime resolver raises
RolloutCohortUnavailable for this cohort and admission records a
`feature_flags`/`v3_holdout` fallback. Kill switch: CONVERSATIONS_V3_HOLDOUT
(default on, empty cohort, so a no-op until an operator adds an owner).

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

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T22:31:06.988169Z 65ec76a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Git-on-my-level and others added 2 commits November 26, 2026 16:24
During a holdout an older v3 window can coexist with a new legacy
in-progress row. The Finish route looked the in-progress row up first, so
a Finish naming the v3 window finalized the legacy row and left the
window open.

When a legacy (non-recording) row is in progress and the Finish names a
different id, the route now calls finish_live_window(named_only=True)
first. It finishes only the named window or its just-sealed capture,
with no unnamed or recording fallback. A miss, or an unnamed Finish, runs
the legacy Finish unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 719b75c365

ℹ️ 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".

Comment on lines +43 to +44
if named_only:
named_outcome, named, recording_id = conversations_v3_live.request_named_finish(uid, window_id, now=now)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable capture supersession for named-only Finish

When a legacy recording is in progress, the named v3 window has left the live set, and another v3 capture sealed after its tail, this call can finish a different capture despite named_only=True. request_named_finish calls _latest_capture and explicitly switches to the newer recording and its owning window; the existing test_named_finish_cuts_capture_that_sealed_after_the_named_window covers that behavior. Consequently, the new mixed legacy/v3 branch can cut an unrelated window and return success instead of finishing only the named window or falling back to legacy Finish on a miss. Add a strict option to the database helper that prevents supersession for this path while preserving the existing recovery behavior for ordinary Finish.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6512723.

request_named_finish takes a new strict flag (default False). With strict on, when _latest_capture finds a newer sealed capture it returns named_superseded instead of switching to that capture and its owning window. The named_only path in finish_live_window passes strict=True, so the mixed legacy/v3 branch can only cut the named target. A miss returns None, and the route then runs the legacy Finish. Ordinary Finish keeps today's supersession recovery: test_named_finish_cuts_capture_that_sealed_after_the_named_window is unchanged and still passes.

Test: test_strict_named_finish_never_moves_to_a_later_capture in tests/unit/test_episodes_finalize_paths.py. It runs both owner shapes on the existing sealed_named_route fixture: named_only returns None, no transaction writes, nothing enqueued, and neither capture is marked. The query-shape driver records strict as a neutral: same reads, no query change. test_firestore_query_shapes.py passed (640).

Git-on-my-level and others added 3 commits November 26, 2026 16:44
…t owners

Review fixes for the holdout:
- live_window_lookup returns (window, complete). A held-out owner's /live
  answers v3:false only after a complete lookup; a READ_CAP-capped miss
  keeps v3 and records a lookup_cap fallback.
- The mixed legacy/v3 named-Finish override runs only when holdout
  membership resolved True, so non-members and unknown membership keep
  today's Finish path.
- request_named_finish(strict=True) refuses named_superseded instead of
  moving to a newer capture and its window; the named-only path uses it,
  and ordinary Finish keeps its supersession recovery.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- F3: a listen v3 rotation successor (supersede) creates with
  v3_continuation=True, and mark_new(continuation=True) skips the holdout,
  so a held-out owner's capture in flight no longer splits into a legacy row.
- F2: LOOKUP_CAP is a FallbackReason member, so the capped /live fallback
  is labelled lookup_cap instead of other.
- F5: a named-only Finish miss counts FINISH_NO_POINTER with its outcome.
- F4: drop the unreachable experiment wake on the mixed Finish branch;
  record_end stores no cut for a held-out owner and the window cut
  enqueues its own builder.
- F1: document CONVERSATIONS_V3_HOLDOUT in listen_pusher_pipeline.mdx.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit ba987fe into main Nov 26, 2026
76 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/v3-holdout branch November 26, 2026 22:47
Git-on-my-level added a commit that referenced this pull request Nov 26, 2026
Resolve backend/utils/conversations/v3/finish.py against #26440 (SCA-2918
per-owner holdout): keep this branch's three-tuple request_finish with
newer_capture and the `capture or window` acknowledgement, and keep main's
named_only strict fallback for a named Finish beside a legacy row.

Main's holdout contract tests stubbed request_finish with the old two-tuple;
they now return (outcome, recording id, None), matching this branch's
request_finish contract.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 26, 2026
Resolve backend/utils/conversations/v3/finish.py against #26440 (SCA-2918
per-owner holdout): finish_live_window takes both named_only and
observe_recording, and every _acknowledge call, including main's named_only
strict fallback, carries observe_recording. The route's held-out named-only
call passes no observer, so it stays unobserved, as on main.

Main's holdout contract tests stubbed _acknowledge with four positional
arguments; they now accept the observe_recording argument this branch adds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 28, 2026
…apped /live (#26552)

Follow-up to #26440. It addresses two accepted review findings, F6 and
F7 from panel `review-20261126t220122-493d`, routed to SCA-2918 through
SCA-5244/SCA-5245.

**F6: the unbound resolver counts as a fallback.** `in_rollout_cohort()`
returned `False` for `conversations-v3-holdout` when the membership
resolver was unbound. A writer that skipped
`configure_rollout_runtime()` would therefore admit held-out owners with
no fallback telemetry.
- It now raises `RolloutCohortUnavailable`, as `dream-agent` and
`go-finalization` already do in the same branch.
- `v3_intake_held_out()` already catches that exception, admits, and
records
`omi_fallback_total{component="feature_flags",from_mode="v3_holdout",reason="unavailable"}`.
- Admission is unchanged (unknown still admits); the case is now
counted.
- Every current writer entrypoint binds the runtime, so this was latent
only.

**F7: runbook.** The holdout `/live` bullet now says that a window
lookup capped at its read limit keeps `v3:true` and counts a
`lookup_cap` fallback, matching `routers/conversations.py`.

**Kill switch:** `CONVERSATIONS_V3_HOLDOUT=off` skips the holdout read
entirely. There is no new flag.

**Tests:**
- The new unit tests check that the unbound resolver raises for the
holdout cohort only (every other non-raising cohort stays a plain miss),
and that `v3_intake_held_out` admits with exactly one `unavailable`
fallback (the full recorded fallback is asserted).
- Local run, `omi-heavy` on m1:
  - `bash test.sh` (changed-file selection): 86 passed.
  - These files, each run on its own, all pass (471 tests):
    - `test_conversations_v3_contract.py` (121)
    - `test_rollout_cohorts.py` (29)
    - `test_rollout_cohort_membership_parity.py` (12)
    - `test_rollout_cohort_migration.py` (71)
    - `test_rollout_cohort_deploy.py` (10)
    - `test_go_finalization_admission.py` (34)
    - `test_dream_eligibility_outage.py` (7)
    - `test_episodes_finalize_paths.py` (180)
    - `test_listen_v3_rotation_continuation.py` (7)

**Review:** panel `review-20261127t235004-46c8` returned SHIP. F1 and F2
(tighter tests) are fixed in `7924db60`. F3 (unbound holdout membership
listing) is declined: nothing reads holdout membership through
`rollout_cohort_members`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26552?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26552?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26552&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Nov 28, 2026
…apped /live

An unbound membership resolver made in_rollout_cohort() return False for
conversations-v3-holdout, so a writer that skipped configure_rollout_runtime()
would admit held-out owners with no fallback telemetry. Raise
RolloutCohortUnavailable instead, as dream-agent and go-finalization already
do; v3_intake_held_out() catches it, admits, and counts
feature_flags/v3_holdout reason=unavailable. Every current writer entrypoint
binds the runtime, so this is latent only (review F6 on BasedHardware#26440).

The runbook now says a capped /live window lookup keeps v3:true and counts a
lookup_cap fallback (review F7 on BasedHardware#26440).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant