Skip to content

chore(sync): key record wait and drain retry logs by a hashed recording id - #24881

Merged
Git-on-my-level merged 4 commits into
mainfrom
claude/project-thread-cqxm31
Nov 7, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
claude/project-thread-cqxm31

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Requested by David · project thread

What changed and why

After #24853 shipped, record_capture_pending 503s on /v2/sync-local-files held steady at about 2.3k per 15 minutes on 2026-11-07, roughly half record_jobs_missing and half audio_coverage_unproven. Three questions couldn't be answered from the logs:

  • whether that was one recording retried thousands of times or thousands of recordings;
  • which drain admission retry reason a stuck upload was hitting, since neither log line carried a per-recording key;
  • why coverage failed.

Answering any of them meant row-level reads of user data.

This is a log-only change:

  • event=sync_record_upload outcome=pending adds record=<16 hex>. That's a prefix of the record content hash sha256("record-v1:{uid}:{cid}"), which is also the intake key bp_<content>. A wait raised before the record identity is known logs record=-.

  • event=batch_live_admission outcome=retry adds the same record=<16 hex> key, taken from the record_pending job's record_content_id, so a pending upload can be joined to its drain retry reason.

  • New event=sync_record_coverage outcome=unproven cause=<cause> before an audio_coverage_unproven wait, with a static cause:

    • wal_audio_outside_record: the WAL has audio before or between the record's units.
    • wal_audio_past_record: the WAL runs past the record's last unit.
    • audio_bytes_differ: the overlapping samples differ.
    • record_unit_exhausted: no overlapping record samples were left.

    This separates a phone holding audio the record lacks from a decode or alignment mismatch, and the two need different fixes.

The key is a one-way hash. No uid, conversation id, audio or error text is logged. Status codes, bodies, retention and admission behavior are unchanged.

Product invariants affected

none

How it was verified

  • backend/: python -m pytest tests/unit/test_sync_admission_diagnostics.py tests/unit/test_record_drain_barrier_backoff.py tests/unit/test_record_drain_privacy_defer.py → 42 passed.
  • scripts/backend-python-format --write on the changed files.
  • scripts/pr-preflight --pr-body-file → 36 checks passed.

Tests

  • test_sync_admission_diagnostics.py:
    • Every pending reason logs the expected record= key: the content prefix, or - for an owner-context mismatch. Neither the uid nor the conversation id appears in the line.
    • _covered logs no cause when the audio is covered. It logs the right cause for WAL audio before the record, after the record, or with differing bytes.
  • test_record_drain_barrier_backoff.py: the drain retry line ends with the job's record= content prefix and doesn't contain the owner id.

UI evidence

UI-Evidence: none -- no UI change

🤖 Generated with Claude Code

https://claude.ai/code/session_017CeWy3fepTWkruwXu3wafS

…ng id

The record_capture_pending log line and the record_pending drain retry
line carried no per-recording key, so the 2026-11-07 post-fix read could
not group ~2.3k waits per 15 min by recording or join a stuck upload to
its admission retry reason without row-level user-data reads. Add a
16-hex prefix of the record content hash (the intake key) and of the
segment id. Both are one-way hashes; no uid or conversation id is logged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017CeWy3fepTWkruwXu3wafS
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T21:07:08.281904Z 83f0203 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.

audio_coverage_unproven was ~43% of record_capture_pending after the
account-pause fix, with nothing saying whether the phone holds audio the
record lacks or the overlap simply differs. Log a static cause from the
coverage check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017CeWy3fepTWkruwXu3wafS

@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

You’re at about 94% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread backend/utils/batch_pipeline/live.py Resolved
…g line

The segment id is sha256(content:0), not the record content hash the
sync pending line logs, so the two could not be joined. Log the job's
record_content_id prefix instead (cubic review).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017CeWy3fepTWkruwXu3wafS

@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: fc7744897d

ℹ️ 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/batch_pipeline/live.py Resolved
@Git-on-my-level
Git-on-my-level merged commit 2b237ab into main Nov 7, 2026
59 checks passed
@Git-on-my-level
Git-on-my-level deleted the claude/project-thread-cqxm31 branch November 7, 2026 21:24
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.

2 participants