Repository navigation
fix(backend): deduplicate action item batch mutations - #20729
edvinas1573 wants to merge 1 commit into
Conversation
Failure-Class: none
|
Thanks @edvinas1573 — this is a nicely scoped fix for the duplicate-ID slice of #19449, and the test discipline is above the usual bar. Reviewed all five changed files against current main:
As a narrower alternative to #20724 that keeps the router preflight at 500 and leaves Pinecone error handling untouched, the scope choice looks sound. Since this is a draft, no CI check summary exists yet — once it's marked ready, the backend suites will validate the claims. Leaving for human maintainer review before merge (maintainers will also want to pick between this and #20724). by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Thanks for the detailed review. The unique-ID response semantics are intentional: duplicate requested IDs produce one deletion and one cleanup per document, and the HTTP regression asserts the exact returned IDs and count. One CI clarification: workflows were created for the current head f03290c, but they are completed with Could a human maintainer approve the pending fork workflow runs and, when appropriate for full review, add AI assistance: this follow-up was prepared with OpenAI Codex. |
|
This draft has been quiet for a while. No pressure at all — if you're still planning to finish it, push a commit or comment within 7 days and it stays open. Otherwise we'll close it to keep the queue tidy; reopening a draft is one click when you're ready. |
|
Hey @edvinas1573 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Repeated action-item IDs currently consume multiple Firestore writes, repeat proactivity cleanup, inflate the batch-delete response, and repeat its lock-preflight reads. Deduplicate IDs in first-occurrence order before the delete and sync writers chunk them, and before the batch-delete lock preflight. Keep document IDs verbatim.
Refs #19449. This is an independent, focused alternative for the remaining duplicate-ID problem discussed in #20724. Current main already chunks conversation deletion, retirement, and sync at 499 writes. This PR preserves the router's existing 500-item read preflight and does not change Pinecone error handling: account deletion must still surface required vector-cleanup failures. It does not claim to resolve every item in #19449.
Validation on Python 3.11.15 with dependencies from
backend/pylock.windows.toml:python -m pytest tests/unit/test_action_items_batch_chunking.py -qpasses all 16 cases. The recording fake enforces one write per distinct ID and at most 499 writes per commit; cases cover 0, 1, 499, 500, 998, and 1200 unique IDs.python -m pytest tests/unit/test_action_item_ids_endpoint.py -q: 14 passed, including an HTTP request through the production FastAPI router and real DB writer with fake external services. Four requested IDs (a2,a1,a2,a1) produce two writes, two returned IDs, and one vector/notification cleanup per distinct ID. Existing 500/500/200 preflight and locked-item rejection tests still pass.test_action_item_sync_batch_reminder.py(3) andtest_task_sync_batch_isolation.py(11), for 44 focused tests total.PRE_PUSH_SKIP_PR_PREFLIGHT=1hatch for this draft after recording the guard failures; its mandatory failure-class guard-artifact ratchet still passed. On a push retry, already-passed typecheck, unit tests, and source closure were not repeated. Full query-guard execution was stopped after more than 12 minutes with the above failures already recorded.OMI_ENV_STAGE=offline PROVIDER_MODE=offline python -m uvicorn main:app --host 127.0.0.1 --port 18081; startup rejected the default Soniox STT chain without its key. Full emulator-backed curl testing is not yet verified. The HTTP regression uses dependency overrides and is not a live Firestore test.Failure-Class: none
No existing registry class specifically covers repeated IDs within the same requested document mutation; this change adds behavioral guards at the current batch boundary.
Line-Count-Exception: backend/database/action_items.py | 1633 -> 1636 | Deduplicate the existing batch writer inputs and document unique deletion results without introducing another persistence owner.
AI assistance: implemented and tested with OpenAI Codex.
Compensation: no bounty amount or payment has been confirmed by the maintainers; this contribution is submitted for technical review.