Skip to content

SCA-3508: Retire jobs bound to erased staged audio - #26850

Merged
Git-on-my-level merged 6 commits into
mainfrom
agent/multica-worker-1-codex-sol/dfa7b6f2d46f
Dec 1, 2026
Merged

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

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Fence the recording-policy sweep's exact staged-audio reservation before deleting the object. This also prevents late admission when staging exists before a job does.
  • Retire the matching job under the same authority transaction, unlink ready work, clear lease authority and remove it from the pending merge set. The terminal privacy disposition survives consent restoration and retains the original enqueue identity for deduplication.
  • Compare object paths and pinned generations before retiring a job. Different replacement inputs and already produced results retain their existing disposition.

Verification

The loopback Firestore regression covers queued and leased inputs with consent denied and restored, late intake, stale result publication, replay of the original identity, and preservation of sibling work and replacement audio. The existing SCA-3508 worker fixture covers both account-writer modes and the local recovery sinks.

Worker retest at 69a67cc8c4: 62 focused tests passed, including the previous reproducer and PostgreSQL mirror recovery. An earlier combined run hit emulator transaction lock timeouts. The final focused run followed the sweep's persisted retry schedule. The separate 53-delete timing test passed in isolation on the base and patched source after an earlier combined run exceeded its timing threshold.

The fix adds bounded work only during recording-policy erasure. It adds no queries to scheduler pull, lease renewal or ordinary input admission. Release owns installed-SDK evidence and the controlled retest of the exact candidate image.

Product invariants affected

none

Failure class

Failure-Class: FC-ingest-recreates-retired-identity

Line-Count-Exception: backend/utils/batch_pipeline/intake.py | 1617 -> 1619 | The existing authenticated status read recognizes the durable erasure disposition before polling can redrive it.

Git-on-my-level and others added 2 commits December 1, 2026 02:12
Failure-Class: FC-ingest-recreates-retired-identity
Co-authored-by: multica-agent <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review December 1, 2026 02:22

@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.

2 issues found across 6 files

Confidence score: 3/5

  • backend/database/batch_pipeline_purge.py can leave workers seeing a retired job as queued or leased in shadow/index mode until the owner purge runs. Keep the PostgreSQL shadow in sync with the Firestore retirement update.
  • 2026-11-24-batch-privacy-window.md documents the ordering and idempotency guarantees only in the dated change note, leaving the canonical pipeline contract incomplete. Add the staged-audio retirement and admission-fence contract to the canonical docs.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/docs/listen_pusher_pipeline/changes/2026-11-24-batch-privacy-window.md">

<violation number="1" location="backend/docs/listen_pusher_pipeline/changes/2026-11-24-batch-privacy-window.md:38">
P2: These new ordering and idempotency guarantees are documented only in the dated change note, so the canonical pipeline contract remains incomplete. Add the staged-audio retirement/admission-fence contract to `backend/docs/listen_pusher_pipeline.mdx` and link it from this note.</violation>
</file>

<file name="backend/database/batch_pipeline_purge.py">

<violation number="1" location="backend/database/batch_pipeline_purge.py:176">
P2: This retirement path updates Firestore scheduler state without refreshing the PostgreSQL shadow. In shadow/index mode, a worker can continue seeing the old queued or leased job until the later owner purge; propagate the changed job and scheduler documents to `mirror_refresh` after the transaction commits.</violation>
</file>

Reply with feedback, questions, or to request a fix.

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

under its current revision, and durably redrives Postgres mirror reconciliation.
Receipts issued after the event survive. Existing obligations continue when
either authorization lever is off.
For a recording-policy erasure, the same fence retires a queued or in-flight

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: These new ordering and idempotency guarantees are documented only in the dated change note, so the canonical pipeline contract remains incomplete. Add the staged-audio retirement/admission-fence contract to backend/docs/listen_pusher_pipeline.mdx and link it from this note.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/listen_pusher_pipeline/changes/2026-11-24-batch-privacy-window.md, line 38:

<comment>These new ordering and idempotency guarantees are documented only in the dated change note, so the canonical pipeline contract remains incomplete. Add the staged-audio retirement/admission-fence contract to `backend/docs/listen_pusher_pipeline.mdx` and link it from this note.</comment>

<file context>
@@ -35,8 +35,15 @@ artifact receipts in the affected scope. A completed account must still have its
 under its current revision, and durably redrives Postgres mirror reconciliation.
-Receipts issued after the event survive. Existing obligations continue when
-either authorization lever is off.
+For a recording-policy erasure, the same fence retires a queued or in-flight
+job that still names the exact staged audio before the storage delete. It
+unlinks ready work, revokes its lease and preserves the job's terminal privacy
</file context>

return

if job['state'] in {'ready', ALLOWANCE_HELD}:
_detach_job(client, namespace, segment_id, job, transaction)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This retirement path updates Firestore scheduler state without refreshing the PostgreSQL shadow. In shadow/index mode, a worker can continue seeing the old queued or leased job until the later owner purge; propagate the changed job and scheduler documents to mirror_refresh after the transaction commits.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/database/batch_pipeline_purge.py, line 176:

<comment>This retirement path updates Firestore scheduler state without refreshing the PostgreSQL shadow. In shadow/index mode, a worker can continue seeing the old queued or leased job until the later owner purge; propagate the changed job and scheduler documents to `mirror_refresh` after the transaction commits.</comment>

<file context>
@@ -135,6 +143,51 @@ def remove(transaction):
+            return
+
+    if job['state'] in {'ready', ALLOWANCE_HELD}:
+        _detach_job(client, namespace, segment_id, job, transaction)
+    transaction.update(
+        job_ref,
</file context>

Git-on-my-level added a commit that referenced this pull request Dec 1, 2026
## What changed and why

Raise the existing Backend emulator proofs job ceiling from 20 to 25
minutes and pin the same value in the nightly workflow contract. Log
elapsed seconds for each completed proof invocation, including failures,
to inform a later split. The check name, triggers, runner, step
timeouts, proof commands and assertions are preserved.

On #26850 at `f2fe8b68`, the proof step ran for 18m57s before the
20-minute job ceiling cut it off. By GitHub log timestamps, 38
invocations completed. The longest were privacy cache replay (350s), v3
locked-closure allowance (190s), and conversation purge (123s).
Cancellation occurred during pull batch parity, which had started about
16 seconds earlier. [Cancelled
job](https://github.com/BasedHardware/omi/actions/runs/46582195771/job/142419256104)
· [SCA-3508 timing
handoff](https://multica.ai/issues/SCA-3508#comment-01a2303a-4618-70a7-a982-ee473c77e5a3)

## Product invariants affected

none

## How it was verified

- `actionlint .github/workflows/backend-emulator-proofs.yml` and `bash
-n backend/scripts/run-emulator-proofs.sh` passed. ShellCheck passed
with the existing SC2164 warning on the directory change excluded.
- A stubbed harness replay compared all 48 invocations with the base,
including arguments and order. It verified one timing line per
invocation and preserved results and exit status in both all-pass and
injected-failure cases.
- The nightly workflow contract pins the 25-minute budget. Hosted
emulator verification runs through the ordinary PR check.

## Tests

The existing nightly workflow contract covers the changed ceiling. The
test selectors and assertions in the emulator suite are preserved.

## UI evidence

UI-Evidence: none -- CI only


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26882?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/26882?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26882&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. -->
@Git-on-my-level
Git-on-my-level merged commit 8d09f6f into main Dec 1, 2026
70 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/multica-worker-1-codex-sol/dfa7b6f2d46f branch December 1, 2026 08:58
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