Skip to content

SCA-5199: Bound memory visibility contention retries - #26547

Merged
Git-on-my-level merged 3 commits into
mainfrom
agent/multica-worker-1-codex-sol/daff45db5e15
Nov 28, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
agent/multica-worker-1-codex-sol/daff45db5e15

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What changed and why

The memory visibility PATCH retries stale canonical plans and Firestore transaction aborts using fresh reads, fresh transactions and jittered backoff. The app PATCH starts its eight-second Firestore RPC budget before preflight. Materialization and the toggle share that deadline, with time reserved for rollback and receipt lookup. Best-effort historical cleanup inherits the original deadline on the cleanup executor and leaves canonical suppression authoritative. Confirmed contention exhaustion returns HTTP 409 and transient storage failures return HTTP 503 with a retry hint. The Developer API uses the same HTTP mapping.

An uncertain Commit is never replayed. A bounded read of the exact operation receipt confirms the write and lets the existing post-commit persona refresh and event run without a second item read. Without confirmation the route returns 503 and skips both. SDK RPC attempts are single-shot within the budget. Only definitive contention is replayed by the adapter. A bounded warning records contention exhaustion.

Product invariants affected

  • INV-MEM-1, INV-MEM-3, INV-MEM-4. Visibility uses the canonical item and writer-admission checks in the existing apply transaction.

How it was verified

  • All 323 focused Python tests passed on multica-worker-1. They exercise both route mappings, canonical apply, historical privacy behavior and writer admission.
  • All 11 loopback Firestore proof cases passed. They exercise canonical and historical retries and exhaustion, a lost Commit acknowledgment, an unconfirmed timeout, a control-state read timeout, a begin-time unavailable error, a bounded route preflight, and cleanup with an expired deadline. The lost-acknowledgment case makes any post-commit item read fail. The hosted emulator runner uses the existing proof workflow and path filter.
  • The app-client OpenAPI export and generated clients include the 409 and 503 visibility responses.
  • All 49 local PR preflight checks passed, including the web typecheck and 1,089 web tests.
  • Production readback is pending rollout. It requires two consecutive Health ticks with zero sampled route 5xx, a drop of at least 3,000 ready jobs in each matching 15-minute window, and no matching canonical mutation exhaustion errors.

UI-Evidence: none -- generated API declarations and backend handling only

Failure-Class: FC-immediate-retry-loses-shared-cas

Line-Count-Exception: backend/database/memory_apply_store.py | 2883 -> 2891 | Expose a single SDK transaction attempt at the canonical write boundary.
Line-Count-Exception: backend/routers/developer.py | 3032 -> 3036 | Map visibility contention consistently in the existing Developer API route.
Line-Count-Exception: backend/utils/memory/canonical_memory_adapter.py | 4038 -> 4221 | Keep bounded materialization retries and exact commit confirmation alongside canonical apply.
Line-Count-Exception: backend/utils/memory/memory_service.py | 4814 -> 4841 | Share the retry deadline with historical materialization and use one HTTP error mapping.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T01:08:37.279670Z 2e4b990 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.

@mintlify

mintlify Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Nov 27, 2026, 11:44 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@Git-on-my-level
Git-on-my-level merged commit 7b0f13a into main Nov 28, 2026
79 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/multica-worker-1-codex-sol/daff45db5e15 branch November 28, 2026 03:36
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