Skip to content

fix(backend): unconfigured recordings bucket deadlocks account deletion (6 users stuck on prod) - #9632

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-account-deletion-recordings-bucket
Jul 13, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-account-deletion-recordings-bucket

Conversation

@kodjima33

@kodjima33 kodjima33 commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator

The bug (live on prod, right now)

Account deletion is failing for every user who requests it, and their data is being retained.

BUCKET_MEMORIES_RECORDINGS was never wired into the backend Helm charts (it's absent from prod_omi_backend_listen_values.yaml, the dev values, and .env.template), so memories_recordings_bucket resolves to None in prod. delete_all_conversation_recordings calls .bucket(None), and listing raises:

ValueError: Cannot determine path without bucket name.

That purge is a required step, so the raise aborts background_wipe_user_data before users_db.delete_user_data(). The wipe is marked wipe_failed, the reconciler re-enqueues it, and it fails again — forever. Prod logs (last 24h):

ERROR:services.users.account_deletion:delete_account purge recordings failed for <uid>: Cannot determine path without bucket name.
ERROR:services.users.account_deletion:delete_account background wipe failed for <uid>: required derived purge failed: conversation_recordings
INFO:services.users.account_deletion:delete_account reconciliation: re-enqueued 6, skipped 0

Six uids are stuck in that loop. Their Firestore data (conversations, memories, chats) is still there after they asked to be deleted.

Root cause

An unconfigured bucket was being treated as a purge failure. A permanent config gap therefore became a permanent block on an irreversible-but-requested deletion.

The fix

An unconfigured bucket now means "nothing to purge" and returns cleanly — uploads resolve the same bucket name, so a deployment without it cannot have stored recordings.

A real GCS failure still raises and still blocks the irreversible Firestore wipe. That contract is deliberate (retry rather than partially wipe) and is unchanged — test_gcs_failure_blocks_firestore_wipe still passes untouched.

Verification (real path, live prod GCS, prod service account)

  • Replaying the pre-fix function body with the bucket unset and one of the actual stuck uids reproduces the prod log line byte-for-byte: ValueError: Cannot determine path without bucket name.
  • With the fix, the same call returns cleanly → required_failures is empty → the wipe proceeds to the Firestore delete.
  • With the bucket configured, the purge still lists live gs://memories-recordings and deletes the {uid}/ prefix (exercised against a uid with no objects, so nothing was deleted).
  • New regression test fails without the guard, passes with it.
  • backend/test.sh: 564 test files, 0 failures.

⚠️ Not merged — needs your sign-off

AGENTS.md requires explicit user sign-off for data deletion changes, and this one enables an irreversible Firestore wipe that is currently blocked. I've verified it end-to-end, but I'm not merging that class of change autonomously. The blast radius is only users who already requested deletion — this does not change who gets wiped, only whether the recordings step can veto the wipe.

⚠️ Config gap left open (deploy config — not mine to land)

BUCKET_MEMORIES_RECORDINGS is still missing from the Helm values. Consequences:

  • Conversation recordings are not purged on account deletion. One legacy uid still has objects in gs://memories-recordings — if they delete their account, this fix skips their .wav files. (None of the 6 currently-stuck uids have objects there, so nothing is left behind for them.)
  • The recordings feature is inert deployment-wide: upload_conversation_recording (consent-gated on store_recording_permission) and the has_recording endpoint both hit the same unset name.

Wiring the env var into the charts restores the purge and the feature. I left it alone because it's deploy config.

🤖 automated by hourly watchdog; opened for review, not merged.

Review in cubic

…t deletion

BUCKET_MEMORIES_RECORDINGS was never wired into the backend charts, so
`memories_recordings_bucket` resolves to None in prod. delete_all_conversation_recordings
then calls .bucket(None), and listing raises ValueError("Cannot determine path without
bucket name").

That purge is a *required* step, so the raise aborts background_wipe_user_data before
users_db.delete_user_data(): every account-deletion request fails, is marked wipe_failed,
and is re-enqueued forever with the user's data still in Firestore. Six uids are stuck in
that loop in prod right now.

An unconfigured bucket now means "nothing to purge" — uploads resolve the same name, so a
deployment without it cannot have stored recordings. A real GCS failure still raises and
still blocks the irreversible wipe (that contract is unchanged and covered by
test_gcs_failure_blocks_firestore_wipe).

Verification (real path, live prod GCS, prod service account):
- Replaying the pre-fix body with the bucket unset and the actual stuck uid reproduces the
  prod log line byte-for-byte: ValueError: Cannot determine path without bucket name.
- With the fix, the same call returns cleanly, so the wipe proceeds to the Firestore delete.
- With the bucket configured, the purge still lists gs://memories-recordings and deletes the
  uid prefix (exercised against a uid with no blobs, so nothing was deleted).
- New regression test fails without the guard, passes with it. backend/test.sh: 564 files, 0 failures.

NOTE: the underlying config gap remains — BUCKET_MEMORIES_RECORDINGS is absent from
prod/dev Helm values and .env.template, so conversation recordings are not being purged on
account deletion (one legacy uid still has objects in gs://memories-recordings). Wiring the
env var is deploy config and is left for a maintainer.
@kodjima33
kodjima33 merged commit a523a4f into main Jul 13, 2026
23 of 26 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-account-deletion-recordings-bucket branch July 13, 2026 14:32
Git-on-my-level added a commit that referenced this pull request Jul 15, 2026
## Summary

Closes #9760.

- Makes production account deletion fail closed: a deletion intent is
durably recorded with an opaque wipe job ID before the wipe can be
dispatched, and production startup rejects inline or incomplete Cloud
Tasks configuration.
- Dispatches only the opaque job ID to the dedicated account-deletion
queue; the handler resolves the user server-side and drops unknown,
ambiguous, terminal, and unsupported legacy payloads before any
mutation.
- Adds reconciliation for persisted-but-undispatched intents, validates
the GKE/Cloud Run deployment contract, and gives deletion tasks an
account-deletion-specific OIDC audience.

## Root cause and recurrence

The deletion workflow previously relied on inline execution as a
reachable deployment mode and accepted a payload that could identify a
user directly. A crash or configuration drift between the delete request
and its side effects could therefore leave a deletion incomplete without
a durable, safely replayable dispatch contract.

This follows the same dispatch/reliability failure class addressed in
#5088, #6750, #7640, #8405, #9117, and #9632. The durable guard is now
the persisted wipe-job identity plus production-only Cloud Tasks
configuration validation, queue payload minimization, dedicated OIDC
audience verification, and reconciliation through the same dispatcher.

## Verification

- `cd backend && ENCRYPTION_SECRET=local-test-secret
BACKEND_PYTEST_WORKERS=1 bash test.sh` — passed all 603 isolated
unit-test files.
- `cd backend && PATH="/tmp/omi-predeploy-9760/bin:$PATH" bash
scripts/pre-deploy-check.sh` — passed (69 tests); validates dev/prod
runtime and deploy contracts.
- `make preflight` — passed.
- Exercised the controlled recovery path: persisted intent -> injected
enqueue crash -> reconciler dispatch -> first handler completion ->
repeat delivery no-op. This is covered by
`test_persisted_wipe_recovers_after_enqueue_crash_and_handler_runs_once`.

No live Cloud Task was dispatched because this PR does not authorize a
deployment mutation.

## Review

Sol review completed before opening. It identified an OIDC
audience-isolation issue; the fix uses
`ACCOUNT_DELETION_TASKS_OIDC_AUDIENCE` (defaulting only to the dedicated
deletion handler URL) for both task creation and verification. A second
independent Sol review after rebasing identified the deploy-order
compatibility path for queued legacy UID tasks; the resolved branch
accepts the former sync audience only for those legacy payloads and
drops job-ID payloads before resolution or mutation.
Git-on-my-level added a commit that referenced this pull request Aug 4, 2026
…ks (#11029)

## Summary

- Make the durable `account_deletions/{uid}` marker a single fail-closed
admission policy across Firebase, developer/MCP keys, OAuth issuance,
HTTP/WebSocket entry points, Agent proxy sessions, and Agent VM
provisioning. Completed and unknown markers remain fenced so an old
token cannot revive a deleted UID.
- Make deletion admission atomic at `pending`, revoke UID-bearing
API/OAuth credentials, delete the account's GCE Agent VM before its
Firestore pointer disappears, and transactionally fence late proxy/VM
writes so in-flight work cannot recreate owner data.
- Make accepted macOS cleanup durable across restart, drain owner-bound
VM/sync work before deleting storage, remove the legacy anonymous
fallback, upload a consistent SQLite snapshot with cancellable
compression and bounded retries, and preserve typed startup errors in
Flutter.

Repeated delete requests during `pending`/`running` intentionally
receive typed `403 account_deletion_in_progress` responses without
marker rollback or requeue. The deletion fence is preserved.

Canonical project: [BasedHardware Project
#15](https://github.com/orgs/BasedHardware/projects/15)

## Sanitized incident evidence

- A delete confirmation preceded a later same-provider
sign-in/onboarding sequence by nine days.
- The deleted UID's user document and GCE instance were gone, while its
durable deletion marker completed after retried queue acceleration
failures.
- No verified event proves old server memory reads after deletion. This
PR treats legacy local-database migration, still-valid old credentials,
and late owner-scoped work as identity-isolation risks; typed readiness
failures remain timeout-class evidence rather than proof of server data
disclosure.

Related lineage: #10444, #7696, #9632, #10597, #9821, #6891, #6892,
#10600, and #10694.

## Failure class

Failure-Class: none

This is an audit-driven hardening sweep across durable deletion
admission, credential revocation, local owner-data disposal, and Agent
VM/proxy lifecycle safety. The reusable prevention surfaces are the
shared fail-closed policy, transactional admission/CAS writers, the
durable local cleanup journal, the effective-owner generation fence, and
behavioral regression tests.

## Product invariants affected

- INV-AUTH-1 — preserves the exclusive effective-owner transition,
clears accepted-deletion storage before credential/session publication,
blocks every credential family after durable admission, and rejects late
owner-bound Agent VM continuations.
- INV-CHAT-1 — drains Agent VM/sync work at the existing owner
transition, transactionally fences late proxy message/session writes,
and preserves typed startup failures without changing canonical
transcript ownership.

## Changed paths

-
`.github/scripts/product_file_line_count_ratchet_baseline/backend-database.json`
-
`.github/scripts/product_file_line_count_ratchet_baseline/backend-routers.json`
-
`.github/scripts/product_file_line_count_ratchet_baseline/desktop-swift-root.json`
- `app/lib/services/agent_chat_service.dart`
- `app/test/services/agent_chat_service_test.dart`
- `backend/agent-proxy/Dockerfile`
- `backend/agent-proxy/main.py`
- `backend/database/account_deletion_projection_fence.py`
- `backend/database/mcp_oauth.py`
- `backend/database/users.py`
- `backend/dependencies.py`
- `backend/routers/apps.py`
- `backend/routers/desktop_agent_vm.py`
- `backend/routers/mcp_sse.py`
- `backend/routers/oauth.py`
- `backend/routers/transcribe.py`
- `backend/services/users/account_deletion.py`
- `backend/testing/e2e/test_account_deletion_cloud_tasks.py`
- `backend/tests/services/users/test_account_deletion.py`
- `backend/tests/unit/test_account_deletion_auth_fence.py`
- `backend/tests/unit/test_agent_proxy_async_boundaries.py`
- `backend/tests/unit/test_agent_proxy_startup_client_gone.py`
- `backend/tests/unit/test_byok_security.py`
- `backend/tests/unit/test_dependency_async_boundaries.py`
- `backend/tests/unit/test_desktop_agent_vm.py`
- `backend/tests/unit/test_mcp_api_key_auth_context.py`
- `backend/tests/unit/test_mcp_oauth.py`
- `backend/tests/unit/test_oauth_token_async_boundaries.py`
- `backend/utils/account_deletion_access.py`
- `backend/utils/other/endpoints.py`
- `desktop/macos/Desktop/Sources/AgentSyncService.swift`
- `desktop/macos/Desktop/Sources/AgentVMService.swift`
- `desktop/macos/Desktop/Sources/AuthService.swift`
- `desktop/macos/Desktop/Sources/Chat/RuntimeOwnerIdentity.swift`
- `desktop/macos/Desktop/Sources/DefaultsKey.swift`
- `desktop/macos/Desktop/Sources/DesktopAutomationBridge.swift`
-
`desktop/macos/Desktop/Sources/MainWindow/Pages/Settings/Components/SettingsContentView+SettingsUpdates.swift`
-
`desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase+AccountDeletion.swift`
- `desktop/macos/Desktop/Tests/AgentSyncBatchQueryTests.swift`
- `desktop/macos/Desktop/Tests/AgentVMLifecycleFenceTests.swift`
- `desktop/macos/Desktop/Tests/AuthSessionCoordinatorTests.swift`
- `desktop/macos/Desktop/Tests/OnboardingPersistenceClearingTests.swift`
- `desktop/macos/Desktop/Tests/RewindDatabaseLifecycleTests.swift`
-
`desktop/macos/changelog/unreleased/20260802-account-deletion-local-data.json`
- `desktop/macos/e2e/flows/logout.yaml`

## Verification

- Focused backend deletion/auth/proxy/VM suite: `194 passed`.
- Hermetic Cloud Tasks deletion suite: `5 passed`; repeated
pending/running requests are asserted as typed `403` without requeue.
- Focused macOS deletion, owner-fence, snapshot, and sync suite: `32
tests`, `0 failures`.
- Focused Flutter Agent Chat suite: `2 passed`.
- Follow-up MCP OAuth consent suite: `37 passed`.
- Follow-up macOS cleanup/bridge compile suite: `17 tests`, `0
failures`.
- Python runtime sources compile cleanly; pinned Python/Dart/Swift
formatters and `git diff --check` are clean.
- Required CI-lane PR-body preflight: `34 checks passed` in `108.01s`.

Backend Hermetic Merge Gate: in scope because backend runtime and
hermetic contract code changed.

## Limitations

- No production Firebase/Auth, Firestore, Cloud Tasks, GCE, deployment,
release, or customer-data mutation was performed.
- Same-provider recreation is covered hermetically at the UID/auth
boundary; no live Google sign-in was attempted.
- Agent readiness and teardown are covered through backend
state-machine, proxy protocol, owner-generation, snapshot/upload,
credential cleanup, and stale-pointer tests; no live GCE VM was
provisioned.

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/11029?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. -->
@undivisible undivisible added the AI label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants