Skip to content

fix(storage): coalesce pusher boundary tails and skip identical merge copies - #23445

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/p76-gcs-m1
Oct 23, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/p76-gcs-m1

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Pusher can flush a full batch on one scheduler tick and then persist its last short frame as another object on close. Give size-only flushes one uploader tick (normally1 second) to absorb that frame. Age limits, recording close, disconnect and genuine gaps still flush; a recording containing only one frame remains stored.

Ordinary merge retries now use the existing checksum comparison and destination generation precondition to skip unchanged object copies. This is the non-deleting code part of P76; bucket lifecycle and regional cache changes remain lead-owned and are not applied here.

Validation: 40 tests passed through targeted backend/test.sh files test_pusher_audio_timeline.py (24), test_sync_bridge_audio_copy.py (11) and test_merge_audio_chunk_copy_failure.py (5), with omi-heavy and Python3.11. The wire-level pusher tests cover exact boundary bytes in both legacy/v2 paths, one-frame recordings, discontinuities, replay, retries and conversation changes. Read-only Luna review: CLEAN.

After merging main through #23440 at merge head 90eb35c, the required pre-push hooks passed all 35 PR preflight checks, backend typecheck (zero errors), runtime source closure, format checks, and the 29 changed-file pusher/merge regression tests. No hook bypasses were used. Exact-head GitHub Actions results are available on this PR.

Limits: genuine short recordings/gaps can still produce sub-1 KB objects; coalescing across owners or real time gaps would lose fidelity. No measured savings are booked. Coldline scoping plan is separate and non-deleting. The fresh 637-object noncurrent-opus sample failed raw-regeneration proof, so deletion remains blocked. Regional provisioning and old-cache read/rollback behavior remain gates.

Product invariants affected: none (selector reports no locked invariant paths).

UI-Evidence: none -- backend audio storage behavior only.

Failure-Class: FC-derived-audio-identity-churn

🤖 Generated with Claude Code

Git-on-my-level and others added 2 commits October 23, 2026 13:59
… copies

Give size-ready pusher batches one uploader tick to absorb a final frame,
while flushing close, disconnect, age limits and real gaps immediately.
Reuse the checksum and destination generation guarded merge copy path for
ordinary merge retries. Preserve single-frame recordings without loss.

Failure-Class: FC-derived-audio-identity-churn

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

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 🔄 Running since 2026-10-23T19:39:47.574949Z 90eb35c 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 merged commit 37010d3 into main Oct 23, 2026
69 of 70 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/p76-gcs-m1 branch October 23, 2026 20:04
Git-on-my-level added a commit that referenced this pull request Oct 23, 2026
#23447)

#23445 (37010d3, merged 20:04Z) passes `skip_existing=True` to
`_copy_audio_chunks_for_merge` from `merge_conversations.py:293`. Four
test stubs replace that function with fixed-arity lambdas, so these
tests now fail on main with `TypeError: unexpected keyword argument
'skip_existing'`:
- `test_merge_deleted_source_race.py` (2 stubs)
- `test_speaker_match_scores.py` (1)
- `test_merge_created_webhook.py` (1)

#23445's own CI was green because selective test selection didn't run
these files. Seen on #23393 (run 40016931073, shards 1 and 5).

Fix: test-only. Each stub now accepts `**_kw`. No production change.

Verification (m1, omi-heavy, nice 19): `pytest
tests/unit/test_merge_deleted_source_race.py
tests/unit/test_speaker_match_scores.py
tests/unit/test_merge_created_webhook.py
tests/unit/test_merge_audio_chunk_copy_failure.py` gives 129 passed.

Failure-Class: none

🤖 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/23447?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/23447?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23447&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
## What changed and why

Redirected sync owner reads loaded the final survivor twice. Reuse the
operation's detached raw snapshot and Firestore revision for ordinary
photo/transcript hydration. A metadata-only bridge with no donor lineage
or effect attempts reuses its initial metadata. Donor traversal and
every attempted effect retain the final refresh. Transaction reads, CAS,
deletion markers, owner/path checks and outbox custody remain
authoritative.

Redirect helpers accept a keyword-only `firestore_client`. One lazily
selected client serves redirect resolution, either hydration mode and
photo reads. This addresses the P1 injection finding at
discussion_r4360643026; scoped-client tests reject fallback to legacy
globals. Invalid paths reject before client initialization.

Default ON. Kill switch: `SYNC_OPERATION_SNAPSHOT_ENABLED=false`. Both
modes use `origin=job:sync_operation_snapshot`;
`omi_sync_operation_snapshot_reads_avoided_total{origin,operation}`
counts avoided redirect-hydration and no-effect bridge lookups. No
reads-loop configuration changes. Keep renamed caller
`sync_conversation_snapshot:resolve_snapshot` in the measurement
baseline; label movement is not savings.

Both the snapshot counter and shared origin-overflow counter reuse
existing Prometheus collectors across fresh imports. The origin helper
is copied unchanged from fs-p2's reviewed commit
`77a033e14a0a53d7eaffb04b7da3fbde2875019c`; the archive contract test is
unchanged.

This is the bounded P5 snapshot slice.
`backend/docs/sync-operation-snapshots.md` records the remaining index
contract and P4 design only. The content-free <=4KiB enrichment outbox
cannot carry structured user content. An id+writer-generation index
obligation needs all-writer coverage, live eligibility, replay/CAS and
migration proof; lead owns the scope ruling. P4 excludes every privacy
caller and requires residual phase measurement after WQ12. The 22M/day
and 25M/day figures are unverified planning ceilings; daily savings are
unknown and none are booked.

## Product invariants affected

none

No transcript, speaker, Free-plan, entitlement, polling, hold, deletion
or privacy authority changes.

## How it was verified

- Counted fake document gets: redirect hydration 5 -> 4 with identical
decoded content and unchanged compressed stored bytes; eligible bridge 2
-> 1. Scoped/default-client cases preserve photo hydration. Fresh
deletions, owner/path mismatches, revision contracts, donor lifecycle,
post-effect races, paid unlock recovery and callback parity are covered.
- Real detail handler through FastAPI TestClient: equivalent JSON across
modes, then 404 after a fresh deletion marker. This is an in-process
endpoint check.
- Snapshot metric regression proves collector identity and exported
increments survive fresh config imports. The unchanged archive-contract
tests exercise repeated database imports with both counter repairs
present.
- Follow-up integration: merged main `532990aee3` as merge commit
`252b517e11`. Conflicts were additive documentation and flag entries
only; preserved both fs-p1 #23394 entries and P5 entries. No Python
conflict resolution. Head `8de371d00851ed4b0e9bd1180633b65faa156944`
also carries the exact fs-p2 shared-origin helper (blob
`d3b25323f440457705bfd6eab3ce83a55217a176`).
- Current published head: 16 focused files PASS, 373 tests, including
all four archive-contract cases, the snapshot metric regression, list
projections and repaired merge fixtures. From `backend/`:
`/Users/david/workspace/omi-workspace/bin/omi-heavy run -- env
BACKEND_PYTEST_WORKERS=4
BACKEND_UNIT_TEST_FILE_LIST=/Volumes/scratch/m1-lanes/fs-p5/merge-focused-files.txt
nice -n 19 bash test.sh`. Log:
`/Volumes/scratch/m1-lanes/fs-p5/merge-focused.log`.
- Current head: `make preflight` PASS37/37 (169.88s) and full mandatory
pre-push PASS, including full-backend typecheck (zero errors), runtime
source closure, bounded selected tests, schema checks and formatting.
Ran through `omi-heavy`, nice19; log
`/Volumes/scratch/m1-lanes/fs-p5/merge-publish.log`. Normal push
succeeded after re-fetching main and the shared lane branch; no
force-push. Exact-head
[CI40024971016](https://github.com/BasedHardware/omi/actions/runs/40024971016)
PASS: all six unit shards, guardrails and suite gate. All PR checks
terminal at collection, 37SUCCESS and zero failures; GitHub merge state
CLEAN. No rerun needed. Lead delta review remains required before merge.
- Earlier m1 metric head `61d363f23a`: eight focused files PASS (134
tests); published CI exposed the separate fs-p2 origin-counter
dependency and main #23445 fixture mismatches. This integration contains
the origin repair and main #23447 fixture repair. Earlier full mandatory
pre-push and full-backend typecheck passed. No checks bypassed.
- Prior Luna R1/R2: SHIP on production head
`f4e376f649fac50a232ea03a929b8b395f9d92a3`. Lead must inspect the
seven-line fixture delta at `7186a6bf67d`, client-injection delta
`7186..526e` and metric delta `06d8..61d3`. No third round: two-round
cap exhausted, and current conflict resolution changes no runtime
behavior. The shared origin fix was reviewed by fs-p2's read-only Luna
delta review.

Line-Count-Exception: backend/database/conversations.py | 4431 -> 4449 |
Add scoped-client parameters and forwarding at existing
redirect/hydration boundaries for P1 correctness; operation
orchestration remains extracted in sync_conversation_snapshot.py.

## UI evidence

UI-Evidence: none -- backend read optimization with unchanged response
contract.

## Failure class (fixes)

Failure-Class: none

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

BasedHardware#23445 passes skip_existing=True to _copy_audio_chunks_for_merge; four
fixed-arity lambda stubs now raise TypeError on main. Test-only fix.

Co-Authored-By: Claude Opus 5.5 <[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