Skip to content

chore: Update .gitignore to remove build artifacts - #7

Merged
eng1n88r merged 1 commit into
BasedHardware:mainfrom
eng1n88r:main
Mar 28, 2024
Merged

eng1n88r merged 1 commit into
BasedHardware:mainfrom
eng1n88r:main

Conversation

@eng1n88r

Copy link
Copy Markdown
Contributor

No description provided.

@eng1n88r
eng1n88r merged commit 3a8c8d8 into BasedHardware:main Mar 28, 2024
mdmohsin7 added a commit that referenced this pull request Oct 18, 2025
closes #3241

before:


https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44

logs:

```
flutter: ----------------FIREBASE CRASHLYTICS----------------
flutter: Bad state: No element
flutter: 
#0      ListBase.firstWhere (dart:collection/list.dart:132:5)
#1      SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22)
#2      _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13)
#3      _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48)
#4      _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27)
#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24)
#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11)
#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5)
#9      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7)
#10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27)
#11
```

after:


https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df

<img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15
52 PM"
src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3"
/>
beastoin added a commit that referenced this pull request Mar 19, 2026
After the OAuth redirect from Safari, the desktop app stayed in the
background while Safari displayed "Authentication Successful". Now
NSApp.activate(ignoringOtherApps:true) brings the app to foreground
immediately after receiving the callback URL.

Fixes #5784 (friction #7)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
chore: Update .gitignore to remove build artifacts
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
closes BasedHardware#3241

before:


https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44

logs:

```
flutter: ----------------FIREBASE CRASHLYTICS----------------
flutter: Bad state: No element
flutter: 
#0      ListBase.firstWhere (dart:collection/list.dart:132:5)
#1      SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22)
BasedHardware#2      _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13)
BasedHardware#3      _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48)
BasedHardware#4      _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27)
BasedHardware#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21)
BasedHardware#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24)
BasedHardware#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11)
BasedHardware#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5)
BasedHardware#9      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7)
BasedHardware#10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27)
BasedHardware#11
```

after:


https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df

<img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15
52 PM"
src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3"
/>
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
After the OAuth redirect from Safari, the desktop app stayed in the
background while Safari displayed "Authentication Successful". Now
NSApp.activate(ignoringOtherApps:true) brings the app to foreground
immediately after receiving the callback URL.

Fixes BasedHardware#5784 (friction BasedHardware#7)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
choguun added a commit to choguun/omi that referenced this pull request Jun 25, 2026
CI lint fix (the only thing blocking merge):
- Ran black --line-length 120 --skip-string-normalization on 7 files that
  the Lint & Format Check job flagged. All 13 .py files now pass --check.

P1 #1: AutoRouter.swift:105 guard treated "model: null" as failure and
left stale cached pick active. If the endpoint reports 'no candidate for
this task today', the client would keep routing to yesterday's model.
Fix: explicitly handle null by clearing the cached pick (removeObject
for both keys). Also fixed invalidate(task:) to clear BOTH the pick and
the date (was: only the date). 2 new Swift tests cover both.

P1 BasedHardware#2: benchmark.py bench_endpoint_cached ignored get_or_refresh's return
value and relied on  side effects. On a cache hit, the loader
doesn't run, so tasks/models stay None and the next call crashes.
Fix: use the return value of get_or_refresh in an async helper.

P2 BasedHardware#3: invalidate(task:) now also clears the cached pick (was: only date).
Done as part of P1 #1.

P2 BasedHardware#4: Demo's 'Original weights' were hardcoded in main(); now read from
the task registry (weights_for(task_name)) so demo output tracks
benchmarks.example.json changes instead of going stale.

P2 BasedHardware#6: from_json didn't validate top-level shape (not a dict), or that
'tasks' is a list / 'models' is a dict. Would crash with AttributeError on
bad input. Now raises clean TaskValidationError/ModelValidationError.
Added 6 new tests (3 in task_registry, 3 in model_registry).

P2 BasedHardware#7: updated_at in the endpoint was datetime.now() — reported RESPONSE
time, not cache refresh time. Misleading for 'is this data fresh?' Added
last_loaded_at + last_loaded_wall_time() properties to DailyRefreshCache
(used by the endpoint).

P2 BasedHardware#8: _load_registries() does blocking JSON file I/O inside an async def,
which the project conventions forbid (per CLAUDE.md: 'no in-function
imports, never call sync file I/O inside async def'). Fix: wrap with
run_blocking(sync_executor, _load_registries) via a lazy _get_loader()
helper. The cache loader is now an async function that schedules the
sync I/O on the threadpool.

P2 BasedHardware#9: New test modules were not in backend/test.sh, so CI was skipping
them. Added explicit pytest invocations for all 6 auto-router test
files, right before the fair-use integration tests section.

P2 BasedHardware#10: README + docs/auto-router-demo.md used PYENV_VERSION=3.12.8 but
backend's .python-version declares 3.11. Updated to 3.11.11 (verified all
142 tests pass under 3.11.11 with pytest-asyncio installed).

Tests added: +8 (137 → 142 backend; 13 → 15 desktop)
Total: 142 backend + 15 desktop = 157 tests, all passing.

Cubic findings NOT addressed (subjective or already correct):
- P2 'Plan redefines the diff budget': per-task commits are correct.
- P2 'Acceptance criteria tie-breaking wrong': tie-breaking is in the
  endpoint, not scoring — cubic is wrong.
- P2 'UAT-FN-07 inaccurate': that finding is now resolved by
  test_auto_router_demo.py (added in this cycle).
- P2 'UAT-FN-01 outdated': the fix is real; the current code does NOT
  leak task names (verified via TestClient in test_auto_router_endpoint).
- P2 'Benchmark uses template data': intentional for v1; documented.
- P3 nits: docstring, diff-hygiene wording, test-count arithmetic.
mdmohsin7 added a commit that referenced this pull request Jun 27, 2026
choguun added a commit to choguun/omi that referenced this pull request Jul 1, 2026
Seven findings from cubic-dev-ai on the R3.1 PR. Two findings are
out of scope for R3.1 (they were introduced in the R0 commits
already on this branch; those fixes are in PR BasedHardware#8739's history):

  - P1 #1 (route_artifacts.yaml:758): anthropic provider not
    registered. R0 scope; addressed in PR BasedHardware#8739.
  - P3 BasedHardware#9 (test_llm_gateway_config.py:42): '15 lanes total' comment
    should be '16 lanes total'. R0 scope; already fixed in commit
    0d3442d (use placeholder flag instead of dev_only).

Five findings addressed in this commit:

P1 BasedHardware#2 (shadow_metrics.py:139): Metrics sink failures are now
contained — try/except around increment/gauge calls logs a WARNING
and does not propagate. Observability is best-effort.

P1 BasedHardware#3 (shadow_cutover.py:178): Metrics recording is wrapped in
try/except at the chat() call site; a sink failure cannot break
the control response. Tested by
test_metrics_failure_does_not_break_response.

P2 BasedHardware#4 (shadow_metrics.py:132): Unbounded memory growth capped by
max_records_per_lane (default 10,000) as a memory safety net
alongside the time-based window eviction. Tested by
test_max_records_per_lane_caps_deque.

P2 BasedHardware#5 (shadow_metrics.py:163): Alert delivery failure now clears
the alerted state. The inner async fire coroutine catches its own
exception and discards the lane from _alerted_lanes so the next
divergence re-fires. Tested by
test_alert_sink_failure_clears_alerted_state.

P2 BasedHardware#6 (shadow_cutover.py:163): Control path failure now cancels the
gateway task (no orphaned work). Tested by
test_control_failure_cancels_gateway_task.

P2 BasedHardware#7 (shadow_cutover.py:135): divergence_threshold is now read —
ShadowCutover.__init__ applies the per-cutover threshold to the
metrics instance (overriding the metrics' default). Tested by
test_divergence_threshold_overrides_default and
test_no_threshold_override_keeps_default.

P2 BasedHardware#8 (shadow_cutover.py:164): Both paths now have INDEPENDENT
timeouts (asyncio.wait_for on each), so a slow gateway doesn't delay
the already-ready control response. Tested by
test_slow_gateway_does_not_delay_control.

Tests: 38 pass (was 30 pre-fix; +8 new).
Git-on-my-level added a commit that referenced this pull request Jul 9, 2026
P1 fixes:
- ChatProvider: resume suspended waiter continuation inside the task
  group body on timeout, preventing withTaskGroup hang (#1).
- AgentRuntimeProcess: route stale-alive latch through handleTermination
  so in-flight continuations are resumed and the old terminationHandler
  is properly superseded (#2).
- WALService: startRecording no longer discards retained frames when the
  best-effort retry fails — preserves audio for next flush (#14).

P2 fixes:
- WALService: remove duplicate wal_write_failed health event recording
  in createWalFromCurrentFrames; writeFramesToDiskAndWait already
  records it (#3).
- BleAudioService: reset isDecodeDegraded on successful decode so the
  flag reflects current processor state instead of staying sticky (#5).
- TranscriptionRetryService: record db-backoff pause via
  DesktopDiagnosticsManager.recordFallback for observability (#7).
- APIClient: derive auth retry outcome from response status code instead
  of assuming success before callers validate 2xx (#9).
- APIClientAuthRetryTests: clean up UserDefaults authUserId in tearDown
  to prevent state leak (#8).
- ChatBridgeModeSwitchTimeoutTests: remove meaningless defer { assertion
  that passes regardless of mode-switch cleanup (#10).
- TranscriptionRetryResilienceTests: check busy-error guard by semantic
  elements instead of exact formatting (#11); remove fragile negative
  assertion (#12).
- capture-lifecycle.yaml: remove 5 files from covers: that the hermetic
  seam does not exercise at runtime (#13).

Verification:
- xcrun swiftc -parse on all 8 changed Swift files: clean
- git diff --check: no whitespace errors
- check-desktop-changelog.py: fragment found
- check-e2e-flow-coverage.py --strict: passes (exit 0)

Co-authored-by: Cursor <[email protected]>
eulicesl added a commit that referenced this pull request Jul 12, 2026
…l-open + CI manifest drift (bug sweep #7) (#9522)

## Summary

Batch 7 of the macOS bug sweep — clearing the confirmed low-severity
deferrals surfaced by the batch-6 second-pass hunt, each personally
re-verified against the source. Three fixes, each low-risk with a
regression test where a hermetic seam exists.

This is likely the last substantive sweep PR: a fresh deep review of the
previously-unswept surfaces (onboarding, settings, Sparkle/update, MCP
OAuth, menu-bar/window lifecycle) turned up **no** confirmed
user-affecting bugs, and the BYOK-vs-session-401 suspicion resolved to a
**false alarm** (the Python backend returns 403, never 401, for BYOK
failures) — so the findings are converging.

## Fixes

### 1. SD-card sync always showed 0 B/s
`StorageSyncService.updateProgress` reassigned `lastProgressUpdate =
now` on the line *before* computing `elapsed = now -
lastProgressUpdate`, so `elapsed` was always 0 and `bytesPerSecond`
always 0 — the SD-card sync UI never showed a real speed/ETA. Now
computes the rate over the real elapsed interval using the bytes
downloaded in that window (via a pure
`bytesPerSecond(bytesDelta:interval:)` seam), tracking
`lastProgressBytes` and resetting it with the rest of the progress state
at sync start/stop.

### 2. Notification metadata grew unbounded
`NotificationService.notificationMetadata` added one entry per delivered
functional banner but only removed it in the `didReceive` delegate,
which fires solely on user interaction. A banner the user never touches
leaked its entry for the life of the process. Now tracks insertion order
and FIFO-evicts past a 200-entry cap (pure generic
`evictOldestMetadata`), with matching removal from the order list on the
interaction/error paths.

### 3. Redis rate limiter failed open permanently after a link drop
(Rust)
`RedisService` cached a bare `MultiplexedConnection` and returned that
clone forever with no reconnect path. Once the Redis link dropped, every
command errored, and the rate limiter (fail-open by design) stopped
enforcing limits entirely until restart. Now caches a
`ConnectionManager` (the `connection-manager` feature was already
enabled), which transparently reconnects after a transient failure.
Command call sites unchanged.

## Root cause & durable guards

- #1 read-after-write ordering on the interval timestamp → pure testable
rate function + regression tests (real-rate / non-zero /
zero-and-negative interval).
- #2 a side-table whose only removal path depended on optional user
action → bounded FIFO eviction + regression tests (evict-beyond-cap /
no-eviction-under-cap / exact-to-cap).
- #3 a permanently-cached connection with no invalidation →
`ConnectionManager` auto-reconnect. No hermetic seam for live
reconnection without a Redis server, so no unit test; verified with
`cargo build` + `cargo test` (328 passed).

## Testing

- `cargo test` (Backend-Rust) — 328 passed, 0 failed.
- `python3 scripts/check_desktop_test_quality.py` — OK (debt decreased).
- `python3 scripts/check-sources-root-layout.py` — OK.
- `python3 scripts/check-e2e-flow-coverage.py --strict` — both changed
Swift files covered.
- `scripts/pr-preflight` — 13 checks pass.
- No Swift toolchain in this environment; the new XCTest cases
compile/run on macOS CI (`desktop-swift-ci.yml`). Opened as a **draft**
for local verification before landing.

## Product invariants affected

- none (no locked-invariant path globs touched).

## Deferred / tracked (not fixed here)

- **BYOK→session-401 contract hardening (latent, not an active bug).**
The WAL upload attaches BYOK keys under the session-invalidating
`.default` policy, which violates the documented `AGENTS.md` "Session
401 vs BYOK/provider 401" contract. It is currently unreachable (the
backend returns 403, never 401, for BYOK failures), so it is *not* an
active bug. The contract-aligned fix (route the upload through
`.providerCredentialBoundary`, mirroring `synthesizeSpeech`) changes
real session-invalidation behavior and was deliberately kept out of this
low-risk PR — tracked as defense-in-depth for a focused follow-up.
- Remaining low/suspected batch-6 findings: `WALService.totalFrames`
double-count on repeated failed writes; audio stop-path converter
release ordering; `RealtimeOmniService.pendingAudio` uncap;
`RewindIndexer` rebuild over-count; deferred-update install overwrite
edge case.

## Also included: pre-existing CI unblock

A separate commit registers `check_isinstance_return_ratchet.py` in
`.github/checks-manifest.yaml`. That script is run by `repo-checks.yml`
but was never added to the manifest when #9458 unified checks, so the
manifest drift-guard fails on `main` and blocks every PR's
`pr-preflight`/Hygiene. Pre-existing breakage, not caused by the batch-7
fixes; added here to unblock this (and every) PR.

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

https://claude.ai/code/session_01RAxLsaxtwVNDTWAZFfJp9q

---
_Generated by [Claude
Code](https://claude.ai/code/session_01RAxLsaxtwVNDTWAZFfJp9q)_

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/9522?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="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
TuEmb pushed a commit to TuEmb/omi that referenced this pull request Jul 22, 2026
Enable electron-vite v5's build.bytecode for the main-process ENTRY and the
preload script so Electron skips V8 parse/compile of the largest bundles at
boot (perf catalog item BasedHardware#7, docs/perf-invisible-wins.md).

Scope is deliberately narrow:
- main: bytecode.chunkAlias = 'index' — compiles ONLY the index entry. It must
  NOT include kgWorker (a separate entry loaded via new Worker(kgWorker.js);
  a worker thread has no bytecode loader, so a bytecoded worker entry would fail
  to load) nor the lazy shared chunks (off the startup path). Verified in the
  packaged asar: out/main/kgWorker.js stays plain JS; only out/main/index.jsc
  is bytecode.
- preload: bytecode = true. Preload runs sandbox:false (BrowserWindow
  webPreferences in src/main/index.ts), which bytecode requires (it relies on
  Node's vm module).

Why this is safe for the release pipeline:
- Production-only: electron-vite gates bytecode to `electron-vite build`
  (NODE_ENV_ELECTRON_VITE==='production'), so `pnpm dev` is unaffected.
- CJS-only and satisfied: main+preload output is CJS.
- No version-lock hazard: bytecode is compiled by spawning the INSTALLED
  Electron (ELECTRON_RUN_AS_NODE), so it always matches the shipped V8. There is
  no committed .jsc; it regenerates on every `npm run build`, and the release
  workflow installs+builds fresh from the tag — an Electron bump can't ship
  stale bytecode.
- The out/main/chunks/*.mjs ACP/MCP entries are emitted as ?asset files
  (type:'asset', not 'chunk'), so bytecode already skips them; they stay ESM
  and are spawned as plain-Node children unchanged.
- electron-builder.config.mjs pi-mono asarUnpack closure is untouched; the
  bytecode files (index.jsc, bytecode-loader.cjs) pack into app.asar normally.

Verification:
- pnpm typecheck + pnpm lint: green.
- pnpm test: 4628 pass (1 timing-test timeout under concurrent-build CPU
  contention; passes cleanly in isolation — coordinator.test.ts 22/22).
- electron-vite build: emits out/main/index.jsc + bytecode-loader.cjs +
  out/main/index.js stub; out/preload/index.jsc; kgWorker.js + chunks plain.
- pnpm build:win: NSIS installer built; bytecode files verified inside
  app.asar; kgWorker.js + *.mjs verified plain in app.asar.unpacked.
- Packaged boot: launched dist/win-unpacked/omi-windows.exe with a scratch
  userData — main + preload bytecode load with no cachedDataRejected/chunk-load
  errors, login window + all renderers open, SQLite/agent-kernel/monitors start.
aryanorastar pushed a commit to aryanorastar/omi that referenced this pull request Jul 22, 2026
fix(windows): Google sign-in via system browser (backend PKCE flow)
skanderkaroui added a commit that referenced this pull request Jul 22, 2026
…owned aborts

errors.mjs: 7-category classifier (the cross-language contract with the
proxy), fixed user-plane copy per category (never interpolate raw error
text), claude-code's retry delay formula (500ms x2 cap 32s, 25% jitter),
foreground-only withRetry honoring abort signals, owned-abort grace
window (5s after our own interrupt/abort — SDK abort rejections carry no
originating signal, so exact attribution is impossible; abort-shaped
errors OUTSIDE the window are unknown errors and must surface), and a
JSON-line logEvent for the internal plane with full stack + own
properties (stdout -> journald, no new sink).

Wiring into agent.mjs (handler replacement, leak sites :753/:963, loop
death recovery, markOwnedAbort at interrupt sites) lands separately —
blocked on the in-flight typed-result work in the same file (task #7).

Verification: tests/errors.test.mjs 8/8 — corpus-derived classification
table, retryability, grace-window boundaries, retry loop semantics,
full-detail log lines.
undivisible pushed a commit that referenced this pull request Aug 17, 2026
…ACHE

Doc 47 R2 #5 recommended this for production and it was never built here: no
cache code, no cache files. Measured on the v7 GLM lane, a dream cycle issues
>=320 model calls and re-issues them every cycle for clusters that did not
change; 18 cycles is on the order of 5,700 calls, overwhelmingly repeats of
byte-identical inputs.

This is a cache and nothing more. D50 is untouched -- the model still proposes
and the deterministic validator still admits, from the same bytes it would have
seen. partition_hash is untouched, so a warm cycle and a cold cycle on the same
ledger produce the same hash.

Three properties make it safe rather than merely fast:

- Successes only. A throw propagates uncached, so transient model failures and
  the retryable rejections built on them behave exactly as they do without the
  cache. Caching an error would turn a network blip into a permanent verdict.
- The model identity is in the key. A GLM cache must never serve a codex verdict
  for the same prompt, and a prompt-version bump must miss. Covered by a test
  that shares one store between two namespaces.
- render/compose are never cached. They carry a per-run model_version rather
  than a pinned prompt contract, and their answers are what the recall log
  grades -- replaying an earlier answer there would corrupt an evaluation
  rather than speed one up.

Measured cold vs warm over 50 labelled boundary claims against real GLM:

  cold   hits=0  misses=50  50 writes   23.6s
  warm   hits=50 misses=0   100% hits    0.1s

and the warm run reproduced the cold run's decisions exactly (15/26 durable,
20/24 residue both times), which is the property that matters -- the speedup is
worthless if the replay is not identical.

identity-cost gains --digests, which prints the per-cluster cache-key input so
two snapshots of a running ledger can be diffed to measure the hit rate
memoization sees ACROSS cycles. That is the number that predicts the real
benefit, and it is not 100%: a cluster that gains a single mention is a
different input and therefore a miss.

Also records the standing rule agreed with the coordinator: a reduction may
select whole clusters and must never prune members inside one (doc 47 #7/#8).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T4Pa42d2xtXWNFxf4MddNc
Git-on-my-level added a commit that referenced this pull request Oct 22, 2026
…notes, boundaries and lifecycle (shadow by default) (#23335)

## Capture, speaker and notes refactor integration

Integrates L1 `efd6d97d1a5`, L2 `f01392bfc7b`, L3 `2475429ecc1`, L4
`8ec85289796`, and L5 `f4877478d10` in that order, plus current main.
This is a branch-only integration: no PR, main merge, deployment or
cohort change.

- L1: committed frame ledger, intake/dedupe/config hygiene,
authenticated coverage route and export, same-key open-live discovery
without a device. The generated plan alias reader now uses the gated
shared parser.
- L2: ranked evidence, receipt-constrained projection, caches and
pooling; explicit owner/retraction wire events; continuity and GPU
policy packaging; boundary roster candidates retain low,
non-label-eligible priors.
- L3: unified notes packet/output/language work; cache source closure
and effective packet/version identity; metric export;
account/conversation-aware episode rendering and language propagation.
- L4: mounted boundary endpoint, live committed events,
CAS/clocks/boundaries/executors, durable atomic merge admission and
epoch-fenced reconciliation in the existing finalization outbox.
Correction transfer seals the recovery phase atomically; recovery safely
rolls back preparation or replays sealed source cleanup without another
paid notes call. Empty-ready quiet obligations use content/lease-fenced
lifecycle deletion. Normal and recovered merge completion share the
typed notification dispatcher and retain the data-only background
transport.
- L5: mobile Home/owner/custody/continuations and desktop
identity/labels/boundary adapters consume the integrated authorities.
Tombstone-first deletion purges staged chunks even without a parent;
staging expires after seven days and expired parts cannot assemble.
- macOS meeting identity requires call-control chrome for Telegram,
Slack, Discord and WhatsApp. Dominant chat windows no longer supply
meeting participants.

## Flags and ramp

Backend `CAPTURE_COVERAGE_MODE`, `SPEAKER_EVIDENCE_MODE`,
`NOTES_PACKET_V2_MODE`, `STT_LANGUAGE_HINTS_MODE`,
`EPISODE_BOUNDARIES_MODE`, `LIFECYCLE_V2_MODE`, and
`CLIENTS_FROM_SEGMENTS_CHUNKS_MODE` remain shadow by default. Percent
selectors default zero; digest lists default empty. No manifest serves a
cohort. Shadow retains legacy output and adds no duplicate paid
model/transcription call. Coverage records may be written in shadow, but
new committed custody events are emitted only for the capture serving
cohort.

PostHog `clients_refactor`, `clients_from_segments_chunks`,
`clients_boundary_evidence` remain off/unknown.
`custody_capture_committed_release` is a deleting opt-in and requires
explicit boolean true through the identity-fenced reader. No PostHog
rows or cohorts are changed here.

Owner **dazheng**, expansion complete by **2026-10-26**: integrated
synthetic/test cohort → reviewed runtime digest cohort → 1% → 5% → 25% →
100%, with a full clean observation window before each expansion. For
notes/client arms whose lane ramp uses 10%, require the same clean gate
before that step. Before continuation serves, enable Firestore TTL for
`from_segments_chunks.expires_at`; the seven-day expiry field and
assembly checks are implemented, but physical database TTL is not
applied by this code-only task. The reviewed declaration is
`backend/deploy/from-segments-retention.json`;
`backend/scripts/batch_pipeline_ttl.py --policy` produces its plan
without credentials.

Require zero custody loss, false frame suppression, duplicate
per-session conversations, manual-receipt violations, cross-boundary
automatic merges, empty rows reaching paid processing, and pre-durable
committed events. Review dedupe/projection/notes disagreements and owner
attribution, language quality, failed/held work, queue age and merge
dead letters. Exported families include capture coverage/dedupe/retry,
speaker evidence/agreement/owner share, notes shadow/results, lifecycle
shadow, executor task gauges and client refactor comparisons. The
prerecorded-language gate and vendor allowlist entries are retained.

Rollback: set backend mode off and client flags false; already-admitted
durable merge obligations continue reconciling. Do not remove TTL or
rewrite historical data as rollback.

## Invariants and failure class

Invariants: **INV-AUTH-1**, **INV-MEM-4**, **INV-CAP-1**,
**INV-TASK-2**. Identity fences remain authoritative; retained/released
audio requires exact durable proof; merge retraction preserves
correction/Undo and memory ownership; task effects stay behind
successful processing and source retraction boundaries.

Failure-Class: FC-split-mutation-authority

## Validation

- Backend lane lists: **2,897 passed across 87 file-isolated suites**.
Expanded seam run: **334 passed across 15 files**. The full selector ran
once (2,223 isolated files); 34 files exposed
integration/import-isolation regressions, all repaired and rerun. A
132-file affected union was checked; two files caught the brief
in-progress merge conflict and were rerun afterward. The 16-file
post-main run is **624 passed**, including those two. These focused
counts overlap.
- Merge/notification recovery follow-up: **135 passed across 13 files**;
the notification direct-call ratchet decreases by one.
- Real local Firestore emulator: **15 passed**, covering concurrent
merge admission, epoch fencing, atomic correction-transfer sealing,
empty-row deletion races and capture-ledger contention.
- Swift: **49 passed** (43 meeting identity/storage plus six L5 client
tests). Flutter: **58 focused tests passed**, plus the bootstrap's
hermetic spine/shell checks; analyzer ratchet passed with baseline lint
debt retained.
- Backend Pyright after the main merge: **zero errors**, with existing
warning-level debt (47,794 warnings).
- All heavy commands use `omi-heavy` and `nice -n 10`. OpenAPI, Dart,
Swift, TypeScript, feature-registry and plan-catalog outputs were
regenerated from their sources. All seven backend modes were checked
with an empty environment: shadow and no serving without a cohort.
Client readers require explicit boolean true, and no serve cohort is
introduced in manifests.

**Body-aware preflight: all 67 selected checks passed, zero skipped**
(also repeated successfully on the final pushed tip), after repairing
the notification boundary. The required non-force push passed its
exact-tip pre-push gate: current preflight, backend Pyright (zero
errors), bounded backend tests, OpenAPI/wire contracts, Flutter
generated output, Dart formatting and Swift compile. No production
reads, production API calls, GCP credential tier, deployment or paid
evaluation is used.

Publication: non-force push succeeded at **2026-10-22 19:20Z**, before
the 21:30Z cutoff. Remote and local tip both verify as
**`8892f2b85e7d5790c8b9a40169cdeffd9f8bb573`**, including review fix
`ec90304a8ca` and current main
`312b4f734c22900547ff23e7260f69622b6aa36b`. All five lane tips remain
ancestors; worktree is clean. The exact-tip pre-push gate passed: 67
selected preflight checks, Pyright zero errors, bounded backend tests,
source closure, OpenAPI/client compatibility, Flutter code generation,
Dart/Python formatting and Swift compile. The separate all-gates
preflight passed 68 gates with no failure or time skip. No GitHub
Actions runs are listed for this branch at verification, so this is
local-gate evidence, not a terminal GitHub CI claim. No PR, deployment
or cohort change is part of this task.

## Review findings

GLM lane reviews plus the contact-name addition are reconciled below.
All required-before-merge and required-before-ramp fixes are
implemented. Defaults remain shadow/off; no cohort or deployment
changes.

| Finding | Status | Resolution |
| --- | --- | --- |
| L1 #1 route registration | Done | Already integrated: authenticated
route policy, app role via sync mount, OpenAPI prefix and regenerated
wire outputs; push gate passes. |
| L1 #2 shadow audio fetch | Done | Shadow uses only an
already-prefetched manifest; full provider audio fetch requires the
capture serve cohort. |
| L1 #3 derivative cleanup | Done | Trim returns ownership of generated
and retired paths through the coordinator cleanup set, including fully
suppressed input. |
| L1 #4 dark metadata | Done | Accepted internal-only delta; missing
envelopes/optional identity fields are guarded and tested. |
| L1 #5 empty uploads | Done | Synthetic covered response is serve-only;
shadow/off retain legacy empty admission. |
| L1 #6 open-live binding | Done | Already integrated: no-device
discovery gate plus full capture/session/clock projection and
transactional selection. |
| L2 #1 preserve established labels | Done | Abstaining clusters emit no
replacement decision; accepted voice candidates and scoped manual
decisions alone project labels. Reprocessing fixtures preserve
established owner/person labels and identity status with expired audio,
exhausted budget or a deleted print. |
| L2 #2 pinned operating points | Done | Independent literal and
comparison-strictness pins cover every legacy point, plus each env
override and the shared finalize/cross-epoch binding. |
| L2 #3 ownership | Done | Integrator ratifies the voiceprint-scoped
users.py and speaker_assignment_effects.py edits and the documented
conversation_speakers path correction. |
| L2 #4 second wire emitter | Done | Owner/retraction adapter already
integrated; the transcript introduction emitter now explicitly declares
is_user=false because it is contact-only. |
| L2 #5 malformed evidence | Done | Evidence reads fail open to existing
labels, with a bounded error log and fallback counter; malformed
content/identity is not logged. |
| L2 #6 policy consumers/markers/provenance | Done | Continuity and GPU
policy imports were integrated; missing superseded markers added and
original offline measurement provenance restored. OperatingPoint.accepts
remains a tested pure policy utility. |
| L2 #7 pooling edges | Done | Legacy multi-sample provenance is
retained as one aggregate base, replaceable/retractable as one
contribution. Sample deletion already preserves the materialized
remaining source; regression coverage pins it. |
| L4 F1 shadow read cadence | Done | Bounded owner/client-scoped
60-second caches cover shadow windows and unchanged context ingestion,
with write invalidation. Serve reads remain fresh. |
| L4 F2 candidate widening | Done | Numeric/ISO timestamp normalization
requires the lifecycle serve cohort; shadow/off retain raw datetime-only
eligibility. |
| L4 F3 rescheduling | Done | Calendar identities accept an updated
start/window; non-calendar starts remain immutable and same-start end
retries cannot reopen. Saved row contexts cannot rewind an authoritative
calendar reschedule. |
| L4 F4 post-commit hardening | Done | Malformed run grouping and
optional publication failures cannot fail an already-durable transcript
flush or trigger rollover. No custody event is emitted without ledger
success. |
| L4 F5 integration gaps | Done | Boundary mount/policy, durable merge
leases/reconciliation, empty-ready deletion and serve-only bounded
executor were completed in integration. Shadow/off deliberately retain
the legacy executor. |
| L4 F6 sanctioned deltas | Skipped | Informational: retain the
brief-authorized cap/CAS/UTC fixes and same-value activity/speech dual
writes; no additional behavior change. |
| L4 F7 missing producer | Done | L1 coverage is present in the composed
runtime and source-closure checks; no absent-module stub or bypass. |
| L4 F8 cold emulator contention | Skipped | Informational flake; no
weakened retry/fixture policy. The current 15-test emulator run includes
the concurrent-reconnect case and passed; this is not treated as a
production defect. |
| L5 #1 custody index failure | Done | Newly released copies revert to
repair on failed index persistence. Flush durably commits a release
before retention can act on it; no extra save in default mode without a
release. Failure fixtures preserve the audio file. |
| L5 #2 continuation flag withdrawal | Done | Prepared input is
terminalized once as continuation_disabled, with the prepared copy
dropped and the audio retained. Status/reason are durable; no repeated
recognition/upload, including without a model. |
| L5 #3 unfinished Home rows | Done | Serving hides in-progress,
processing and merging members until completed/failed. Flag-off behavior
remains identical. |
| L5 #4 missing desktop finish | Done | Chunked finalization derives an
absent finish from the latest finite positive segment end; explicit
finish and legacy single-shot behavior are preserved. |
| L5 #5 early chunk validation | Done | Finite, nonnegative,
positive-duration and nonblank segment checks run before any staged
write. |
| L5 #6 projection-digest response | Skipped | Optional protocol
expansion is beyond a cheap follow-up: it needs a versioned
response/decoder contract. Frozen clients already keep a stable
projection; retain first-staged display-only projection and list digest
negotiation as follow-up. |
| L5 #7 agreement log noise | Done | Mobile comparison helper and
desktop hot paths log disagreements/errors only; backend agreement
counters remain available without per-agreement log lines. |
| L5 ownership/registry notes | Done | Integrator ratifies extracted
developer intake/models/tests for the line-count boundary; the L1-owned
coverage registry declaration was reconciled at integration. |
| Ambiguous contact names | Done | Rule preserves transcript spelling
when contacts compete and forbids merging shared first names. Synthetic
packet fixture lists confusable and shared-first-name candidates without
choosing or projecting a label. |

Review-pass validation: **1,180 passed across 29 focused backend files**
after merging P71; **157 passed across six final seam files**
(overlapping the broader run), **33 Flutter tests**, **seven Swift
tests**, and **15 local Firestore emulator tests**. Pyright after the
main merge: **zero errors** (47,827 warnings under the repository's
warning-level checks). The only initial new-fixture failure was its
missing policy_version; corrected and rerun. No required finding is
deferred to the ramp. Review-pass body-aware preflight: **68 gates
passed, zero failures, zero time skips** (492 seconds). Exact-tip
pre-push passed; the remote SHA and gate receipt are recorded above.

## UI evidence

L5's real ConversationsPage hermetic renders are retained unchanged by
integration.

![Shadow
Home](https://raw.githubusercontent.com/BasedHardware/omi/5d66b99f2460e1a591d87df7323789244180f7ca/.agent-artifacts/ui-evidence/refactor-l5-clients/001-mobile-ios-home-shadow.png)
![Serve
Home](https://raw.githubusercontent.com/BasedHardware/omi/5d66b99f2460e1a591d87df7323789244180f7ca/.agent-artifacts/ui-evidence/refactor-l5-clients/002-mobile-ios-home-serve.png)

## Conflicts

Review-pass main merge: `312b4f734c2` brings the P71 as-captured archive
ruling. Resolve the `audio_archive.py` parser conflict by preserving
main's LIVE/READ default-on behavior through the shared default-on
helper; all seven refactor modes remain shadow and their cohorts empty.
The registry renderer synchronizes those inherited kill-switch metadata
fields and regenerates the doc. No refactor serving default is enabled.

Lane merge conflicts were flag declarations and dead-code metadata. The
final main merge also conflicted on the sync-router imports and the
metric-export regex: retain both route/playback imports and the union of
metric families, including main’s playback metric and the pinned
language/vendor entries. Preserve each authority's declarations, retain
consumed-contract removals, and regenerate the registry. OpenAPI and
client wire artifacts are regenerated after route composition. The
dead-code tool explicitly never generates/prunes allowlists; merge their
explicit declaration changes and validate them with the tool rather than
inventing missing exemptions. No product-code conflict was resolved by
taking an entire side.

## Risks and remaining rollout work

- No deployed/product acceptance claim: PostHog configuration, physical
Firestore TTL activation, runtime cohorts and semantic
attribution/language sampling still require the owner-led ramp.
- Source provenance absent from older/on-device results remains unknown;
partial segment overlap retains audio rather than guessing alignment.
Simultaneous read-only admissions can still duplicate provider spend
before transactional dedupe observes a committed winner.
- Speaker calibration starts at existing operating points and
process-local embedding caches do not imply cross-replica reuse.
Evidence can briefly lag transcript persistence.
- Persistent sealed merge cleanup failure stops after five attempts,
retaining its survivor and durable failure record for reconciliation. No
speculative restoration after correction anchors move.
- L3 filtering only drops explicit `out_of_profile` metadata. The
independent live language observer remains telemetry-only; expanding
stored classification and the topic request's optional classified-input
support is follow-up work, not a new heuristic in this integration.
- GPU policy source closure and local tests do not prove a deployed GPU
image. Client screenshots remain the L5 hermetic page evidence; no
named-bundle live E2E or physical-device custody test is claimed.

## Deletion follow-up after bake

1. Retire legacy capture text/clock dedupe, open-target selection and
config parsers only after missing-speech and held-work gates are clean;
add the same-audio-twice synthetic soak case to private staging tooling.
2. Retire competing speaker hard-label writers and legacy voiceprint
replacement after evidence/receipt and Undo acceptance; keep
released-client sentinel reads until supported versions adopt explicit
owner events.
3. Retire the legacy notes packet/output/prompt branches after quality
sampling; move remaining offline-only episode selection/tier helpers
alongside evaluation code.
4. Retire legacy merge admission and redundant speech-clock readers
after outbox recovery bake; stop `finished_at` compatibility dual-writes
only when all consumers migrate.
5. Retire old Home, local-label and 500-segment/refusal/compaction paths
after client adoption. Verify physical staging TTL and account-erasure
coverage before deleting migration adapters.
6. Append-only segment storage and the pusher session-state restructure
remain separate follow-ups.

🤖 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/23335?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/23335?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23335&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. -->
Git-on-my-level added a commit that referenced this pull request Nov 1, 2026
…T) and split owner_wait re-leases (relet) (#24273)

## Summary

Two batchdesign §9 worker-roll items (PR-3 + PR-4a), one themed PR.
Rides the batch worker roll, no Cloud Runtime env changes, no `.github/`
changes.

**PR-3 — sample the strict-VAD shadow.**
`BATCH_PIPELINE_STRICT_VAD_SHADOW_PERCENT` (default 10; 0 off, 100 full;
invalid keeps 10) samples the CPU strict-VAD shadow deterministically by
segment hash (`cohort_bucket(segment_id, '')`, the repo's unsalted
sha256 primitive, so a re-leased unit samples identically on every
worker). Unsampled units skip `inspect_worker_vad` in `_decode_context`
and the comparison site emits no `strict_vad` counters; the
`strict_vad_shadow` stage timing and CPU histogram fire only for sampled
units. Worker outcome and payload are unchanged — the existing parity
test (`test_shadow_cannot_change_words_speakers_clocks_or_model_calls`)
plus a new sampling-parity test prove it.

**Cost and proof.** The shadow costs up to 0.6 s of the measured 2.55 s
GPU-lock flight (batchdesign #7, 15:36–16:56Z window). Stage sums
overstate; the saving is proven only by post-roll
`rate(stage_seconds_sum{stage="worker_flight"})/rate(completed)`.

**PR-4a — honest owner wait.** `record('leased', wait_seconds=…)` gains
`relet: bool`; `omi_batch_pipeline_owner_wait_seconds` gains the bounded
`relet` label ('true'/'false'). `relet = admission_refusals > 0 or
attempt > 1` (post-increment): `defer()` refunds the attempt
(`scheduler.py` `attempt=max(0, attempt-1)`), so an admission-deferred
re-lease has attempt 1 and is a relet only through its refusal streak;
every compute-failure re-lease carries a charged attempt. This unblocks
the batchdesign §7.2 gate: gate on `owner_wait{relet="false"}`, never
the mixed series (at 25%, 62% of leases were re-leases of held units).

## The 48 h silence qualification at 10% sampling

The qualification needs `strict_silent` evidence to prove
strict-silent-but-pyannote-nonempty units produce no words (12.7%
disagreement observed; 1,602 strict-silent/day at the 25% cohort with
full shadow, batchdesign #9). At a **fixed cohort**, 10% sampling
collects ~160 strict-silent/day, so the same evidence the planned 48 h
window would collect now needs **~480 h (20 days)**. Batch ramps to 100%
tonight (5–10× unit intake): at 100%, a **48 h window at 10% collects
~1.6k–3.2k strict-silent ≈ today's full-shadow 48 h volume**, so the
original window holds once the ramp lands. Re-derive the window from
`omi_batch_pipeline_strict_vad_shadow_total{outcome="strict_silent"}`
rate at the current cohort; if the ramp stalls, raise the percent (it is
live config on the worker chart) rather than waiting.

## Tests (local shard, `backend/test.sh` via
BACKEND_UNIT_TEST_FILE_LIST, omi-heavy)

- 233 passed / 0 failed across `test_batch_pipeline_worker_bundle.py`
(51), `test_batch_pipeline_worker.py` (105),
`test_batch_pipeline_scheduler.py` (43),
`test_batch_pipeline_metrics.py` (15), `test_reason_label_enums.py`
(19).
- New: percent parse/clamp; deterministic-by-hash + ~10% distribution
band; 0%/100% edges; unsampled skips inspect AND counters with identical
payload; first lease `relet=false`; admission-deferred re-lease (attempt
refunded) `relet=true`; attempt-charged re-lease after lease expiry
`relet=true`.
- Updated: `test_worker_strict_silence_commits_or_preserves_quarantine`
pins sampling to 100 to keep counting its record-only inspection;
`owner_wait` series assertions now carry the `relet` label.

## Config surfaces

- Worker chart: `worker.strictVadShadowPercent` default 10, prod pinned
10 with rollback comment (100 restores full, 0 disables). Registry row
added (`config_switch`, terminal keep),
`backend/docs/feature-flag-registry.md` regenerated as-of 2026-11-01,
deployment-setting classified `config`. `feature-flag-registry` and
`deployment secret-boundary` checkers pass locally. No runtime_env
change (no INV-MEM-4).

## Rollout

Worker image roll only (lead-owned). Both changes are observable
immediately after the roll: shadow counter rate ÷10 at fixed cohort,
`relet` label on new series. Kill switch:
`worker.strictVadShadowPercent=100` (or 0) on the worker chart.

Failure-Class: none
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Nov 11, 2026
Replace the 35-file source digest that keyed notes/L1 reuse with an explicit
prompt version, guarded by a pinned prompt-source digest in the test. A deploy
that touches unrelated code no longer voids every stored hash.

Skip the L1 memory-extraction call for noise rows and owner speech under 30
words. Unknown owner attribution is never read as owner absence; a curated row
always extracts; nothing is written on a skip.

Fable LLM-efficiency BasedHardware#5 and BasedHardware#7.
Dimank92 pushed a commit to Dimank92/omi that referenced this pull request Nov 11, 2026
Replace the 35-file source digest that keyed notes/L1 reuse with an explicit
prompt version, guarded by a pinned prompt-source digest in the test. A deploy
that touches unrelated code no longer voids every stored hash.

Skip the L1 memory-extraction call for noise rows and owner speech under 30
words. Unknown owner attribution is never read as owner absence; a curated row
always extracts; nothing is written on a skip.

Fable LLM-efficiency BasedHardware#5 and BasedHardware#7.
Git-on-my-level added a commit that referenced this pull request Nov 21, 2026
…ersations-v3 first (SCA-2967) (#25713)

## What changed and why

SCA-2967. Activating conversations-v3 for TestFlight on 2026-11-17
needed several services to move in a fixed order: backend Cloud Run,
then llm-gateway, then pusher, then listen. Nothing encoded that order,
and each gap was found in prod or by luck:
- llm-gateway was two weeks stale and had no v3 lanes;
- pusher lacked the `SYNC_TASKS_PROJECT`/`SYNC_TASKS_LOCATION` that
listen sets;
- pusher's image was 8 days old (version skew);
- the `conversations-v3` queue and the v3 scheduler jobs did not exist.

KB evidence: `evidence/2026-11-17-v3-testflight-activation-escapes.md`
(#7, #8) and `2026-11-17-delivery-debt-from-v3-rollout.md` (D1, D8).

This PR adds a feature activation manifest (data) and a read-only tool
that checks it against live serving state. The first manifest is
conversations-v3. **The tool is not wired into any gate.**

- `backend/deploy/activation/conversations-v3.yaml` lists:
- the services and the commits each must contain (ancestry, not an exact
SHA);
  - the order they must move in;
- env keys that must be set, and equal across runtimes where that
matters;
  - gateway lanes, the queue and the scheduler jobs.

Each entry has a `why` that points at the code or incident behind it.
The format is in `backend/deploy/activation/README.md`.
- `backend/scripts/activation_check.py` is pure: manifest + state JSON
in, verdict out. Each requirement is `satisfied`, `missing`, `unknown`
or `deferred`.
- Exit codes: `0` READY; `1` BLOCKED (a controlled requirement is
missing); `2` UNKNOWN (nothing missing, but a controlled requirement
could not be read); `3` invalid input.
  - `unknown` never counts as satisfied.
- Some requirements are owned elsewhere: anything marked `controlled:
false` (the backfill queue), and anything listed under `not_checked`
(Firestore indexes, owned by the index readiness gate). They are always
reported, and the report says who owns them, but they never change the
exit code.
- `--before <service>` checks only the requirements due before that
service moves.
  - The verdict prints the state's `collected_at`.
- `backend/scripts/activation_collect.py` reads prod metadata only:
- Cloud Run: only the revisions receiving traffic, from
`status.traffic`, never the spec.
- GKE: the Deployment template env, with ConfigMaps resolved, and the
image digests of running pods.
  - Cloud Tasks queues and Scheduler jobs: one `list` call per location.

Serving identity comes from the image: its OCI
`org.opencontainers.image.revision` label, else its commit tag. The prod
pusher digest is looked up in the dev registry it was promoted from.
`OMI_BACKEND_RELEASE_SHA` is only recorded, as `release_env`: env merges
never remove a value, so it can name a release the revision does not
serve.

The collector never reads Secrets and records only the env keys the
manifest names. The checker's report prints key and runtime names, never
values.

### v3 requirements

| Kind | Requirement |
| --- | --- |
| Order | 1. `backend`, `backend-sync`, `backend-sync-backfill`,
`backend-integration`, `desktop-backend` → 2. `llm-gateway` → 3.
`pusher` → 4. `backend-listen` → lever (`CONVERSATIONS_V3_STAGE` /
`CONVERSATIONS_V3`) |
| Contains | Writers (`backend`, `backend-integration`,
`backend-listen`): #25500, #25588, #25658, #25661. Builder hosts
(`backend-sync`, `backend-sync-backfill`): the same plus #25691.
`llm-gateway`: #25500 (v3 lanes). `pusher`: #25500 (v3-aware
finalization), #25658 (admission) |
| Gateway lanes | `omi:auto:conversation-v3-outline`, `-summary`,
`-summary-open`, `omi:auto:conv-action-items` |
| Env | `v3-task-binding`: `SYNC_TASKS_PROJECT`/`LOCATION`/`INVOKER_SA`
set and equal on the six writers.<br>`v3-task-target`:
`CONVERSATIONS_V3_TASKS_URL` or `SYNC_TASKS_HANDLER_URL`.<br>`v3-stage`:
`CONVERSATIONS_V3_STAGE` equal on the writers and desktop (code default
`beta` for an absent key).<br>`v3-kill-switch`: `CONVERSATIONS_V3`
equal.<br>`v3-gateway-endpoint`: `OMI_LLM_GATEWAY_URL` on `backend` and
`backend-sync`; the placeholders `http://127.0.0.1:9` and `:9080` count
as unset |
| Queues | `conversations-v3` (controlled); `conversations-v3-backfill`
(`controlled: false`) |
| Scheduler | `conversations-v3-sweep`, `conversations-v3-legacy-users`
(ENABLED) |
| Not checked | Firestore composite indexes (index readiness gate) |

### How Release calls it (not in this PR)

Before each step of the train, and before a stage or kill-switch move:
1. `source ~/.local/bin/gcp-agent-env.sh ro-prod && git fetch origin`.
2. `python3 backend/scripts/activation_collect.py --manifest
backend/deploy/activation/<feature>.yaml --cluster prod-omi-gke
--promoted-from-gcloud-config ~/.config/gcloud-agent/ro-dev --out
state.json`.
3. `python3 backend/scripts/activation_check.py --manifest … --state
state.json --before <service|activate> --json`.
4. On exit 1, stop and name the missing requirements. On exit 2, a human
reviews the unknowns. On exit 0, proceed.

Only controlled requirements affect the exit code, so the check trips
only on signals the activation controls. The meta-repo train
(`omi-deploy-prod` / `train.sh`) can call these two scripts from its
release checkout; that wiring is a separate change.

## Product invariants affected

none

## How it was verified

- `backend/.venv/bin/python -m pytest -q
backend/tests/unit/test_activation_manifest.py`: 38 passed.
- **2026-11-17 fixture**
(`backend/tests/unit/fixtures/activation/state-2026-11-17.json`):
`verdict=BLOCKED`, exit 1, satisfied=63, missing=14, unknown=1. Missing:
- stale gateway: `service:llm-gateway:contains:012329830a9e`, plus the
three lanes `lane:omi:auto:conversation-v3-outline` / `-summary` /
`-summary-open`;
- old pusher image: `service:pusher:contains:012329830a9e` and
`:156b50921d7e`;
- pusher task binding: `env:v3-task-binding:pusher:SYNC_TASKS_PROJECT`
and `:SYNC_TASKS_LOCATION`, with their two `env-equal` results;
- infra: `queue:conversations-v3`,
`scheduler-job:conversations-v3-sweep`,
`scheduler-job:conversations-v3-legacy-users`;
  - the backfill queue (advisory).

The one unknown is the advisory Firestore-index item. With `--before
backend-listen`, the gateway, pusher and infra gaps still block, and
listen's own 10 requirements are deferred.
- **Correct-state fixture** (`state-ready.json`): `verdict=READY`, exit
0, satisfied=77, missing=0; the only unknown is the advisory
Firestore-index item.
- **Current prod, collected 2026-11-18T19:24:59Z** with the read-only
`ro-prod` identity, plus `ro-dev` for the dev-registry tag only.
Metadata reads only, no writes.
- `verdict=READY`, exit 0: satisfied=77, missing=0, unknown=1 (advisory
`external:firestore-indexes`).
- All 9 services resolved to a source commit, all 4 lanes are served,
all env requirements are met and equal, the `conversations-v3` queue is
RUNNING, and both v3 jobs are ENABLED.
- The first manifest draft required #25691 on `backend-listen`, and prod
(listen serving 44d0a4f) reported it missing. Short-task extraction runs
only on the sync task handler, so that requirement now applies to the
builder hosts only.
- `scripts/pr-preflight --pr-body-file` passed, and so did `python3
.github/scripts/check_release_rings.py` (the scope panel warned against
reusing the forbidden "release ring" names).

### Panels

- **Scope** `scope-20261118t174316-a7fd`: only glm-flash completed; luna
failed to launch (journal busy) and deepseek failed. Taken from it:
  - `activation` naming;
- CLI and tests only, with no checks-manifest entry or cross-service
invariant (check budget);
  - queue and scheduler ownership (ops_train, scheduler_reconcile);
- keep the manifest from drifting away from `runtime_env` (handled by a
drift test).

Two of its claims were contradicted by live reads, and I resolved them
that way:
- It said `OMI_BACKEND_RELEASE_SHA` is the true marker. Image identity
is used instead, per the documented env-merge misread.
- It said prod pusher's digest has no live source. The dev-registry tag
does resolve it.
- **Review** `review-20261118t185330-8905` (FIX-FIRST; deepseek and
glm-flash; luna failed to launch):
  - Accepted and fixed in d204e36: F1, F4–F17.
- F2/F3: the PR body first posted was another lane's (SCA-2966), because
a scratch file was shared between sessions. It has been replaced with
this one.

## Tests

`backend/tests/unit/test_activation_manifest.py` covers:
- **Fixtures:** each 11-17 escape is reported by name; the correct state
passes.
- **Unknown handling:** an unreadable service, ancestry or lanes gives
UNKNOWN (exit 2), never satisfied; missing beats unknown; uncontrolled
requirements never change the exit code; split traffic (every serving
revision must contain the commit); an env-equal result with one
unreadable unit is unknown.
- **Env values:** stage skew, code defaults versus an explicit empty
value, the placeholder URLs, `any_of` and Secret refs.
- **Order and input:** order deferral; invalid YAML, manifest and state
exit 3.
- **Collector, with fakes:** reads `status.traffic` and never the spec;
never reads Secrets; resolves ConfigMap and `envFrom`; resolves promoted
digests; failed reads become unknown; pod digest counting; container
choice; `Registry.source` (label, index, tag fallback, ambiguity); only
Google registry hosts.
- **Drift:** queue, job and lane names are parsed exactly from
`ops/prod.yaml`, `scheduler/jobs.yaml` and
`generated_route_overrides.yaml`. Every required env key is declared for
each runtime in the composed prod `runtime_env.yaml`; this would have
caught pusher's missing task binding at PR time.

## UI evidence

UI-Evidence: none -- backend tooling, no UI

## Failure class (fixes)

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant