Repository navigation
fix(backend): declare the action-items due-range Firestore index (#10777) - #10778
Merged
Merged
Conversation
Every due-date-filtered action-item read builds `completed ==` plus an ascending `due_at` order, but the only deployed composite was (completed ASC, due_at DESC), which serves the reverse ordering. Prod therefore raised `FailedPrecondition: 400 The query requires an index` on every such read — the chat `get_action_items` tool returned "Error retrieving action items" and GET /v1/action-items with due filters 500'd (55 occurrences in the 7 days to 2026-07-28, 50 of them in the last 24h). Declares (completed ASC, due_at ASC, __name__ ASC) in the index registry and regenerates firestore.indexes.json. The index is already created in based-hardware and based-hardware-dev, so the deploy-time reconcile check-only gate stays green. Verified: - reproduced against prod Firestore before the index existed: the exact query (completed == False, due_at range, order_by due_at ASC) raised FailedPrecondition - after index creation the same query returns rows with no error - backend/test.sh over the index + action-item read files: 6 files pass - new regression test fails when the registry entry is removed Failure-Class: none
kodjima33
force-pushed
the
watchdog/issue-10777-action-items-due-index
branch
from
July 28, 2026 16:01
a15afc1 to
e897aeb
Compare
undivisible
pushed a commit
to Archit-lal/omi
that referenced
this pull request
Jul 29, 2026
…edHardware#10778) Every due-date-filtered action-item read builds `completed ==` plus an ascending `due_at` order, but the only deployed composite was (completed ASC, due_at DESC), which serves the reverse ordering. Prod therefore raised `FailedPrecondition: 400 The query requires an index` on every such read — the chat `get_action_items` tool returned "Error retrieving action items" and GET /v1/action-items with due filters 500'd (55 occurrences in the 7 days to 2026-07-28, 50 of them in the last 24h). Declares (completed ASC, due_at ASC, __name__ ASC) in the index registry and regenerates firestore.indexes.json. The index is already created in based-hardware and based-hardware-dev, so the deploy-time reconcile check-only gate stays green. Verified: - reproduced against prod Firestore before the index existed: the exact query (completed == False, due_at range, order_by due_at ASC) raised FailedPrecondition - after index creation the same query returns rows with no error - backend/test.sh over the index + action-item read files: 6 files pass - new regression test fails when the registry entry is removed Failure-Class: none
This was referenced Aug 9, 2026
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.
Bug
Every due-date-filtered action-item read fails in prod with
google.api_core.exceptions.FailedPrecondition: 400 The query requires an index.get_action_itemstool returnsError retrieving action items(traceback fromutils/retrieval/tools/action_item_tools.py→database/action_items.py:_stream_action_items_bounded).GET /v1/action-itemswithdue_start_date/due_end_datehits the same path.backend: 55 occurrences in the 7 days to 2026-07-28, 50 of them in the last 24h.Root cause
_apply_action_item_date_filtersordersdue_atascending whenever a due range isrequested (a bounded prefix must match the soonest-due-first product sort), and
get_action_itemsthen adds thecompleted ==equality filter. That composite needs aFirestore index on
(completed ASC, due_at ASC).The only deployed
action_itemscomposite was(completed ASC, due_at DESC), which servesthe reverse ordering and not this query. The index was never declared in
firestore_index_registry.py, so nothing caught the gap —firestore.indexes.jsonhad noaction_itemsentry at all.Fix
Declare
(completed ASC, due_at ASC, __name__ ASC)foraction_items(COLLECTION scope) inthe registry and regenerate
firestore.indexes.json.The index is already created and READY in
based-hardwareandbased-hardware-dev, so thedeploy-time
reconcile_firestore_indexes.py --check-onlygate stays green on merge; this PRadds no serving-schema mutation of its own.
Tested
(
completed == False,due_atrange,order_by due_at ASC) raisedFailedPrecondition: 400 The query requires an index.backend/test.shover the index + action-item read files(
test_action_items_due_range_index_contract.py,test_firestore_indexes.py,test_firestore_query_contract.py,test_action_items_pagination_order.py,test_reconcile_firestore_indexes.py,test_bounded_firestore_list_reads.py): 6 files pass.get_action_itemsseam,derives the Firestore index signature from it, and asserts the manifest declares it. It
fails when the registry entry is removed (verified) — so flipping the order direction
without declaring the matching index breaks here, not in prod.
Product invariants affected
none
Failure class (fixes)
Failure-Class: none
🤖 automated by hourly watchdog — tested and merged
Closes #10777