wenjin272 opened a new pull request, #1148:
URL: https://github.com/apache/flink-agents/pull/1148

   Linked issue: #844, #1087 (follow-up cleanup)
   
   ### Purpose of change
   
   Python vector-store retrieval now runs embedding and search as one durable 
operation, including Chroma's NumPy conversion. Remove the mailbox-only 
normalization workaround now that the runtime gives managed Java async workers 
their own thread-confined Pemja interpreters.
   
   #### Runtime flow
   
   `ContextRetrievalAction` resolves the store and builds the query. It runs 
`vectorStore.query()` through `durableExecuteAsync(...).await()` when async 
execution is enabled and supported, or through `durableExecute(...)` otherwise. 
The normal Python query bridge passes a list of floats to Chroma, which 
performs its own normalization. The action emits the retrieval response after 
the query completes.
   
   #### Key decisions
   
   Use the ordinary vector-store query path for both Java and Python stores 
rather than retaining separate embedding and search operations. Remove the 
now-unused Java helpers and Python normalization hook. Keep the existing 
`supportAsync()` version gate because interpreter isolation does not replace 
that compatibility requirement.
   
   ### Behavioral Semantics
   
   #### Interaction decisions
   
   | Store | RAG async | Cross-language async support | Execution |
   |---|---|---|---|
   | Java | Off | Not applicable | One synchronous durable query |
   | Java | On | Not applicable | One asynchronous durable query, awaited |
   | Python | Off | Either | One synchronous durable query |
   | Python | On | Unsupported | Existing synchronous fallback |
   | Python | On | Supported | One asynchronous durable query, awaited; 
normalization stays inside search |
   
   #### Behavioral contracts
   
   1. Successful retrieval returns documents through a response carrying the 
original request ID and query, for both synchronous and asynchronous execution.
   2. Python Chroma retrieval works with either Java or Python embedding models 
when two distinct input keys are processed with two configured async workers.
   3. Python stores retain synchronous fallback on Flink versions rejected by 
`supportAsync()`.
   
   #### Failure behavior
   
   Embedding, conversion, and search failures propagate through the existing 
durable execution path; this change adds no retries or exception suppression. A 
query failure prevents the action from emitting a successful retrieval 
response. The version gate is the only synchronous fallback; runtime query 
failures do not trigger it. Query/result validation remains in the existing 
store and adapter code.
   
   ### Tests
   
   | Contract | Verification |
   |---|---|
   | 1. Retrieval response | `VectorStoreCrossLanguageTest`: both sync/async 
settings, exactly two non-empty successful outputs. Request ID/query 
preservation is unchanged and not explicitly asserted by this test. |
   | 2. Cross-language Chroma retrieval | Same E2E: Java/Python embedding 
models crossed with sync/async execution, two input keys and two configured 
workers, with a 120-second test timeout. |
   | 3. Version fallback | Existing gate retained; older Flink versions were 
not exercised in this validation. |
   
   Local validation on JDK 21 / Flink 2.3 with real Ollama and Chroma: all four 
cross-language cases passed. Python Chroma tests: 21 passed, one cloud test 
skipped because its API key was unavailable. Java vector-store bridge tests: 13 
passed. Spotless, Ruff, and diff whitespace checks passed.
   
   Coverage focuses on the actual Java-to-Python Chroma path after removing 
mailbox normalization. Not verified: the original CI resource-contention 
conditions, deterministic overlap of both queries, older Flink versions, 
injected backend failures, and recovery from checkpoints created with the split 
operation sequence.
   
   ### API
   
   Removes the public Java wrapper helpers `PythonVectorStore.embedQuery`, 
`normalizeEmbedding`, and `queryNormalized`, plus the Python 
`_normalize_embeddings` hook and Chroma override. Direct users of these 
workaround helpers must use the normal query API. `BaseVectorStore.query`, 
retrieval events, YAML configuration, and the async option are unchanged.
   
   Durable replay changes from `rag-embed` plus `rag-query` to one `rag-async` 
operation. Compatibility with checkpoints containing the old sequence is not 
provided by this cleanup.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Codex CLI 0.153.4 (GPT-6)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to