Skip to content

fix: reconcile Home processing with durable mobile finalization - #23857

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/stuck-processing
Oct 28, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/stuck-processing

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed

Process Now could leave Home showing a local id=0 Processing row forever if its WAL drain or HTTP request never finished. Refresh preserved that placeholder unconditionally, and a completed result without title/emoji was also treated as still processing. The server's legacy mobile route owned enrichment synchronously rather than durably handing it off.

  • Use the existing exact-ID transactional finalization outbox for mobile Process Now when Cloud Tasks dispatch is enabled; preserve request-scoped BYOK and inline deployments.
  • Use the same speech clock for quiet candidate selection and transactional admission, including lifecycle-v2 rows without finished_at.
  • Track the optimistic row's known server ID, reconcile real statuses, expire local optimism after two minutes even offline, and poll server processing rows until they settle. Fence newer attempts and live events; cancel timers on clear/dispose.
  • Render a processing-only Home and settle completed transcript-only rows without waiting for presentation fields.

Ships on with the existing dispatch configuration. No new rollout switch, production write, merge, or deploy. Rollback: revert this PR.

Evidence and limits

Read-only, metadata-only investigation under ro-prod, scoped to the reporting owner's UID. The reported conversation had already completed via server_recovery: its 900-second quiet timeout delayed admission until about 15 minutes after the legacy finished_at watermark. Its recording lease expired before that admission. The exact historical client in-memory row ID and socket-close cause were not observable; the displayed local timestamp is consistent with the optimistic row, and a later metadata query found no server conversation created or started during that minute. The speech-clock mismatch is independently reproduced by regression tests; it is not claimed as this record's proven cause.

finished_at is continuously populated on live recordings; it is not an explicit end marker. Existing continuation/recording-lease fences remain authoritative. Existing-data repair is proposal only; the now-completed row needs no write.

Validation

  • Backend selected suites through backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST: 191 core/projection tests and 428 related lifecycle/finalizer tests passed; HTTP tests exercise durable mobile admission and lost-enqueue-ACK recovery.

  • Focused Flutter provider/widget regressions: 80 passed after helper extraction (including rendered Home and timer/identity races).

  • Native arm64 iPhone simulator build passed. agent-flutter verified the real Home pending-to-completed transition and the real two-minute unreachable-target expiry with synthetic data. make preflight: all 47 checks passed.

  • Focused Flutter analysis: no issues. The existing braces lint in the touched capture controller is corrected.

  • Selected hermetic mobile journeys: 31/31 passed across all seven journeys (full-suite fallback).

  • TZ=UTC bash app/test.sh <focused files>: shell/native guards, 138 opt-in spine tests, and 80 focused Flutter regressions passed.

  • Exact-commit scripts/pr-preflight --pr-body-file .agent-briefs/pr-body.md: 47 passed. Required pre-push gate passed, including backend typechecking with zero errors.

Visual evidence

Pending Home
Completed Home

Expired local placeholder

Product invariants affected

INV-CAP-1, INV-UI-1, INV-UI-3, INV-PERF-1. Audio custody and the WAL drain/stamp flow remain intact; the local UI deadline does not acknowledge or delete audio. Existing privacy and finalization fences remain in force.

Failure-Class: FC-split-mutation-authority

View guided diff Turn on auto-fix

🤖 Generated with Claude Code

Git-on-my-level and others added 2 commits October 28, 2026 13:36
Hand mobile Process Now to the existing exact-ID outbox when durable
finalization is configured. Align quiet recovery admission with the speech
clock and bound local Home optimism by authoritative status and a deadline.

Cover transaction idempotency, HTTP handoff, provider races, rendered Home,
and native simulator completion and expiry with regression evidence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stub utils.cloud_tasks in the conversations events-bounds fixture: the
real module imports the Google SDK at module scope, which cannot load
under the fixture's faked top-level google package (21 setup errors,
ModuleNotFoundError 'google.oauth2').

End the processing row inside the retry-row widget test before the body
returns: a live row keeps the provider's periodic reconcile timer armed,
and the binding rejects pending timers ahead of addTearDown disposal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 28, 2026 08:32
@Git-on-my-level
Git-on-my-level merged commit a8cb818 into main Oct 28, 2026
58 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/stuck-processing branch October 28, 2026 08:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T08:35:54.336594Z e8140c3 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.

Git-on-my-level added a commit that referenced this pull request Oct 28, 2026
…each (URGENT) (#23888)

## Summary

Firestore read config train — **5xx-guard flag-off (URGENT)**. The
2026-10-28T10:02Z evaluator tick failed the backend-sync 5xx guard (rate
0.0035 / 1424 errors vs ref 0.0014, floor 50) and flagged nine levers
UNSAFE. This PR sets those nine levers to **0** in every
`FIRESTORE_READ_LEVERS` declaration and keeps the eight SUPPORTED levers
at 100. No source query, authority, transcription, speaker, price, Free
benefit, or audio-retention behavior is changed here.

Flagged to 0: `singleton_loops`, `usage_month_cache`,
`backfill_task_reads`, `historical_scan_memo`, `ledger_purge_coalesce`,
`people_scan_dedupe`, `queue_age_sample_budget`,
`finjob_candidate_queries` (was 5), `usage_month_total` (was 100 on
Cloud Run only).

Kept at 100: `deletion_marker_cache`, `subscription_cache`,
`request_read_dedupe`, `serving_config_cache`, `candidates_page`,
`action_items_page`, `mcp_conversation_cards_cache`,
`canonical_statuses_dedupe`. `memory_list_index_window` and
`batch_privacy_memoize` stay 0.

## Monthly-total split — dissolved by this flag-off

`usage_month_total` goes to **0 on every surface**, including the four
prod Cloud Run services. The previously qualified `c2fs_20261026_r1`
epoch declarations are left untouched: every reader is off, so no reader
seeds or overwrites ready totals, and Cloud Run's qualified epoch stays
recorded for a deliberate re-enable. Re-enable path per the loop guard:
if the 5xx rate persists with these levers at 0, each lever is
exonerated and may come back at 5% individually with complete-literal
changes, restoring the monthly-total split at that point.

Declarations: `backend/deploy/runtime_env/_base.yaml`,
`prod.overlay.yaml` (all four Cloud Run service overrides), four
listen/pusher chart values; generated runtime manifest, flag registry,
and both contract tests updated
(`test_verify_pusher_config_references.py` pin;
`test_firestore_train_preserves_monthly_reader_scope_and_cloud_run_overrides`
now asserts readers-off on every surface with epochs unchanged).

## Product invariants affected

- INV-MEM-4 — keep privacy/deletion authority checks unchanged; this is
a read-cache/scan-dedupe flag-off with 0% kill switch semantics in the
direction of safety.
- INV-DATA-1 — existing configuration keys and data planes; no routing
or ownership change.

## Verification

- Focused suite: `test_render_backend_runtime_env.py` +
`test_verify_pusher_config_references.py` — **119 passed** on this head.
- Complete-literal check: all 42 literal sites (11 base + 4 prod overlay
+ 22 rendered manifest + 4 chart + 2 test pins) grep-verified: every
flagged lever is 0, every kept lever is 100/0 as intended, no other key
moved.
- Diff is literal-only outside README + one test expectation block;
runtime_env.yaml changes are exclusively `FIRESTORE_READ_LEVERS` value
lines.

## Lead-owned ship plan (URGENT flag-off train)

Ship **listen → pusher → Cloud Run** as soon as the train allows
(FIRESTORE_READ_LEVERS order listen → pusher → Cloud Run);
desktop-backend and jobs follow the standing train. This is a
guard-response rollback: reads give back until attribution lands. If the
breach is attributed to a non-lever cause (sync-path code PRs
#23849/#23857 merged 08:33–09:01Z inside the breach window are
candidates), restore the prior literal (#23837 state) in every
applicable full literal, retaining the monthly-total split.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/23888?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/23888?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23888&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Git-on-my-level added a commit that referenced this pull request Nov 28, 2026
…26563)

## What changed and why

Port PL-158 from the backend parity ledger into the Python and Go
Firestore emulator suites. Quiet discovery and transactional admission
use the same persisted speech clock. This covers a lifecycle-v2 row
without `finished_at`, a later legacy heartbeat, and a new speech write
committed after discovery.

Both adapters must bind a durable finalization intent at the exact
speech deadline when the recording lease expires. After newer speech
commits, admission against the old cutoff leaves the conversation
version unchanged and creates no intent, including when the newer quiet
deadline is already due. The Go proof then admits the same row with only
the cutoff advanced to the new speech time. The Python leg runs in the
existing Backend Emulator Proofs entry point. The Go leg runs with the
normal adapter tests.

Source [#23857](#23857).
Rollback is a revert of this test commit.

## Product invariants affected

none

## How it was verified

- Python: all three cases passed twice consecutively on the same private
loopback Firestore emulator.
- Go: `make check` passed with private Firestore and Postgres instances,
including the adapter race suite.

- Repository preflight passed all 36 selected checks.

Failure-Class: FC-split-mutation-authority

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26563?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26563?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26563&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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