Repository navigation
fix(batch): project source-reuse rows a pre-reuse merger committed unmarked - #25597
Conversation
…marked Intake stamps protocol_version=2 and source_reuse_version=1 on source-key jobs. The GPU pump's ordered merger, when built before source reuse, copies only protocol_version onto the result row. The projector refused that row as an immutable binding mismatch, and since the owner chain is ordered, every later result for the owner (including server-batch recordings) stayed unprojected: conversations completed with an empty transcript. Admit a protocol-2 row with no marker field when the immutable job carries the marker and the source key. A present but wrong marker is still refused. Failure-Class: none Co-Authored-By: Claude Fable 5.2 <[email protected]>
Codex Review Summary: ✅ CompletedThis 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: 151237c9fe
ℹ️ 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".
| return ( | ||
| 'source_reuse_version' not in entry | ||
| and 'source_alias_version' not in entry | ||
| and (job.get('source_reuse_version') == 1 or job.get('source_alias_version') == 1) |
There was a problem hiding this comment.
Instrument admission through the legacy-marker fallback
When a pre-reuse merger produces an unmarked protocol-2 row, this new branch admits it using the job marker without emitting fallback telemetry. Consequently, projection can recover while operators have no shared fallback signal that an outdated GPU pump is still producing incompatible rows. Emit utils.observability.fallback.record_fallback when this compatibility path is taken, preferably at the transaction/composition boundary rather than inside the predicate. This is required by the new-fallback rule in backend/AGENTS.md.
AGENTS.md reference: backend/AGENTS.md:L322-L322
Useful? React with 👍 / 👎.
| The ordered merger also runs in the GPU pump (`batch-pipeline-worker`, its own | ||
| deploy). A pump image older than source reuse copies `protocol_version=2` onto | ||
| the result row without the marker. The projector admits such a row on the |
There was a problem hiding this comment.
Add the required transcription pipeline change note
This changes transcription projection admission and how an owner's blocked conversation chain recovers, but the commit adds no note under backend/docs/listen_pusher_pipeline/changes/; its documentation change is confined to the source-reuse runbook. backend/AGENTS.md explicitly requires a same-change pipeline note for transcription and conversation-lifecycle changes. Add a dated note describing the compatibility admission, separate GPU-worker rollout requirement, and verification evidence, linking to the runbook as appropriate.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
… cover canonical sync rows Panel review-20261117t105741-c92b: a valid marker no longer launders an unsupported one; inherited admissions emit omi_fallback_total so the GPU worker roll is measurable; session-level coverage for the canonical sync flavor and a realistic pre-marker refusal case; runbook removal criterion. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79dabe8517
ℹ️ 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".
| return bool(values) and all(value == 1 for value in values) | ||
| inherited = any(job.get(field) == 1 for field in _SOURCE_MARKERS) | ||
| if inherited: | ||
| from utils.observability.fallback import record_fallback |
There was a problem hiding this comment.
Move the fallback helper import to module scope
The compatibility branch introduces a function-local production import, contrary to the explicit rule in backend/AGENTS.md that all imports must be at module scope and never inside functions. Move record_fallback into the module's import section so this newly added dependency follows the repository's import convention.
AGENTS.md reference: backend/AGENTS.md:L166-L168
Useful? React with 👍 / 👎.
… the summary is owed (#25611) ## Problem Since 2026-11-16 22:17Z, about half of new recordings show on Home as a row titled "Discussion notes" with no summary and the default emoji. They never change. Two defects overlap in that window. This PR fixes the second one. The first is already fixed on main and is waiting on a deploy. 1. **Transcripts stopped landing (not this PR).** #25479 shipped on Cloud Run at 18:11–18:52Z on 11-16 while the GPU worker stayed on an older image, so source-reuse results were committed without their marker and the projector refused them. Projection is ordered per owner, so every later recording for that owner waits behind the refused result. #25597 fixes this; it merged at 11:38Z on 11-17 and is not serving yet (all four Cloud Run services report release `0ce3965`). 2. **A capture with no notes gets the fallback title (this PR).** #25462 added the deterministic label "Discussion notes" for generated notes whose headline is unusable. `_quality_processing_notes` applied it to every conversation write that carries a `structured` map, including the in-progress stub a listen socket creates and the raw completion of a batch capture. Neither has notes. What the stamped title does to a batch capture: - **Home shows a finished row.** `transcribing_hold.applies` and `home_step.classify` read any non-empty title as "has notes". The row leaves the bounded "Transcribing…" presentation and shows "Discussion notes" with no expiry. - **The first-summary obligation is not registered.** `stamp_projection_debt` skips a row that already has a title, so the row gets no `summary_due_at`. The repair sweep never sees it; it depends on one enrichment attempt. - **A stamped zero-content stub is no longer classified as noise** by the expired empty-capture rule. ## Evidence (prod, read-only tier, aggregates only, 2026-11-17 14:50–15:21Z) Completed `batch_live_v1` rows, 12,656 sampled across 11-16 12:00Z → 11-17 14:50Z: | Rows carrying the fallback title (n=3,756) | value | | --- | --- | | `title_change_reason = initial_title` | 100% | | title stamped minus row created (p10 / p50 / p90) | 0.0 s / 0.0 s / 0.1 s | | title stamped minus recording finished (p50) | 126 s **before** the finish | | `content_word_units = 0` when stamped | 99.6% | | notes run recorded (`notes_written_at`, notes input hash) | 0% | | `summary_first_pending_at` / `summary_due_at` | 0.0% / 0.1% | | first row stamped | 11-16 22Z hour (the listen roll to `235baea` finished 22:17Z) | The title is written at creation, on a row with no speech, before any model call. The model is not returning a placeholder. Rows created through the idempotent create path skip this writer and stay untitled, which is why the same feed mixes "Discussion notes" rows with untitled or "Transcribing…" rows. Replayed on unmodified `f47914db885`: a stub written through `upsert_conversation_with_lifecycle` commits `title='Discussion notes'`, `title_change_reason='initial_title'`; `replace_record` then stamps no debt; `home_step.classify` returns `ready`. For the transcript stall, on the same sample: `record_audio_closed` is true on ≈100% of rows throughout, while rows with a landed transcript fall from 82–88% (finished 11-16 14–18Z) to 51% (19Z), 16% (22Z) and 6–20% since. `summary_first_pending_at` tracks that within 1 point every hour. Of 60 owners with a stuck row, 49 had a chain head that was `pending`, `protocol_version=2`, with no source marker and committed a median 15.4 h earlier; the median owner had 563 results pending behind it. ## Changes On by default. No new flag, Firestore read, provider call or stored-data rewrite. - **Write.** `_quality_processing_notes` leaves the title empty when `home_titles.notes_pending` holds (no usable title, overview, gist, section body, task or event) and there is no user title or stored valid title. A stored stand-in title is kept and a stored placeholder is cleared. Generated notes with an unusable headline still get the fallback label. - **Admission.** `stamp_projection_debt` treats a placeholder as untitled. Rows stamped before this change are enrolled when their transcript lands. - **Read.** `transcribing_hold.applies`, the `processing` branch of `home_step.classify`, `empty_capture.applies` and `legacy_empty_wire.project` treat a placeholder as untitled. `home_titles.placeholder_title_wire`, applied at the same API exits as the transcribing hold, serves a row that carries only the fallback label as untitled. It matches the two labels `title_or_fallback` produces and nothing else, and never changes a user title or a row with notes. - **Home feed.** `GET /v1/home/feed` serves a title sealed at write time, so the list-wire rule does not reach it. `database/home_feed.py` now applies `home_titles.display_title` to conversation cards: a bare fallback label with no preview is served as untitled. Rows already stamped are healed on read. `utils/summary_quality.py` is byte-identical to main, so the notes prompt fingerprint and its reuse checkpoints are unchanged. ## Not in this PR - Deploying #25597 and rolling the GPU worker. Both are required before transcripts and summaries land again. - A bound and alert for a permanently blocked projection head (also called out by #25597). - A backfill for rows stamped in the window whose transcript lands before this PR serves and whose enrichment attempt fails. They keep a transcript with no registered obligation. The verification query below counts them; if the count is not zero, a follow-up enrols them. - `process_conversation` recovery's `stored_content_is_replaceable` still reads a placeholder as a title. ## Serving and rollback Serves from `backend-listen` (stub writes), `backend` (list and detail reads) and `backend-integration` (projection). Each part is independent, so the services can roll in any order. Rollback is a revert; no stored state depends on the change. Deploy this before or with #25597 if possible. The projector then registers the obligation for stamped rows as the backlog drains. ## Verification after deploy (read-only) 1. **New rows are no longer stamped.** Completed `batch_live_v1` rows created after the listen roll, stored `structured.title` matching `^discussion (notes|\d+)$` with `summary_output_present != true`: 37–64% per finished hour now → **0%**. 2. `sum(increase(omi_fallback_total{component="conversation_notes",to_mode="deterministic_title"}[1h]))`: about 15,800/h now. It should fall by more than 90%, to the rate of generated notes with an unusable headline. 3. **Stamped rows are enrolled.** Rows created 11-16 22:17Z → deploy that carry the fallback title and a `record_projection_revision` set after the integration roll: `summary_due_at` or `summary_completed_at` present on 100%. 4. **Residue.** Rows with the fallback title, a `record_projection_revision`, no `summary_due_at`, no `summary_completed_at`, no `summary_blocked_reason` and `summary_output_present != true`. For projections that land after the integration roll: 0. For projections that landed before it (6 in the last pre-deploy sample): the count must only fall; what remains is the backfill population above. 5. **End to end, after #25597 and the worker roll.** Share of rows finished more than 15 minutes ago with `summary_output_present = true`: 5–12% now → back to the 57–63% of 11-16 14–18Z. ## Tests `backend/tests/unit/test_notes_pending_title.py`, 43 cases (plus one pin in `test_summary_quality.py` so a new fallback label fails beside the policy that emits it): stub create and raw completion stay untitled; a stored placeholder is cleared; a stored stand-in, user title or earlier generated title is kept; generated notes with an empty headline still get the fallback; the projection enrols a placeholder-only row and leaves titled or summarised rows alone; Home classifies a stamped capture as transcribing with the bounded wait; the wire rule and its non-matches; a stamped expired empty capture is noise; a pending write is sanitized like generated notes and records no title fallback; the Home card title rule. Focused regression at `fd3ee68a9c7` (before the review fixes; the review-fix commit re-ran the 5 directly affected files, 154 passed): the 91 test files that reference the touched modules, one pytest process per file, cloud credentials unset. 89 files pass. `test_chat_edits_firestore.py` is skip-only (it needs the emulator). `test_empty_capture_recovery.py` has 7 failures, all `RuntimeError: Opus support requires opuslib and the native libopus library` on the development host; CI has the library. `test_llm_input_prompt_version.py` passes: the notes prompt fingerprint is unchanged. Also run: `scripts/pr-preflight` (39 checks), runtime-image contracts (19 images), the conversation lifecycle write guard, import-time purity, async blockers and the dead-code ratchet. No production writes, deploys or flag changes were made. No app UI change. ## Product invariants affected none ## Failure class (fixes) Failure-Class: FC-provisional-home-content-published-as-final The admission half also reopens the contract of `FC-content-write-omits-implied-obligation`: the projection landed content without recording the obligation, this time because a placeholder satisfied the "already titled" check. Line-Count-Exception: backend/database/conversations.py | 5225 -> 5245 | The pending-notes rule belongs in the one transaction that decides the stored title, beside the user-title and stability rules it must not override. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Problem
Since 2026-11-16 ~19:00Z, sync (offline-upload) users stopped getting transcripts. Their conversations finish with an empty transcript, the "Discussion notes" placeholder title and no notes.
67ac7b04629,BATCH_SOURCE_REUSE_ENABLEDdefault on) shipped with Cloud Run deploys5097caaand235baea(18:41–19:16Z).Sync intake now stamps
protocol_version=2, source_reuse_version=1on every job with asource_reuse_key.commit_source=gpu_pump). That worker deploys separately and is still onef42ee8(image digest
sha256:ffbcd66a…), which is older than fix(sync): reuse exact source files across upload bundles #25479. Atef42ee8,merge.pycopiesprotocol_versiononto the result row,but not
source_reuse_version/source_alias_version.ProjectionSessionrefuses a protocol-2 row without the marker withProjectionBlocked('immutable result binding mismatch').A blocked head has no retry bound and no terminal disposition, and projection is strictly ordered per owner, so every later result for that
owner waits behind it, live captures included. Merge holds then park new results in
result_ready.Prod evidence (ro-prod, 2026-11-17),
stop=blocked_immutable_result_binding_mismatchowner-drain log lines on backend-integration, per 3 minutes:As of 10:31Z: about 888 owners blocked, about 14.8k unmarked rows, and about 463k results pending projection.
Fix
source_reader_marked(entry, job)inbatch_pipeline_projection_protocol.py, used by the binding gate inbatch_pipeline_projection_session.py.A protocol-2 row with neither marker field is admitted when the immutable job carries
source_reuse_version == 1orsource_alias_version == 1and asource_reuse_key. A marker that is present but wrong is still refused, and so is a row without a reuse key.There's no flag. Once backend-integration serves this, the existing owner drain retries the blocked heads and the held results merge and project.
No data repair is needed.
Not in this PR
Tests
backend/tests/unit/test_batch_pipeline_source_reader_marker.pyhas 12 cases, including the session-level production error without the fix.231 passed across it plus
test_batch_pipeline_source_reuse.py,test_batch_pipeline_projection.py,test_batch_pipeline_sweep_owner_chain.pyandtest_batch_pipeline_quarantine.py.Failure-Class: FC-rollout-flag-absent-from-a-cohost-of-its-code-path
🤖 Generated with Claude Code