Skip to content

fix(sync): drop clock-offset duplicate transcript lines on offline merge (#4769) - #11165

Merged
kodjima33 merged 8 commits into
BasedHardware:mainfrom
aryanorastar:fix/4769-offline-dup-transcript
Aug 9, 2026
Merged

kodjima33 merged 8 commits into
BasedHardware:mainfrom
aryanorastar:fix/4769-offline-dup-transcript

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • python3 -m pytest tests/unit/test_sync_silent_failure.py::TestSegmentDeduplication …offset… -q → 9 passed (incl. short-backchannel keep)
  • CI backend unit / hermetic / Hygiene green
  • Not verified on-device: live + offline WAL with intentional clock skew (needs pendant). Hermetic tests cover the merge contract.

Failure-Class: new

Fixes #4769

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread backend/utils/sync/pipeline.py Resolved
Comment thread backend/utils/sync/merge_dedupe.py Resolved

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for chasing this down — the shape of the fix (centralizing merge dedupe and adding regression coverage for clock-offset reuploads) is pointed in the right direction, and the backend CI is green.

I do think this needs one more pass before merge because the partial-dedupe + private-cloud path can now lose backing audio for newly-added transcript lines. In process_segment, when dedupe_segments_for_merge drops any incoming lines, the code skips _store_sync_audio_chunk(...) entirely, but still appends any surviving deduped_segments. For a mixed chunk like [duplicate line, duplicate line, genuinely new line], the helper returns only the new line, dropped_for_dedupe > 0, and the conversation is updated with that new transcript segment while no private-cloud chunk is stored for its audio. The previous code explicitly preserved the invariant that “segment present ⇒ chunk present”, so this looks like a user-data/playback regression for partial overlaps.

Could you adjust the partial-overlap handling so newly-appended segments still have a valid audio backing without reintroducing duplicate audio, and add a regression test covering private-cloud-enabled partial dedupe (some lines dropped, some kept)? The all-duplicate skip case still looks fine to avoid re-uploading already-represented audio.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added needs-tests PR introduces logic that should be covered by tests needs-maintainer-review Needs a human maintainer to sign off before merge backend Backend Task (python) labels Aug 6, 2026
@aryanorastar

Copy link
Copy Markdown
Collaborator Author

@Git-on-my-level addressed the partial-overlap private-cloud regression.

Change: when merge dedupe drops some lines but keeps others, we no longer skip audio entirely. Survivors get PCM16 slices uploaded via store_partial_merge_survivor_audio (keyed by each survivor’s absolute timestamp) before conversation-relative rewrite — so new transcript lines keep segment ⇒ chunk without re-uploading the full WAV (which would duplicate audio for dropped ranges). All-duplicate skip still uploads nothing.

Tests:

  • TestMergeSurvivorAudio — slice alignment + one upload per survivor
  • TestProcessSegmentReal::test_partial_dedupe_private_cloud_stores_survivor_slices — private-cloud on, mixed chunk → partial store called, full _store_sync_audio_chunk not

Head: 32a5e6d07e

aryanorastar and others added 6 commits August 6, 2026 14:41
…rge (BasedHardware#4769)

Exact absolute-range keys miss live+offline WAL merges when filename timestamps
drift from conversation started_at, so every line was appended twice. Add
shrink-only text+slop dedupe and regression coverage.

Co-authored-by: Cursor <[email protected]>
…class

Address cubic P2s: batch/length-gate text+slop so short backchannels stay,
skip private-cloud chunk upload on partial dedupe, and add
FC-offline-merge-clock-offset-dup for Failure-Class protocol.

Co-authored-by: Cursor <[email protected]>
…edHardware#4769)

Keep segment⇒chunk when some lines are dropped: upload PCM slices for
survivors only, still skip full WAV on all-duplicate merges.

Co-authored-by: Cursor <[email protected]>
@aryanorastar
aryanorastar force-pushed the fix/4769-offline-dup-transcript branch from 32a5e6d to cfa699f Compare August 6, 2026 09:12
@aryanorastar

Copy link
Copy Markdown
Collaborator Author

Rebased and force-pushed the #4769 partial-dedupe private-cloud audio fix to resolve GitHub conflicts.

  • New head: cfa699f
  • Local verification: pytest tests/unit/test_sync_silent_failure.py::TestSegmentDeduplication + TestMergeSurvivorAudio + TestProcessSegmentReal::test_partial_dedupe_private_cloud_stores_survivor_slices (all passed)

Could you please re-review / dismiss the remaining CHANGES_REQUESTED for the partial-overlap audio invariant now that the branch is mergeable again?

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

@Git-on-my-level \n\nCI failure on this tip was a timing-guard hit, not an invariant assertion: tests/unit/test_sync_silent_failure.py::TestMergeSurvivorAudio::test_store_partial_uploads_one_chunk_per_survivor exceeded the 1.00s CPU guard (1.67s).\n\nI updated that unit test to stub utils.other.storage via sys.modules so it doesn’t import the slow real module inside the timed section.\n\nPushed commit: 3bf7f20\nLocal check: pytest for that exact test now passes.\n\nCan you please re-review and dismiss the remaining CHANGES_REQUESTED for the partial-overlap audio invariant now that CI should be green again?

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

@Git-on-my-level need human response — re-review request.

Partial-dedupe private-cloud audio regression is fixed on head @3bf7f20e19 (store_partial_merge_survivor_audio for survivors; timing-guard stub so the unit test stays hermetic). CI fully green. Could you re-pass / APPROVE?

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the follow-up. I re-reviewed the current head after the partial-overlap private-cloud audio change.

The previous blocker looks resolved: mixed dedupe now stores sliced audio for surviving transcript lines via store_partial_merge_survivor_audio(...) before the conversation-relative rewrite, while the all-duplicate case still avoids re-uploading already-represented audio. I also ran the targeted backend regression tests locally in an isolated venv:

python -m pytest backend/tests/unit/test_sync_silent_failure.py::TestSegmentDeduplication backend/tests/unit/test_sync_silent_failure.py::TestMergeSurvivorAudio backend/tests/unit/test_sync_silent_failure.py::TestProcessSegmentReal::test_partial_dedupe_private_cloud_stores_survivor_slices -q

Result: 10 passed.

I'm removing the stale needs-tests signal and dismissing the older automated changes-request for the now-fixed private-cloud audio invariant. I’m still leaving this as human-maintainer-review rather than formal approval because this is sync/private-cloud transcript/audio behavior and the PR is tied to an issue sequence, so David/maintainers should make the final merge call.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level removed the needs-tests PR introduces logic that should be covered by tests label Aug 7, 2026
@Git-on-my-level
Git-on-my-level dismissed their stale review August 7, 2026 07:26

Resolved on current head: partial-dedupe survivors now get sliced private-cloud audio and targeted regressions passed; dismissing stale automated change request.

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

@kodjima33 / maintainers follow-up: PR #11165 is fully CI-green at 3bf7f20. @Git-on-my-level dismissed the stale changes-request after verifying the partial-dedupe private-cloud audio fix and 10 targeted tests. The only remaining gate is final maintainer approval/merge; no author-side blockers remain.

Co-authored-by: Cursor <[email protected]>
@aryanorastar

Copy link
Copy Markdown
Collaborator Author

@kodjima33 write-access APPROVE / merge when ready — #11165 clock-offset offline transcript dedupe (#4769).

Author-clear:

  • @Git-on-my-level dismissed CR after partial-dedupe private-cloud survivor audio fix (10 targeted tests)
  • Merge conflict resolved on tip @579a3c085b2f: backend-utils.json keeps main’s stt/streaming.py baseline + this PR’s pipeline.py 2499 / Duplicate Transcript Lines - offline recordings #4769 justification
  • Local re-check: focused sync suite 10 passed; ratchet line counts match
  • Honest gap unchanged: no on-device live+WAL clock-skew smoke (no kit); hermetic merge contract covered

Please APPROVE/merge when you have a moment.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Batch-gated dedupe for clock-offset duplicate transcript lines — approve only (606 lines, above the merge-without-Nik threshold for backend).

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

@kodjima33 @beastoin need human response — merge call for #11165.

Author-clear + CI green + mergeable CLEAN @579a3c085b:

  • @Git-on-my-level dismissed CR after partial-dedupe private-cloud survivor audio fix (10 targeted tests)
  • @kodjima33 APPROVED (size-gate: approve-only / above merge-without-Nik for backend)

Honest gap unchanged: no on-device live+WAL clock-skew smoke (no kit); hermetic merge contract covered.

Please merge when ready (or say if you want a smaller follow-up split).

@Git-on-my-level Git-on-my-level removed the needs-maintainer-review Needs a human maintainer to sign off before merge label Aug 9, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Real #4769 fix: conversation-relative range match plus batch- and length-gated text/slop dedupe, shrink-only, with regression tests. CI green.

@kodjima33
kodjima33 merged commit 389e568 into BasedHardware:main Aug 9, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend Task (python)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate Transcript Lines - offline recordings

3 participants