Repository navigation
config train T0: sync fresh, archive COALESCE 100%, call-link shadow, drop Deepgram - #21887
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f09b1eeeb7
ℹ️ 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".
| STT_SERVICE_MODELS: | ||
| value: parakeet-window,modulate-velma-2,soniox,dg-nova-3 | ||
| value: parakeet-window,modulate-velma-2,soniox |
There was a problem hiding this comment.
Keep Deepgram reachable for BYOK fallback
For a BYOK session, managed_chain_enabled() is false, and after Modulate or Soniox fails deepgram_fallback_model() scans only STT_SERVICE_MODELS; removing the sole dg-* token therefore returns None even when the user supplied a Deepgram key. The session skips the supported BYOK fallback and instead reaches bounded, English-only Parakeet or fails, contradicting the retained policy in config/stt_provider_policy.py:142-147; keep a Deepgram token or add a BYOK-specific fallback path.
AGENTS.md reference: backend/AGENTS.md:L141-L141
Useful? React with 👍 / 👎.
| LISTEN_COMMITTED_CAPTURE_COVERAGE_ENABLED: {value: 'true', category: rollout} | ||
| CAPTURE_GROUP_CONTAINMENT_MODE: {value: 'shadow', category: rollout} | ||
| DESKTOP_PENDANT_CALL_LINK_MODE: {value: 'off', category: rollout} | ||
| DESKTOP_PENDANT_CALL_LINK_MODE: {value: 'shadow', category: rollout} |
There was a problem hiding this comment.
Update the listen/pusher operational map
Changing the fleet default to shadow leaves backend/docs/listen_pusher_pipeline.mdx stating that desktop/pendant call linking ships off, so operators consulting the owning env/wire contract will incorrectly believe the shadow path is inactive. Update that required pipeline document alongside this rollout (and the related STT/archive configuration changes).
AGENTS.md reference: backend/AGENTS.md:L159-L159
Useful? React with 👍 / 👎.
| return [_without_named_env(item, name) for item in node] | ||
| return node | ||
| return any(_contains_uid_outside_approved_allowlists(item, uid) for item in node) | ||
| return node == uid |
There was a problem hiding this comment.
Preserve substring detection in the UID guard
When the protected UID appears inside a comma-separated allowlist or serialized JSON value, this scalar equality check returns false, whereas the previous serialized-substring assertion detected it. Since these rollout fields commonly encode multiple UIDs in one string, a future forbidden dev admission can now pass this regression test unnoticed; test string containment here or retain the prior serialization approach after excluding only the approved paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 746346b265
ℹ️ 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".
| AUDIO_ARCHIVE_PERCENT: | ||
| value: '100' | ||
| category: rollout | ||
| AUDIO_ARCHIVE_UID_ALLOWLIST: | ||
| value: '' |
There was a problem hiding this comment.
Keep archive coalescing scoped to the canary UID
In production, this override replaces the base configuration’s zero-percent David allowlist with AUDIO_ARCHIVE_PERCENT=100 and an empty allowlist. Because config/audio_archive.py::admitted grants access when either the UID is allowlisted or its bucket is below the percentage, the next deployment enables coalescing for every production UID—not just David as intended—and makes cache uploads synchronous for all admitted rebuilds in storage.py. Restore the zero percentage and David allowlist on the production surfaces.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db1e4fba5a
ℹ️ 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".
| SYNC_LEGACY_FRESH_PERCENT: | ||
| value: '100' |
There was a problem hiding this comment.
Set the UID-only sync rollout percentage to zero
When any non-allowlisted production UID uploads a recent LEGACY batch, legacy_fresh.enabled_for() admits it because the allowlist and percentage checks are alternatives and every UID bucket is below 100. This therefore routes the entire eligible fleet into fresh capacity, subject only to each user's token bucket, rather than restricting the rollout to the configured UID as stated; keep the master flag and allowlist enabled but set this percentage to 0 for the UID-only rollout.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9047571bb9
ℹ️ 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".
| SYNC_LEGACY_FRESH_PERCENT: | ||
| value: '100' |
There was a problem hiding this comment.
Update the sync admission operational contract
In the checked production backend-sync and backend-sync-backfill overlays, this admits 100% of eligible UIDs, while backend/docs/listen_pusher_pipeline.mdx:4810-4822 still says the production default is disabled and documents the old 10-token burst and 60-token hourly budget rather than the newly configured 60/120 limits. Operators using the owning env/wire contract will misread the active capacity and rollback settings, so update that document with this rollout.
AGENTS.md reference: backend/AGENTS.md:L159-L159
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da17bc06e1
ℹ️ 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".
| BATCH_PIPELINE_RECOVERY_MODE: | ||
| value: 'on' | ||
| BATCH_PIPELINE_RECOVERY_UID_ALLOWLIST: | ||
| value: vi7SA9ckQCe4ccobWNxlbdcNdC23 |
There was a problem hiding this comment.
Document the enabled recovery cohort in the pipeline map
In the checked production backend-integration overlay, these settings enable quarantined-segment legacy STT recovery for the listed UID, but backend/docs/listen_pusher_pipeline.mdx contains no BATCH_PIPELINE_RECOVERY_* contract or rollout/rollback description. Operators relying on the required transcription pipeline map therefore cannot see that this production STT path is active; update that document with the host, cohort, and kill switch.
AGENTS.md reference: backend/AGENTS.md:L159-L159
Useful? React with 👍 / 👎.
## Demand-driven processing Add default-off surface leases, immediate dispatch with tier priority under contention through existing Cloud Tasks workers, open-time promotion, and coalesced lazy memory/vector/task work. Expose `process_recent_conversations` to app chat, shared Telegram/Linq chat and hosted MCP with authenticated owner binding, six-hour/twenty-obligation bounds and a shared rate limit. Phone and Mac reporters renew explicit intent independently of audio sockets. Mac intent measures the main window. The end-of-day hook is omitted under David's updated 2026-10-16 KB rulings. Daytime merge decisions and proactive notification priority remain unchanged. ## Product invariants affected - INV-AUTH-1: lease reporting captures and revalidates the current authorization generation; it never changes Firebase session state. - INV-DATA-1: desktop deploy declarations retain the existing customer identity/data-plane authority; only default-off demand controls are added. - INV-CAP-1: capture/intake and durable audio retention are preserved; only processing dispatch changes. - INV-MEM-4: lazy work uses the existing canonical memory writer and privacy fences, without a second promotion authority. - INV-TASK-2: lazy tasks use the existing suggestion/capture policy and do not accept suggestions automatically. Failure-Class: none UI-Evidence: none -- changes report lifecycle intent; no rendered view or navigation changes. ## Rollout plan Config trains are documented in `backend/docs/runbooks/demand-driven-processing.md`: default-off image -> explicit owner client reporting and scheduler allowlist (0%) -> lazy work -> agent tool -> 1% -> 5% with >=30 minutes of clean sentinel readouts at each step -> 25/50/100 only after acceptance. No production flag change or deployment is included. Measure per-tier queue age, existing end-to-end finalization journeys, retry/dead-letter and outbox repair counts, visible quality, memory/task completeness and live p95. Qualification requires tier 0 <=1m, tier 1 p95 <=5m, tier 2 <=60m; newest 20m <=2m and newest hour <=4m on simultaneous opens. Scheduling headroom is not a measured freshness guarantee. Roll back admission flags while retaining workers/sweeps to drain durable debt. No GPU/cost saving is claimed. ## Validation - Targeted backend: **490 passed** across twelve targeted files using the repository file-list runner, one worker and `nice -n 19`. Includes tier assignment/promotion/drain/ceiling and idle-capacity dispatch, shared outbox recovery, visible/lazy split, synthetic-owner ASGI auth, registration/recovery-read avoidance, tool auth/bounds. - Flutter `listen_client_state_test.dart`: 8 passed. Focused Mac `ListenClientStateTests`: 9 passed, including URL normalization; the final incremental run compiles the regenerated additive API types. - Local HTTP smoke: real loopback HTTP -> production surface handler -> fake Redis -> recorded Cloud Tasks; open intent promoted pending work to tier 0. No live cloud acceptance is claimed. - Full backend Pyright: 0 errors, 36,017 warnings; async blocker scan: 0 findings; changed production import scan: 0 violations. - Schema inventory, full MCP transport/output schemas, prompt-cache inventory and pusher config snapshots pass. - Runtime fixture/renderer contracts: 219 passed; workflow actionlint: both changed workflows pass. Runtime compose check and dev/prod validators pass; source closure passes for all 17 images. OpenAPI and generated Swift/TypeScript contracts regenerated; Dart model freshness passes. - Final-head repository preflight passed 83 selected checks; final-head/push-hook receipts are recorded in the run handoff. Config trains, metrics, rollback and load/quality gates are in the runbook. ## Limits The earlier upstream daily-summary decoder inventory failure is fixed by #21925, now integrated from main (`bfd3a973ed4`). The Grok fix commits do not implement that unrelated client migration. Full CI is not claimed green. The tool promotes the caller's indexed recent debt and reports `ready=false`; it does not scan Firestore for pre-rollout historical work. Existing durable reconciliation owns unindexed debt. Full peak-load and provider qualification are rollout gates. The newer KB rulings remove item 5 from this PR; #21836 and lazy speaker refinement remain separate work. ## Grok fixes - Preserve production's 600-second trailing-edge sync settle when the master switch is enabled, including tier 0/open promotion, Redis-loss enqueue fallback and the durable worker claim. Appends continue to extend one outbox obligation; invisible effects retain explicit-demand bypass. - Retain close/occlusion changes during in-flight Mac and phone reports. Mac re-reads visibility after asynchronous header preparation; both clients drain queued state changes after send and retry failed closes on closed heartbeats without spinning. - Only explicit boolean `surface_open` counts as listen intent. Released iOS/Android/mobile/Mac telemetry remains unchanged when server flags turn on. - Targeted regression run: 490 backend tests passed across twelve files, one file worker at a time via `BACKEND_UNIT_TEST_FILE_LIST`, `nice -n 19`. Mac lifecycle/race tests: 9 passed. Phone lifecycle/race tests: 8 passed. Detailed receipts are recorded in the run handoff. - Merged main's #21923 telemetry (`a4cce4c3099`) while retaining strict surface intent and both documentation sections; telemetry and demand policy regression tests pass. - Merged main's T0 config train (#21887, `acfcd8ed0d4`), regenerated runtime/registry output, and verified all 96 demand defaults remain off/empty/zero while every other runtime value exactly matches main. Sync settle remains 600 seconds; 55 Helm/cohort/parity checks pass. - Continue from the lead's `fb698130b3e` merge of main, without rebasing. The two desktop deploy workflows retain only six additive default-off env lines each; **David approved these exact workflow lines in the final-main-sync instruction**. No merge, deploy or runtime configuration change is included. ## Main sync 2026-10-17 Merged `origin/main` at `6e7007e3e35` without rebasing. Resolved eight conflicts by retaining both additive config/registry/test sets and both post-persistence processing paths. Demand mode retains its 59-minute ceiling and 600-second trailing settle; upstream revision reuse alone retains its 60-minute ceiling. Both enabled use the existing demand headroom, covered by the four-way flag matrix and Redis/open-state settle tests. No intentional change to Grok-approved semantics. Targeted merge validation: **434 passed across nine files**, canonical `BACKEND_UNIT_TEST_FILE_LIST` runner, `BACKEND_PYTEST_WORKERS=1`, `nice -n 19`. All 96 demand defaults remain off/empty/zero and every other runtime value matches main. The two workflow diffs remain exactly six additive default-off lines each; David has approved these exact workflow lines. Detailed conflict resolutions and final publication receipts are appended to the run handoff. ## Final main sync Merged `origin/main` at `3a4fe148259` without rebasing. The only conflict was generated `backend/docs/feature-flag-registry.md`; regenerated it from the merged sources with `--as-of 2026-09-24`, and recomposed/checked runtime env. Seven key Grok-reviewed production files are byte-identical to `66bdc353202`; all 96 demand defaults remain off/empty/zero and every other runtime value matches main. No reviewed semantic change. **303 targeted tests passed across four files**, using `BACKEND_UNIT_TEST_FILE_LIST`, `BACKEND_PYTEST_WORKERS=1` and `nice -n 19`, serially. The workflow edits remain exactly six additive default-off `DEMAND_PROCESSING_*` lines in each approved file and are unchanged from the Grok-reviewed head. **David's scoped approval is recorded.** No PR merge or deployment is included. Final head and publication receipts are appended under “Final main sync” in the run handoff. ## Integration size exceptions Line-Count-Exception: backend/database/conversations.py | 4107 -> 4120 | Small blind metadata writer; avoids a new hot-path Firestore read and stays with database ownership. Line-Count-Exception: backend/routers/listen/receiver.py | 2618 -> 2632 | Small guarded ingestion hook reuses existing client_state; scheduling lives in its own module. Line-Count-Exception: backend/routers/users.py | 2576 -> 2598 | Small typed authenticated lifecycle endpoint; all lease logic lives in the demand module. Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3566 -> 3592 | Small integration seams retain canonical memory/task writer ownership; scheduler and outbox worker are separate modules. Line-Count-Exception: backend/utils/retrieval/agentic.py | 1993 -> 1999 | Register and gate one tool implemented in its own module. Line-Count-Exception: backend/utils/sync/pipeline.py | 3385 -> 3391 | Small flag/coalescing and explicit-demand hooks preserve the existing sync owner. Line-Count-Exception: app/lib/pages/home/page.dart | 1126 -> 1127 | One startup hook starts the opt-in reporter even without a recording socket; no view construction changes. Line-Count-Exception: desktop/macos/Desktop/Sources/OmiApp.swift | 1683 -> 1684 | One startup hook starts the opt-in reporter after environment/auth setup; implementation remains in ListenClientState.
Summary
The lead reports the prod Cloud Run env update is already live on
backend-syncandbackend-sync-backfill. This PR makes those values durable so the next main deploy preserves them: legacy fresh enabled at 100% (all UIDs are eligible), the configured UID allowlist populated, a per-UID 60-token burst and 120 tokens per hour, and assignment contention retry enabled. Redis budget failures demote to backfill.Set archive COALESCE to 100% on all six prod hosts carrying
AUDIO_ARCHIVE_*keys, with every other archive phase disabled and the prod UID allowlist empty. Dev retains COALESCE enabled at 0%, with the David UID allowlist and all other phases disabled.Add the recovery pair to the four Cloud Run services and
backend-listenin both environments: off/empty everywhere except prodbackend-integration, which is on with David's UID. The two backend-listen Helm values declare off/empty.This PR supersedes #21843; Enable David-only batch quarantine recovery #21843 remains open for the lead to close.
Keep desktop/pendant call-link mode at
shadowand 100%. Removedg-nova-3from runtime and the four matching HelmSTT_SERVICE_MODELSlists. Leave the provider policy unchanged.No production deployment was run.
Re-enable prod David-only batch admission (
BATCH_PIPELINE_ENABLED=trueon the five prod maps; percent remains0and the David allowlist remains in place) for qualification: fix: retry empty batch ASR on full padded captures #21920 (empty-ASR padded full-capture retry) is merged and the prod batch worker runs image71043a7(digest31e26a1d). The 101 quarantines were a historical drain; fresh David-only admission is the qualification. Units still empty stay held for fenced legacy recovery.Product invariants affected
Failure-Class: none
Validation
nice -n 19 python3 backend/deploy/compose_runtime_env.py --checkpassed. Rendered the feature-flag registry with--as-of 2026-09-24.origin/mainat8239f2af68bfb9bb842d1c3d82b2ff7e7d243694: exactly 76 runtime entries and 21 Helm entries changed, limited to the T0 env groups, recovery pair, and David-only batch admission. No other effective runtime or Helm env values changed.