Skip to content

config(sync): turn off the per-UID backfill sequencer in prod - #21883

Merged
mdmohsin7 merged 2 commits into
mainfrom
rex/sync-sequencer-off
Oct 16, 2026
Merged

mdmohsin7 merged 2 commits into
mainfrom
rex/sync-sequencer-off

Conversation

@mdmohsin7

@mdmohsin7 mdmohsin7 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Turns SYNC_BACKFILL_UID_SEQUENCER off for backend-sync and backend-sync-backfill (dev and prod) so offline-sync backfill uploads are no longer processed one job per user at a time.

Why

Users report offline recordings that never get processed, with the backlog growing daily.

  • Nearly every upload is classified into the backfill lane (99.6% of admissions today).
  • With the sequencer on, each user's backfill jobs dispatch one at a time. Heavy pendant users produce jobs faster than one-at-a-time drains them.
  • A job still waiting after the 24h sync-job TTL is retired unprocessed. The app then re-uploads it into the same queue.
  • Pending sequencer entries in prod: 508,369 across 1,724 users, about 251k already past the TTL (13 before Oct 1).

off is the flag's documented kill switch. New backfill uploads dispatch directly to Cloud Tasks, which has room for 90 concurrent jobs on the backfill queue. The Scheduler sweep keeps draining entries already queued, so the Scheduler must stay enabled.

Changes

  • backend/deploy/runtime_env/_base.yaml: SYNC_BACKFILL_UID_SEQUENCER on → off for both sync services.
  • backend/deploy/runtime_env.yaml: regenerated.
  • config/feature-flags.yaml: registry note updated.

Product invariants affected

  • INV-MEM-4: unaffected. This only changes how offline-sync backfill jobs are dispatched; memory admission still goes through canonical consolidation.

Verification

  • python3 backend/deploy/compose_runtime_env.py --check reports the manifest is up to date.
  • All four rendered entries (dev and prod × two services) are off.
  • After deploy, check that sync_uid_sequencer action=registered stops on new uploads, that backfill jobs finalize, and that the pending count falls.

🤖 Generated with Claude Code

With the sequencer on, each user's backfill uploads ran one worker job at a
time. Pendant users record faster than that drains, so their queues only
grow; anything still waiting after the 24h sync-job TTL is retired
unprocessed and re-uploaded behind the same queue. Prod had 508,369 pending
entries across 1,724 users, about 251k past the TTL.

'off' is the flag's documented kill switch: new backfill uploads dispatch
straight to Cloud Tasks (sync-backfill queue, 90 concurrent), and the
Scheduler sweep keeps draining the entries already queued.
@mdmohsin7
mdmohsin7 merged commit 53de804 into main Oct 16, 2026
37 of 39 checks passed
@mdmohsin7
mdmohsin7 deleted the rex/sync-sequencer-off branch October 16, 2026 16:10
mdmohsin7 added a commit that referenced this pull request Oct 16, 2026
… off (#21909)

## Summary

With `SYNC_BACKFILL_UID_SEQUENCER=off`, the backfill worker now
processes direct backfill jobs immediately. Before this change it still
sent them back into the one-per-UID queue whenever the user had an
active or pending sequenced entry.

## Why

#21883 turned the sequencer off, and it is off on both prod sync
services now. Ten minutes after the switch, sequencer registrations were
unchanged (1,414 → 1,594 per 10 min), and every one came from the
backfill worker.

The worker's cutover branch (`run_sync_job`, epoch-less backfill
payloads) did two things when the flag was off:

- It re-registered the job into the sequencer if the user had an active
owner or any pending entry.
- Otherwise it called `refresh_direct_run`, which makes `kick()` defer
that user's sequenced drain.

All 1,724 users with a backlog still have pending entries (502k total),
so the kill switch changed nothing for them.

## Change

- The cutover branch now runs only when the sequencer is on. Flag off
goes straight to `_run_sync_job_body`, and the already-sequenced entries
keep draining through `kick`/Scheduler in parallel.
- Sequenced deliveries (those carrying `sequencer_epoch`) are untouched.
They still finish their job and kick the next one.

Trade-off: with the flag off, a user's direct jobs and their leftover
sequenced jobs can run concurrently. That is the pre-sequencer
behaviour, paced by the Cloud Tasks queue.

## Product invariants affected

none

## Failure class

Failure-Class: new

Adds `FC-kill-switch-keeps-the-gated-path`: a rollout flag turned off
must stop admitting new work to the gated path, even while leftover
state from the flag-on period exists.

## Verification

- `test_old_backfill_task_migrates_on_flag_on_and_runs_direct_when_off`
now asserts that, with the flag off, a direct job runs and is not
registered for an idle owner, an active owner, or a pending backlog, and
that `refresh_direct_run` is never called. The old code registers in the
last two cases, so the test fails on it.
-
`test_sync_task_persistence_fence_terminalizes_backfill_and_releases_its_slot`
no longer pads the adoption read that the flag-off path no longer makes.
- `tests/unit/test_sync_cloud_tasks.py` and
`tests/unit/test_sync_backfill_uid_sequencer.py`: the same 11 failures
as unmodified `main` in my local environment, and nothing new.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/21909?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="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/21909?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F21909&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.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.

1 participant