Repository navigation
fix(pusher): skip durable projection for purged conversations on NotFound - #24090
Conversation
…ound A conversation deleted (user delete, merge, empty-recording cleanup) while its receipts still sit in the durable projection queue makes every pinned- generation read 404 deterministically: retries rescue nothing, the batch terminates into failed_recordings, and at the 128-entry session cap those deleted conversations can poison later healthy recordings of the same websocket session. Catch NotFound before the generic projection handler: when the conversation is tombstoned (same read as the custody write gate) or its doc no longer exists, drop the refs without a custody failure, a failed_recordings entry, or retry churn, and log the skip at info. A live conversation keeps today's transient retry/terminal paths unchanged, and a failed deletion-intent read fails open to the transient path rather than propagating out of the drain loop. The projection failure class warning now also names the innermost raising frame (co_name only, never the message or args) so the unattributed InvalidArgument minority becomes diagnosable without a redeploy.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73f3f8bd88
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| projection_retries.pop(conv_id, None) | ||
| logger.info('Durable audio projection skipped; conversation gone') | ||
| return | ||
| # Terminal for this batch: a later independent batch for the | ||
| # same conversation starts with a fresh budget instead of | ||
| # inheriting this one's exhaustion, and the entry stops | ||
| # counting toward the bounded retry map. | ||
| projection_retries.pop(conv_id, None) | ||
| await record_barrier.fail_recording(conv_id) | ||
| record_failure('projection', reason='transient') | ||
| record_fallback( | ||
| component='pusher', | ||
| from_mode='private_cloud_sync', | ||
| to_mode='raw_audio', | ||
| reason='other', | ||
| outcome='degraded', | ||
| log=logger, | ||
| ) | ||
| logger.warning('Durable audio projection deferred after retries; archive receipt retained') | ||
| await _transient_projection_failure(exc, conv_id, refs) |
There was a problem hiding this comment.
Document the gone-owner projection behavior in the pipeline guide
This introduces a new durable-audio outcome: a NotFound for a tombstoned or missing conversation drops projection references without retries or a recording-failure marker. However, the commit updates only the router and tests, leaving backend/docs/listen_pusher_pipeline.mdx unchanged. backend/AGENTS.md explicitly requires that guide to be updated in the same PR for audio, conversation-lifecycle, or pusher WebSocket changes. Document the gone-owner exception and the retained transient behavior for live conversations so the pipeline contract reflects this change.
AGENTS.md reference: backend/AGENTS.md:L163-L163
Useful? React with 👍 / 👎.
Pusher durable projection: gone-owner no-op on NotFound + raising-frame attribution
Failure-Class: none
Line-Count-Exception: backend/routers/pusher.py | 1542 -> 1611 | NotFound gone-owner arm (deletion-intent read + drop without custody failure) and raising-frame attribution per lead ruling 2026-10-30 06:00Z
No existing failure class covers the pusher durable-projection surface; this
change stops a permanent gone-owner condition from being classified as a
transient projection failure (deterministic retry churn plus
failed_recordingspoisoning at the 128-entry session cap). Adding a newclass definition would require
.github/changes, which are out of scopefor this PR.
What
flush_refsnow catchesNotFoundbefore the generic projection handler.If the conversation is tombstoned (
conversation_tombstones.is_deleted,the same read the custody write gate uses) or its conversation doc no
longer exists, the purged refs drop as a gone-owner no-op: no
record_barrier.fail_recording, nofailed_recordingsentry, norecord_failure/record_fallback, no retry churn — one info lineDurable audio projection skipped; conversation gone.unchanged (NotFound on live audio is never hidden as a gone owner). The
extra deletion-intent read runs only on the NotFound arm; if that read
itself fails, the arm fails open to the transient path instead of
propagating out of the drain loop.
Durable audio projection failure class: %snow alsonames the innermost raising frame (walking
exc.__traceback__to the lastframe,
co_nameonly — never the message or args), so the unattributedInvalidArgument minority becomes diagnosable from logs without a redeploy.
Why
Read-only verdict (2026-10-30, swarm/state/refs/projfail-verdict-2026-10-30.md):
the dominant NotFound stream (~1,000 class lines/10m, ~460 conversations/h)
is
read_pcmhitting objects purged by sanctioned conversation deletion(user delete, merge, empty-recording cleanup) while the receipts still sit
in the pusher durable queue. Retries are deterministic (requeue:terminal
ratio 2.0 — retries rescue nothing), and every terminal conversation enters
failed_recordings, where the 128-entry session cap flipsrecord_upload_failed=Truesession-globally and can fail-mark later healthyconversations of the same websocket session. Chronic since #23641; made
visible by #24084's class logging. No rollback indicated (attributed in the
verdict); this PR removes the churn and the poisoning path.
Tests
backend/tests/unit/test_audio_durable_outbox.py:test_notfound_on_tombstoned_conversation_drops_refs_without_custody_failure— purged read + tombstone: refs dropped on the first NotFound (no
requeue), zero custody failures, zero
fail_recording(observed viamark_record_upload_failed), receipts still acked and readable.test_notfound_on_hard_deleted_conversation_doc_drops_refs— tombstonefalse + missing conversation doc: same gone-owner no-op.
test_notfound_on_live_conversation_keeps_transient_retry_and_terminal_paths— live conversation: exactly
1 + PROJECTION_RETRY_BUDGETattempts, theterminal
('projection', 'transient')drop, record close withheld, andthe class line attributes
NotFound raised by purged_readwith theexception message never logged.
format and a message-leak assertion.
Local verification (layer: backend unit suite, selected by the CI
changed-file selector for this diff — 34 files, all green):