Repository navigation
fix(retrieval): clear main pyright errors from #23408 runtime guards - #23440
Merged
Merged
Conversation
#23408 added defensive isinstance checks on RunnableConfig/configurable inputs; pyright (reportUnnecessaryIsInstance) rejects them against the dict/TypedDict annotations, failing every backend unit shard on main. Widen turn_refs helpers to Any and route edit_tools through a small _configurable(Any) helper so the runtime guards stay, unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 23, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Oct 23, 2026
Resolve the two incidental typing-prerequisite conflicts using main's #23440 implementation. The final guard PR diff no longer changes retrieval behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 23, 2026
legacy-retire C9 (draft, deletion): remove legacy admission from v2 sync, delete legacy_fresh
#22592
Open
Git-on-my-level
added a commit
that referenced
this pull request
Oct 23, 2026
… copies (#23445) Pusher can flush a full batch on one scheduler tick and then persist its last short frame as another object on close. Give size-only flushes one uploader tick (normally1 second) to absorb that frame. Age limits, recording close, disconnect and genuine gaps still flush; a recording containing only one frame remains stored. Ordinary merge retries now use the existing checksum comparison and destination generation precondition to skip unchanged object copies. This is the non-deleting code part of P76; bucket lifecycle and regional cache changes remain lead-owned and are not applied here. Validation: 40 tests passed through targeted backend/test.sh files test_pusher_audio_timeline.py (24), test_sync_bridge_audio_copy.py (11) and test_merge_audio_chunk_copy_failure.py (5), with omi-heavy and Python3.11. The wire-level pusher tests cover exact boundary bytes in both legacy/v2 paths, one-frame recordings, discontinuities, replay, retries and conversation changes. Read-only Luna review: CLEAN. After merging main through #23440 at merge head 90eb35c, the required pre-push hooks passed all 35 PR preflight checks, backend typecheck (zero errors), runtime source closure, format checks, and the 29 changed-file pusher/merge regression tests. No hook bypasses were used. Exact-head GitHub Actions results are available on this PR. Limits: genuine short recordings/gaps can still produce sub-1 KB objects; coalescing across owners or real time gaps would lose fidelity. No measured savings are booked. Coldline scoping plan is separate and non-deleting. The fresh 637-object noncurrent-opus sample failed raw-regeneration proof, so deletion remains blocked. Regional provisioning and old-cache read/rollback behavior remain gates. Product invariants affected: none (selector reports no locked invariant paths). UI-Evidence: none -- backend audio storage behavior only. Failure-Class: FC-derived-audio-identity-churn 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level
added a commit
that referenced
this pull request
Oct 23, 2026
…checks (#23394) ## What changed and why Repeated conversation/action list polls reread unchanged source pages. Python Firestore atomic commits now maintain content-free metadata rows and per-owner/family versions. Existing `If-None-Match` requests on `/v1/conversations`, `/v1/action-items` and `/v1/dev/user/action-items` can return 304 after one version lookup without querying the list. Existing clients keep their response shapes and source-query behavior; no client release is required. Metadata rows are a migration substrate: legacy partial updates never claim full coverage. Source writes/preconditions/transforms, authorization dependencies, privacy/hold/deletion fences, Free behavior, transcript/speaker data and polling limits retain their paths. Authentication's platform telemetry patches preserve both list versions and add zero projection writes, including when Redis is unavailable and every request writes telemetry. Only exact audited platform fields are exempt; unknown/mixed fields, replacements, creates and root deletion still invalidate both families. Version reads resolve the Firestore factory and missing-head initializer when called. Importing the action-item router therefore works with the existing isolated task-sharing stubs, without editing those stubs. ## Product invariants affected None by protected path. Task completeness and current access decisions remain on the existing source readers for all 200 responses. ## Rollout and rollback Writer defaults ON; kill switch `OMI_LIST_PROJECTION_WRITER_ENABLED=false`. Reader activation requires `OMI_LIST_VERSION_EPOCH` and `OMI_BACKEND_RELEASE_SHA`. The epoch attests that every writer runtime is covered. Clear it BEFORE disabling or rolling back any writer; re-audit and rotate it before reactivation. The two-lane lead owns merge/deploy, writer coverage audit (including direct/non-Python/non-atomic BatchWrite paths), synthetic staging parity/update/delete/correction checks, and the reader ramp. Target train: 2026-10-24 08:00Z, cutoff 07:30Z. Reader ramp: 5%, then 100% only after two clean hours of parity, net cost and p95. Lead must publish a revised ramp date or explicit hold by 2026-10-24 08:00Z if this train cannot meet that gate. No production activation was performed by this lane. Contract: [list-serving projection runbook](backend/docs/list-serving-projection.md). ## Attribution and economics `omi_list_version_checks_total{origin,outcome}` uses the fixed origins `http:/v1/conversations`, `http:/v1/action-items`, `http:/v1/dev/user/action-items`. Marker SDK reads retain the request origin. Booked savings: **zero**. The sprint's 50M/day is an unverified ceiling. Existing explicit validator adoption was not found in shipped client source; automatic HTTP-cache revalidation remains unmeasured. The reads loop owns adoption and net-cost measurement before expansion. Unchanged eligible 100-row polls become one marker read and zero source queries. Nonconditional requests add zero marker reads. Conversation responses may issue a random initial `lp0` validator; the first conditional poll must still query the source before graduating to `lp1`. Changed conditional conversation requests add two marker reads. Missing heads get one create-only baseline write under the existing transactional deletion fence, including three cold-path reads. Unavailable/malformed heads fall back to source. Partial/locked conversation pages omit validators so locked-content recovery still runs. Count metadata/version writes, storage and indexes in net economics. Recursive account erasure clears final heads even when the root is absent. No new production configuration or workflow. ## Validation - Prior published source head `251a7630136b322d82a2197019a10ef8dea7d963`: Luna R2 and Sol/P88 SHIP. Four real loopback Firestore emulator cases covered 450/499 source rows, 901/999 expanded writes, source/mirror recursive-delete parity and 179,662-byte maximum Commit. Actual production GET/auth mounted locally over TCP with synthetic authority proved initial source200, later one-marker304, changed-source200 and missing-auth401. Evidence: [original handoff](#23394 (comment)). - Telemetry correction `35888d9fc0b7a7a24420c1141170c82708e8128a`: 56 targeted projection/platform tests passed on m1. Real `record_user_platform` before conditional GET preserves both heads; repeated auth writes append zero projection writes; warm polls use the existing auth read plus one marker and zero source reads; subscription changes return source200. Masks/transforms, unknown/mixed paths, replacements/creates/deletes covered. - Main typecheck blocker was fixed by [#23440](#23440) and merged into this branch at `416bf600eed714b660225afb1c969252e27f799b`. The subsequent [task-sharing collection failure](https://github.com/BasedHardware/omi/actions/runs/40012313742/job/120615518889) is addressed by deferred imports in this follow-up. Fresh focused validation, lead-authorized single Luna delta review, normal push gates and exact-head CI are recorded in the latest handoff comment. - Focused import/telemetry regression on m1: **89 passed** (33 task-sharing, 50 list-projection/version, 6 platform normalization), through the three-file `omi-heavy` command below. Existing task-sharing stubs are unchanged. The initial marker lookup bounds timeout/retry and falls back on outage. Total missing-head initialization RPC deadline remains a tracked P2 follow-up (`card:fs-p1-head-initialization-deadline`), owned by fs-p1 for lead disposition before reader activation, due2026-10-24T07:30Z. - Single lead-authorized Luna delta review: **no P0/P1 findings** for telemetry commit `35888d9f` plus import fix `fd570d8c`. Execution `exec-narrow-category-rifle-tunnel-hotel-arctic`, collected on m1. Reviewer checked code statically; the lane's locked Python 3.11 environment supplies the dynamic 89-test proof above. ## Tests `backend/tests/unit/test_list_projection.py`: sync/async SDK batches and transactions, atomic rejection, masks/transforms, owner/family separation, nested corrections, conditional HTTP/auth, counted reads, races, truncation, rollback, release/epoch rotation, marker outage, telemetry and source equivalence. Focused resume list adds `test_task_sharing.py` and `test_platform_normalization.py`; executed via `omi-heavy run -- nice -n 19 env BACKEND_UNIT_TEST_FILE_LIST=<three-file-list> BACKEND_PYTEST_WORKERS=2 bash backend/test.sh`. ## UI evidence UI-Evidence: none -- server-only change. Failure-Class: none Line-Count-Exception: backend/routers/conversations.py | 2425 -> 2435 | Wire the shared version helper before list I/O and after lock recovery; all protocol logic stays in utils/list_version_check.py. Line-Count-Exception: backend/routers/developer.py | 2819 -> 2828 | Wire the shared conditional check after existing auth and before source I/O; no protocol implementation is added to the oversized router. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Git-on-my-level
added a commit
that referenced
this pull request
Oct 23, 2026
…23402) ## Summary Repeated released-memory reads reload identical canonical, historical and metadata windows. This change atomically maintains a content-free owner change head with source commits, including deletes, and reuses exact raw-query projections at internal canonical, historical, list-window, status-pair and MCP-card callers. Existing authorization, policy, lineage, privacy, decryption and lever paths remain authoritative. Warm 100-document pages use two head reads instead of 100 source-document reads. Cold pages add head checks; queries smaller than three rows bypass reuse. The sprint's **50M/day target is conditional and unmeasured**. Grade avoided source reads minus marker reads and added writes before booking savings. This branch merges main through `251892e223fca3bf5c90f060d3b9673683e258fa`, including P1 list projections (#23394), fs-p5 operation snapshots (#23393), the typecheck repair (#23440), merge-copy fixture repairs (#23447), and apt CI repair (#23446). Conflict resolution retains BOTH writer installers, BOTH account-erasure cleanup families, and all flag contracts. New real-SDK sync/async mixed-batch checks verify one atomic commit, both projection families, and unchanged source result counts. Erasure checks cover late head recreation with both present and missing user roots. The final fs-p5 refresh resolved only an adjacent flag insertion; its origin-counter repair is byte-identical to P2's. The archive-filter CI regression is fixed in production registration: `firestore_read_origin` and `released_memory_projection` recover their existing process-wide Prometheus counters after import-isolation teardown evicts modules. Two re-import cycles prove collector identity and counts survive. No test catches the error or weakens archive behavior. The earlier shard-5 rerun passed all four archive cases in 514s against its unchanged 720s budget. ## Lane / contract fs-p2 owns `released_memory_changes_v1`, `MEMORY_RELEASED_PROJECTION`, `MEMORY_RELEASED_WRITERS_COVERED`, and `omi_memory_released_projection_total`; original design bus 9012d9. MCP consumes P1's `list_serving_versions/conversations.version`, writer kill switch and coverage epoch (original bus dd3ecb). Missing P1 metadata retains source reads. No additional conversation writer is introduced. ## Product invariants affected - INV-MEM-1: existing three-tier policy, pending/expiry and archive/device visibility checks rerun on raw candidates. No transcript, speaker or Free-plan changes. - INV-MEM-3: source errors and canonical/suppression/lineage checks still fail closed. Projection faults fall back to the same authoritative query. - INV-MEM-4: projections grant no promotion authority. Canonical receipts, graph transitions and lineage collapsing retain their existing owners; source/head writes remain atomic, including deletes. ## Verification Final focused conflict-resolution run on m1: **433 tests across 21 files passed** through `/Users/david/workspace/omi-workspace/bin/omi-heavy run -- nice -n 19 env BACKEND_UNIT_TEST_FILE_LIST=/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-files.txt BACKEND_PYTEST_WORKERS=4 bash backend/test.sh`. Covers P1/P2 projections, mixed sync/async writes, erasure/privacy, archive filtering, origin attribution/wiring, MCP consumers, memory policy, all three shared-main merge-copy stub files, and fs-p5 snapshot/metric/tombstone/unlock contracts. Log: `/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-focused.log`. The prior P1/P2 refresh passed 353 tests across 17 files. Full backend typecheck passed with **zero errors** (existing warnings remain), via `omi-heavy run --cache-default backend-typecheck -- nice -n 19 bash backend/scripts/typecheck.sh`; log `/Volumes/scratch/m1-lanes/fs-p2/merge-typecheck.log`. One read-only Luna conflict delta review completed with **no P0/P1 findings**: `exec-curve-yellow-plunge-fancy-pill-obtain`, result `/Volumes/scratch/m1-lanes/fs-p2/luna-merge-result.txt`. Historical metric delta review: `exec-rhythm-sort-chapter-traffic-comic-vendor`; its P1 typing finding was corrected and verified. Published final merge head: `6ac131f9f566b0eb2d35447329c685d76c951ed1`. **Exact-head CI is green**: [Backend Unit Tests, attempt 2](https://github.com/BasedHardware/omi/actions/runs/40028276311), [Firestore emulator proofs](https://github.com/BasedHardware/omi/actions/runs/40028276314), and [hermetic backend gates](https://github.com/BasedHardware/omi/actions/runs/40028276356) pass. All visible checks are terminal: 37 successful, 30 intentionally skipped, no failures. Final-head shard 5 passes all four archive cases with wall **673s/720s**. The single permitted failed-job rerun passed shard 4 (all 66 runtime-contract assertions, GPU closure CPU **0.88s/1.00s**, shard wall **615s/720s**). No threshold, allowlist or source changes and no further reruns. Attempt 1's sole failure was the unchanged GPU closure CPU guard at 1.01s against 1.00s, with all 66 assertions passing. **Exact main also fails the same guard at 1.16s** in [run 40026957577](https://github.com/BasedHardware/omi/actions/runs/40026957577/job/120665436845); test and closure tool blobs match. ANX `card:fs-p2-runtime-duration` retains the shared-main timing follow-up for the lead. **Normal pre-push exited 0**: all 37 manifest checks, full backend typecheck with zero errors, runtime source closure and bounded selected unit checks passed; log `/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-push.log`. The prior main refresh also passed all normal pre-push gates; log `/Volumes/scratch/m1-lanes/fs-p2/merge-push.log`. Prior-head CI passed five unit shards, guardrails, Firestore emulator proofs and hermetic gates. Shard 5 passed all four archive cases in **635s against its unchanged 720s wall budget**. Shard 4 passed all 66 assertions in unchanged `test_runtime_image_contracts.py` but failed its CPU guard on the GPU import-closure test at 1.05s versus 1.00s. A focused same-runner local reproduction passed all 66 tests, that case at 0.31s; log `/Volumes/scratch/m1-lanes/fs-p2/runtime-focused.log`. No threshold/allowlist changes and no CI rerun used. Tracking: ANX `card:fs-p2-runtime-duration`. Main advanced with fs-p5 during this CI run, so the final merge gets fresh CI rather than rerunning the superseded head. Earlier synthetic P2 Firestore emulator proof passed failed-batch atomicity, SDK transaction retry, result cardinality, sync/async deletes, bulk exclusion and raw-read parity at recovered head bf6f72c. Emulator project `demo-fs-p2`, local `127.0.0.1:18585`; log `/Volumes/scratch/m1-lanes/fs-p2/emulator.log`. This historical emulator run is not claimed as fresh conflict-resolution evidence. New-head registered CI emulator proofs must pass before merge. ## Rollout / rollback Writer maintenance is on. Reader preference defaults on with `MEMORY_RELEASED_PROJECTION=off` as kill switch. **Reuse requires `MEMORY_RELEASED_WRITERS_COVERED=v1:<unique-epoch>`**, initially absent until complete writer-fleet attestation. MCP additionally requires P1 writer coverage and its fresh epoch. Bulk-blocked or missing-head owners retain source reads; no user-data backfill. Owner: rollout lead. Target T2 **2026-10-24 08:00Z**, cutoff **07:30Z**, only after exact-head CI is green. By cutoff, verify every backend/sync/backfill/integration/listen/pusher/desktop/job writer release and synthetic create/update/delete parity, including standalone/non-Python/raw-RPC writers. If proof is missing, record the blocker and keep reuse disabled. Once proved, enable all eligible owners with a fresh epoch. Metrics: bounded `surface/outcome/origin` on `omi_memory_released_projection_total`; marker reads use `origin=job:released_memory_projection`, and source reads retain their existing caller/origin. Compare output/order/access parity and p95. Any mismatch or regression disables readers. Grade net reads in equal full-day windows and mature billing before recording savings. Clear coverage before ANY writer rollback or gap; rotate the epoch after restoration. Reader-only rollback keeps head writers installed. Details: `backend/docs/released-memory-change-projection.md`. Failure-Class: none Line-Count-Exception: backend/database/memories.py | 1968 -> 1971 | three raw query calls adopt the shared projection transport; query and policy ownership remain in place Tracking: ANX `card:fs-p2-released-memory-projection`, owner fs-p2; lead owns merge/deploy and full writer-fleet audit/activation by 2026-10-24 07:30Z. Handoff: `/Volumes/scratch/m1-lanes/fs-p2/HANDOFF.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main's backend typecheck has failed since #23408 (1c64780): seven
reportUnnecessaryIsInstanceerrors (edit_tools.py 47/99/127/160, turn_refs.py 20/32/52) stop every unit shard before tests run, which blocks CI on all backend PRs (e.g. #23402, run 39993556902).Fix: keep #23408's runtime guards exactly. Widen the
configurableparameter of the three turn_refs helpers toAny, and route edit_tools' four call sites through_configurable(config: Any). No behavior change.Verification (m1, omi-heavy, nice 19):
backend/scripts/typecheck.sh(pyright 1.1.403): 0 errorspytest tests/unit/test_chat_edit_tools.py: 23 passedFailure-Class: none
🤖 Generated with Claude Code