Repository navigation
feat(sync): measure eligible new-row overlap for gate 3 - #23437
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. |
# Conflicts: # backend/utils/retrieval/tools/edit_tools.py # backend/utils/retrieval/turn_refs.py
…servative live test Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df0431adad
ℹ️ 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".
| or row.get('sync_live_target') | ||
| or (row.get('capture_evidence') or {}).get('origin') == 'live' | ||
| or (row.get('external_data') or {}).get('recording_origin_id') | ||
| or (row.get('external_data') or {}).get('recording_session_id') |
There was a problem hiding this comment.
Distinguish sync session identity from live provenance
When CAPTURE_COVERAGE_MODE serves an upload, utils/capture/identity.py::persist_identity also writes external_data.recording_session_id onto ordinary sync-created rows. Consequently, this predicate classifies those rows as live despite their positive sync_content_revision and sync_vad evidence. For example, a size rollover that creates a new row overlapping its full sync predecessor can report created_overlap even though no live row exists, falsely failing gate 3 and blocking widening. Use live-specific provenance rather than the shared recording-session identity.
Useful? React with 👍 / 👎.
| from config.sync_lineage import sync_lineage_resolve_enabled | ||
| from utils.sync.intake_completion import log_sync_lineage_created |
There was a problem hiding this comment.
Move the new imports to module scope
The two new imports inside assign_sync_conversation violate the explicit Import Rules in backend/AGENTS.md: all imports must be at module top level, never inside functions. Move these dependencies to module scope; the pre-existing local assignment import does not exempt newly added imports from that repository convention.
AGENTS.md reference: backend/AGENTS.md:L161-L163
Useful? React with 👍 / 👎.
Gate 3 was unmeasured because resolver diagnostics could not distinguish an eligible committed new row from an append. This adds one id-free
event=sync_lineage_resolve stage=assignmentlog observation per committed new sync row from a lineage-admitted, S1-validated upload:created_clear,created_overlap, orcreated_unknown.For the 48-hour gate-3 watch, report all three aggregate outcome counts. Require zero
created_overlap;created_unknownis unmeasured and blocks widening. Each line carrieslookup_complete=true|falseand a closedchecked_live_candidates_bucket(0|1|2_5|6_10|11_20|gt_20). Exclude assignment-stage lines from resolver-decision and truncation denominators. Failed, capped, skipped, missing-device, or extent-incomplete lookups cannot prove clear; an observed strict overlap is a violation even when lookup coverage is incomplete.Validated S1/cohort admission flows from the coordinator and authenticated batch projection as transient metadata. Classification uses only metadata in assignment's existing transactional read cache, with the same source/device/lock/clock-run partition, including empty live stubs. The existing 128-row metadata discovery query only gains a caller-owned diagnostic sink; its filters, projection, limit, and returned candidates are unchanged. Assignment does not re-query cohort membership, whose cache refresh could otherwise add a Firestore read. Only the local kill switch is rechecked.
Telemetry only: no added Firestore reads, routing decisions, persisted fields, request/response shapes, flags, or metric labels. Emission follows the successful transaction commit and precedes indexing/followup; appends, landed retries, non-admitted uploads, and legacy/held paths without validated S1 admission emit none. Labels are closed; logs contain no account or row identifiers, filenames, or content. The architecture and pipeline guides describe the measurement limits. Rollback: revert this PR.
The merge from main also introduced seven backend typecheck errors in runtime retrieval-config guards. This PR includes minimal annotation/cast corrections at those existing boundaries; the runtime guards and their behavior remain intact.
Verification
BACKEND_UNIT_TEST_FILE_LIST=$PWD/.local/agent-tasks/syn003-gate3/finish/final-tests.txt /Users/dazheng/workspace/omi/bin/omi-heavy run -- nice -n 10 bash backend/test.sh: 412 tests across 11 files passed after merging current main. Coverage includes clear/overlap/unknown, non-admitted/S1-unvalidated/kill-switch parity, identical assignment read sets and codec payloads, unchanged discovery query shape, partitions, commit retry/failure, and live-origin provenance after sync revisions. A regression test rejects any cohort membership resolver call by the telemetry path.make preflight: all 34 checks passed. Final PR metadata validated withscripts/pr-preflight --metadata-only --pr-body-file <file>.Product invariants affected
none
Failure-Class: none
Line-Count-Exception: backend/database/conversations.py | 4431 -> 4444 | carry validated admission and observe committed creates without changing reads, routing or stored payloads
Line-Count-Exception: backend/utils/sync/pipeline.py | 3690 -> 3698 | carry validated admission as transient telemetry metadata