Skip to content

fix(home): show a held sync piece as Processing on legacy Home - #25723

Merged
kodjima33 merged 2 commits into
mainfrom
fix/home-held-sync-piece-processing
Nov 18, 2026
Merged

kodjima33 merged 2 commits into
mainfrom
fix/home-held-sync-piece-processing

Conversation

@kodjima33

@kodjima33 kodjima33 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Prod, 2026-11-18. A batch-only live capture stayed in_progress for over 30 minutes because speech never paused for 120 s. Its phone-WAL sync piece already had speech and a server-minimum title. Its notes were held: sync_processing_hold.held=True, and sync_bridge_pending named the open live row.

is_settling_fragment hides every completed server-minimum row until two hours after finished_at. A growing piece keeps moving finished_at, so on the legacy Home list the piece stays hidden for as long as the capture lasts. The live row is not listed either, so legacy Home (App Store 1.0.592 and older, Android) shows neither row.

Scope: legacy Home only. v3 owners (conversations_v3_enabled(uid)) and v3-layer rows (recording, v3_derived) keep their current behavior.

  • fragment_visibility.held_for_notes covers a completed legacy-layer row whose quiet hold is held or whose live bridge names a target, with intake's sync_relevance='keep' and has_content.
    • keep means the deterministic rules did not classify the piece as filler. It does not prove real speech. The slim list select has no word or speech-seconds field for sync rows (full_snapshot exists only after a full run), and this module never treats duration as evidence.
    • So a TV or passer-by piece the rules could not settle can show as Processing during its hold. Then the relevance step's verdict hides it or gives it notes.
    • Discarded, rule-discarded, blocked, below-floor, merged, already-summarized (summary_output_present/summary_completed_at), recording and v3_derived rows never qualify. A standalone run leaves sync_bridge_pending in place, and only assignment pops it.
    • The wait counts from sync_processing_hold.last_content_at (falling back to finished_at) and ends at SETTLING_MAX_HOLD_SECONDS.
  • The exemption is opt-in (show_held, default off):
    • is_settling_fragment takes show_held, and is_visible_conversation and the list collectors thread it through.
    • home_step.classify/project return writing_notes for the piece only with show_held.
  • Only GET /v1/conversations sets show_held, and only for the default Home view when conversations_v3_enabled(uid) is false. That is the gate /v1/conversations/live uses to tell the app it is a v3 account.
    • Known limit: on a Redis error, capable_cached/client_seen_cached fail closed and cache False for 120 s (READ_CACHE_SECONDS/SEEN_CACHE_SECONDS). For that window a v3 owner gets show_held on.
    • /v1/conversations/live reads the same gate and returns v3:false, so the app shows legacy Home for that window too. Tested.
  • The Home list's slim select gains sync_processing_hold. sync_bridge_pending, sync_relevance and has_content were already selected. SETTLING_FIELDS and the other projections are unchanged. No new document reads.
  • Shadow telemetry: phase_shadow.compare('settling_hold') and ('home_visibility') will count held pieces on the legacy Home list as mismatches against the phase model, which still reads them as waiting.

The 10-minute sync_bridge_pending window is unchanged. get_live_conversation and lifecycle_loop are untouched.

Several pieces for one live row

All are listed. When the live row closes, the bridge merges every unprocessed piece into it (_finish_pending_live_bridge), so they end as one conversation. Released Home clients already fold every transcribing/writing_notes row of a day into one Processing row (home_rows.dart foldProcessingRuns; 1.0.593 = bc05bc952d has the same code).

Collapsing on the server would hide speech whenever the bridge rejects a piece's overlap. It would also make per-row visibility depend on neighbouring rows.

Not in this PR: notes before the live row closes

Releasing a held piece's notes before its live target closes is not duplicate-safe:

  • A processed piece is never absorbed later. _finish_pending_live_bridge returns it unchanged when already_processed and SYNC_BRIDGE_CONTAINED_DONOR_MERGE_ENABLED is off, which is prod (deploy/runtime_env/_base.yaml).
  • Even with on, a piece that only partly overlaps the target is refused.
  • Assignment keeps processed rows out as protected donors (assignment.py processed_ids/protected_donors).
  • Covered today by test_pending_bridge_preserves_an_independently_enriched_donor and test_off_refuses_contained_processed_donor_before_any_target_read.

The live row's own transcript would then make a second Home row. The smallest safe follow-up is provisional early notes: no derived effects, and a receipt already_processed ignores, so the bridge still absorbs the piece at seal.

Verification

  • tests/unit/test_home_held_sync_piece.py, 26 cases. They cover:
    • the prod row shape;
    • every other reader keeping the hold;
    • recording/v3_derived rows never qualifying;
    • filler, blocked, below-floor, rule, model and merged rows staying hidden;
    • the open bridge window, the 2-hour bound, and the offline-backlog clock;
    • a landed summary (summary_completed_at or summary_output_present) with title_provenance=server_minimum and a stale bridge target reading ready;
    • a held piece leaving Home once merged (deleted + sync_merged_into);
    • the v3-gate Redis-miss window.
  • The real GET /v1/conversations route over the listing fake, on the indexed slim projection (one piece is held by the quiet hold alone, so the projection must carry sync_processing_hold):
    • non-v3 owner: before, only the finished row; after, both held pieces as writing_notes, with the filler piece and the in_progress live row excluded;
    • ?statuses=completed is unchanged;
    • a v3 owner with an e87bfed2-shaped legacy piece bridged to a recording=True row sees only the derived row.
  • Read-only on prod metadata: the real predicate on the CEO's legacy-layer rows today. The v3-owner path (show_held=False) gives the same result as main for every row.
  • Backend unit tests: the final diff touches database/conversations.py, so the selector picks 1,823 files and CI runs them. Locally, 110 files that touch these symbols or the query registry passed (bash test.sh, exit 0).
  • The first local run caught three files: one-argument classify monkeypatches, the query-shape registry needing show_held classified, and a strict-fake projection. Fixes:
    • project passes show_held only when it is set;
    • show_held is registered as post-read only;
    • only the Home list select gains sync_processing_hold, not the shared SETTLING_FIELDS;
    • the _collect_cursor_conversation_page digest is re-pinned (pass-through kwarg, same query).
  • backend/scripts/typecheck.sh: 0 errors with NODE_OPTIONS=--max-old-space-size=8192. The pre-push copy hits the Node heap limit (exit 241) while running beside the other gates, so the push skipped it. CI runs it.
  • Not exercised against a live server.

Deploy: API backend. Rollback: revert this PR.

Line-Count-Exception: backend/database/conversations.py | 5245 -> 5257 | show_held threaded beside capture_only through the existing list collectors
Line-Count-Exception: backend/routers/conversations.py | 2902 -> 2909 | default-Home and v3-owner gate for show_held in the existing list route

Product invariants affected

none

Failure-Class: FC-provisional-home-content-published-as-final

🤖 Generated with Claude Code

A batch-only live capture can stay open for a long time when speech never
pauses. Its phone-WAL sync piece already has speech and a server-minimum
title, and its notes wait on the quiet hold or the live bridge. The
settling hold hid every completed server-minimum row until two hours after
finished_at. A growing piece moves finished_at forward, so legacy Home
showed neither the piece nor the live row.

On the default legacy Home list, for an owner who is not a v3 owner, a kept
legacy-layer piece with content whose hold is held, or whose bridge names a
live target, now lists as writing_notes. Every other reader, filtered
views, v3 owners and recording/v3_derived rows keep the previous behavior.
Filler, discarded, blocked, below-floor and merged pieces stay hidden. The
wait counts from the last content arrival and ends at the settling bound.

Failure-Class: FC-provisional-home-content-published-as-final
…iting notes

A standalone run leaves sync_bridge_pending in place, so a piece whose
summary already landed could still match held_for_notes and flip from
ready to writing_notes for up to two hours. Summary receipts now
disqualify it. Tests cover that case, a held piece leaving Home once
merged, and the v3-gate Redis-miss window.

Failure-Class: FC-provisional-home-content-published-as-final
@kodjima33
kodjima33 merged commit ffa1426 into main Nov 18, 2026
68 checks passed
@kodjima33
kodjima33 deleted the fix/home-held-sync-piece-processing branch November 18, 2026 21:12
Git-on-my-level added a commit that referenced this pull request Nov 18, 2026
Failure-Class: FC-raw-page-limit-before-visibility-filter

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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