Skip to content

chore(batch): diagnose projection follow-up failures and verify cooldown recovery - #25135

Merged
aryanorastar merged 2 commits into
mainfrom
codex/24768-phone-cloud
Nov 12, 2026
Merged

aryanorastar merged 2 commits into
mainfrom
codex/24768-phone-cloud

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up failures currently log only blocked or an exception type/site. A production investigation cannot associate those failures with its persisted receipt, so it cannot distinguish discovery delay from a repeatedly refused follow-up. Add a stable, hashed unit key to existing failure/timeout logs and reuse the closed projection/privacy reason helpers. Source IDs, exception messages, audio URLs and transcript text remain out of these logs. Scheduling, retry budgets, privacy fences and stored data are unchanged.

The Firestore timeout-recovery fixture also expected an immediate retry through intentional cooldown. Use a controlled monotonic clock to prove preservation before the deadline and completion at the deadline, including lost replies after commit.

Related to #24768. This closes the diagnostic and verification gaps only; it does not repair the customer's backlog or enable the separately controlled producer-lease rollout. Keep the incident open. After a separately approved deployment, the correlated failure identifies the exact follow-up refusal; an approved operator can use the existing bounded projection-repair workflow without bypassing deletion/privacy fences.

Product invariants affected

none — additive failure diagnostics and tests only; no mutation or scheduling contract changes.

Failure class

Failure-Class: none

UI evidence

UI-Evidence: none -- backend diagnostics only

Line-Count-Exception: backend/utils/batch_pipeline/projection_followup.py | 515 -> 535 | Attach hashed correlation and existing closed reason/source-site helpers at the four existing failure log sites; no new scheduling authority or retry path.

Validation

  • 42 follow-up unit cases passed, including new projection/privacy/unknown-privacy/retry/timeout log privacy regressions. Unsafe source IDs, exception payloads and unregistered reason values are excluded while existing outcome and custody behavior is preserved.
  • Initial unchanged-main Firestore run: 16 passed, 2 timeout-recovery failures. Disabling intentional backoff makes both baseline cases pass.
  • Corrected fixture: 18 Firestore emulator cases passed, including cooldown boundaries, lost commit replies, privacy/deletion fences, pagination and sibling completion. Rerun against the diagnostic additions also passed all 18 cases (84.89s).
  • Earlier unchanged-main focused suites: 184 passed. These are not represented as rerun after this log-only change.
  • Current-candidate make preflight passed all 37 selected checks; the normal pre-push hook passed with 0 backend type errors and 42 focused tests. The existing operator repair-plan suite also passed all 17 cases; no production repair was run.
  • Current head: 7168f93ede05390ec3097193c70db576761ddf9b. Code CI passed: all 8 backend unit shards and slow guardrails, Firestore emulator proofs, hermetic E2E, listen/pusher and sync Cloud Tasks stack gauntlets, CodeQL, hygiene, formatting and metadata validation. Unaffected mobile/web/desktop jobs are path-filtered skips, not executed tests. The PR remains draft; this diagnostic patch does not complete the remaining production investigation.

Emulator command (Python 3.11): FIRESTORE_EMULATOR_HOST=127.0.0.1:8476 GCLOUD_PROJECT=demo-omi-24768 GOOGLE_CLOUD_PROJECT=demo-omi-24768 OMI_ENV_STAGE=local python -m pytest -p no:langsmith_plugin tests/integration/test_server_batch_completion_emulator.py tests/integration/test_batch_pipeline_projection_followup_firestore.py -q.

Only synthetic accounts and a loopback Firestore emulator are used in tests; Redis advisory claims use fakeredis. No production recovery, deletion, deployment, flag change or customer message was performed.

@aryanorastar aryanorastar changed the title test(batch): verify timeout recovery after follow-up cooldown chore(batch): diagnose projection follow-up failures and verify cooldown recovery Nov 12, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: safe, well-scoped diagnostics change — the hashed-correlation design is right and I verified the tests; no blocking findings.

What I verified on this head:

  • backend/utils/batch_pipeline/projection_followup.py — unit_key() hashes the segment (SHA-256, truncated) following the established pattern already used for owner and segment digests elsewhere in the pipeline, and all four failure log sites (timeout, blocked, retry, claim-release timeout) now carry unit= with lazy %-formatting. The blocked log composes projection_block_reason / fence_reason_field / error_site_field, all closed-set helpers (block reasons are whitelisted against BATCH_PROJECTION_BLOCK_REASONS with an 'other' fallback; fence reasons emit only the enum value), so unregistered reasons and exception text cannot leak into logs. Return values, outcomes, scheduling and retry budgets are untouched — production impact is log lines only.
  • backend/tests/unit/test_batch_pipeline_projection_followup.py — the parametrized regression plants private strings in exception payloads and in error.block_reason, then asserts exactly one log line containing only the hashed unit and closed tokens, plus no enrichment side effects; ran locally: 42 passed, matching the PR's validation claim.
  • backend/tests/integration/test_batch_pipeline_projection_followup_firestore.py — replacing the immediate-retry assumption with the _monotonic fake clock and an explicit BATCH_PIPELINE_PROJECTION_FOLLOWUP_BACKOFF_SECONDS=120 makes the cooldown contract explicit: no task scheduled before the deadline, ledger stays 'processing', no extra source loads, resumption at the deadline. Skipped locally without the loopback emulator; the green Backend Hermetic Merge Gate on this head covers it.

Security/privacy: strictly improves log hygiene — correlation no longer requires raw source IDs, and the new tests pin that guarantee.
Performance: one hash per failure/timeout event only; no hot-path cost.
Blast radius: backend follow-up failure logs and their tests.

USER IMPACT: none — internal change; it makes batch-pipeline production failures diagnosable without exposing user data in logs.

Still wanted: nothing material. Once this leaves draft it looks merge-ready from my side unless new commits land.


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 positive-signal Automation verified a genuine fix/quality contribution backend Backend Task (python) labels Nov 12, 2026
@aryanorastar
aryanorastar marked this pull request as ready for review November 12, 2026 14:12
@aryanorastar
aryanorastar merged commit 2e5efe9 into main Nov 12, 2026
77 of 78 checks passed
@aryanorastar
aryanorastar deleted the codex/24768-phone-cloud branch November 12, 2026 14:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 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-12T14:17:06.220149Z 7168f93 Draft marked ready
ℹ️ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend Task (python) positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants