Repository navigation
fix(backend): merge raw conversations before full processing - #23931
Merged
Merged
Conversation
Decide automatic absorption after relevance and before notes, preserve already-processed sync identities, and debounce material canonical refreshes through durable custody. Keep explicit user ends immediate and provide an independent default-on kill switch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep the oversized processing coordinators at their current line budgets by sharing custody rejection, budget deferral and deferred webhook primitives. Preserve legacy callback parity without line-count exceptions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Track each pending producer and reset that provenance for new epochs. Rollback drains live-only debt while mixed obligations retain the separately enabled sync window. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Protect old generated title-only captures that lack rich-summary receipts, while allowing proven server-minimum titles to enter pre-notes merging. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stamp deterministic title provenance for known owners whenever merge-before-processing is enabled, independently of the first-summary cohort. Preserve the no-LLM minimum and unknown-owner behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve conservative legacy policy defaults while satisfying the inherited schema inventory gate; no UI behavior changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Skip ineligible short captures before loading merge dependencies and migrate raw-donor fixtures to explicit minimum provenance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assert an actual committed donor before testing terminal retries, avoiding unrelated derived-effect work under the new default. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use the equivalent C safe YAML loader when available so the full registry check stays within the fast-unit CPU budget. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The helper inventory now uses the equivalent C safe loader and stays below the fast-unit CPU guard, so keep the duration assertion active. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A silence-split conversation currently buys full notes before Jev decides to absorb it. This moves automatic absorption to the shared relevance-to-notes boundary, so raw donors never buy notes/title/tasks/memories or run their derived effects. Late sync bridges also keep every already-processed identity instead of deleting a summarized donor after its maximum hold expired.
Failure-Class: FC-sync-enrichment-before-merge-settles
This is occasion architecture step 2 following #23919 and #23920. The fix extends the existing shared processing/hold primitive with a pre-notes absorption boundary and transactional donor fence. Historical generated title-only results without rich-note receipts keep their identity; known-owner deterministic minima receive raw-title provenance independently of the first-summary cohort and remain mergeable before full notes.
Product invariants: INV-MEM-4, INV-TASK-2. Existing memory promotion and task-authority rules remain; donor intelligence is suppressed and canonical processing uses the same authorities.
Design and path audit
sync_merged_intochains: workers resolve to the canonical row and transfer durable custody before acknowledging the donor. Cycles, deletion, leases, privacy and revision fences remain. No donor full run is used to resolve a chain.CI integration repair
Retry routing follows the canonical shared persistence-fence exception so a handled retryable 409 stays retryable after the helper extraction. Current main now supplies the generated account-deletion wire adapter (#23936); this PR carries no duplicate client adapter.
UI-Evidence: none -- this PR changes backend processing only; no widgets, navigation, copy, layout or user-visible behavior changed.
Aggregate production baseline (read only)
Tier: ro-prod, only in a subshell sourced with
~/.local/bin/gcp-agent-env.sh ro-prod. No production writes, account/document reads, API calls to api.omi.me or secrets output. Fixed window: 2026-10-28 01:35:36.946711 UTC through 2026-10-29 01:35:36.946711 UTC. GKE in-cluster Prometheussum(increase(...[24h]))estimates, rounded below; counters count events/attempts, not unique conversations. Re-querying the fixed window can shift counter estimates slightly as scrape samples settle._get_structured/completed persistence. Exact rich-note donor count is unavailable from the old metric.SERVER_RECOVERYwas excluded by the oldcapture_endgate. Recovery volume is not measured by a merge counter.Queries:
sum(increase(omi_conversation_smart_merge_decision_total{mode="merge",decision="merge",reason="absorbed"}[24h])); refresh and flatten equivalents grouped by outcome/reason;sum by(event,outcome)(increase(omi_product_event_total{event=~"capture_group_joined|duplicate_capture_detected"}[24h]));sum by(outcome)(increase(omi_sync_intake_total[24h])). Sync hold and bridge-retraction series were absent. GKE and Cloud Run scrape coverage differs; do not infer zero or fleet totals from missing series.Two metadata-only Firestore COUNT aggregations (smart donor
merged_atwindow, with/withoutsummary_output_present=true) returnedFailedPrecondition; no index was created or document fetched. The new boundedomi_conversation_merge_processing_stage_total{stage,donor_notes}measures actual note-bearing donors separately after rollout. This PR does not invent an exact rich-note waste rate or dollar estimate from event counts.Planning estimate for the same 24h baseline: about 1,279 added pre-notes Jev calls/day, using 1,278.54 successful survivor refreshes as a proxy for eligible candidate volume; there is no direct eligible
SYNC_UPDATEJev-call counter. About 1,270 donor notes runs/day are avoided, using the 1,269.55 absorbs as a proxy. Jev's rate card is $42,000 micro-USD per million input tokens ($0.000042 per 1,000 input tokens; output is unpriced). At an assumed 1,000 input tokens/call, 1,279 calls cost about $0.054/day; actual mean input tokens are unavailable in this aggregate, so spend scales linearly with token usage. The refresh and absorb counters describe adjacent outcomes in this flow and are not added together.Verification
Line-Count-Exception: backend/utils/sync/pipeline.py | 3919 -> 3935 | mirror max-hold terminal settlement in the frozen legacy callback so both callback bodies remain structurally identical.
Review follow-up (2026-10-29; head
440544dbe2eccb98eaf7a11657447ae038071964)A funded refresh denied at the one-hour maximum now settles the processing hold and merge refresh without re-arming a quiet-window wake. The frozen sync callback mirrors this behavior to preserve callback parity.
A donor with no completed derived processing bypasses the immaterial cutoff and uses the existing full survivor refresh, which extracts its derived effects. This is the cheaper correct path versus a separate donor extraction run; the regression test uses a 40-word, 20-second donor.
Focused verification:
BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-23931-review-followup-tests.txt nice -n 10 bash test.shfrombackend/passed the callback-parity, occasion-merge, and process-usage files. The tests cover max-hold budget denial and the 40-word donor.Push preflight passed all 40 checks against
f60de9b011ec70cfcab05fde0a6c2669a652ab02; backend typecheck had 0 errors; runtime-image contracts passed; all 15 selected backend unit test files passed. GitHub CI returned GREEN OPEN CLEAN MERGEABLE on this exact head with 0 pending, 0 failed.Prior review head
080863f6e46:BACKEND_UNIT_TEST_FILE_LIST=/tmp/occasion-focused-49.txt nice -n 10 bash backend/test.shthroughomi-heavyexited 0 across 49 selected backend unit files (513 passed, 1 deselected; 13 dependency warnings), covering smart/Jev merges, sync assignment and redirects, capture groups, holds, leases, deletion fences, explicit ends, retry/rollback and the kill switch.The standalone flag-budget suite passed 21 tests with the one-second fast-unit guard active. Replacing the Python YAML loader with the safe C loader preserves safe parsing and removes the timing overrun; the duration exception added by newer
origin/mainwas removed as unnecessary.Occasion-specific suite: 56 cases passed for historical title-only receipt protection, raw-minimum provenance, real structuring/finalizer boundaries, late-bridge protection, donor ancestry and SDK contention.
CI regression follow-up: 524 passed across 11 files; the shared generated account-deletion adapter test also passed locally (6 tests). No workflow, timeout, skip or test-duration exception was added.
make preflight: 40 checks passed against current maine0cc9e13096fon head080863f6e46.Backend typecheck: 0 errors; async blocker gate: 0 findings. No live endpoint or production canary was run.
The first exact-head GitHub run exposed the flag-budget test exceeding its one-second fast-unit guard (21 assertions still passed). The safe C loader fixes the runtime without a duration exception. GitHub CI passed all 57 checks on prior head
80f52633746. Integrated headffb346aefd3passed all 58 checks on retry after its first attempt had no assertion failures but exceeded the shard-5 720-second budget by 8 seconds. Prior review head080863f6e465passed 58 GitHub checks: 0 pending and 0 failed.~/.local/bin/ci-wait 23931 BasedHardware/omi 90returned GREEN OPEN CLEAN MERGEABLE. The review follow-up below records the current head separately.Rollout and rollback
Default on for every processing host. Independent
CONVERSATION_MERGE_BEFORE_PROCESSINGops kill switch is registered inconfig/feature-flags.yamland the backend flag budget; owner rollout-meetings; review 2026-11-28. Coordinator deploy train owns production promotion; this draft does not deploy.After deployment, observe the new stage/note-presence counter, smart-merge rejects/failures, finalization failures and summary debt/max-hold outcomes for one full hold window. Verify no automatic
before_notesdonor has notes and no held canonical loses its wake. Jev now sees transcript excerpts without a generated donor summary; merge precision/recall must be checked on the rollout train before claiming product acceptance.Rollback: set
CONVERSATION_MERGE_BEFORE_PROCESSING=falseon every processing host. It restores post-notes live merging, legacy sync donor selection and immediate live survivor refresh; live-only merge holds drain through their stored wakes/repair sweep; mixed sync work retains the independent step-1 window and committed donor cleanup remains retryable.SYNC_PROCESSING_HOLD_ENABLEDis independent. No historical data rewrite.Unverified: production deployment/behavior, rich-note waste percentage, Cloud Run-only events, Jev accuracy with an empty donor summary, and destructive unification of metadata-only capture-group transcripts.
🤖 Generated with Claude Code