Skip to content

refactor: one authority each for capture coverage, speaker evidence, notes, boundaries and lifecycle (shadow by default) - #23335

Merged
Git-on-my-level merged 71 commits into
mainfrom
refactor-integration
Oct 22, 2026
Merged

Git-on-my-level merged 71 commits into
mainfrom
refactor-integration

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

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
Serve Home

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

View guided diff Turn on auto-fix

Git-on-my-level and others added 30 commits October 22, 2026 21:49
…s refactor

One mode parser (off/shadow/serve, typo-safe, digest-only serve cohort) and the
default-on/default-off boolean parsers; pydantic contracts for the capture
coverage ledger, speaker evidence and boundary evidence; the episode moment
renderer seam (current behavior).

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

Gate parser and precedence changes behind capture coverage mode while retaining the legacy shadow behavior.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep legacy retry behavior in shadow and terminalize capped serve attempts through the existing fenced recovery paths.

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

Share frame-proof and legacy text dedupe across incoming sync chunks and bridge donors. Keep legacy output in shadow; expose the bounded authenticated coverage query and preserve source provenance through batch packing.

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

Preserve the live, finalize and clustering accept boundaries while exposing a monotonic operating-point calibration. Reuse byte-identical clip vectors across extraction entrypoints with a bounded model-aware TTL cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve capture-session identity across held recovery and retain conservative whole-frame boundaries.

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

Persist encrypted conversation evidence without changing the parent revision. Shadow compares label projection; the serve cohort uses the manual-receipt-constrained projection, resolves compatible batch boundaries, and abstains on unproven audio windows. Pool person teaching with provenance and undo while preserving publication fences.

Failure-Class: FC-split-mutation-authority

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add serve-gated notes authorities and cheap shadow comparisons, retain repairable agent submissions, share safe voice rendering, and archive retired evidence-writing prompts.

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

Count skipped audio only after successful materialization and keep provider coverage manifests separate from legacy binding decisions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use only synthetic transcripts to exercise every processing trigger, one-call shadow behavior, shared repairs, episode rendering, Soniox cohort isolation and revision-aware recaps.

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

Keep shadow validation on copies, use the repaired artifact for serving, and leave empty transcript admission to the existing relevance rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Make the derived cohort key names enumerable by the flag registry and assert that they agree with the shared parser naming convention. Runtime mode and cohort reads remain centralized.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use one independent internal output schema, migrate length-policy imports, declare dynamically read cohort keys for the registry, and resolve type diagnostics without changing wire contracts.

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

Stage encrypted chunks by session and index, preserve the existing conversation admission owner, and shadow L1 coverage with exact optional source ranges.

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

Keep finished episode conversations visible for the client cohort, retract automatic labels, send long transcripts in immutable chunks, and shadow exact server custody receipts behind an explicit release opt-in.

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

Keep malformed evidence errors on the repository read boundary and verify that diagnostics expose neither payload values nor account identifiers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level and others added 9 commits October 22, 2026 23:55
Integrate route composition, cache identities, live discovery, roster and
language adapters, fenced durable merge recovery and staged deletion.
Keep all serving paths behind their existing shadow/off defaults.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restore the complete flag declarations, keep new imports behind their serving seams, and carry isolated fixtures and trust-boundary inventories through the module moves. Gate committed custody events by the capture serve cohort and preserve unpositioned sync uploads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve sync imports by retaining coverage and playback adapters; retain the combined metric export families and regenerate client contracts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve the data-only background merge message while sharing the typed notification policy boundary across ordinary and recovered completion. Remove the old direct-producer baseline entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Include the admin sensitive-field and review follow-up changes that landed during the first integration push.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bound shadow observation work, preserve established speaker labels on abstention, pin operating points, support safe calendar rescheduling, and make client custody and continuation rollback durable. Include the inexpensive review follow-ups and explicit ambiguous-contact rules with synthetic regressions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve P71 LIVE and READ defaults through the shared default-on parser; keep refactor modes shadow and regenerate the registry from the combined declarations.

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

mintlify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Oct 22, 2026, 7:32 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T20:09:55.168628Z ff2e766 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: 8892f2b85e

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

row.captureRoot == wal.captureRoot &&
row.channel == 'mono' &&
row.clockEpoch == wal.sourceClockEpoch.toString() &&
(row.recordingSessionId == null || row.recordingSessionId == wal.recordingSessionId))

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 Require an exact session match before releasing custody

When a capture_committed event omits the optional recording_session_id, this predicate treats it as a wildcard and accepts it for any WAL sharing the root, channel, epoch, and range. That collapses two distinct capture keys; a sessionless receipt can therefore mark audio from a session-scoped WAL as synced, allowing retention to delete the only local copy without uploading it. Compare nullable session IDs for equality instead of treating null as a wildcard.

Useful? React with 👍 / 👎.

Comment on lines +70 to +71
do { try await APIClient.shared.sendBoundaryEvidence(signals, authorization: authorization) } catch {
log("event=refactor_shadow lane=L5 check=boundary_evidence outcome=error")

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 Retain failed boundary events for retry

If the start-boundary request fails because the Mac is temporarily offline or the backend is unavailable, observe has already stored the signal as active, so later active observations emit nothing and this catch permanently drops the event. The backend then cannot apply the boundary while the meeting is in progress, and an app exit before the closing edge loses it entirely; keep the event in an owner-scoped retry queue (or revert the state) and record the required structured fallback rather than only writing a local log.

AGENTS.md reference: desktop/macos/AGENTS.md:L43-L44

Useful? React with 👍 / 👎.

title = re.sub(r'^\W*(?:and\s+)?|\s+and\W*$', '', title, flags=re.IGNORECASE).strip(' :,-')
if title != repaired.get('title'):
repairs.append('owner_removed_from_title')
repaired['title'] = title

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 a nonempty title after removing the owner name

When the submitted title consists only of the account owner's name or possessive form, it passes the earlier nonempty-title validation but this repair removes its entire contents. Nothing subsequently revalidates or replaces the now-empty title, so an otherwise accepted note can be served with a blank conversation title. Revalidate after owner removal and choose a grounded fallback when nothing remains.

Useful? React with 👍 / 👎.

target = (
client.collection('users').document(job['uid']).collection('conversations').document(job['merge_target_id'])
)
if target.get().exists and not cleanup_failed_merge_target(job['uid'], job['merge_target_id']):

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 Clean up merge artifacts before the target document exists

If a merge worker crashes after _copy_audio_chunks_for_merge has copied some objects but before it creates the target Firestore document, recovery skips cleanup_failed_merge_target because target.get().exists is false and then releases the source conversations. The partially copied customer audio under merge_target_id is consequently orphaned indefinitely; run target cleanup for this recovery phase even when the document was never created.

Useful? React with 👍 / 👎.

Comment on lines +29 to +30
if episode and current != previous:
proposed = policy.Boundary('close', 'boundary')

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 Close episodes that cross a completed boundary window

When a meeting starts and ends between the current episode's start and the next moment, both previous and current are empty, so this equality check misses both hard edges and leaves the legacy decision in place. This occurs when there is no speech during a short meeting or its calendar evidence arrives late, and it can merge the ambient speech on either side into one episode despite the recorded boundary. Check whether any stored edge was crossed over the interval, rather than comparing only the active sets at its endpoints.

Useful? React with 👍 / 👎.

if any(common(part) != common(parts[0]) for part in parts):
raise HTTPException(status_code=409, detail='Continuation metadata changed between chunks')
assembled = dict(parts[0])
assembled['transcript_segments'] = [segment for part in parts for segment in part['transcript_segments']]

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 Bound the assembled continuation before processing

Each of the 128 permitted chunks may contain 500 segments and up to 700 KB, but this concatenation has no aggregate segment or byte limit and deliberately bypasses the request model's 500-item validation. A final chunk can therefore make one worker decrypt and synchronously process tens of thousands of segments and tens of megabytes, eventually exceeding the LLM or Firestore document limit after all chunks were accepted; the client then repeatedly retries an upload that cannot complete. Enforce an aggregate processing/storage budget before constructing or ingesting the assembled request.

Useful? React with 👍 / 👎.

Comment on lines +241 to +242
if serving_for(flag, uid):
raise

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 Validate coverage range limits at the request boundary

In serving mode, a request model may contain up to 500 capture_segment_ranges, while coverage.admit accepts at most 32; a valid request with 33–500 per-segment ranges therefore raises ValueError here and is rethrown as a 500 response. The same path exposes other client-controlled key/range validation failures as server errors. Align the schema with the coverage limit or coalesce the ranges, and translate invalid proofs into a 422 response.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 3 commits October 23, 2026 02:40
In shadow, every committed live batch wrote a ledger transaction and every
positioned sync segment read it, for every user. Shadow only needs a
measurement sample: the ledger now records and answers for the serve cohort
plus CAPTURE_COVERAGE_MODE_SHADOW_PERCENT of uids (default 5). Outside the
sample it behaves exactly as mode off.

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

The writer now lives under testing/; the inventory lists production call sites only.

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: ff2e766765

ℹ️ 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 +192 to +193
fingerprint = input_fingerprint(conversations_data or [])
if existing_summary and existing_summary.get(FINGERPRINT_FIELD) == fingerprint:

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 Retire stale recaps when no eligible inputs remain

When an existing recap's only source conversation becomes locked, the new fingerprint changes, but the subsequent filtering produces no conversations and returns without updating or deleting existing_summary. The daily-summary list, search, and detail routes serve the stored recap without rechecking source locks, so content derived from the newly locked conversation remains accessible (including through a preserved shared recap). Retire the stale recap or replace it with an empty eligible state when a mismatched fingerprint resolves to no eligible inputs.

Useful? React with 👍 / 👎.

Comment on lines +22 to +23
for (final segment in segments) {
if (segment.speakerId != event.speakerId ||

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 Scope speaker retractions to the current voice epoch

When a live connection or provider changes, numeric speaker IDs can restart, but neither this event nor the Flutter transcript model carries the server's speaker_id_scope. This new loop therefore handles a retraction for the current SPEAKER_01 by clearing automatic owner/person labels from every retained segment numbered 1, including segments produced by a different voice before a reconnect. Carry the scope through the event/client model, or otherwise restrict retraction to segments proven to belong to the event's voice epoch.

Useful? React with 👍 / 👎.

Comment on lines +795 to 802
record_projection(
binding.owner_id,
incoming,
target_id=context.target_id,
candidate_id=candidate['id'] if candidate else None,
firestore_client=self.store.client,
before_assign=session.prepare,
validate_plan=session.validate_plan,
after_assign=persisted,
retry_contention=policy.projection_contention,
timing=policy.projection_timing,
**self._index_options(hint),
assigned[0],
manifest,
capture_at=item.capture_at,
survivors=assigned[2],
)

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 Make coverage publication replayable after projection commits

After assign_sync_conversation commits, its callback has already persisted the projection receipt in the same transaction, but the coverage record is written only here afterward. If the worker dies in that window, or the coverage write encounters the transient failure that record_projection catches internally, the next attempt reaches self.store.check, raises ProjectionReplay, and skips this call permanently. The committed frame range is then absent from the ledger, so a later upload of the same capture can be transcribed and appended again; publish coverage through a durable outbox or reconstruct it on the replay path before acknowledging the receipt.

Useful? React with 👍 / 👎.

Comment on lines +9 to +11
wal.onDevicePreparedUpload = null;
wal.onDeviceUploadFailure = 'continuation_disabled';
wal.markUploadRejected();

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 Preserve prepared uploads across unavailable flag reads

When a WAL already has a prepared multi-chunk snapshot, any later false result from chunkUploads() reaches this method. That flag reader returns false not only for an intentional rollback but also when analytics is disabled or uninitialized, identity changes, or PostHog times out; these lines then discard the frozen request and put the WAL in terminal uploadRejected. The pending runner only selects miss, and the UI offers only Delete for uploadRejected, so a transient flag-read outage permanently strands the recording even if the flag later returns. Keep the snapshot and WAL retryable, or distinguish an authoritative flag-off from an unavailable read, instead of terminalizing it.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit f6021c0 into main Oct 22, 2026
65 of 66 checks passed
@Git-on-my-level
Git-on-my-level deleted the refactor-integration branch October 22, 2026 20:39
Git-on-my-level added a commit that referenced this pull request Oct 22, 2026
…ter #23335 (#23355)

Urgent fix for two runtime-image dependency closures that #23335 (wave 1
of the capture/speaker/notes refactor)
broke. Nothing rolled: the gcp_parakeet prod build failed its closure
probe, and prod Parakeet is unchanged.

## What broke
1. **parakeet:** `parakeet/transcribe.py` and `speaker_math.py` now
import the checkout shim `omi_speaker_policy`,
which re-exports `utils.speakers.policy`. The Dockerfile copies
`utils/speakers/policy.py` over the shim
(the NeMo image owns the top-level `utils`), the same pattern as
`omi_logging_config`. But the closure probe
   still counted `utils.speakers.policy` as an installed dependency:
`AssertionError: missing installed dependency modules:
utils.speakers.policy, ...` (run 39861808906).
2. **batch-pipeline-worker** (would fail on its next build):
`utils/batch_pipeline/retry_policy.py` imported
`utils.sync.retry_hygiene`, whose sync-only dispatch helper lazily
imports `utils.cloud_tasks`. That puts
`google.cloud.tasks_v2` in the GPU worker's closure, and
`google-cloud-tasks` is not in
   `pylock.batch-pipeline.toml`.

## Fix
- `backend/runtime_images.json`: a `dependency_probe_exclusions` entry
for `utils.speakers.policy` on the parakeet
contract, with the same reason as the existing `utils.logging_config`
entry. The image's copy of `policy.py`
  imports only the standard library.
- New `utils/capture/retry_cap.py`: the dependency-free retry-cap core
(`RetryCap`, `retry_cap`, `observe`,
`MODE`, `DECISIONS`). `utils/sync/retry_hygiene.py` re-exports it and
keeps the sync dispatch helpers.
`utils/batch_pipeline/retry_policy.py` imports the core. No behavior
change.

## Verification
- Every image's static closure (`third_party_dependency_modules`) was
compared before (f6021c0^1) and after:
  - parakeet no longer lists `utils.speakers.policy`;
- batch-pipeline-worker gains only `fastapi` and `protobuf`, both in its
lockfile;
- no other image's closure changed (19 images: pusher, desktop-backend,
llm-gateway and the rest).
- `tests/unit/test_runtime_image_contracts.py` plus every test touching
retry_hygiene, retry_policy or the
  retry-cap code: 505 passed.

Failure-Class: FC-runtime-image-boundary

🤖 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/23355?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/23355?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23355&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 Oct 23, 2026
…/actions/vocabulary, MCP read-API correctness (shadow by default) (#23358)

## What and why

Integrate wave 2 of capture, speaker evidence and notes against the
reviewed wave-1 authority. This is a branch-only handoff: no PR, merge
to main, runtime cohort, deployment or production data access. All
implementation commits use the requested co-author trailer.

- Wave 1: merged origin/refactor-integration first (2ca1c67); main
had not absorbed #23335 at intake. Its verified merge f6021c0 landed
at 2026-10-22 20:39:40Z and is now merged here.
- V1 speakers: 4c368cc. Participant hints and bounded
compatible-cluster reduction, explicit channel/near-field/voice anchors,
ambiguity-preserving people matching and enrollment quality. Applied
speakers-live-name-hook.patch. Reconciled the newer wave-1 abstention
contract: preserve unresolved identity while allowing compatible count
consolidation.
- V2 media/noise: 1519a9a. Applied media-consumer-integration.patch.
Classify before notes, keep media/noise history with deterministic
minima, suppress memory/task/recap derivation through one shared helper,
and persist terminal intelligence suppression for replay. Explicit
restore/reprocessing clears the exclusion and marker. Shared live/sync
hallucination admission remains cohort-only.
- V3 cross-device: a05a1f8. Completed-capture shared-speech
reconciliation and exact-key coverage aliases reuse the ledger and
capture-group writer. Originals and audio remain; unique secondary
speech remains visible. Streaming partial-window suppression and
automatic secondary-socket dispatch remain unimplemented.
- M MCP: 34d47d3. Correct filtered memory candidates, bounded
default lists, fair batch budgets/continuations, whole-window screen
aggregates, truthful counters/stubs, call metadata, provenance and
explicit timezones. Additive read correctness is on by default, as
authorized in lane M. Omitted timezone retains released UTC behavior.
- V4 calls/recaps/actions/vocabulary: d4509d3.
Completed-local-day/grace-period recaps, durable states and rollback
recovery, positive-evidence call metadata, owner-involved commitments
and bounded Soniox vocabulary. Applied calls-boundary-integration.patch
and calls-prompt-integration.patch, including authenticated agent
identity and cohort-sensitive notes cache identity. Automatic stale task
mutation remains partial: its producer-bound reference and canonical
CAS/reminder adapter do not exist in this lane. Older screen/desktop
producers still need explicit joined-controls evidence.

## Defaults, flags and ramp

SPEAKER_EVIDENCE_MODE, MEDIA_NOISE_MODE, CAPTURE_COVERAGE_MODE,
NOTES_PACKET_V2_MODE, EPISODE_BOUNDARIES_MODE, LIFECYCLE_V2_MODE,
CALLS_RECAP_MODE, ACTION_ITEMS_V2_MODE and STT_VOCAB_MODE remain shadow.
No serve cohort is configured. Existing client flags remain off/unknown.
Costly shadow database writers use refactor_modes.shadow_sampled:
CAPTURE_COVERAGE_MODE_SHADOW_PERCENT,
SPEAKER_EVIDENCE_MODE_SHADOW_PERCENT and
EPISODE_BOUNDARIES_MODE_SHADOW_PERCENT, each default 5.
STT_VOCAB_MODE_SHADOW_PERCENT samples source reads at default 1. Serve
cohorts always write and zero disables sampled writes. All bindings are
declared and the registry regenerated. Invalid percentages keep the
bounded default. V4 phone/calendar boundary publication is serve-only
under CALLS_RECAP_MODE; shadow projects the evidence locally without
authority writes. No CALLS_RECAP_MODE_SHADOW_PERCENT binding is needed
for this serve-only choice. On-demand recaps explicitly bypass scheduled
grace; all scheduling/backfill keeps the completed-day grace.

Owner dazheng, by 2026-10-26: synthetic integrated acceptance, reviewed
runtime digest pilot, then 1% -> 5% -> 25% -> 100%, one full lookback
window per step. Keep modes shadow while configuring sampled serve
cohorts; mode serve is the 100% stage. Align producer/consumer runtime
cohorts (especially speaker/boundary evidence with media and calls) so
sampling does not make serving evidence unavailable. No expansion until
manual/identity violations, false folds, lost unique speech/custody,
false owner-call/media exclusions, genuine-speech drops and duplicate
recap deliveries remain zero. Inspect speaker count/anchor/agreement
metrics, omi_media_noise_shadow_total (especially repeated_sentence
admission receipts), cross-device duplicate/examined lines, coverage
admits/seconds, sync failures/latency and vendor spend. No paid
duplicate generation/transcription in shadow. Rollback modes to off and
clear runtime cohorts; durable lifecycle obligations still reconcile.
Persisted groups/classifications are non-destructive and may need
restore/reprocess after rollback. Budget cohort entry for one
regeneration per fingerprint-less legacy day inside the seven-day
lookback (subject to the existing per-run backfill cap); retained IDs
and delivery receipts prevent duplicate notifications. No serve cohort
was enabled for this work.

## Review disposition

| Review finding | Status | Resolution / reason |
| --- | --- | --- |
| V1 #1 nullable speaker | Done | Never project a null cluster speaker
into a numbered segment; production-seam regression. |
| V1 #2 count metrics | Done | Producer and observer share a
voice/channel partition helper; channel splits are not reductions. |
| V1 #3 learning state quality vs stale fence | Skipped | Requires
changing the transactional publication result and learning-state
contract, beyond a mechanical fix. Existing bounded quality counter
distinguishes rejection; track before serve ramp. Enrollment and
unpublished-blob cleanup remain protected. |
| V1 #4 live name-only guard | Done | Supplied patch applied before
text-only lookup/create/map mutation. |
| V1 #5 count cues | Skipped | No threshold change without audited
acceptance data. Acoustic thresholds, cannot-links and abstention
retained; count hints cannot force incompatible voices together. |
| V2 H1 dormant consumers | Done | Patch applied; real
processing/persistence, replay, all four consumer boundaries and
restore/reprocess exercised. |
| V2 M2 genuine foreign repetition | Skipped | No evidence supports
changing the threshold here. Zero serve cohort; pilot must audit
repeated_sentence receipts before expansion. Audio custody remains
intact. |
| V2 M3 shadow reads | Skipped | Production volume validation is outside
the no-prod-reads scope. Reads are bounded; no second paid call or
shadow media-edge write. Sampled speaker/boundary writers bound
mutations; serving pilots need aligned producer coverage. |
| V2 L1 collapsed metric checks | Done | Explicit conversation bucket
and strict unknown-check rejection with regression. |
| V2 L2 admission naming | Skipped | Distinct module namespaces, no
shared caller or behavior collision; avoid unrelated public rename. |
| V2 L3 sync hook size | Done | Existing no-content settlement needs a
small hook, covered by tests and line-count metadata. |
| V2 L4 fixtures | Done | Minimal request-authority and timeline fixture
updates retained. |
| V3 dead distinct_streams return | Done | Removed unreachable duplicate
condition; unknown devices abstain. |
| V3 shadow lane label | Done | Compare accepts explicit lane; V3 does
not emit an L1 fold observation. |
| V3 serve query transaction cost | Skipped | No query semantics change
without runtime evidence. Bounded alias validation reads remain; watch
sync latency/failures before expansion. |
| M P1 default memory failure | Done | Default lists use released-size
bounded reads, return data and explicit incomplete coverage; filtered
incomplete windows still error. |
| M P2 read amplification | Done | Physical-read regression pins bounded
default source batch. |
| M P3.1 aggregate cursor | Done | Ignore stale aggregate cursor and
explain whole-window behavior. |
| M P3.2 timestamps | Done | Released strings retained unless offset
format/timezone is requested. |
| M P3.3 calendar-day stub pagination | Skipped | Intentional
bounded-date contract; an old in-flight cursor may shift across
deployment. No historical rewrite or invented failure cause. |
| M P3.4 retired/private helpers | Done | Dead collector/branch/imports
removed; shared adapters public with migrated callers. |
| M P3.5 duplicate-ID progress | Done | Absolute occurrence cursor with
regression. |
| V4 HIGH boundary authority write | Done | Parent ruling wins: both
phone record and calendar ingest are serve-only under the calls cohort.
Shadow uses local evidence; the regression holds
EPISODE_BOUNDARIES_MODE=serve and proves a non-cohort user produces no
authority write. |
| V4 MEDIUM on-demand grace | Done | Explicit user_initiated plumbing
from generate_daily_summary_on_demand bypasses grace; scheduler/backfill
do not set it. Partial-day and post-midnight grace tests exercise the
actual producer. |
| V4 MEDIUM STT uid | Done | Both legacy initial/reconnect calls and the
managed Soniox leg pass authenticated request uid. Removed get_byok_uid
fallback; real managed config and legacy call seams are tested. |
| V4 MEDIUM vague_social / incident 09 | Done | Named counterpart plus a
concrete place/time retains owner-alias commitments, including catch up
with Matt in NYC. Fourteen incident/negative cases cover missing
feedback, CV review, Deepgram check, invitation/Drive, unrelated customs
purchase and bogus hiking. Promisor/provenance authority remains intact.
|
| V4 LOW legacy-day regeneration cost | Done | Budgeted in the ramp
above; no serve cohort enabled. |
| V4 LOW dead constants | Done | Removed six unused lane constants.
Actual shared cohort bindings now live in and are consumed by
refactor_modes._COHORT_ENVS; no env behavior changes. |
| V4 LOW stripped comments | Done | Restored explanatory shared model,
finalizer, notifications and Soniox comments/docstrings; public recap
docs distinguish legacy order and serving revision/state behavior. |
| V4 LOW inverted / expired parity labels | Done | Found vocabulary
emits agree; absent expired evidence compares the retained durable call
projection. Regression assertions pin both labels. |
| Integrator runtime-image closure | Done | All 19 contracts compared
using third_party_dependency_modules against origin/main; zero added
third-party modules. Incorporated PR #23355 branch and added GPU
closure/shim regressions. |

## Conflicts and shared contracts

Resolved person_pool.py by retaining incoming quality checks and wave-1
type annotation; duplicate_capture.py retains both lifecycle serving and
cross-device imports. Generated artifacts are regenerated from
generators, not resolved by hand. ContentKind has one literal definition
shared by stored/create models and policy; request classification stays
hidden/server-authored. BoundaryKind includes media_playback once.
Participant count and owner anchor live only in SpeakerEvidence. Call
fields are additive optional Conversation metadata; explicit boundary
proof survives canonical normalization and wire round trips. V4
persisted stubs pass through M with null generated_at. Media/noise-only
days report not_generated rather than falsely saying no recordings;
actual empty days keep no_recordings. Both one-shot and agentic prompt
mounts are exercised in off/shadow/serve.

The pipeline guide records integration, sampling, call/recap/prompt
contracts, replay and pending socket semantics. The developer storage
guide explains original-recording retention and unknown/remote metadata
without publishing rollout controls. Dead-code analyzer regenerated its
baseline without new suppressions; the allowlist tool deliberately never
auto-edits allowlists. Existing evaluator-only exceptions remain, and
imported wave-1 contract scaffolds have no stale allowlist entries.

## Runtime image closure audit (fix pass)

Merged fresh origin/main at 81270c6
after #23355 landed. It merged without conflicts and leaves exactly the
same source tree as fix commit ed2c034. Before #23355 landed, also
merged origin/fix-parakeet-policy-closure at
2d3ec70; its remote branch was deleted
after merge. No unseen remote integration commits were overwritten.

The audit independently executes each revision's
backend/scripts/runtime_image_contracts.py
third_party_dependency_modules(contract) over every registered contract
(including lazy imports), without importing application code or reading
production. There are **zero added and zero removed third-party probe
targets across all 19 images** against the final main base; no new
lockfile/requirements package is needed.

| Runtime image | Added third-party modules | Removed probe targets |
| --- | --- | --- |
| backend-api | None | None |
| backend-workers | None | None |
| backend-realtime | None | None |
| backend-gateway | None | None |
| backend-pusher | None | None |
| backend | None | None |
| desktop-backend | None | None |
| pusher | None | None |
| models | None | None |
| memory-maintenance-job | None | None |
| x-connector-sync-job | None | None |
| frame-request-retention-job | None | None |
| day3-reengagement-email-job | None | None |
| notifications-job | None | None |
| diarizer | None | None |
| batch-pipeline-worker | None | None |
| parakeet | None | None |
| nllb-translation | None | None |
| plugins | None | None |

The earlier comparison against pre-#23355 main
4499deb had zero additions in all
images; the only removals were batch-pipeline-worker: fastapi.Request,
google.api_core.exceptions.AlreadyExists, google.cloud.tasks_v2,
google.protobuf, google.protobuf.duration_pb2 and
google.protobuf.timestamp_pb2; and parakeet: utils.speakers.policy plus
its BATCH_CLUSTER/PARAKEET_CLUSTER attribute candidates. Those are the
intended #23355 repairs, now present on both sides of the final
comparison.

Batch retry policy imports the dependency-light utils.capture.retry_cap
core, avoiding utils.sync.retry_hygiene -> utils.cloud_tasks.
Dockerfile-overwritten first-party shims are explicitly excluded from
checkout dependency probes: parakeet excludes utils.logging_config and
utils.speakers.policy; diarizer excludes omi_logging,
utils.logging_config and utils.stt.diarization_turns; nllb-translation
excludes omi_logging. The copied implementations are
standard-library-only. Full-backend/pusher copies use their real source
modules rather than checkout shims. Four new regressions verify the
three shim contracts and the batch worker's separation from Cloud Tasks.
Full final JSON evidence: image-closure-diff.json; earlier comparison:
image-closure-diff-pre23355.json; reproducible script:
audit-image-closure.py.

## Additional integration findings

- Done: M's successful-row timestamp fallback incorrectly gave persisted
V4 pending/failed/empty/not-generated stubs a creation-based
generated_at. The read adapter now preserves null; five direct
regressions, four actual producer-to-reader cases and a real REST smoke
cover it.
- Done: V4 used no_recordings after filtering a nonempty media-only day,
contradicting M's true recording count. That state is now not_generated,
with actual shared-policy generation regression; true empty-day behavior
is unchanged.
- Done: wave-1 abstention must preserve labels while V1 independently
consolidates compatible count clusters. Processing now keeps that
separation and null-speaker protection.
- Done: hermetic Firestore readiness fixture now includes the new MCP
query registry dependency in its copied control checkout; readiness
behavior and index enforcement remain unchanged.
- Done: whole-backend reason-label ratchet identified three new dynamic
label sites. Media/call metrics now expose closed normalization at the
label call, and person voice rejection uses a central three-reason enum
with an unknown fallback. The guard/debt list is unchanged; a new
regression prevents unbounded quality labels.
- Done: omit an empty speaker energy header so inactive cache
serialization remains byte-identical to the existing format; populated
energy metadata still round-trips. Whole-suite cache parity regressions
and four explicit cache tests cover both contracts.
- Done: isolated legacy fixtures retain real pure policies/metric owners
before package stubs, initialize media admission state, execute call
metadata in explicit off mode, and stub new profile/screen reads. Usage
tests supply eligible recordings and target the retained legacy budget
entrypoint; task response assertions include additive source without
exposing lifecycle fields. Historical telemetry byte parity runs with
speaker evidence off, while active energy cache reload has a separate
regression. Voice-pool retention fixtures use compatible, normalized
samples; V1 rejection guards remain intact.

## Validation

Pre-V4 combined validation on ec9bd4f6695: **2,725 passed across 97
focused backend files**, 15 standard marker deselections, no skips. Real
live name gating, media processing/persistence/restore, replay, recap
consumers and V4/M stub timestamps have integrated regressions.
Repository preflight: **65 selected checks passed**; metadata
validation: five passed. Separate CI slow guardrails: **2,049 passed**,
1,342 deselected (all 25 manifest files). Flutter
capture/labels/Home/parity: **86 passed, 5 existing skips**. Swift
capture/group/decoder suites: **33 passed**. Actual loopback
REST/JSON-RPC smoke: **nine passed**, external connects blocked and
synthetic stores only; server stopped. Full backend Pyright: **zero
errors**, existing warning debt retained.
App-client/public/integration-public OpenAPI and all
Dart/Swift/TypeScript generators completed; dead-code baseline
regeneration made no suppressions or tracked changes.

Final whole-backend selection: **2,244 runnable files**, **48,510
passed**, 84 skipped and 2,120 deselected by the standard marker policy.
It ran once and reported 496 failed cases plus nine setup errors across
**14 files**. Those exposed the cache header/metric-label contracts and
isolated fixture dependencies described above. All 14 failed files are
repaired: the final 15-file scoped selection passed **860 tests**,
followed by **94 passed** in the workflow fixture after its missing
module copy was added (**954 green scoped tests across 16 files**,
including the new cache and quality-label regressions). The whole suite
was not rerun. Logs: integration-full-backend.log,
integration-failed-files-final.log and integration-workflow-repair.log
in this brief directory.

Post-V4 validation also passed: full Pyright zero errors; all 25 CI
slow-guardrail files 2,049 passed/1,342 deselected; Flutter 86
passed/five skips; Swift 33 passed; loopback HTTP smoke nine passed.
Repository preflight passed 65 checks after the cache repair; metadata
passed five checks. V4/shared composition passed all 13 cases and
latest-main FinOps selection passed 113 tests across six files.
Regenerated OpenAPI and Dart/Swift/TS artifacts are current. All backend
suites use nice -n 10, the worktree-local Python 3.11 environment and
BACKEND_UNIT_TEST_FILE_LIST through omi-heavy. The normal pre-push gate
**passed** on pushed head **9fc0e7118efd407b933b7f7e1417cbfe0e958529**:
65 preflight checks, full Pyright (zero errors), runtime source closure,
the bounded 40-file backend selection, generated OpenAPI/Dart/Swift
artifacts and the native Swift build. No hook was bypassed. The remote
wave2-integration ref was verified equal to that head after the push.
GitHub reports a completed/skipped Mintlify check and no commit status
checks; this branch-only handoff does not claim full PR CI.

No production reads, api.omi.me calls, user content, cloud changes,
device claims or deployment. GCP tier: none. Local validation is not
full PR CI or production acceptance; no PR is authorized.

## Fix-pass verification

The 16-file focused selection passed 475 tests. After adding four
runtime-image regression cases, its image-contract file passed all 66
tests (the original 62 plus four new), giving **479 distinct focused
cases green across the 16 files**. Full Pyright passed with zero errors
(48,941 non-blocking warnings). Logs: fix-pass-focused-tests.log,
fix-pass-image-tests.log and fix-pass-pyright.log. The whole backend
suite was not rerun. No Flutter or Swift source changed in this pass;
the normal pre-push gate still performs its configured native/generated
validation.

The full metadata/preflight run passed 65 checks in 250.84 seconds
(fix-pass-metadata.log). The subsequent merge of main is
source-identical: both source trees are
33f6033. Current fix-pass head is
58d4c61. The normal pre-push gate
passed on 58d4c61: 65 preflight checks
(189.64 seconds), full Pyright zero errors, runtime source closure, the
bounded 40-file backend selection, OpenAPI/generated-client checks and
native Swift build/checks. The fast-forward push 9fc0e71 ->
58d4c61 completed, and git ls-remote verified that exact full SHA at
refs/heads/wave2-integration on 2026-10-22 23:15:18Z. Working tree is
clean. GitHub reported zero commit statuses and zero check runs at
verification; no full PR CI claim is made. No approval or hook bypass
was used. Log: fix-pass-push.log. Final saved handoff metadata
revalidation passed five checks (fix-pass-metadata-final.log).

## Owner-replay fixes (wave-1 code, found by the offline replay)

- Episode boundaries: screen-meeting contexts carry the shared sentinel
id `screen-activity`, so every screen window hashed to one
boundary-signal identity (a later window was rejected as an immutable
start change; batches collapsed). `context_signal` now drops that
sentinel and screen-source ids, so each window keys by its own start.
Behind `EPISODE_BOUNDARIES_MODE` (shadow writes are sampled). Test:
`test_distinct_screen_windows_get_distinct_identities`.
- Contact spelling: a contact the user created by hand (no voice labels
yet) was excluded from trusted spellings, so a correct contact name
never reached the notes prompt. `is_user_created` is written only by the
user create and rename paths (automatic detection never creates people),
so it now counts as stored user evidence. This intentionally applies to
the legacy prompt too: it only adds names the user typed.

- Shadow cost: the media/noise classifier
(`relevance_media.classify_for_processing`) and cross-device reconcile
(`coverage_crossdevice.reconcile`) read Firestore per finalize. Their
shadow now runs for a 5% uid sample (`MEDIA_NOISE_MODE_SHADOW_PERCENT`,
`CAPTURE_COVERAGE_MODE_SHADOW_PERCENT`) via
`refactor_modes.shadow_sampled`; serve cohorts always run. Found by the
default-inertness audit.

## Risks and remaining work

Precision-first speaker/media and whole-secondary alignment can abstain
or retain duplicates. Missing SNR/confidence uses deterministic
source/duration order. V3 live secondary receipt dispatch and
partial-window suppression require durable frame alignment; only exact
committed aliases may release custody. No historical memory/task/recap
repair. MCP indexes are declared but not deployed; fallback and
bounded-window uncertainty remain explicit. Historical watching
intervals and past recap failure causes cannot be reconstructed. Runtime
TTL activation and all serve ramps remain separately scoped operator
work. V4 screen/desktop positive-proof production and automatic stale
task mutation remain partial; the supplied backend boundary and both
notes prompt hooks are integrated.

Invariant-Impact: INV-AUTH-1, INV-MEM-1, INV-MEM-3, INV-MEM-4,
INV-MEM-5, INV-CAP-1, INV-TASK-2. Auth/privacy and canonical memory/task
authorities are preserved; capture custody requires exact durable proof.
No unsupported attribution becomes an owner claim.

Failure-Class: FC-split-mutation-authority
V3 lane classification: FC-same-speech-captured-twice-surfaces-twice
M lane classification: FC-raw-page-limit-before-visibility-filter
Failure-Class-Guard: backend/tests/unit/test_cross_device_coverage.py
Failure-Class-Guard: backend/tests/unit/test_wave2_media_integration.py
Failure-Class-Guard: backend/tests/unit/test_mcp_read_correctness.py

Wave 1 client evidence is retained in this integration; V2 adds no UI
source:
![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)



Line-Count-Exception: backend/database/users.py | 2496 -> 2507 | Small
authority integration hooks; substantive policy lives in focused owning
modules.
Line-Count-Exception: backend/routers/listen/receiver.py | 2780 -> 2782
| Thread authenticated request identity into the two existing Soniox
call sites; vocabulary policy stays in its owning module.
Line-Count-Exception: backend/routers/listen/transcripts.py | 1648 ->
1655 | Small authority integration hooks; substantive policy lives in
focused owning modules.
Line-Count-Exception:
backend/utils/conversations/process_conversation.py | 3212 -> 3233 |
Small authority integration hooks; substantive policy lives in focused
owning modules.
Line-Count-Exception: backend/utils/conversations/speaker_resolution.py
| 1560 -> 1564 | Small authority integration hooks; substantive policy
lives in focused owning modules.
Line-Count-Exception: backend/utils/sync/pipeline.py | 3657 -> 3671 |
Small authority integration hooks; substantive policy lives in focused
owning modules.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Oct 23, 2026
…ter BasedHardware#23335

- parakeet: exclude utils.speakers.policy from the dependency probe; the
  image copies policy.py over the omi_speaker_policy shim (same as
  omi_logging_config), and it imports only the standard library
- batch-pipeline-worker: move the retry-cap core into a dependency-free
  utils/capture/retry_cap.py so the GPU worker no longer reaches Cloud Tasks

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
…lout and a kill switch (#24477)

* docs(hardware): add the visual guide "How the Omi pendant works"

Picture-first on-ramp for contributors: an animated scene of where audio goes (live, saved, lost), the real exploded view and KiCad-rendered mainboard, nine behaviour cards tied to where each lives on the board, a playable day, and the questions to ask before a pendant decision.

Mintlify does not serve raw HTML, so the page mounts as a JSX snippet; the board renders are static SVGs produced by omi/hardware/consumer/explainer/build_explainer.py from the KiCad sources.

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

* docs(hardware): UI evidence for the pendant guide

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

* pre-push: validate manifest paths against HEAD for sparse checkouts

Cone-mode sparse worktrees do not materialise out-of-cone paths, so a
literal trigger or command path that is real at HEAD fails
validate_manifest's working-tree existence check, and every sparse
checkout hard-fails pre-push at manifest resolution with hundreds of
'explicit trigger path does not exist' errors before any check runs.

Validate against the HEAD tree as well as the working tree: present in
either passes; absent from both still fails closed (typos unchanged).
head_tree_paths() lists HEAD once per invocation, not once per path.

* feature-flag-registry: accept prereg docs tracked at HEAD in sparse checkouts

Same class as the manifest validation fix: the registry check requires
prereg docs to exist on the working tree, and a cone-mode sparse checkout
does not materialise out-of-cone paths, so feature-flag-registry failed
in any sparse lane whose cone excludes the prereg doc. Accept a prereg
path that exists on disk or is tracked at HEAD; neither still fails.

* feature-flag-registry: scan flag reads at HEAD in sparse checkouts

The read scanner iterates tracked paths but skipped any file absent from
the working tree, so a cone-mode sparse checkout reported every app/web
flag as 'stale registry entry'. Read sources (and chart manifests) from
disk first, falling back to the HEAD blob; an alias with no read on disk
or at HEAD still fails. Uncommitted deletions are judged against HEAD,
which is what the pushed tree will contain.

* check-manifest-contract: read manifest test modules at HEAD in sparse checkouts

The drift guard that proves registered test commands actually execute
cases read test modules from the working tree only, so a cone-mode
sparse checkout failed check-manifest-contract with 'does not exist' for
every out-of-cone test module. Read disk first, HEAD blob second; absent
from both is still an offender.

* product-invariants: accept guards tracked at HEAD in sparse checkouts

The registry audit fails every locked invariant whose guard file is
absent from the working tree, and guards live across all surfaces, so a
cone-mode sparse checkout failed product-invariants on every push.
Existence now counts the HEAD tree as well; a guard in neither still
fails closed.

* failure-class: accept prevention artifacts tracked at HEAD in sparse checkouts

canonical_prevention_artifact paths are guard files across every
surface; a cone-mode sparse checkout does not materialise out-of-cone
paths, so validate failed on every push from a sparse lane. Existence
now counts the HEAD tree as well; a path in neither still fails.

* dead-code-ratchet: skip cone-excluded areas instead of failing sparse checkouts

Each area scanner fails when its entry tree is missing from the working
tree. A cone-mode sparse checkout legitimately excludes whole areas
(app/, desktop/macos/agent, desktop/windows), so the ratchet failed on
every push from a sparse lane even though none of those files can have
changed there. Skip areas whose entry paths carry the skip-worktree bit
(tracked, cone-excluded): they carry no signal in this worktree and CI's
dense run still enforces them. User deletions keep their 'H' tag and
keep failing closed; a skipped area also never rewrites its baseline.

* client-compat: read the OpenAPI doc at HEAD in sparse checkouts

The C10 check reads docs/api-reference/app-client-openapi.json from the
working tree; docs/ is outside every code surface's sparse cone, so a
cone-mode sparse lane crashed pre-push. Read disk first, HEAD blob
second.

* desktop-flow-lint: skip cone-excluded flows directory in sparse checkouts

The lint fails when desktop/macos/e2e/flows is missing, which every
cone-mode sparse checkout without the desktop surface is. Skip with a
note when the directory carries the skip-worktree bit (tracked,
cone-excluded — dense CI enforces it); deletions keep failing.

* perf(backend): profile batch worker stages and connect queue-age scaling input

* fix(monitoring): declare batch worker scrape and reviewed ready-age adapter rule

- Inventory batch-pipeline-worker-metrics in expected-targets.prod.yaml.
- Add the omi_batch_pipeline_ready_age_seconds external rule to the reviewed
  adapter upgrade expectation (diff_prod_adapter.py), rejecting any modified
  live copy.
- Contract fixture models the pre-upgrade live config and finds the listen
  rule by name instead of by list position; add exact/modified/live-drift
  tests for the new rule.

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

* fix(testing): forward stage timings through the gauntlet CPU worker shim

run_process now constructs SynchronizedWorker(..., timings=timings); the
Sync Cloud Tasks gauntlet's CpuSynchronizedWorker override rejected that
keyword, so batch-worker-1 exited before readiness.

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

* fix(backend): measure prefetched decode at its executor

The fetch_decode timer previously wrapped prefetch.take(), so under the
production IO concurrency it measured only the later Future.result() wait;
a decode overlapping earlier GPU work appeared nearly free. Wrap the decode
callable submitted to the prefetch executor instead, keep the no-prefetch
fallback timing decode directly, and document the measurement point.

* ci-flake: keep desktop Linux runtime apt install off the network when warm

The 'Linux package · helper smoke' job's 'Install Linux runtime
dependencies' step downloads ~35 MB of debs plus package indexes from
azure.archive.ubuntu.com on every run. When that mirror is throttled the
downloads alone exceed the step's 5-minute budget and the job dies:
run 39846837408 attempt 1 (PR #23335, 2026-10-22; the same SHA passed on
rerun with the step finishing in ~14 s), run 37693118159 (main push,
2026-10-07, every fetch Ign) and run 33911765703 (PR, 2026-09-04) all
timed out identically — an infra flake, not a regression.

Mirror the fix proven for the backend twin of this flake (#23308):
cache the downloaded .deb closure keyed on the runner image with a
restore-keys fallback across ImageVersion bumps, replay warm caches with
dpkg -i (zero network on the hot path — apt-get update fetches indexes
even when every deb is local), and keep bounded apt only as the cold
path and as repair when the replay fails. Single job, no matrix, so the
save step has no concurrent same-key race to gate.

.github is edited only for this flake's own step; no workflow is added,
per the 2026-10-22 CI flake-fix and caching direction.

* ci-flake: load utils.task_sync once per file in cloud export dedup tests

The fast-unit CPU duration guard failed this file twice on CI (1.04s and
1.08s over the 1.00s fail budget; both runs passed on re-run). Each of the
four tests ran its own stub_modules + load_module_fresh pair, and the block
teardown evicts every transitively imported module (httpx and friends), so
every test re-paid the full import inside the guard's measured call phase:
0.50-0.68s CPU on a quiet runner, 0.78-1.08s under the file-isolated
runner's saturation, sitting on the 1.0s cliff.

utils.task_sync has no module-level mutable state, so one module-scoped
import shared by the four tests is behaviorally identical. The per-test
store/create_calls/fail_on move onto a mutable _Harness the stub closures
dispatch through, and each test seeds it first. The single import lands in
the first test's setup phase, which the guard deliberately does not charge
(tests/conftest.py measures the call phase only so shared file setup is not
misattributed), matching the module-scoped stub_modules pattern already
used by tests/unit/test_sync_reprocess_coalesce.py.

Measured locally (nice -n 19, guard thresholds 0.1/1.0): before, the file
warned at 0.11-0.36s CPU per test; after, no guard output at all, also with
six parallel pytest processes saturating the machine, and file wall time
1.18s -> 0.27s. Test isolation unchanged: sibling task_sync files pass in
the same process before and after this file.

* ci: cache apt runtime packages and retime Linux runtime-deps step

The build-linux job's 'Install Linux runtime dependencies' step downloads
~35 MB of .debs from azure.archive.ubuntu.com every uncached run; when
runner<->mirror throughput degrades (~68 KB/s avg in job 120062237675)
the download alone exceeds the 5-minute step budget while every
connection keeps streaming, so the per-request apt timeouts cannot catch
it. Same signature on main 2026-10-07 (job 113037996050); the re-run of
the same job on the same PR code succeeded.

Cache the .deb archives (seed /var/cache/apt/archives, download-only,
capture, unpack) so steady-state installs download nothing but version
changes, and raise the step budget to 10 minutes to cover cold-cache
runs at the worst observed throughput (34.6 MB / 68 KB/s ~ 8.5 m). Stall
bounds and the 20-minute job ceiling are unchanged.

* ci: raise Linux runtime-deps step budget to 20 minutes on new slow-mirror evidence

This PR's own first run (job 120074210159) missed the apt cache (first run
with the new key) and streamed the deb pool at ~40-45 KB/s — worse than
the 68 KB/s the 10-minute budget was sized from — timing out mid-download
at Get:30 of 30 (~14.4 min of pure download needed at that pacing).

20 minutes covers ~32 KB/s effective throughput while reserving 2 minutes
for index fetch and unpack, and is idempotent for warm-cache runs, which
download nothing and finish in seconds. Note the budget must cover the
cold path even though cache misses are rare: the key hashes this workflow
file, so every edit re-cold-starts the cache.

* feat(deploy): drift check compares serving revisions by value hash

check_cloud_run_env_drift.py now reads what is serving instead of
spec.template: Cloud Run revisions from status.traffic (resolving
latestRevision entries and split traffic) and, with --gke, the GKE
ReplicaSets that hold ready pods for backend-listen, pusher and
batch-pipeline-worker. Each serving env is compared with the manifest,
rendered deploy state or chart values by key name and by a truncated
SHA-256 of the value or secret reference. Values are never printed and
hashes of sensitive-looking keys are redacted. The report flags when the
template differs from what is serving.

Report-only by default; --strict exits 1 on drift and 2 on fetch or
render errors for use after a train. Fixtures replay the 2026-10-18
23:50Z template-versus-serving misread.

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

* fix(deploy): address review — envFrom ConfigMap coverage and drift-check hardening

- GKE envFrom: resolve the ConfigMaps serving containers bulk-load (live
  kubectl read or offline fixture) and join their keys in the name/hash
  comparison; missing/out-of-date keys are drift, unresolvable refs
  report INVENTORY, and live-vs-chart reference drift is flagged (P1).
- Unresolved deploy-time bindings are now presence-checked: a None
  expected hash skips only the value comparison, never the key check.
- --rendered-state must exist and contain a services mapping; no silent
  fallback to the raw manifest.
- --strict exit precedence: fetch/render errors (2) outrank drift (1);
  expected-state render failures return 2 instead of a traceback.
- Offline snapshots require a top-level env list; a statusless template
  document is refused instead of being misread as serving.
- --no-cloud-run without --gke/--gke-workload is a usage error.
- Secret-ref hashes keep the project in project-qualified references
  (cross-project rebinds are visible) and include the normalized
  optional flag.
- Published env fingerprints are built from redacted placeholders for
  sensitive keys; full fingerprints stay internal for equality checks.

* fix(deploy): address review round 2 — envFrom provenance, prefixes, exact-state keys

- Live envFrom ConfigMap data cannot prove what already-running pods
  resolved at container start (K8s never refreshes envFrom; a ConfigMap
  update carries no trustworthy last-write timestamp). Live envFrom keys
  now report INVENTORY instead of asserting OK; offline fixtures are
  snapshots and still compare exactly (P1).
- envFrom prefix is part of the reference: a prefixed source expands to
  PREFIX_KEY and its identity carries the prefix, so rebinding cfg to
  prefix: X_ + cfg is visible reference drift, not a silent match.
- With --rendered-state, provisional env_var bindings the renderer
  omitted (unset at deploy time, incl. secret env_var resolving empty)
  are dropped from the expected set instead of being inherited from the
  raw manifest as name-only false drift.
- --cloud-run-state / --gke-state loads moved inside the handled error
  section: malformed fixtures return exit 2 under --strict, never an
  uncaught exception misread as drift.

* fix(deploy): compare explicit env entries that shadow unproven envFrom

Live GKE reads mark every envFrom ConfigMap reference unproven, so the
flat skip dropped all manifest ConfigMap keys from the value comparison —
including keys the serving ReplicaSet sets through explicit env entries,
whose values are knowable (explicit env shadows envFrom; the serving
spec is immutable). A stale serving literal on an overlapping key such
as STT_SERVICE_MODELS could therefore pass --strict with only INVENTORY.

ServingTarget now records its explicit env key names and the per-target
skip excludes them: keys whose effective value comes exclusively from
envFrom keep the INVENTORY downgrade, shadowing keys are compared by
hash like any other explicit entry.

* fix(deploy): per-target envFrom provenance, prefixed key expansion, optional-aware identities

Review round 3 (Codex P2 x4) on the GKE envFrom provenance model:

- Live-only drift now excludes every key contributed by an unproven envFrom
  source on that target, not only keys already declared expected: a ConfigMap
  key added after the ready pods started must not read as unallowlisted
  live-only drift.
- Expected ConfigMap keys expand with the reference's prefix: the
  `name#prefix` identity is parsed instead of compared with the bare ConfigMap
  name, so a prefixed chart reference is resolved, not reported unresolved
  with phantom live-only keys.
- envFrom references are compared per serving target instead of as a union:
  during a mixed rollout a still-serving ReplicaSet without the reference no
  longer hides behind the new ReplicaSet's matching reference, and expected
  envFrom keys are excused only on targets that hold the degraded reference.
- configMapRef optionality joins the reference identity (omitted normalizes to
  false): `optional: true` on the serving side is reference drift, because it
  changes what a missing ConfigMap does to the pod.

* fix(deploy): reject a rendered state missing a checked service

Review follow-up: a rendered state whose top-level services mapping omits a
manifest service, or carries a non-mapping entry for it, silently fell back
to the raw manifest for that service. Deploy-time env_var bindings then
degraded to name-only checks while the command claimed exact-state
validation. Every manifest service must now have a valid rendered entry.

* fix(deploy): validate rendered env lists and envFrom source ordering

Review follow-up round 2:

- A rendered state service entry without an env list (missing, null, or
  non-list) is rejected instead of silently re-sourcing expected values from
  the raw manifest; the renderer always emits an env list per service.
- envFrom reference order is now compared: the K8s API resolves the last
  envFrom source when several export the same key, so a reordered reference
  list changes the effective environment and is reported as reference drift
  instead of passing as the same set. Multi-source envFrom key merging in
  envfrom_entries() follows the same last-source-wins rule.

* fix(deploy): harden rendered-state validation, envFrom duplicates and optional refs

Review follow-up round 3:

- Malformed entries inside a rendered env list (null, non-mapping, missing
  name) are rejected instead of silently skipped: the renderer only emits
  named mappings, and skipping would keep the manifest expectation for the
  corrupted key while reporting OK.
- --allowlist-file loading moves inside the operational-error boundary: a
  missing or malformed allowlist is an exit-2 input failure, not drift and
  not a traceback.
- Duplicate envFrom sources are preserved end to end: K8s resolves the last
  source for overlapping keys, so [A, B, A] and [A, B] are different
  effective environments and must not normalize to the same reference tuple.
- An optional envFrom reference whose ConfigMap is NotFound live resolves to
  an empty unproven contribution (INVENTORY) instead of a workload-wide
  fetch ERROR: K8s permits the pod to run without it.

* fix(deploy): scope envFrom suppression per source, compare template refs, accept deployed helm args

- Missing-key suppression now covers only the keys a degraded expected envFrom
  reference contributes (tracked per reference), so a snapshot that proves
  ConfigMap A while omitting B still reports keys missing from the proven A
  instead of skipping the whole expected envFrom set.
- The template-vs-serving comparison includes the ordered envFrom identities:
  rebinding ConfigMap A to B with identical data no longer passes as
  "Template = serving: yes".
- Expected GKE renders accept the exact deployed override inputs via
  --gke-helm-arg / --gke-helm-arg-file (the argv format the listen deploy
  workflow writes), so an intentionally overridden rollout is not reported as
  drift against repository defaults.

All three covered by regression tests that fail on the previous code.

* fix(deploy): scope helm override args to their workload and redact values from helm failures

- Override arguments (--gke-helm-arg / --gke-helm-arg-file) are now scoped to a
  single workload via --gke-helm-arg-workload (default backend-listen, the argv
  file's producer): an argv generated from one chart's env indices must not be
  applied to a different chart, where the same index can name another variable
  or fail the render.
- A failing helm template no longer surfaces CalledProcessError's default str()
  (full argv, including literal --set-string values) into markdown/JSON/summary
  reports; the error is re-raised redacted.

Both covered by regression tests that fail on the previous code.

* fix(deploy): forward envFrom optionality on the template path, compare template identities unconditionally, disambiguate JSON keys

- The Deployment-template envFrom expansion forwards configMapRef.optional to
  resolution, so a missing optional ConfigMap is an empty contribution instead
  of a workload-wide fetch ERROR (matching the ReplicaSet loop).
- The template-vs-serving envFrom identity comparison no longer short-circuits
  on an empty template identity list: a template that dropped the reference
  while a serving ReplicaSet still references an empty ConfigMap is exactly
  the divergence the field exists to reveal.
- The JSON report keys results by platform and name, so checking a Cloud Run
  service and a GKE workload sharing a name no longer silently overwrites one
  platform's entry.

All three covered by regression tests that fail on the previous code.

* fix(deploy): keep explicit configMapKeyRef values unproven, cache NotFound distinctly, track envFrom secret identities

Address review round 5 (Codex P2s):

- Explicit env entries bound through valueFrom.configMapKeyRef prove the
  reference in the immutable pod spec, never the data the container resolved
  at start (ConfigMap updates require a pod restart). On live reads these
  keys are now excluded from value comparison and reported as INVENTORY via
  explicit_unproven_keys instead of a verified OK/DRIFT from unknowable data.
- An optional reference to a missing ConfigMap no longer caches {} under the
  name: the NotFound fact is cached distinctly so a later REQUIRED reference
  to the same name fails with ERROR/exit 2 instead of reading the optional
  caller's empty result from the shared cache.
- envFrom sources are parsed once into spec-ordered descriptors; secretRef
  sources join the reference comparison as opaque secret:<name> identities
  (contents never read) on the serving, template, values and helm paths, so
  an unexpected serving Secret bulk-load is reference drift instead of
  silence. Interleavings are compared in spec order (last-source-wins).
- Inline --set*=NAME=value helm tokens are redacted like the bare argv shape;
  values containing '=' (base64 padding, connection strings) redact in full.
- An exact --rendered-state that omits a required env_var binding is now
  rejected: the renderer fails rather than omit one, so only explicitly
  provisional omissions may drop out of the expected set.
- The sensitive-key regex is case-insensitive: api_key, dbPassword and
  MyServiceToken digests are redacted like uppercase names.
- Keys contributed by an expected envFrom source the repository cannot
  enumerate are excused from live-only drift on targets holding the same
  reference (INVENTORY), not unallowlisted drift failing --strict.

Seven regression tests; all 58 unit tests pass via backend/test.sh.

* fix(deploy): require a value source in rendered entries; redact *_KEY and OAUTH digests

Address review round 6 (Codex P2s):

- A rendered-state env entry must carry exactly one of value or
  valueFrom: the renderer always emits one of them, and an entry with
  neither was hashed as an empty literal, so a corrupted state matching
  an empty serving value could report OK. Neither/both now raise an
  operational input error.
- The sensitive-key regex adds _KEY and OAUTH alternatives so declared
  manifest secrets accidentally deployed as literals (ADMIN_KEY,
  FAL_KEY, MCP_OAUTH_CLIENTS_JSON) get redacted digests like other
  credentials; non-credential *_KEY names remain covered by the same
  redaction rather than published.

Two regression tests; all 60 unit tests pass via backend/test.sh.

* fix(deploy): compare keyref binding identities, honor envFrom last-source-wins, redact SALT, reject override tokens in values render

Address review round 3 (chatgpt-codex-connector):

- Explicit configMapKeyRef bindings now compare by reference identity
  (ConfigMap name, key, optionality) in addition to name: the immutable
  pod spec proves the binding, so a rollout that rebinds a key to a
  different ConfigMap/key is drift; only a matching binding stays
  value-unproven on a live read (INVENTORY).
- Value comparison honors K8s envFrom last-source-wins: a key whose
  effective source is an external reference the repository cannot
  enumerate is no longer compared against the repo ConfigMap's manifest
  digest (false drift / strict exit 1 on a correct rollout). An explicit
  env entry shadowing the source keeps the key compared.
- SALT joins the sensitive-key regex: DREAM_AGENT_FEEDBACK_SALT is a
  declared manifest secret; an accidental literal deployment would
  otherwise publish its deterministic digest.
- --gke-render values now rejects --gke-helm-arg/-file override tokens as
  an operational error (exit 2, per workload) instead of silently
  comparing an overridden rollout against repository defaults.

Six regression tests added; suite: 66 passed.

* fix(deploy): flag a live keyref swap of a proven expected literal

Codex P2 (r4341399125): a key the chart renders as a literal (or any
non-keyref source) that serving binds through configMapKeyRef was
subtracted from value comparison as explicit_unproven, while
expected_keyref_hashes — which only holds expected keyref keys — could
not flag it either, so the value-source change vanished into INVENTORY
with a --strict exit 0.

The immutable pod spec proves the live binding and the repository
proves the expected source, so compare them directly. Their hashes live
in disjoint domains (value: vs configmap:), so a source change always
shows as a mismatch; an expected source the repository cannot prove
(None hash, deploy-time binding) still skips the comparison — name-only,
no false drift.

test_gke_live_explicit_configmap_keyref_values_stay_unproven now
mirrors the binding identity on the expected side: the resolved data
stays unproven (ConfigMap edits after pod start, without a rollout, do
not drift), while a literal-vs-keyref source swap is provable drift.

* fix(deploy): honor opaque envFrom overrides, reject foreign rendered keys, resolve secret aliases

Codex review round 7 (r4342784015/4021/4028/4033/4039):

- envFrom last-source-wins now tracks keys a later opaque Secret source may
  override: those keys stay value-unproven (INVENTORY) instead of asserting
  the earlier ConfigMap's data, and a trailing known source re-proves them.
- A rendered state that declares a key the manifest does not bind is rejected
  instead of merged; merging hid exactly the live-only drift this checker
  exists to detect.
- Rendered valueFrom entries must match the renderer's only nested shape
  (secretKeyRef with non-empty name/key); anything else is the documented
  operational error, not a hash-domain comparison.
- Values-mode pusher envFrom expectations read runtimeConfigMapName (the only
  field its deployment template uses) instead of the dead .Values.envFrom.
- Cloud Run cross-project secrets resolve their secretKeyRef alias through
  the run.googleapis.com/secrets annotation before hashing, on both serving
  revisions and the template, so a correct deployment no longer reports a
  value mismatch.

* fix(deploy): degrade form-ambiguous alias mismatches and unresolved-source shadows to INVENTORY

Codex review round 8 (r4343951882, r4343951890):

- The platform normalizes run.googleapis.com/secrets annotation resources to
  project numbers while repository state may carry the project ID: a value
  mismatch on an alias-resolved key is form-ambiguous, not proven drift, so
  those keys now degrade to INVENTORY (alias_unproven_keys) instead of
  failing --strict. Matching forms still compare OK.
- An envFrom source whose data the snapshot omits is as opaque as a Secret:
  it may override any earlier known source's key (last-source-wins), so
  earlier keys stay value-unproven until a later known source re-exports
  them.

* fix(deploy): confine alias degradation and opaque shadows to provable ambiguity

Codex review round 2 (PR #22389):

- Alias-resolved secret references now compare by a canonical (project-stripped)
  hash: only a difference confined to the projects/<id|number> qualifier —
  including the bare-name manifest form — degrades to INVENTORY; a secret name
  or version difference stays proven drift (test_cloud_run_secret_alias_{version,
  name}_difference_is_real_drift).
- expected_cloud_run_env derives the canonical map and inspect_services_drift
  wires it through, so the degradation fires for every caller (the None default
  previously left it empty and never degraded).
- A prefixed opaque envFrom source (Secret or unresolved ConfigMap) can only
  shadow earlier keys its prefix can reach, so unprefixed keys stay
  value-comparable (test_gke_prefixed_{secret_source,unresolved_configmap}_
  shadows_only_matching_keys).

* fix(deploy): surface alias uncertainty, excuse Secret-suppliable missing keys, reject stale rendered literals

Codex review round 3 (PR #22389):

- JSON and markdown reports serialize alias_unproven_keys, so an INVENTORY
  driven by project-form ambiguity is explainable from the payload alone.
- A prefixed Secret envFrom source may supply an expected key absent from the
  earlier known sources: its contents are never readable, so the absence is
  unproven and excused from the missing check (prefix-scoped; unresolvable
  ConfigMap siblings still attribute their expected keys — proven sources'
  missing keys stay drift).
- Rendered-state entries that contradict a manifest-owned literal or fixed
  secret reference are rejected: the renderer emits those unchanged, so a
  stale state can no longer replace the manifest hash unchecked and mask
  repository drift behind an equally stale serving revision.

* fix(deploy): prove alias project equality, excuse opaque-supplied missing keys, redact validation hashes

Codex review round 4 (PR #22389):

- Alias comparison now keeps the project segment and degrades to INVENTORY only
  for genuine form ambiguity: project ID vs number (either direction) or an
  implicit bare name vs a qualified reference. Two different project numbers or
  IDs are provably different projects and stay real drift
  (test_cloud_run_secret_alias_unequal_{numeric_projects,project_ids}_is_real_drift).
- The missing-key excuse extends to opaque ConfigMap sources (unprefixed
  unresolved later source may supply any expected name), still scoped by
  prefix-reachability and to sources without a known key set; the legacy
  anti-blanket-suppression case now pins the prefix boundary
  (test_gke_missing_key_excuse_stops_at_the_opaque_source_prefix,
  test_gke_unprefixed_unresolved_configmap_may_supply_missing_expected_keys).
- The rendered-state contradiction error redacts digests for sensitive keys via
  display_hash before the message reaches stderr
  (test_rendered_state_contradiction_redacts_sensitive_hashes).

* fix(deploy): reject duplicate rendered environment names

An exact --rendered-state declaring the same binding name twice passed
every structural validation: rendered_names collapsed the duplicate and
the later entry silently won the expected-hash merge. Deploy-time env_var
bindings carry no manifest hash to contradict, so a corrupted state
ending on a stale value could match a stale serving revision and report
OK. The renderer emits each binding exactly once, so duplicates are now
rejected as an operational input error.

* fix(deploy): excuse manifest-only provisional omissions, keep template envFrom lookup best-effort

Manifest-only mode now mirrors the renderer's provisional contract: a
provisional env_var unset in the environment is legitimately omitted at
deploy time, so it must not enter the declared set as a name-only
requirement — that reported false missing drift and a strict exit 1 for
a valid deployment. Bindings the environment resolves stay required.

GKE template envFrom expansion is best-effort now: a failed rollout can
leave the Deployment template referencing a ConfigMap that no longer
exists while the previous ReplicaSet still serves, and the propagated
kubectl NotFound errored the whole workload before any serving
ReplicaSet was inspected. The lookup failure degrades template context
to unproven (template_matches_serving None) instead.

* fix(deploy): reject rendered source-type swaps, normalize the backfill overlay

A corrupted rendered state could represent a manifest env binding as
valueFrom.secretKeyRef or a manifest secrets binding as a literal;
deploy-time env_var bindings have no manifest hash to contradict, so the
swap bypassed the contradiction check and a serving revision carrying
the same invalid source reported OK. The renderer emits each section
with its own source type; validate that before adopting the hash.

The sync-backfill worker deploys through an overlay the renderer cannot
see (sync-backfill-lifecycle rewrites SYNC_TASKS_HANDLER_URL and
SYNC_TASKS_OIDC_AUDIENCE to the worker service's own URL after the
shared render), so the rendered state's values never reach Cloud Run for
backend-sync-backfill. Those keys compare name-only on -sync-backfill
services; presence stays required.

* fix(deploy): keep backfill overlay value checks, alias lookup by name only, optionality in alias form

Codex review round 9 (r4348673531/3546/3557):

- The sync-backfill overlay no longer erases the expected hashes: the
  lifecycle action defines the value deterministically (the worker
  service's URL plus /v2/sync-jobs/run), so both sides normalize only the
  project-number segment and the comparison stays a value check. A URL
  pointing at backend-sync, an old service, or the wrong path is drift
  instead of a presence-only pass.
- Secret alias resolution now pairs the annotation lookup with
  secretKeyRef.name only (the platform's documented contract); the
  env-entry-name fallback could rewrite a live binding through an
  unrelated annotation entry and report a false OK.
- The alias comparison form includes secretKeyRef.optional, so a live
  binding flipped from required to optional is real drift; only the
  project-identifier representation difference still degrades to
  INVENTORY.

Four regression tests added; the stale env-name-keyed annotation fixture
in the project-form degradation test now keys by the declared lookup
name.

* ci: key apt cache on runner image and raise job budget to 30m

Address Codex review of c5e2116:

1. Cache key pinned the workflow file hash, which stays an exact match
   forever (actions/cache never re-saves on exact hit): cached .debs
   would freeze at first-saved versions as Ubuntu publishes updates,
   and every workflow edit gratuitously cold-started the cache. Key on
   ${ImageOS}-${ImageVersion} plus a literal package-list token instead,
   matching the scheme already established in PR #23344; the restore-key
   prefix carries still-current .debs across runner image bumps.

2. The step budget raise (10 -> 20) ignored the pre-existing job-level
   timeout-minutes: 20 on build-linux. Worst case cold apt (14.4 min
   measured pacing) + ~70s setup + ~5m packaging/smoke exceeds 20 min,
   cancelling the job mid-packaging; a cancelled job never saves the
   cache (save-always: false), so every retry stays cold. Raise the job
   budget to 30 so the cold path fits and the cache actually warms.

* fix(deploy): degrade privateEnv-replaceable listen keys, reject rendered optional fields, flag explicit bindings lost to envFrom

- backend-listen STT_CAP_DISPATCH_* values can be replaced at deploy time from
  LISTEN_PRIVATE_VALUES_YAML (chart privateEnv); without the exact override
  argv the checked-in defaults are not proven deployed values, so they degrade
  to presence-only (ops/drift_check.py contract) instead of false-drifting a
  valid rollout under --strict.
- Rendered-state validation now requires the renderer's exact secretKeyRef
  shape (name and key only); a carry-along field such as optional is rejected
  instead of silently skipping the manifest contradiction check for
  env_var-backed secrets.
- A chart-explicit env key dropped from the serving spec while envFrom still
  supplies the name is flagged as explicit_binding_lost drift; previously the
  provable spec divergence vanished into INVENTORY with --strict exit 0.

* feat(stt): add private production-path quality scorecard

Failure-Class: none

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

* feat(stt): qualify private local evaluation and artifact provenance

Keep decoded capture durations and persisted overlapping groups honest, use the shared conversation speaker allocator, verify model reference provenance, and add held-out enrollment diagnostics.

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

* test(stt): fence cached policy and reference provenance

Count allocated conversation voice IDs across unit scopes, and reject mismatched source crops or model locks before WER.

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

* feat(stt): verify immutable local inference archives

Validate original source, crop, configuration and payload hashes without changing inference output or requiring a centroid enrichment implementation.

Failure-Class: FC-independent-owner-voice-accepts

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

* feat(stt): reuse verified baseline inference with honest receipts

Preserve original inference identity while rerunning persisted projection, without repeating private audio inference.

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

* fix(ci): pin and bound native audio dependency fetches

* perf(backend): reduce isolated unit test startup and image scan work

* fix(stt): type optional local batches and heterogeneous scorecards

Failure-Class: none

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

* test(stt): collect pure evaluator dependencies before timed calls

Keep the unit CPU guard focused on the exercised behavior while preserving the production projection calls.

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

* test(stt): collect remaining projection dependencies before timing

The exact guarded runner now passes all 19 evaluator tests without changing duration budgets or exercised projection behavior.

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

* docs(eval): keep the model environment outside source staging

Use the external evaluation environment in the runnable command, matching the private-artifact and runtime-image guidance.

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

* test(eval): isolate the decision-mill letter tool contract

Use fixed synthetic tool output and verify the complete invocation so CI never depends on a personal decision-mill installation. Real local task generation retains the authoritative installed tool.

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

* fix(eval): bind cached inference to effective worker switches

Retain original archive identities with explicit switch evidence and use package imports for isolated viewer tests.

Failure-Class: none

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

* fix(eval): capture all worker disposition and handoff switches

Failure-Class: none

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

* refactor(stt): relocate local projection hooks for upstream composition

Move the optional injected keyword-only arguments before the existing publish
argument. Defaults, callers and execution behavior stay the same. The reviewed
candidate combines cleanly with current main without importing its changes.

Failure-Class: none

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

* docs(listen): record T3b on/100 serving in live-stt-routing runbook

Follow-up ruled by the two-lane lead with #23516 (18:53Z): fold the
rollout-wording updates into a small docs PR with no re-review loop. The
runbook still described stage 1 (on/90, static 10%) as the live state and
named on/100 as the rollback direction, which is now the serving state.
Record the 2026-10-24 T3b rollback of the static expansion, mark the stage
table historical (stages 2-4 not planned), and name back to on/90 as the
remaining abort step.

* perf(llm): omit server-derived L1 fields from generation schema

* ci(deploy): name the requester on every backend dispatch

Prod run 40214727824 (gcp_backend.yml workflow_dispatch, prod,
cloud-run-only, f3e669f, 10-25 17:04Z) could not be traced to any
session: every agent dispatches as the shared account and nothing in
the run says who asked or why.

- workflow_dispatch input requested_by (string, required): lane label
  or session that requested this dispatch. The REST API does not
  enforce required string inputs, so validate-production-boundary fails
  closed with ::error on prod when it is empty or whitespace, and
  echoes requested_by=<value> into the log.
- run-name renders environment, mode and requester, falling back to
  the event name and actor for non-dispatch triggers.
- test_workflow_contracts.py pins the input contract, the run-name
  reference, and the prod rejection of an empty requester (hermetic
  bash run of the boundary step).
- ci-budget.yaml: refresh the dispatch-input inventory for the new
  input and record the conventional one-minute bump plus rationale on
  every gcp_backend.yml job (dispatch count is unchanged; the gate
  requires an explicit budget change for any input change).

Dispatchers must pass -f requested_by=... once this merges; infra
updates bin/omi-deploy-prod right after (a dispatch in between fails
closed, which is intended).

* perf(backend): defer heavy LLM provider imports out of per-file test startup

Backend unit shards run one pytest process per test file, and every file
that reaches utils/llm/clients paid for the Anthropic SDK, the
langchain-anthropic binding, and (via utils/llm/providers) the google gRPC
stack at import time, even though those clients are only constructed on
use. With ~1/3 of the 2314-file suite importing this chain, full-suite
shards carried ~763 redundant provider imports, which is part of why shard
walls now drift past the 720s regression budget (flaky overages of 727s,
746s, and 841s on 2026-10-26 with every test passing).

Resolve the bindings on first use instead: construction sites go through
materialization helpers, module __getattr__ keeps from-imports and
mock.patch targets working, and TYPE_CHECKING imports keep the pyright
lane unchanged (0 errors). Interleaved A/B on the same host: importing
utils.llm.clients drops from a median 1.31s to 0.90s (-31%) and 3167 to
2014 loaded modules per affected process; at runner speed that removes
roughly 20s of wall from a full-suite shard, permanently, and shrinks the
slow tail that trips the budget.

* ci(deploy): extend the requester gate to prod traffic repair

Luna round 1 on #23694 (P1): repair-traffic-only skips
validate-production-boundary, so a prod traffic mutation could run
without a requester when the REST API omits the required input.
The repair-traffic Validate Environment Input step now fails closed on
an empty or whitespace requested_by for prod and echoes it into the
log, exactly like the boundary step. Contract test covers the repair
path hermetically.

* chore(ops): prepare dry-run source image retention policy

Render a local cleanup-policy proposal that retains deployed and rollback
digests, named releases and recent versions. Keep all images whenever
reference coverage is incomplete. No cloud writes or active apply path.

* perf(llm): trim redundant prompt fields and reuse exact Vertex embeddings

* perf(llm): separate notes dedupe for synthetic model qualification

* chore(ops): hold registry proposal until OCI graph coverage is complete

Require explicit OCI manifest graph coverage alongside runtime, Jobs and
rollback evidence. A missing graph attestation keeps every image. Add the
reviewer's regression scenario and document the fifth coverage surface.

* perf(llm): remove the retired embedding runner import

* perf(llm): stage embedding reuse until the batch outcome is known

* docs(backend): add why-headers to hot backend files

State what each file owns and the non-obvious constraint it upholds, with
links to the owning ARCHITECTURE/runbook docs. Comments only; no code
changes.

* docs(app): add why-headers to hot app files

State what each file owns and the non-obvious constraint it upholds, with
links to the owning contract docs. Comments only; no code changes.

* docs(desktop): add why-headers to hot macOS Swift files

State what each file owns and the non-obvious constraint it upholds, with
links to the owning contract docs. Comments only; no code changes.

* check: require purpose headers on new first-party source files

Fails when a file added in the diff (backend/*.py, app/lib/*.dart,
desktop/macos/Desktop/Sources/*.swift, desktop/macos/agent/src/*.ts)
lacks a header: Python module docstring first, or >=2 comment lines
before the first non-import code. Excludes tests, generated files,
__init__.py and files under 40 lines, thresholds justified in the
script. Registered in both local and ci lanes with a test suite.

Instance: #14527 merged the 231-line headerless
app/lib/backend/http/api_result.dart (the C3 typed-result contract).

* docs(macos): trim AGENTS.md, move detail to owning docs

desktop/macos/AGENTS.md: 535 lines / 46,552 bytes -> 348 lines / 29,402
bytes, budget ratcheted 560/47,000 -> 380/32,000.

Moved, not deleted, per .github/agent-docs/doc-maintenance.md:
- INV-6 write-path contract, PR definition of done, gauntlet gate policy,
  and live-vs-hermetic table -> docs/chat-continuity-write-path.md
  (cross-linked with product/invariants/chat-continuity.md); the guide
  keeps the invariant and the core never-rules inline. The gauntlet
  script pointers that named the old AGENTS.md sections now point at the
  new doc.
- Product analytics integrity contract -> docs/analytics-integrity.md;
  privacy and product-authority hard rules stay inline.
- Release-train mechanics, signed-smoke scope, recovery, backend
  deployment workflows, and the Codemagic CLI -> docs/release.md (merged
  with its existing promotion/recovery detail); the guide keeps the
  operator never-rules inline.
- Firebase quick-connect snippet -> docs/firebase-connection.md.
- Changelog guidelines -> changelog/README.md; the kind:none
  anti-footgun stays inline. Added a kind:none fragment for this
  internal-only edit per that rule.
- Agent-runtime stamp-cache detail and incomplete_runtime_payload ->
  README.md, which already owned the fast lane, dev-feedback loop, and
  suite worker isolation (those paragraphs are now cited, not duplicated).

Dropped as generic or duplicated with a verifiable owner: pinned
swift-format/SwiftLint versions (wrapper scripts), test-quality marker
syntax (check_desktop_test_quality.py), ps aux | grep Omi, the
dev-instance primary-checkout note (script header).

Safety rules (production bundle protection, named bundles, signing/TCC,
backend URL env rules, never/must clauses) remain inline.

* check: reword new-file header docstring to avoid a deferred-work marker

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

* docs(app): declare comment-only header changes as internal

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

* docs: correct header claims and restore smoke safeguards after review

Header check now rejects empty docstrings and marker-only comments, and no
longer treats a rename as a new file. Corrects three headers that overstated
what the code guarantees, keeps the signed-smoke safeguards visible in the
macOS guide, and fixes the incident citation's line count.

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

* feat(firmware): promote tested CV1 images with staged rollout

* fix(firmware): identify OTA cohorts and preserve blocked version safety

* test(firmware): initialize OTA request test environment

* fix(firmware): bind CV1 promotion to the tested attempt and bytes

* docs(api): export firmware rollout device_id to the app-client contract

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

* chore(desktop): regenerate API types for firmware device_id

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

* chore: regenerate TypeScript API types for firmware device_id

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

* fix(ci): exercise extracted CV1 OTA staging and publication guards

* fix(ci): read complete immutable Swift blobs for UI approval

* chore: keep safe_mode.c on main's canonical clang-format

The branch carried a brace-style-only delta that CI's clang-format
rejects; the snapshot initializer is semantically identical either way,
so main's formatting wins.

* fix: give the emulator proof's fake consumer clock a monotonic reading

Main's lease-hold cap (#24554) reads time.monotonic() on entering the
heartbeat loop, but this proof injects a frozen SimpleNamespace clock
that only carried time(). Pin monotonic at T0 so the cap stays inert
and the transient-retry semantics under test are unchanged. Same-root
failure is currently red on main's own backend-emulator-proofs run.

* chore: land main's canonical safe_mode.c formatting

The previous fix was re-styled by the local pre-commit hook's newer
clang-format (19+ changed cast-designated-initializer spacing), which
CI's clang-format 18 then rejects. Commit main's exact blob with the
hook pinned to clang-format 18 so local hooks and CI agree.

* test: record the #24392 uncertain-paid-submission contract for Soniox 5xx

#24392 documented that a 5xx from the paid transcription POST is
uncertain and stays held (submitted=True, no duplicate transcription),
but the stale assertion in test_batch_vendor_clients.py still expected
submitted=False, which is why main's own Backend Unit Tests shard 3/8
has been red since it landed. Explicit refusals (402 credit, 429 rate)
keep submitted=False; only the uncertain 5xx case moves.

* Drop native-audio-replay-deps lane: main evolved the inline replay design, helper script superseded

* Restore main's suite-wide pytest plugins: per-file gating keeps the Werkzeug import chain out of isolated files

* fix(eval): label unnamed viewer voices through the SpeakerLabeler authority (#23381); raw ids stay transport keys

* fix(ci-budget): close the build-image rationale string the dispatchtag union left open

* fix(eval): import the labeler from the display authority and keep tainted voice ids out of interpolations

* fix(firmware): guard the changelog array expansion for bash 3.2 under set -u

* fix(tests): match the deferred-SDK clients.py/providers.py seams — stale source grep and guardrail inventory

* test(enrichment): match main's emulator clock stub — monotonic advances with the consumer clock

* test(lifecycle): restore main's PhaseMetrics gauge expander and the blocked_byok row metric the fold's merges dropped

* fix(explainer): match SCRIPT tags case-insensitively when extracting the embedded script (CodeQL Bad HTML filtering regexp)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: David Zheng <[email protected]>
Co-authored-by: David Zhang <[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