Skip to content

Retire ruled-dead shadows; unset modes default off; shadows expire - #26582

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/shadow-retire
Nov 28, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/shadow-retire

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What

Stage 1 of the 2026-11-28 shadow settlement (David, anx card:prod-shadows-settled-retire-the-dead; ruling: R-20261128-01, proposed). Two parts: production stops running the shadows David ruled dead, and new shadows can no longer run forever. Stage 2, a separate PR, deletes the retired code paths.

1. Retire the dead shadows (config only, code paths kept for stage 2)

Family Change Why it is safe
MEDIA_NOISE_MODE listen off (overlay + chart); dropped from the implicit-shadow set off serves the same output as shadow. This ends new-path serving for the one live-only MEDIA_NOISE_MODE_SERVE_UID_SHA256S digest cohort on the four Cloud Run backends (the Release issue lists that env for removal)
ACTION_ITEMS_V2_MODE, ACTION_ITEM_VALIDITY_MODE, STT_VOCAB_MODE, CLIENTS_FROM_SEGMENTS_CHUNKS_MODE dropped from the implicit-shadow set, so unset = off shadow was CPU and logging only (STT vocab shadow never sends Soniox terms; segment chunks return 409 in both modes)
SPEAKER_GROUPING_SHADOW (EXP-004) off, percent 0 on listen, pusher and Cloud Run readout showed no difference
BATCH_PIPELINE_SHADOW_PERCENT 0 in the overlay and in the batch-pipeline-worker prod/staging charts (shadowPercent) batch serves at 100% (omi_runtime_percent{name="batch-pipeline"}=100; 7 d intake 4.55M batch vs 6 not_cohort), so no non-serving owner is left to shadow
TRANSCRIPTION_SHADOW_ENABLED / _KILL_SWITCH false / true; new diarization cohort stage F (= E with the shadow off) 7 d: only skipped_budget outcomes, zero ok/failed; omi_legacy_sync_mode=dark, so it promotes nothing
CAPTURE_GROUP_CONTAINMENT_MODE off in _base.yaml and all charts; code default off ruled retire
OMI_FLAGS_SOURCE posthog on listen, pusher and the Cloud Run backends dual mode made 0 compare reads. desktop-backend stays dual (its workflow hard-codes it; follow-up on the Release issue), llm-gateway stays omi

Registry rows for these families now say decision: kill, terminal: off with the ruling in notes. The config_switch rows move to rollout with review_by: 2026-12-05 as the stage 2 deletion date. No extension or due date moved.

2. Guardrails (all four approved by David)

  1. An unset mode is off. config/refactor_modes.py mode() no longer defaults to shadow. _LEGACY_SHADOW_DEFAULT keeps the old default for five families that still rely on it: CALLS_RECAP, CAPTURE_COVERAGE, LIFECYCLE_V2, NOTES_PACKET_V2, SPEAKER_EVIDENCE. Each is handed to its owner to bind, ramp or retire. A test caps the set so it can only shrink.
  2. Registry shadow: block. New _MODE/SHADOW rollout rows created on or after 2026-11-28 must carry shadow: {readout_by, metric}, with readout_by at most 21 days after created.
  3. Auto-expiry. scripts/render_shadow_expiry.py generates backend/config/shadow_expiry.py. From readout_by + 7 days, mode() reads a shadow binding as off and logs event=shadow_expired once. serve is never touched. The registry checker fails when the table drifts. The table is empty today.
  4. Watchdog. In omi-workspace, infra/rollout/bin/killed_flags_serving.py reports kill/terminal-off rows that still serve as non-off on live Cloud Run traffic revisions and GKE deployments. It is read-only and runs under ro-prod.

Verification

  • scripts/check_feature_flag_registry.py: OK. compose_runtime_env.py --check: up to date. validate-backend-runtime-env.py --env prod: passed.
  • scripts/test_check_feature_flag_registry.py: 114 passed. tests/unit/test_refactor_modes.py: 21 passed.
  • Selected backend unit files for the changed paths (423 files): all pass. Two files failed on stale expectations that this PR updates (batch worker chart shadowPercent 25 → 0 in prod and staging; the containment registry-row assert), and both pass after the fix. tests/unit/fixtures/containment_long_pair.py collects no tests.

Product invariants affected

  • INV-MEM-4

runtime_env.yaml changes only shadow and flag-source bindings. Memory promotion keeps its existing authority: the retired shadows never served memory writes, and the notes and lifecycle families (NOTES_PACKET_V2, LIFECYCLE_V2) are unchanged here, since the Home v3 owner settles them in #26580.

Rollout

Release owner merges and rolls (David: "I build, Release ships"). Rollback: revert this PR, or for one family set its env back (BATCH_PIPELINE_SHADOW_PERCENT=25, SPEAKER_GROUPING_SHADOW=on, TRANSCRIPTION_SHADOW_KILL_SWITCH=false, X_MODE=shadow). Readback after serving:

  • omi_runtime_percent{name="batch-pipeline"} stays 100;
  • transcription shadow and speaker grouping shadow outcome counters fall to 0;
  • the killed_flags_serving.py finding count drops to the live-only env the Release issue removes.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Stage 1 of the 2026-11-28 shadow settlement (David, anx card:prod-shadows-settled-retire-the-dead).
ruling: R-20261128-01 (proposed)

- Serve off: MEDIA_NOISE, ACTION_ITEMS_V2, ACTION_ITEM_VALIDITY, STT_VOCAB,
  CLIENTS_FROM_SEGMENTS_CHUNKS, CAPTURE_GROUP_CONTAINMENT, SPEAKER_GROUPING_SHADOW,
  BATCH_PIPELINE_SHADOW_PERCENT=0, TRANSCRIPTION_SHADOW (stage F); OMI_FLAGS_SOURCE=posthog
  on listen, pusher and the Cloud Run backends.
- refactor_modes: an unset mode is off; a frozen, shrink-only legacy set keeps shadow.
- Registry: shadow {readout_by <=21d, metric} block for new _MODE/SHADOW rows; generated
  backend/config/shadow_expiry.py turns an expired shadow off in mode().

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

chatgpt-codex-connector Bot commented Nov 28, 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-28T05:43:21.853680Z 3ee3026 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.

@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: dc410e6be1

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


def capture_group_containment_mode() -> str:
value = os.getenv(MODE_ENV, 'shadow').strip().lower()
value = os.getenv(MODE_ENV, 'off').strip().lower()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Document the pipeline retirement and changed default

This changes the containment default from shadow to off, but the commit includes neither the required pipeline change note nor an update to the env contract. backend/docs/listen_pusher_pipeline.mdx:2170 still documents CAPTURE_GROUP_CONTAINMENT_MODE as defaulting to shadow, leaving operators with incorrect configuration guidance. Add a note under backend/docs/listen_pusher_pipeline/changes/ covering the retirement and rollout state, and update the affected default in the contract document, as required by the backend guide.

AGENTS.md reference: backend/AGENTS.md:L164-L164

Useful? React with 👍 / 👎.

… shadow blocks

- serving_for() reads the configured mode, so an expired shadow still serves its cohort (F1).
- Expiry starts at readout_by + 7 days, as documented (F2).
- Registry summaries and listen/pusher doc say default off for the retired families (F3).
- shadow: blocks only on refactor_modes *_MODE families, the only readers of the table (F4).
- Pusher chart comment names stage F (F5); registry rows keep the compact JSON style.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Panel review-20261128t052728-e26c: SHIP on 3ee3026 (F1 accepted and fixed; F2–F5 fixed). Release issue SCA-5315 covers the merge and roll; it needs batch-custody (lead2) to ack the batch-pipeline-worker shadowPercent 25 → 0 chart change.

@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: 3ee3026185

ℹ️ 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 +147 to +148
if resolved == 'shadow' and _shadow_expired(name):
return 'off'

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 Preserve serving behavior in gates after shadow expiry

When a shadow binding with a configured serving cohort expires, serving_for() deliberately keeps returning true for that cohort, but shadow_or_serve() and cohort_configured() now return false because they call mode(). Existing consumers therefore disable serving work despite the explicit preservation in serving_for(): for example, utils/other/daily_recap.py stops selecting the cohort's recipients at the new delivery hour and restores legacy date selection, while generate() still uses the new producer. Make the execution and discovery gates preserve configured serving cohorts while stopping only shadow observation; the current expiry test checks serving_for() alone and misses this inconsistency.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 27ee3e8 into main Nov 28, 2026
69 of 70 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/shadow-retire branch November 28, 2026 06:24
Git-on-my-level added a commit that referenced this pull request Dec 1, 2026
…lists, speaker-grouping allowlists) (#26828)

## Why

SCA-5315: clears the residual config left after stage 1 of the shadow
settlement (#26582, merged as `27ee3e849fb4`). The killed-flags audit
found these residuals; they are rows 7–12 of Ship's matrix on SCA-5315.
Stage 1 already serves both shadows off (transcription shadow kill
switch on; speaker grouping shadow off), but the percent and the
allowlisted UID still sat in prod config. This PR clears them so the
retired shadows carry no live cohort.

## Changes (prod only)

| File | Key | Before → after |
| --- | --- | --- |
| `backend/deploy/runtime_env/prod.overlay.yaml` (+ regenerated
`runtime_env.yaml`) | `TRANSCRIPTION_SHADOW_PERCENT` (pusher, backend,
backend-sync, backend-sync-backfill) | `'5'` → `'0'` |
| same | `TRANSCRIPTION_SHADOW_UID_ALLOWLIST` (pusher) | the allowlisted
UID → `''` |
| same | `SPEAKER_GROUPING_SHADOW_UID_ALLOWLIST` (listen, pusher) | the
allowlisted UID → `''` |
| `backend/charts/pusher/prod_omi_pusher_values.yaml` |
`TRANSCRIPTION_SHADOW_PERCENT` | `"5"` → `"0"` |
| same | `TRANSCRIPTION_SHADOW_UID_ALLOWLIST` | the allowlisted UID →
`""` |
| same | `SPEAKER_GROUPING_SHADOW_UID_ALLOWLIST` | the allowlisted UID →
`""` |
| `backend/charts/backend-listen/prod_omi_backend_listen_values.yaml` |
`SPEAKER_GROUPING_SHADOW_UID_ALLOWLIST` | the allowlisted UID → `""` |
| `backend/deploy/ops/live_only.yaml` |
`SPEAKER_GROUPING_SHADOW_UID_ALLOWLIST`,
`TRANSCRIPTION_SHADOW_UID_ALLOWLIST` | entries removed |
| `backend/deploy/cross_service_known_gaps.json` | `no-uid-literals`
gaps for listen/pusher `SPEAKER_GROUPING_SHADOW_UID_ALLOWLIST` and
pusher `TRANSCRIPTION_SHADOW_UID_ALLOWLIST` | removed (no UID literal
remains) |
| `config/diarization-cohort-stages.json` | stage F (retired shadow)
`TRANSCRIPTION_SHADOW_PERCENT`, `TRANSCRIPTION_SHADOW_UID_ALLOWLIST` |
`"5"` → `"0"`, the allowlisted UID → `""` |
| `backend/docs/feature-flag-registry.md` | regenerated by
`scripts/render_feature_flag_registry.py` | prod values follow the
config |
| `backend/tests/unit/test_diarizer_david_cohort.py` | retired stage F:
shadow percent 0 and empty shadow allowlist; final-pass assertions
unchanged | |

The reviewed stage F in `config/diarization-cohort-stages.json` is the
stage the prod pusher/Cloud Run bindings must match (validator, cohost
gate and cohort tests), so it moves with the config. Every other stage
and every final-pass value is unchanged.

Not touched: `MEDIA_NOISE_MODE_SERVE_UID_SHA256S`, the Sync
`RECORD_WAL_DUPLICATE_SHADOW_*` settings, the Calls Recap and Notes
Packet frozen legacy rows, `DEMAND_PROCESSING_UID_ALLOWLIST`, the
`BATCH_PIPELINE_*` recovery and UID allowlists,
`TRANSCRIPTION_FINAL_PASS_*`, and any stage-2 rows.

## Serving

Merging changes no serving state. The change reaches production only
through Release deploys:
- a full pusher deploy (GKE);
- the next Cloud Run train (backend, backend-sync,
backend-sync-backfill);
- removal of the live-only `SPEAKER_GROUPING_SHADOW_UID_ALLOWLIST` /
`TRANSCRIPTION_SHADOW_UID_ALLOWLIST` env from the Cloud Run services
that carry it by name (backend, backend-integration, backend-sync,
backend-sync-backfill), since they are no longer declared live-only.

## Verification

- `compose_runtime_env.py` regenerated `runtime_env.yaml`;
`check_runtime_env_compose.sh` reports it up to date.
- `bash test.sh` (changed-files selection, 97 files) passed, including
`test_render_backend_runtime_env.py`,
`test_backend_runtime_env_validator.py`,
`test_verify_pusher_cohost_env_diff.py`, `test_sync_two_lane.py` and
`test_diarizer_david_cohort.py`.
- `backend/scripts/pre-deploy-check.sh` (hermetic:
`validate-backend-runtime-env.py --env dev|prod --check-workflows` plus
deploy-safety tests, 710 passed).
- `scripts/check_feature_flag_registry.py`: no drift.
- `scripts/pr-preflight --all`: 52 gates; 51 passed on the first run,
`product-invariants` passed after naming INV-MEM-4 below.

## Product invariants affected

- INV-MEM-4 — named because `backend/deploy/runtime_env.yaml` is under
its locked glob. This PR changes no memory setting: only the
transcription and speaker-grouping shadow keys listed above.

## Rollback

Revert this commit.

🤖 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/26828?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/26828?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26828&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. -->
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