Skip to content

feat(sync): measure eligible new-row overlap for gate 3 - #23437

Merged
Git-on-my-level merged 12 commits into
mainfrom
lane/syn003-gate3-signal
Oct 24, 2026
Merged

Git-on-my-level merged 12 commits into
mainfrom
lane/syn003-gate3-signal

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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=assignment log observation per committed new sync row from a lineage-admitted, S1-validated upload: created_clear, created_overlap, or created_unknown.

For the 48-hour gate-3 watch, report all three aggregate outcome counts. Require zero created_overlap; created_unknown is unmeasured and blocks widening. Each line carries lookup_complete=true|false and a closed checked_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.
  • Backend typecheck: 0 errors. make preflight: all 34 checks passed. Final PR metadata validated with scripts/pr-preflight --metadata-only --pr-body-file <file>.
  • Hermetic tests only; no production reads, writes, deployment, or cohort widening. No GCP tier used.

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

View guided diff Turn on auto-fix

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-10-24T05:17:24.728979Z df0431a New commits
ℹ️ 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 and others added 2 commits October 24, 2026 11:14
# Conflicts:
#	backend/utils/retrieval/tools/edit_tools.py
#	backend/utils/retrieval/turn_refs.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +4178 to +4179
from config.sync_lineage import sync_lineage_resolve_enabled
from utils.sync.intake_completion import log_sync_lineage_created

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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