Repository navigation
fix: address Conversations API review comments and add cassette tests - #370
maralbahari merged 14 commits into
Conversation
Fixes three issues identified in PR review:
1. **Architectural layering violation** (conversation.rs:24-26)
- Make ConversationHandler.store() private to enforce typed operations
- Add create_items(), list_items(), retrieve_item(), delete_item()
methods
- Update HTTP handlers to use typed operations instead of direct storage
- Add fallible convert_item() helper that propagates errors
2. **Pagination issues** (item.rs, conversation_items.rs)
- Rewrite list_for_conversation() to use keyset pagination with (seq, id)
- Resolve cursor to (seq, id) tuple within conversation and tenant
- Use compound predicates matching ordering to prevent skip/repeat
- Handle NULL seq values for items added via Items API
- Add 'order' query parameter (defaults to 'desc' per OpenAI spec)
- Add 'include' parameter with explicit rejection of unsupported values
- Replace silent filter_map with fallible conversion that propagates
errors
3. **API compatibility testing**
- Types already match OpenAI (items array, flattened response)
- Cassette infrastructure exists (record_cassette.py)
- Need to add Conversations mode to recorder (see cassettes/README.md)
Changes:
- crates/agentic-server-core/src/executor/modes/conversation.rs
* Private store() accessor
* New typed operations with ExecutorResult returns
* Fallible item conversion helper
- crates/agentic-server/src/handler/http/conversation_items.rs
* Remove storage model imports
* Add order/include query params with validation
* Use ConversationHandler operations
- crates/agentic-server-core/src/storage/models/item/conversation.rs
* Rewrite list_for_conversation with keyset pagination
* Resolve cursor to (seq, id), use compound predicates
* Handle NULL seq edge cases
- crates/agentic-server-core/src/storage/conversation/api.rs
* Pass cursor ID directly (not pre-resolved sequence)
- crates/agentic-server-core/src/types/conversations.rs
* Add DeletedResponse::item() method
C-authored-by: Claude Sonnet 4.5 <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Explain the recording infrastructure and requirements for capturing HTTP cassettes against OpenAI and gateway endpoints. Note that actual recording requires either OpenAI API access or a running gateway instance with LLM backend. Co-Authored-By: Claude Sonnet 4.5 <[email protected]> Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
|
@avinashsingh77 Thanks for the test support. I'll help to record the cassettes and push in your branch. |
Consolidate storage, fix branching and pagination, and add OpenAI/gateway cassettes. Correct test fixtures that reused item IDs. Signed-off-by: maral <[email protected]>
|
@avinashsingh77
The #351 PR also introduced extra The shared |
- Add StorageError::Validation for client-side validation failures
- Validate no duplicate IDs in serialize_new_items using HashSet
- Reject explicit empty ID strings ("" vs missing field)
- Return 400 BAD_REQUEST instead of 500 database constraint errors
- Add unit and integration tests for both validation cases
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: Avinash Singh <[email protected]>
Signed-off-by: maral <[email protected]>
|
The fresh OpenAI and gateway recordings now match across all 19 edge-case steps. The recordings clarified several behaviors:
The tests now compare every edge-case status and complete response body, normalizing dynamic IDs and timestamps. They also replay the OpenAI sequence against gateway storage and retain history, branching, pagination, and streaming checks. These recordings establish parity for the captured cases; duplicate invented IDs and pagination/deletion among repeated occurrences remain unrecorded. |
## Summary Several user-facing docs had fallen behind `main` or contradicted each other and the code. This PR brings them in line with what has shipped. It changes documentation only. **Corrected claims** - README listed the Messages API as "🚧 Planned" while another README section documents `/v1/messages`. It is now listed as shipped; only stateful Messages stays planned. - README and `docs/index.md` advertised "Background execution" and gateway-executed file search. Neither exists yet: background mode is #357, and `file_search` declarations parse but are dropped before inference (`tool/normalize.rs`). Both claims are removed. - `docs/api/index.md` quoted fixed WebSocket and executor limits (256 KiB SSE lines, 1 MiB events and response budget). These now come from the configurable `[responses]` settings, which default to 16 MiB and 8 MiB. - `docs/api/index.md` listed only some of the conditions that route a Responses request through the executor. The list now also includes non-function tools, `multi_agent.enabled`, and tool-search state, matching `handler/http/responses.rs`. - CHANGELOG listed Tavily under 0.8.0, but it merged on Sep 28, after the Sep 19 release. The two Tavily entries move to `[Unreleased]`. **Newly documented features** - README: a multi-agent Responses section with an example and the gateway's limits (`store: true`, HTTP/SSE only, default of 3 concurrent subagents, no `max_tool_calls` or reasoning summaries). Also new rows in the API table for `/v1/responses/compact`, the full Conversations routes, `/v1/messages` with `/v1/messages/count_tokens`, and Swagger/OpenAPI (`ENABLE_OPENAPI_DOCS`). The features list, diagram, and tool ownership table now include MCP, the code interpreter, Claude Code, compaction, and OpenTelemetry. - `docs/api/index.md`: new sections for `GET /v1/responses/{response_id}`, multi-agent, Conversations, and Messages. - CHANGELOG `[Unreleased]` was empty. It now has entries for #345, #347, #349, #351/#370, #354, #368, #369, #372/#373, #380, and #387. **Roadmap** - ROADMAP.md marks multi-agent HTTP execution as shipped, with WebSocket injection (#300) and stateless requests (#393) still open. It adds a status note for Messages, a code interpreter entry, and a file search item linking #34 and #356. - README "Roadmap at a Glance" checks off Messages and Conversations and adds unchecked items for multi-agent, file search, and stateful Messages. **Smaller fixes** - The repository layout in README and AGENTS.md now lists `agentic-llm-d`, `agentic-cli-docs`, and `python/agentic_api/`. - ARCHITECTURE.md's list of multi-agent rejections now includes `max_tool_calls`, matching `executor/rehydrate.rs`. - `mkdocs.yaml` adds the existing but unlinked `design/shell-tool.md` to the nav. **Not changed:** the README's "Rust 1.85+" badge is wrong (1.85 cannot build the lockfile, see #377), but #379 already updates it to 1.88 along with `rust-version` and a CI check, so this PR leaves it alone to avoid a conflict. Signed-off-by: haoshan98 <[email protected]>
Summary
Note: Actual cassette recording requires OpenAI API access or a running gateway instance, which were not available to me at the time of development.
The infrastructure is complete and ready for recording
Fixes #155