Repository navigation
perf: narrow smart-merge and KG Firestore reads - #23442
Merged
Merged
Conversation
Partition unbounded smart-merge barrier reads with index fallback, query native KG reverse citations while retaining global orphan cleanup, share public catalog single-flight, and memoize cohort maps within requests. Preserve the global predecessor window and existing authority fences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Partition unbounded smart-merge barrier reads with index fallback, query native KG reverse citations while retaining global orphan cleanup, share public catalog single-flight, and memoize cohort maps within requests. Preserve the global predecessor window and existing authority fences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the serving-query guard hermetic with a cache-miss fake and register the KG citation helper under the driver that executes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Share the request holder through a module without Redis or serving imports so rollout checks do not expand the batch worker's source dependency graph. The existing runtime-image closure guard catches this contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |
Consume the merged typecheck and native-audio CI repairs and refresh main-target qualification after the temporary stacked base was deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Git-on-my-level
had a problem deploying
to
development
October 23, 2026 19:36 — with
GitHub Actions
Failure
Keep payment-link and visibility regressions hermetic after the catalog helper adds memory-cache, read-origin, Redis exception and fallback dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Git-on-my-level
had a problem deploying
to
prod
October 23, 2026 19:57 — with
GitHub Actions
Failure
Git-on-my-level
had a problem deploying
to
development
October 23, 2026 19:57 — with
GitHub Actions
Failure
Git-on-my-level
had a problem deploying
to
development
October 27, 2026 19:33 — with
GitHub Actions
Failure
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.
Summary
Retain two unsuperseded structural Firestore query optimizations from orphan #23442; merge current main into the existing lane history. The public-catalog and request-cohort cache changes are removed. No query policy, transcription, speaker labels, Free benefits, legacy price, raw-audio custody or authority checks change.
memory_idsreverse citations for at most 30 distinct IDs before mutations. Larger retractions keep one original full scan so overlapping chunks cannot amplify billed reads. Retain the full surviving-node and orphan-edge cleanup, including unrelated dangling edges. No side collection, backfill or new application writes.FSR_SMART_MERGE_PARTITION=offandFSR_KG_CITATION_INDEX=offrestore their original paths.Four-part decision / economics
10-26 fleet caller data already captured in the fsown report; $0.43–0.47 per million reads × 30 days. These are opportunity ceilings, not forecasts or booked savings.
Retained gross upside cap $299.03/month, not a point forecast. Composite storage, empty-query floors, fallback overhead and the actual request/graph mix remain unmeasured; net savings may be zero or negative. New verified/realized savings: $0, until lead serving plus D+1 net billing against the 10-24/25 baseline.
Track old and new callers together:
smart_merge:find_preceding_conversations→smart_merge:collect(including unchanged finite reads);knowledge_graph:prune_memory_citations_from_kgplusknowledge_graph:_citation_nodes. New origins aretask:smart_merge_partition_lookupandtask:kg_citation_prune. Caller renaming is not saving.Integration and validation
f923e4862f1240b52c429f5705f091558f2a90f3parents: existing PR head789db126e73be7c01465af90e4f7f5277c3fce56and main5f2caea10a67fcd2dbc52347aff08c9f0ac5fdab. Follow-upf240ea8dbe01b2f061fbbb9aa5ce56be6f75070ccaps bulk KG reads. Final source4174839ab5f0c0bc06eda0a4e81b96b66931980apreserves scans for identifiers beyond index bounds, with ASCII and multibyte boundary tests. No rebase/force-push/stash. Original divergent local lane work is preserved.backend/test.sh,BACKEND_UNIT_TEST_FILE_LIST,BACKEND_PYTEST_WORKERS=4,nice -n10andomi-heavy. Includes all seven Firestore guards, offline SDK query serialization, global-window/deleted-barrier/transaction fallback, finalizer/donor integration, identical KG cleanup, and bulk read non-amplification.reports/fsown-owner-1027.mdbefore MERGE READY.Lead-owned index / ship gate
A ro-prod metadata-only check found 221 composites and no matching device index. The lead must clear the standard additive index prebuild auth/environment approvals and verify
conversations_smart_merge_device_precedingREADY before serving this source. Production prebuild approval is a lead gate, not lane authority. Do not ship through the missing-index fallback to bypass the readiness gate. Native KG array-index availability also retains the standard guard/fallback contract.Once readiness and source CI are clean, the lead merges and ships through its normal source train, watches missing-index/fallback/query latency, smart-merge barrier equivalence, KG cleanup, 5xx and live p95, and rolls either switch off on a regression. Compare matched caller windows and D+1 total reads/writes/storage before booking dollars. This lane performs no deploy/apply, prod write, approval or access change, and does not close the PR.
Product invariants affected
Line-Count-Exception: backend/database/firestore_index_registry.py | 2247 -> 2266 | Declare the partition query beside the original query in the single index authority; preserve generated manifest ownership.
Failure-Class: FC-merge-across-discarded-rows