Skip to content

fix(episodes): keep memo optimizations safe across async and repair paths (#24582 follow-up) - #24604

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/24582-memo-safety-followup
Nov 4, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/24582-memo-safety-followup

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Follow-up to #24582 (squash-merged at 93d8c89 before this round landed). This is a cherry-pick of the episodes fix lane's unpushed commit 02372e29c75f, which fixes 4 safety issues the review follow-up found after the published head:

  • live.on_realtime_segments awaits the DB executor around the scheduler, so a blocking Firestore call no longer runs on the event loop.
  • The finalizer honors noop_schedule_enabled.
  • memo.complete catches stamp failures and falls back to the old path instead of failing.
  • Async and repair paths (enrichment callback, sync pipeline, intake content shadow, capture groups) keep the memo optimizations safe. The umbrella kill switch EPISODE_ATTACH_OPTIMIZATIONS_ENABLED still restores the old paths.

17 files, +184/−31. The cherry-pick onto main was clean apart from an auto-merge in tests/unit/test_sync_reprocess_coalesce.py.

Authorization: David, 2026-11-04 ~12:55Z, in chat: skip pre-push and CI to ship ASAP.

Verification

  • Targeted unit tests for the test files this commit touches (bin/omi-heavy run -- pytest): episode_attach_cost, episode_attach_review, episodes_finalizer_hook, late_audio_recorded_time, sync_intake_content_shadow, sync_reprocess_coalesce. Result: 227 passed.
  • The lane reported its own green follow-up run (502 cases / 8 files) before committing.
  • No Luna re-review of this round yet. Pre-push gate and full CI were skipped per the authorization above.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

@Git-on-my-level
Git-on-my-level merged commit 7f18e81 into main Nov 4, 2026
31 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 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-11-04T13:05:33.037612Z ad9c0b7 PR opened
ℹ️ About Codex in GitHub

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

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

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

@Git-on-my-level
Git-on-my-level deleted the fix/24582-memo-safety-followup branch November 4, 2026 13:02
Git-on-my-level added a commit that referenced this pull request Nov 4, 2026
)

<!-- claude-projects-attribution: {"github_login":"Git-on-my-level"} -->
_Requested by **David**_

Batch captures previously stayed outside episodes until transcription
finished. Audio close now attaches retained captures by committed audio
bounds before queueing finalization, through the shared fenced
recorded-time membership transaction. Arrival and processing clocks
never select the episode or change its live pointer.

The membership transaction stamps a fixed pending-transcription entry
time and two-hour deadline. Replays preserve the deadline. Home shows
“Transcribing…” while awaiting the durable batch projection; a dead
letter, failed upload/status or elapsed deadline shows “Couldn't
transcribe” with the committed audio finish time. A later successful
projection restores ordinary member metadata. Audio and retry work
remain retained.

`EPISODE_BATCH_CLOSE_ATTACH_ENABLED` defaults on. Setting it to
false/off/0/no restores attach-after-transcription. Episode/cohort,
privacy, custom-STT, retention, lock, deletion and donor guards remain
authoritative. Attachment adds no model calls and does not require a
client-seen marker. Failure emits shared degraded-fallback telemetry and
leaves finalization as the repair path. The overdue metric is an
unlabeled read-observation counter; the info alert remains in the
pending catalog, with no monitoring provisioning in this PR.

Refreshed with merge commits through main `563e6c240944` (#24577,
#24579, #24582/#24604 and subsequent main changes, including #24509).
The resolution keeps batch 1's shared transaction/fence, attempt-local
candidate reuse, current canonical partition proof, visibility
validation, deduplicated memberships and recovery memo. Pending close
writes its deadline inside that transaction without claiming/resetting
completed transcript recovery. Close replay validates current committed
archive bounds, normalized through the same datetime conversion used at
admission, and is a true no-op with attach optimizations on or off.
Changed bounds still update the episode without renewing the deadline.
Composer settling, foreground promotion, Home read cuts and
recording-speaker carry remain intact.

The five original conflicts were in `episode_recorded_components.py`,
`episode_timeline.py`, `service.py`, the Firestore query-driver registry
and the generated feature-flag catalog. The sync callback and affected
tests now use the public `attach_recorded` helper. The final speaker-tip
merge was clean; the core episode resolution is unchanged.

Validation at `817784dced26`: **858 passed across 21 focused backend
files** through `backend/test.sh` with an explicit file list and four
workers; **4 real Firestore emulator replay cases passed**, covering
integer/fractional archive epochs and attach optimizations on/off. All
tests/build gates run through `omi-heavy` at low priority, with no
production credentials.

Emulator limitation: the full 28-case episode suite alternated SDK
transaction-lock timeouts between two old concurrency cases. Its last
full run was **27 passed / 1 failed**, not all green. Both concurrency
cases then passed together in a targeted run on exact main
`cf601889c67b` and exact candidate `b8633977345c`. All 28 cases have
passing candidate executions across full plus targeted runs; this does
not establish a cause for the intermittent timeout. Core
episode/emulator source is byte-identical after the final main merge,
and the four new replay cases were rerun on the final head. Firestore
clients now close at fixture teardown; test concurrency and transaction
retry budgets are unchanged.

Final hermetic e2e at `817784dced26`: **205 passed, 3 skipped, 2 xfailed
in 101.14s**, within the unchanged **120s** limit. Native-library
threads were capped at one; `--disable-warnings` suppressed only the
console warning summary, without filtering warnings or changing warning
assertions. Two earlier final-head attempts reached the wall limit (one
at 100% test progress while rendering warnings). The lead authorized a
documented 300s diagnostic if necessary, but it was **not used**.
Committed and remote-CI budgets remain 120s. `make preflight` passed
**43/43** before the final clean main merge; the normal push hook runs
the final required gates again.

Failure-Class: FC-finalize-hook-allowlist-omits-ingestion-path

Product invariants: INV-MEM-4 and INV-TASK-2. Canonical episode
ownership and task/enrichment authority remain unchanged.

No PR merge, deploy, production account access or GCP calls. GCP tier:
none. No rebase, force-push, workflow additions or firmware edits. The
lead owns merge and the backend/listen release train.

UI-Evidence: none -- backend response projection; related mobile fixture
evidence belongs to #24541.
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