Skip to content

fix(episodes): synced fragments join the live episode and fold under its Home row - #23418

Merged
Git-on-my-level merged 24 commits into
mainfrom
fix/episode-fold-fragments
Oct 24, 2026
Merged

Git-on-my-level merged 24 commits into
mainfrom
fix/episode-fold-fragments

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

While an episode is live, Home should show one live episode row with every conversation fragment folded under it (backend/utils/episodes/ARCHITECTURE.md: "live splits, short fragments and parallel captures hide under one row"). Two gaps broke that (RCA, David's account 2026-10-23: a live episode had 1 member while ≥10 offline-sync conversations overlapped its span):

Backend — synced conversations never join episodes. The episodes finalize hook ran only for capture_end, client_finalize and server_recovery (RECONCILE_TRIGGERS), and the sync lane — which finalizes every WAL conversation with SYNC_UPDATE on its own path — never called the hook at all. So offline-sync conversations could never become episode members: nothing to fold under the live row, ever.

  • The sync lane now schedules the same after-finalization hook every other finalize path uses (utils/episodes/finalize.schedule_after_finalization, ProcessingTrigger.SYNC_UPDATE), off the sync lane and fail-open — mirrored in both reprocess bodies (utils/sync/pipeline.py and utils/enrichment/callback.py, kept identical by the parity tripwire).
  • SYNC_UPDATE joins RECONCILE_TRIGGERS, and on_conversation_finalized gains a sync attach path: a never-attached sync conversation joins the live episode that covers its time span under the same boundary rules as everything else (_attach_synced, continue/parallel decisions only). It joins as a parallel capture — a member (so Home folds it) whose text the live stream already fed, so no moment and no reconcile; a WAL transcript is a second capture of speech the notes already have, and per-conversation applied offsets dedupe nothing across conversations.
  • Guards respected: a sync conversation never closes the live episode (_finalize_closes is false for sync_update — a WAL row's finalize is when offline sync processed it, not when its speech ended), never opens an episode when nothing is live, never reopens a closed one (only the current live episode is consulted), never joins when older than the episode's own start or when the boundary decision is ambiguous, and a discarded conversation never joins. _closed_owner semantics for already-attached conversations are unchanged (a WAL append to an attached conversation lands its tail on its own episode, opening nothing).

App — completed members still showed as separate Home rows. hiddenLiveConversations folded only members that were still in progress ("Finished rows, including highlights, become available without waiting for the episode to close"), so even with correct attachment a completed 14-minute member kept its own row. In the default Home view, every member of the currently live episode now folds under the live row — finished rows and highlights included; they stay reachable inside the live episode page (Moments, members). Non-members are untouched, ProcessingConversationRow (#23371) still shows under the live row, and once the episode closes its members return as ordinary rows exactly as before. The behavior no longer depends on the clients_refactor cohort.

Product invariants affected

None — no locked invariant's path globs cover these changes (episodes overlay, sync reprocess bodies, Home visibility filter). INV-TASK-2 was checked: provisional items keep their reconcile path; sync-attached conversations simply never mint provisional items (no text feed), so capture still proposes nothing new.

Failure-Class: new

Line-Count-Exception: backend/utils/sync/pipeline.py | 3690 -> 3696 | one mirrored call (sync lane schedules the shared episode finalize hook) plus its import; the body must stay byte-identical to utils/enrichment/callback.py per the parity tripwire, so extracting it is not available to this change

New class FC-finalize-hook-allowlist-omits-ingestion-path (.github/failure-classes/): a post-finalization hook a user-visible surface depends on must run for every finalize path that can produce the row it consumes; a hand-restated trigger allowlist silently drops ingestion lanes the list never named. Guard artifacts: the backend sync-attach test block and the Home-fold widget tests named in the definition.

Testing

Backend (hermetic, nice -n 10 + BACKEND_UNIT_TEST_FILE_LIST bash backend/test.sh):

  • tests/unit/test_episodes_service.py — 35 passed (5 new: sync-finalized conversation joins the covering live episode and feeds no text; never reopens a closed episode; discarded never joins; ambiguous-gap and older-than-episode rows stay ordinary; no live episode → nothing created, while capture_end still opens one).
  • tests/unit/test_sync_v2.py — 182 passed (harness extended with the sanctioned install_package_submodule_stubs pattern for the new module-scope episodes import; verified these pass on a clean tree too).
  • Plus the affected surface in one sweep — test_enrichment_callback_parity.py (9), test_enrichment_callback_fence.py, test_enrichment_route.py, test_sync_enrichment_custody.py, test_sync_reprocess_coalesce.py, test_silent_batch_redrive.py, test_rule_discard_visibility.py, test_episodes_finalize_paths.py, test_episodes_finalizer_hook.py, test_episodes_router.py, test_episodes_client_gate.py, test_owner_recognition_telemetry.py, test_mobile_client_journeys.py, test_free_tier_entrypoint_matrix.py — 709 tests, all passing.

Flutter (hermetic widget tests, flutter test):

  • test/widgets/l5_home_visibility_test.dart — 4 passed, rewritten for the new contract: every live-episode member hides whatever its status (both clients_refactor cohorts), non-members and processing rows still show, completing a member does not lift it out, and a closed episode returns members as ordinary rows.
  • Related surfaces (day_conversations_page, b1/c3 spine, episode_provider, episodes_ui, home_empty, semantics_baseline, c3_production_wiring, home_after_detail_perf) — 68 passed. flutter analyze on changed files: no issues.

UI evidence: .agent-artifacts/ui-evidence/episode-fold-fragments/001-mobile-ios-home-shadow.png and .agent-artifacts/ui-evidence/episode-fold-fragments/002-mobile-ios-home-serve.png (Home with a live episode: live row + processing member + non-member only, in both cohorts).

make preflight (42 checks) and scripts/pr-preflight pass.

Deployment

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Offline-sync (WAL) conversations finalize with SYNC_UPDATE on the sync
lane, which never ran the episodes finalize hook, so they could never
become episode members; and Home folded only still-in-progress members,
so completed members stayed separate rows. The sync lane now schedules
the shared after-finalization hook, a never-attached sync conversation
joins the live episode covering its span as a parallel capture (never
closing, opening or reopening an episode; discarded rows never join),
and Home folds every live-episode member under its row until the
episode closes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a3ace64d6

ℹ️ 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".

Comment on lines +754 to +755
expected_episode_id=str(episode['id']),
expected_version=episode.get('state_version'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Retry sync attachment after CAS conflicts

When this hook races with a live moment or another sync attachment, either can advance the episode's state_version after it is read, causing commit_moment to raise EpisodeConflict. Unlike attach_conversation and record_moment, _attach_synced has no bounded retry; on_conversation_finalized converts the conflict to error, and the fire-and-forget caller ignores the result. If this is the final WAL append, the conversation is never linked and remains a separate Home row indefinitely. Please retry the read/decision/commit sequence on conflicts and cover this contention path with the prescribed Firestore emulator test.

AGENTS.md reference: backend/AGENTS.md:L226-L226

Useful? React with 👍 / 👎.

/// all fold under the one live row, reachable inside the live episode page
/// (Moments, members). When the episode closes, the members return as ordinary
/// rows beside it — nothing here hides them then.
Set<String> hiddenLiveConversations(Set<String> episodeIds) => episodeIds;

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 Badge Preserve episode members in filtered conversation views

When a search, folder, starred filter, or selection mode is active while an episode is live, conversations_page.dart still applies this returned set before building the filtered rows. Consequently a completed member that matched the query disappears from the results, even though the page explicitly treats filtered views as showing what they matched. This regression affects the former serving cohort because completed members were previously excluded from the hidden set; gate the folding to the default Home view rather than hiding every member in all list modes.

Useful? React with 👍 / 👎.

Comment on lines +782 to +784
if episode is None and trigger == SYNC_UPDATE:
return _attach_synced(uid, conversation_id, row, c)
if segments and not absorbed_from and trigger != SYNC_UPDATE:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Feed non-duplicate WAL speech into the episode

When a safety-WAL append contains speech that realtime capture missed, this blanket SYNC_UPDATE exclusion prevents that recovered text from ever reaching the episode. The sync assignment path explicitly retains genuinely new survivor speech (backend/utils/sync/assignment.py lines 544-547), but an unattached row returns immediately after linking and an already-linked row skips record_moment, so the conversation stores the unique text while the episode's bullets and provisional items omit it—and the app now hides that member under the episode row. Suppress only segments proven to duplicate live text, or feed the retained tail through the existing applied-offset logic.

Useful? React with 👍 / 👎.

# Episodes: the WAL row joins the live episode covering it, so Home folds it under the
# live row instead of a second capture's fragment. Off this lane, fail-open; a later
# WAL append re-runs it and is a no-op once joined.
schedule_after_finalization(uid, conversation_id, ProcessingTrigger.SYNC_UPDATE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the owning listen/pusher lifecycle contract

This new sync-finalization hook changes the audio/conversation lifecycle by sending every completed WAL row into episode reconciliation, but the commit does not update backend/docs/listen_pusher_pipeline.mdx. That document owns this pipeline contract and must be updated in the same change so operators and future lifecycle work account for the new asynchronous edge.

AGENTS.md reference: backend/AGENTS.md:L159-L159

Useful? React with 👍 / 👎.

# Episodes: the WAL row joins the live episode covering it, so Home folds it under the
# live row instead of a second capture's fragment. Off this lane, fail-open; a later
# WAL append re-runs it and is a no-op once joined.
schedule_after_finalization(uid, conversation_id, ProcessingTrigger.SYNC_UPDATE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not drop episode hooks when the bounded pool fills

When LIFECYCLE_V2_MODE serves a user and a sync batch finalizes many fragments quickly, each call submits to the shared episode executor, which has only two workers plus eight queue slots. The eleventh concurrent submission raises ExecutorSaturatedError; schedule_after_finalization catches it and returns, while the sync job still succeeds and has no durable retry. A one-shot final WAL batch can therefore leave arbitrary conversations unattached—the exact multi-fragment workload this change is meant to repair. Use backpressure or durable/retryable dispatch rather than dropping the hook on pool saturation.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T21:11:36.341488Z 4619878 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

FIX — Sol / P88, round 1, exact head 6a3ace64d61148d4e25faeeacad7f6f2e08a30e1 (direct sprint-bus request).

[P1] Preserve recovered WAL speech before folding its conversation — backend/utils/episodes/service.py:784. SYNC_UPDATE is excluded from every text feed, and a newly linked WAL row returns immediately at :783. A WAL append is not proof of duplicate speech: sync assignment explicitly preserves genuinely new survivors (utils/sync/assignment.py:544). For example, a live episode last heard realtime at 09:10; a recovered WAL row spans 09:09–09:20. Its start overlaps, so the boundary returns CONTINUE/parallel and this code links it, but none of the recovered 09:10–09:20 speech reaches episode notes. Home now folds the completed member under that episode, whose bullets/moments omit the recovered content. The same omission applies to a new WAL tail on an already attached conversation. Feed only proven novel/unapplied speech, or leave a conversation ordinary until duplication is established; do not infer that all its text was already streamed from the processing trigger or time overlap alone. Cover mixed duplicate/new WAL speech and an already-attached recovered tail.

[P1] Make the final WAL attachment retryable — backend/utils/episodes/service.py:755 and backend/utils/sync/pipeline.py:1166. _attach_synced reads a version then commits once. A concurrent live moment/second attachment advances state_version, commit_moment raises EpisodeConflict, and the outer wrapper returns error; the fire-and-forget hook discards that result. Unlike attach_conversation, there is no read/decision/commit retry. There is also a dispatch loss path: schedule_after_finalization catches submission failure, while the serving episode executor admits only 2 workers + 8 queued tasks and raises on saturation. A one-shot final WAL batch can finish successfully with fragments permanently unattached and no later append to retry them. Retain bounded CAS retry plus a reliable dispatch/retry/backpressure path; prove final-append contention and pool-saturation recovery without duplicating notes or tasks.

Reviewed the sync/enrichment mirrored hook, trigger guards, boundary/CAS store and Home-fold tests. These findings are source-supported; no local test rerun, production read, merge or deploy in this review. Existing documentation-only and P2 comments are outside this pool's blocking bar. Re-review should cover only the fix delta.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5fce44af8e

ℹ️ 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".

uid,
expected_episode_id=str(episode['id']),
expected_version=episode.get('state_version'),
updates=_with_conversation(episode, conversation_id, source),

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 Badge Preserve the live capture's ownership of episode closure

When a WAL fragment joins after the live conversation, _with_conversation appends its ID to conversation_ids. However, _close_for_finalize treats the last ID as the newest active capture and returns continued for any other conversation on capture_end or server_recovery. Consequently, the original occasion conversation can no longer close its episode when it ends, even though the appended WAL conversation is already completed and its own sync hook explicitly cannot close the episode. The episode remains live until idle cleanup and can absorb subsequent speech into the ended occasion. Track live-capture ordering separately or exclude completed sync attachments from the closure-owner check.

Useful? React with 👍 / 👎.

/// all fold under the one live row, reachable inside the live episode page
/// (Moments, members). When the episode closes, the members return as ordinary
/// rows beside it — nothing here hides them then.
Set<String> hiddenLiveConversations(Set<String> episodeIds) => episodeIds;

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 Badge Provide member navigation before hiding completed conversations

While an episode is live, completed members now disappear from Home, but the replacement live page provides no way to open their saved conversation details. Repository-wide searches for conversationIds show no member-list consumer in the episode pages; _LiveSummaryTab renders only episode.moments, _MomentRow has no navigation, and LiveTranscriptView displays the current capture rather than fetching member transcripts. Newly attached WAL rows additionally have no moments at all. Thus users cannot reach these completed members' saved summaries or playback through the replacement row until the episode closes. Add navigable episode members, or retain completed rows until that access exists.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 6 commits October 24, 2026 11:57
…oader

utils/sync/pipeline.py now imports utils.episodes.finalize at module
scope to schedule the post-finalization episodes hook. The fast-path
loader in test_sync_cloud_tasks stubs utils as a MagicMock that is not
a package, so importing utils.episodes.finalize raised
AttributeError: __spec__ at collection and failed every test in
test_sync_cloud_tasks and test_legacy_dark_router (which shares the
loader). Stub the whole episodes package from disk like observability,
matching the treatment test_sync_v2 already gives it on this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Update stale rollout expectations and exercise both workload-only and rollback metric policies without changing runtime configuration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove the unpublished duplicate repair before integrating the now-green main baseline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level and others added 8 commits October 24, 2026 17:20
Keep the active worker count in the parent shell and update it with the existing PID arrays. Every 20ms polling iteration previously forked twice for command substitution merely to count workers. File isolation, status handoff, crash detection and timing budgets remain intact.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A feature shard still exceeded the unchanged 720-second wall guard at 762s after counter-fork removal. Bash 5.1+ can wait for any tracked child; retain the atomic status-file and liveness reaper, with polling on older Bash. This removes the remaining periodic jobs/sleep subprocesses from Linux CI while preserving per-file isolation and failure detection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The drain test assumed a 50ms sleep meant renewal had begun; a loaded runner returned the response before the heartbeat reached renewal. Wait for an asyncio.Event set at the blocked renewal entry. Keep the renewal-reached, cancellation and sub-5-second drain assertions unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tely

Retain None and non-string input guards without strict typecheck errors. Keep the public tool schema unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A full feature shard still spent 638s in isolated pytest sessions and exceeded the unchanged 720s step budget. Keep core xdist and asyncio, skip the unused loop-on-failure plugin, and load pytest-httpserver only in files referencing its fixture. Preserve unified/batched plugin behavior and explicitly test both isolated and unified plugin states.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level and others added 7 commits October 25, 2026 00:51
…xture

Keep all four error-sanitization assertions and the unchanged CPU limit. Measure the status behavior in the call phase rather than charging its cold dependency import to one test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…endencies normally

Keep the input guards and output contract, remove production file-loader fallbacks added for the isolated test, and register the real pure modules in that fixture so dataclass annotations resolve correctly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Retain main notes and header-chip fixes. On overlapping retrieval/Wrapped guards, keep the validated accurate annotations, canonical imports and normalized text rather than reintroducing type ignores or test-only production loaders.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve fresh per-test isolation and every proration/402/no-write assertion. Keep endpoint calls under the unchanged one-second CPU guard without charging cold router imports and mock construction to the call phase.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Retain sync episode attachment and Home folding alongside main episode liveness, quiet-check retirement, and isolated rendering-helper fixtures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Retain upstream batch profiling, deploy configuration, and dark Firestore lever registrations alongside the episode folding fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve main module-scoped payment-router loading, per-test mock resets, and package alias cleanup alongside synced episode attachment and Home folding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 646e54d into main Oct 24, 2026
59 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/episode-fold-fragments branch October 24, 2026 21:44
Git-on-my-level added a commit that referenced this pull request Oct 27, 2026
…#23828)

## What changed and why

Fix three P1 episode/projection failures identified in #23404 and
#23418. Client projection binding now rejects mixed scopes among unnamed
voices while preserving hash encoding v5. WAL attachment and sync
finalization merge recovered member speech into running notes with
transactional content receipts; close rechecks recovered member
transcripts for unapplied speech. Attachment retries version conflicts
three times with jitter and fresh reads, and saturated episode hooks
retain bounded deferred admission until capacity returns.

Recovered text uses bounded batches so prompt truncation cannot
acknowledge unseen words. Complete live prompt input and recovery share
content-revision receipts, so WAL appended to the same canonical
conversation skips proven live speech and preserves novel gaps. Donor
repointing transfers receipt namespaces with the membership CAS inside
the retry owner; absorb finalization reads the survivor's current
transcript. Canonical ingest binding uses the same scope guard as
persisted binding. Existing EPISODES and LIFECYCLE flags and defaults
are preserved.

Failure-Class: FC-once-only-trigger-dropped-at-capacity

The admission regression is a once-only trigger lost at capacity.
Companion tests cover missing scope in v5 binding and recovered speech
incorrectly treated as already consumed.

## Product invariants affected

INV-TASK-2: episode updates retain provisional items and never write
action items, Candidates, or memories. Customer identity and
serving-plane authorities are preserved (INV-DATA-1).

## How it was verified

- Local backend shard through
`BACKEND_UNIT_TEST_FILE_LIST=/Volumes/Ephemeral/scratch/p88fix/regressions.txt
BACKEND_PYTEST_WORKERS=1 bin/omi-heavy run -- nice -n 19 bash
backend/test.sh` (workspace `bin/omi-heavy`): all 16 targeted files
passed again after the round-two corrections, including 78
episode-service cases, ingest trust/idempotency and the background-task
inventory ratchet.
- Fail-before/pass-after: corrected regressions run against base
production sources `5f2caea10a6` fail on mixed-scope binding, lost
recovered notes/close rebuild, two CAS conflicts, and saturated final
hooks. The candidate passes those regressions.
- `bin/omi-heavy run -- nice -n 19 make preflight`: all 35 repository
checks passed (389 seconds), including Firestore guards, runtime source
closure, async blocking, import purity, metadata, and file-size gates.
- `bin/omi-heavy run -- nice -n 19 bash backend/scripts/typecheck.sh`:
canonical full backend type check, zero errors.
- `bin/omi-heavy run -- nice -n 19 bash
backend/testing/sync_cloud_tasks_stack/run.sh --only sync --state-dir
/Volumes/Ephemeral/scratch/p88fix/sync-stack`: hermetic Sync Cloud Tasks
gauntlet passed with real local Firestore/Redis and separate
admission/worker processes; sanitized evidence retained.
- Read-only Luna rounds 1 and 2 returned FIX-FIRST; their findings were
corrected with fail-before/pass-after regressions. Under acknowledged
lead ruling `2fedac`, no third review runs: acceptance is corrected-head
CI plus the regression mapping for the lead's delta review. Terminal CI
and that mapping will be attached before handoff.

These are source, hermetic unit, and local harness claims. Product
deployment and production acceptance belong to the lead's release train.

## Tests

- `test_transcript_hash.py`: dict/model scope-only attribution
correction, legacy unscoped mix, bound owner/person compatibility, v5
unchanged.
- `test_client_processing_finalize.py`: router and transactional binding
reject the stale digest while finalization fields survive.
- `test_episodes_service.py`: recovered speech at attach, idempotent
replay, existing member gap behind an applied offset, close after a
provider failure, three fresh CAS attempts retaining concurrent members,
full long-transcript prompt coverage in served/legacy modes, preserved
speaker-evidence IDs, and ordinary-finalize/unplaced-slice failure
receipts.
- `test_episodes_finalize_paths.py` and `test_executors.py`: saturated
final/intake hooks run without another append, context survives, errors
surface, cancelled and shutdown work stays bounded.
- Review regressions fail at `0b0e740ae3c` and pass after correction:
canonical ingest scope guard, same-row live/WAL consumption, donor
receipt transfer, and fresh donor CAS attempts. The merged-survivor
finalization test also proves only novel survivor speech reaches the
model.
- `test_background_task_ratchet.py`: both retry APIs remain subject to
caller inventory; returned cast-wrapped futures transfer ownership while
done callbacks alone remain detached. The new regression fails before
correction; all six scanner cases pass afterward.
- Round-two regressions fail at `90f2eff0f13` and pass after correction:
absorbed callback survives two fresh CAS conflicts, legacy-only donor
receipts prevent replay, and transferring 50,000 content receipts bounds
every archive to 2,000 IDs while retaining order and all proof.

## Risks and rollout

Recovery can add notes-model calls for retained WAL snapshots whose
prior live consumption cannot be proved. Older placed cursor-only state
cannot distinguish an old line from a new gap behind that cursor, so its
first recovery conservatively merges the retained snapshot once. Legacy
unplaced-ID receipts remain proof; new live content receipts prevent
replay. Updates merge into the existing compact state. The deferred
queue is process-local like the ordinary executor queue, capped at 64
pending submissions with synchronous producer backpressure when full;
shutdown cancels it. Its documented background-task inventory entry
retains the existing best-effort episode-overlay lifetime over durable
source conversations. No new queue infrastructure or migration is
required.

Lead-owned backend/listen/pusher release train required after merge. No
production access or mutation was used in this lane.
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