Skip to content

fix(memory): make projection invalidation safe across Commit retries - #23464

Closed
Git-on-my-level wants to merge 1 commit into
mainfrom
lane/fs-p2-retry-safe-head
Closed

Git-on-my-level wants to merge 1 commit into
mainfrom
lane/fs-p2-retry-safe-head

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

A successful Firestore Commit can lose its acknowledgement and be retried by GAPIC with the same prepared request. The old request UUID can then restore an older projection key: after another write deletes a memory, the deleted row can reappear from cache. A retried source Increment without another writer also returned the first value. Both failures were reproduced through the pinned SDK's real retry policy against the emulator.

The existing head Write now atomically increments a server generation. Readers key raw projections by generation, request token and exact server update_time, including nanoseconds. Schema1, missing/restarted/invalid/saturated versions and unproved epochs retain the source path. Source writes, preconditions, result cardinality, authorization and deletion fences stay unchanged. This fixes the P1 automated review finding on #23402.

Rollout and dependencies

Reader preference remains default on with MEMORY_RELEASED_PROJECTION=off as kill switch. Reuse now requires MEMORY_RELEASED_WRITERS_COVERED=v2:<fresh-epoch>; clear v1 coverage before rollout. Old readers reject v2 and new readers reject v1/schema1. The writer remains on and the head document path stays unchanged; no backfill or production account changes.

Lead owns writer-fleet release verification and synthetic ambiguous-success/create/update/delete parity, then v2 activation by T3 cutoff 2026-10-24 07:30Z. Leave coverage absent and report a blocker if proof is incomplete. Clear coverage before any writer gap/rollback and rotate the epoch afterward. Existing levers and reads-loop ramp ownership remain intact.

MCP reuse also requires a P1 v2 epoch and schema2/server-generation head capability. Current UUID-only P1 heads lack it, so MCP keeps its source path. P1's owner must fix the analogous retry issue and attest the capability before that share is enabled. P2 does not modify the P1 writer or ETag policy.

Attribution remains origin=job:released_memory_projection for head reads and the original caller origin for source reads. One head Write and two warm head reads remain. The counted 100-document warm-page proof stays 100 -> 2. The 50M/day P2 target remains conditional; MCP's share waits for its dependency. No live savings or deploy is claimed.

Product invariants affected

  • INV-MEM-1: original access, pending/expiry, archive/device and Free-plan checks rerun on raw candidates.
  • INV-MEM-3: failed/unsupported version proof retains authoritative source queries; no stale fallback or recovery authority.
  • INV-MEM-4: source/head atomicity includes deletes and transforms; no transcript, speaker, privacy, legal-hold or deletion-fence change.

Verification

All local verification ran through omi-heavy at nice19 with explicit FILE_LIST and workers4, using cached pinned dependencies in the existing worktree. 214 targeted unit tests passed, including writer/reader, SDK-stub, P1 composition, custody/privacy and read-count coverage. The dedicated real-SDK emulator test failed both cases before the fix and passed both afterward: interleaved deletion following ambiguous success, and repeated source Increment. Existing atomic failed-batch/transaction retry, sync/async deletion, bulk exclusion, canonical correction/revert, competing/concurrent reopen and privacy-race emulator proofs also passed.

Evidence: /Volumes/Ephemeral/scratch/fs-p2/retry-before.log, retry-after.log, retry-unit.log, retry-contract-emulator.log. Required bounded pre-push passed, including typecheck with zero errors. Luna review and exact-head CI are reported before final handoff. No new workflow, production reads/writes, GCP tier, deployment or fresh dependency install.

Failure-Class: new

View guided diff Turn on auto-fix

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 24, 2026 02:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T02:41:40.619206Z da0aec8 Draft marked ready
ℹ️ 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 marked this pull request as draft November 4, 2026 07:01
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 4, 2026 07:27

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 11 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

View guided diff | Turn on auto-fix | Re-trigger cubic

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Folded into #24602 (the consolidation of this batch onto the age-gate survivor branch lane/freshtitles-agegate, head e2e0767). Survivor #24580 merged separately at 11:59Z without the batch folds, so #24602 carries this PR's changes on top of current main for review. Every behavior change from this PR is preserved in the fold; conflicts were reconciled against main's newer contracts (details in #24602's description). Closing as folded — follow #24602.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Hey @Git-on-my-level 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

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