[Bug]: conditional get(ids=..., limit/offset) marks unreturned ids as known-absent, so a later add of an existing id commits and is silently dropped
What happened?
In a conditional transaction, get(ids=[...]) with a limit or offset marks every requested id that the server did not return as known absent — but with a limit/offset the server didn't return them because of the window, not because they don't exist. The client then accepts a subsequent add() for an id that really exists; the commit succeeds (no OCC conflict — the record predates the read snapshot), and the materializer ignores an Add for an existing record, so the user's write is dropped while commit() reports success. The offset variant does the reverse: an update() of an existing id that fell outside the window is spuriously rejected as "requires a prior read proving the id exists".
Root cause is in chromadb/api/conditional_http.py (~L75-80): when a read has ids and no where filter, absence is inferred for any id not in the response, without checking limit/offset. The same inference exists in rust/types/src/conditional_transaction.rs (~L300) and in the JS client's collection.ts, and test_http_conditional_transaction_matches_rust_fixed_corpus pins Python/Rust agreement — so I'm reporting this rather than sending a Python-only PR, since all three implementations presumably want the same change (only infer absence when limit is None and there's no offset). Happy to do the Python side, or all three, if you'd like.
Minimal repro (mocked HTTP transport; server holds ids a and b and honours limit/offset on /conditional/get):
txn = col.conditional()
txn.get(ids=["a", "b"], limit=1) # server returns ['a']
txn.add(ids=["b"], embeddings=[[0.1, 0.2]]) # accepted — 'b' exists
txn.commit() # succeeds; 'b' is silently not written
txn2 = col.conditional()
txn2.get(ids=["a", "b"]) # no limit → add(ids=['b']) correctly rejected
txn3 = col.conditional()
txn3.get(ids=["a", "b"], offset=1)
txn3.update(ids=["a"], metadatas=[{"k": 1}]) # spuriously rejectedExpected: with a limit or offset on the read, ids outside the window are neither known-present nor known-absent, so the add is rejected (as in the no-limit control) and the update is allowed.
Unverified but possibly related: if the server's quota enforcer can cap the page size in collection_conditional_get, the same mis-inference could happen even without a user-supplied limit.
Versions
chromadb 1.5.9 (bindings) with cloned python source @ 0ca571e2c, Python 3.13.5, Darwin arm64. Conditional transactions are not in a PyPI release yet, so the repro runs the cloned Python source over the released bindings.
Relevant log output
txn.get(ids=['a','b'], limit=1) -> ['a'] client-side known_absent: ['b'] txn.add(ids=['b']) ACCEPTED although 'b' exists commit -> {'first_inserted_record_offset': 43, 'record_count': 1} committed ops: [('add', ['b'])] control (no limit): add rejected -> InvalidArgumentError transactional add for id "b" requires a prior read proving the id is absent offset=1 known_absent: ['a'] offset variant: update of existing 'a' spuriously rejected -> InvalidArgumentError transactional update for id "a" requires a prior read proving the id is present
Source: chroma-core/chroma