Skip to content

fix(sync): converge durable Cloud Tasks ledger retries - #10008

Merged
Git-on-my-level merged 1 commit into
mainfrom
codex/hermetic-sync-cloud-tasks
Jul 19, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
codex/hermetic-sync-cloud-tasks

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 19, 2026 •

Copy link
Copy Markdown
Member

What changed and why

Adds a blocking, two-process hermetic gauntlet for fresh Sync v2 Cloud Tasks
admission and worker execution. It also repairs the durable-ledger recovery
boundary: a valid ledger completion can now converge a queued retry, and a
first successful pipeline on the final task delivery cannot be overwritten by
a false terminal failure.

Closes #10001
Closes #10004

Product invariants affected

none

How it was verified

  • BACKEND_PYTEST_WORKERS=4 bash backend/test.sh — passed.
  • npm run test:sync-cloud-tasks-stack:emulator — passed with separate
    admission/worker processes, private Redis, Firestore emulator, local
    storage, strict task recorder, and real loopback worker delivery.
  • npm run test:sync-cloud-tasks-stack:emulator -- --state-dir <relative-dir>
    — passed; retained caller-owned evidence/state and then removed only the
    generated temporary directory after inspection.
  • Focused Sync/CI-wiring suite — 288 passed.
  • Two independent code reviews — approved with no blockers.
  • make preflight and scripts/pr-preflight --pr-body-file /tmp/pr-body-10001.md
    — passed against the committed diff.

Tests

  • The gauntlet covers fresh admission, unauthenticated worker rejection,
    terminal and cleanup duplicates, pre- and post-ledger retries, final-attempt
    ledger convergence, retry exhaustion, concurrent delivery fencing, named
    task acknowledgement loss, and expired staged input.
  • Unit regressions prove ordinary finalization remains processing-only,
    durable-ledger recovery can finalize a queued retry, final-attempt recovery
    wins over false failure, lease loss preserves retry material, and terminal
    cleanup keeps precedence.
  • test_sync_cloud_tasks_stack_ci_wiring.py prevents the package script,
    high-risk workflow contract, or blocking CI job from disconnecting.

Failure class (fixes)

Failure-Class: FC-split-mutation-authority

New guards

The stack gauntlet and its CI-wiring tripwire would have caught incident
#10004. They are Sync-specific rather than a shared primitive because this
route alone couples the Cloud Tasks payload, Redis run lease, Firestore content
ledger, fair-use meter, and staged-blob lifecycle.

The product-file ratchet baselines advance only for the two existing Sync
owners. Their one-line justifications record why the coupled recovery stays
there instead of splitting this small repair across more modules.

Review in cubic

Add a process-isolated Cloud Tasks gauntlet for fresh Sync v2 admission and worker recovery, including durable-ledger convergence after retries.

Verification: backend/test.sh, focused Sync tests, and the Firestore/Redis emulator stack gauntlet passed locally.

Failure-Class: FC-split-mutation-authority
@Git-on-my-level
Git-on-my-level merged commit ae38a64 into main Jul 19, 2026
35 of 38 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/hermetic-sync-cloud-tasks branch July 19, 2026 01:08
Git-on-my-level added a commit that referenced this pull request Jul 19, 2026
## Summary

- Add a non-production Rewind artifact/recovery bridge gauntlet covering
privacy admission, HEVC, SQLite, readback, recovery, and cleanup.
- Make memory-read fixtures inject their reference time so CI never
expires a fixed visibility window.
- Keep the shared vector-fixture seam signature-aligned with
production's explicit `now` snapshot, including callers that inject a
custom fixture clock.
- Fix Rewind lifecycle ownership: cleanup, writes, and finalization are
generation-fenced; concurrent shutdown flushes join the active trailer
write, cancellation surfaces failure, and chunk paths are
collision-proof and recover at their absolute capture time.
- Extend the upstream two-process Listen Cloud Tasks gauntlet with a
deterministic public REST finalization race: four stale-read requests
create one outbox job and one named task, prove the three
`AlreadyExists` handoffs, then rehydrate that task after listener
restart and prove exactly-once worker completion.
- Repair the Firestore contention the new REST race exposed in CI:
recreate the transaction and SDK wrapper for bounded `Aborted` retries,
preserve the atomic outbox boundary, and return the existing retryable
503 contract only after that budget is exhausted. Failed gauntlet jobs
now retain and tail their synthetic backend logs for actionable
diagnosis.
- Adopt the stronger upstream Sync (#10008) and Listen (#10000)
gauntlets during rebase instead of restoring the older overlapping
harnesses.

## Final verification (rebased onto current `origin/main`)

- `BACKEND_PYTEST_WORKERS=4 bash backend/test.sh` — all 675 backend unit
test files passed
- `backend/testing/listen_pusher_stack/run.sh --keep --state-dir
/tmp/omi-listen-pusher-final-head.X326dN` — passed all inline and Cloud
Tasks scenarios, including the deterministic REST/restart case
- `bash backend/test.sh` — all 675 backend unit test files passed again
after the contention repair
- `backend/testing/listen_pusher_stack/run.sh --state-dir
/tmp/omi-listen-pusher-contention-fix` — passed all inline and Cloud
Tasks scenarios after the contention repair
- `bash backend/scripts/typecheck.sh` — 0 errors
- `cd desktop/macos && bash test.sh` — launcher tests, Rust tests, and
isolated Swift suites passed
- `make preflight` — deterministic CI manifest passed
- `scripts/pr-preflight --pr-body-file /tmp/omi-gauntlet-pr-body.md` and
`scripts/failure-class validate --base origin/main --head HEAD
--pr-body-file /tmp/omi-gauntlet-pr-body.md` — passed

The former PR head was GitHub-conflicted, which suppressed normal
`pull_request` runs. This branch is rebased cleanly onto current
`origin/main`; these are the final-head checks before its fresh CI run.

## Guard scope

The four-party read barrier intentionally lives only in the Listen
gauntlet entrypoint, rather than in a shared or production primitive. It
coordinates a controllable harness race after the real authenticated
lookup; the production route, Firestore transaction, Cloud Tasks task
construction, listener restart, and worker all remain unmodified. It
extends the recovery surface introduced by merged
[#10000](#10000).

## Product invariants affected

- INV-MEM-1
- INV-MEM-2

## Failure class

Failure-Class: none

The Rewind lifecycle defects and bounded Firestore
transaction-contention recovery have behavioral regression guards, but
no existing semantic failure class describes either failure boundary.
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
…#10008)

## What changed and why

Adds a blocking, two-process hermetic gauntlet for fresh Sync v2 Cloud
Tasks
admission and worker execution. It also repairs the durable-ledger
recovery
boundary: a valid ledger completion can now converge a queued retry, and
a
first successful pipeline on the final task delivery cannot be
overwritten by
a false terminal failure.

Closes BasedHardware#10001
Closes BasedHardware#10004

## Product invariants affected

none

## How it was verified

- `BACKEND_PYTEST_WORKERS=4 bash backend/test.sh` — passed.
- `npm run test:sync-cloud-tasks-stack:emulator` — passed with separate
  admission/worker processes, private Redis, Firestore emulator, local
  storage, strict task recorder, and real loopback worker delivery.
- `npm run test:sync-cloud-tasks-stack:emulator -- --state-dir
<relative-dir>`
— passed; retained caller-owned evidence/state and then removed only the
  generated temporary directory after inspection.
- Focused Sync/CI-wiring suite — 288 passed.
- Two independent code reviews — approved with no blockers.
- `make preflight` and `scripts/pr-preflight --pr-body-file
/tmp/pr-body-10001.md`
  — passed against the committed diff.

## Tests

- The gauntlet covers fresh admission, unauthenticated worker rejection,
terminal and cleanup duplicates, pre- and post-ledger retries,
final-attempt
ledger convergence, retry exhaustion, concurrent delivery fencing, named
  task acknowledgement loss, and expired staged input.
- Unit regressions prove ordinary finalization remains processing-only,
durable-ledger recovery can finalize a queued retry, final-attempt
recovery
wins over false failure, lease loss preserves retry material, and
terminal
  cleanup keeps precedence.
- `test_sync_cloud_tasks_stack_ci_wiring.py` prevents the package
script,
  high-risk workflow contract, or blocking CI job from disconnecting.

## Failure class (fixes)

Failure-Class: FC-split-mutation-authority

## New guards

The stack gauntlet and its CI-wiring tripwire would have caught incident
BasedHardware#10004. They are Sync-specific rather than a shared primitive because
this
route alone couples the Cloud Tasks payload, Redis run lease, Firestore
content
ledger, fair-use meter, and staged-blob lifecycle.

The product-file ratchet baselines advance only for the two existing
Sync
owners. Their one-line justifications record why the coupled recovery
stays
there instead of splitting this small repair across more modules.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10008?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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.

fix(sync): converge durable ledger completion after queued Cloud Tasks retry test(sync): exercise durable Cloud Tasks worker handoff hermetically

1 participant