Skip to content

fix(backend): stop projecting ledger-bound capture receipts as partial recordings - #23412

Merged
Git-on-my-level merged 18 commits into
mainfrom
fix/partial-recording-chip
Oct 24, 2026
Merged

Git-on-my-level merged 18 commits into
mainfrom
fix/partial-recording-chip

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

fix(backend): stop projecting ledger-bound capture receipts as partial recordings

Summary

The iOS conversation detail shows a "Partial recording" chip whenever
capture_coverage == 'incomplete'. Since #20903, that field projects straight
from the internal capture_evidence.coverage receipt. For live captures, that
receipt comes from the committed-capture proof (CommittedCaptureMap, #20427),
whose incomplete flag latches on ledger bounds, not observed loss: the
run ledger keeps 32 runs of at most 30 s each and evicts the oldest beyond
that, so any continuous capture past ~16 minutes — and any capture past 512
transcript notes — latches incomplete even with zero missing claims and zero
conflicts. Every long live conversation therefore told the user that audio was
lost when none was.

Observed loss can never take this shape: a missing source-position claim sets
complete=False and any conflict bumps conflicts, and both make
committed_snapshot return None (the conversation then gets an unknown
envelope, no chip). So a committed-proof incomplete envelope with a complete
lifetime and zero conflicts is bound-only by construction.

Root cause with locations

The fix

ledger_bound_incomplete() (backend/utils/capture_evidence.py) recognizes the
two bound-only receipt shapes: a committed proof with a complete lifetime and
zero conflicts, and the bounded_envelope byte-overflow stub. The public
projection downgrades those to mapped (positions proven for committed
transcript audio) or unknown (overflow stub abstains), so only observed loss
serves incomplete and shows the chip. The rule runs at projection time, so
already-stored rows — including today's false positives — are repaired without
a migration. Sync receipts keep their meaning: their incomplete is decoded
frames short of the claimed count, i.e. real missing audio.

Evidence (production, metadata-only reads on the owner's account)

Last 55 conversations (2026-10-23): 2 carry coverage='incomplete', both
origin=live, proof=committed_transcript_v1, conflicts=0,
lifetime.complete=true — both ledger-bound false positives. One is the cited
54-minute pendant conversation (created 06:39Z); the other is a >29-minute
live conversation still in progress. 48 sync conversations are unknown
(no claims, no chip), 2 are mapped, 3 carry no evidence. Cloud Logging shows
≥1000 check=live_coverage shadow records in 24h fleet-wide, so the writer is
fleet-default and any user with >16-minute continuous live captures is affected
— not an account-specific issue.

Product invariants affected

None of the locked invariants govern this surface; the behavioral contract is
backend/docs/listen_pusher_pipeline.mdx (coverage projection paragraph),
updated in this PR: only observed loss serves incomplete.

Verification

  • backend/.venv/bin/python -m pytest tests/unit/test_conversation_capture_coverage.py -q
    — 11 passed, including an end-to-end reproduction: 20 minutes of continuous,
    fully-claimed pendant audio latches incomplete in CommittedCaptureMap,
    the snapshot says incomplete, and the public projection now serves mapped.
    Conflicts, an incomplete lifetime, and sync frame-loss receipts stay incomplete.
  • pytest tests/unit/test_capture_evidence.py tests/unit/test_capture_evidence_paths.py tests/unit/test_capture_coverage_ledger.py tests/unit/test_capture_coverage_pipeline.py — 59 passed.
  • Changed-file selector run per-file (one pytest process per file, matching CI's
    isolation contract) across the 277 selected conversation/capture/coverage/listen
    files — all green.
  • black --line-length 120 --skip-string-normalization clean.

Failure-Class: none

UI-Evidence: none -- this PR touches backend capture-evidence code and the generated app-client schema artifacts only; no hand-written UI source changed

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…l recordings

The committed-capture proof latches coverage='incomplete' when its run
ledger evicts runs (32 runs x 30s) or transcript notes overflow 512 —
both accounting bounds, not observed loss. Observed loss (missing claims,
conflicts) fails the snapshot to None before any envelope exists, so any
live capture past ~16 continuous minutes served capture_coverage=
'incomplete' and the app showed a 'Partial recording' chip with zero
missing audio.

The public projection now downgrades a ledger-bound 'incomplete'
(committed proof, complete lifetime, zero conflicts) to 'mapped' and the
envelope-overflow stub to 'unknown', at projection time so already-stored
rows are repaired too. Sync receipts keep 'incomplete' meaning decoded
frames short of the claimed count: real missing audio.

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

mintlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Oct 24, 2026, 9:07 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@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-24T22:09:41.931738Z ac045cb 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.

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

No P0/P1 findings. The read-time change is limited to the committed-proof/complete-lifetime/no-conflict shape and the explicit overflow stub. I traced the producer: missing observed claims or conflicts prevent the committed snapshot, while run eviction and transcript-note limits latch the bound flag. Ordinary sync decoded-frame-loss receipts lack that proof/lifetime shape and remain incomplete; source evidence and capture/transaction behavior are unchanged.

Reviewed the continuous 20-minute producer-to-projection regression, conflicting/incomplete-lifetime rejection cases, overflow abstention, sync-loss preservation and public round-trip tests. Internal receipts remain excluded from response serialization; the generated schema additions are optional. No local test rerun or production-data access in this review.

Code-review verdict only; exact-head CI and lead-owned merge/deploy remain separate gates. No merge performed.

@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: 6dfe83fd23

ℹ️ 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 thread backend/utils/capture_evidence.py Outdated
Comment on lines +214 to +215
if evidence_field(evidence, 'capability') == 'unknown' and evidence_field(evidence, 'reason') == 'overflow':
return True

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 observed-loss overflow receipts

When a sync WAL decodes fewer frames than claimed and its receipt is near the 4096-byte limit, apply_capture_evidence_dark_write first sets coverage='incomplete' and then bounded_envelope reduces it to this same overflow stub. For example, 14 ordinary UUID-based segment receipts serialize to 4096 bytes as mapped but 4100 bytes after the observed-loss status is applied, producing {capability: 'unknown', coverage: 'incomplete', reason: 'overflow'}. Treating every such stub as ledger-bound changes the public projection to unknown, so the Partial recording warning is suppressed despite confirmed missing audio; the overflow representation needs to preserve whether the bounded payload already represented observed loss.

Useful? React with 👍 / 👎.

Git-on-my-level and others added 13 commits October 24, 2026 11:53
…S client

models.conversation imports evidence_field/ledger_bound_incomplete from
utils.capture_evidence at module scope; test_action_item_date_validation
stubs utils as a package with an empty __path__, so the isolated
models.conversation load failed at collection with ModuleNotFoundError.
Load the real stdlib-only modules before the models load, mirroring
utils.model_text.

The desktop/windows omiApi.generated.ts output was also stale against
the committed app-client spec (lifetime/proof on CaptureEvidenceMetadata);
regenerate it so the TS generator and knowledge-ledger contract checks
see all four client artifacts in sync.

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]>
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]>
Keep accurate types, canonical imports and scoped real-module fixtures while retaining main notes fixes and all runtime/test limits. Carry the shared isolated-worker startup optimization.

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]>
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]>
Preserve the capture coverage projection, main rendering-helper fixtures, and explicit payment stub cleanup ordering.

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 the capture coverage projection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…loss stays visible

bounded_envelope can replace an oversize sync receipt that is short of frames
with the overflow stub, so projecting that stub away hid real loss. Only the
live committed proof's evicted-ledger shape is downgraded now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 2c80706 into main Oct 24, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/partial-recording-chip branch October 24, 2026 22:19
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