Repository navigation
feat: preserve prompt_cache_key in Responses execution - #347
franciscojavierarceo merged 5 commits into
Conversation
Signed-off-by: zitian.zhao <[email protected]>
Signed-off-by: zitian.zhao <[email protected]>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 2
Open (3)
What changed in this PR
Preserves prompt_cache_key end-to-end for /v1/responses when using typed execution, ensuring it reaches upstream calls across HTTP/WebSocket flows, gateway tool rounds, and internal compaction.
Changes:
- Adds
prompt_cache_keyto request payload types and forwards it into upstream request serialization. - Threads
prompt_cache_keythrough compaction paths so automatic compaction inference keeps the same upstream cache group. - Expands HTTP/SSE/WebSocket and tool-execution test coverage to validate forwarding and null/absence semantics.
| File | Description |
|---|---|
| docs/api/index.md | Documents prompt_cache_key forwarding behavior and scoping rules. |
| crates/agentic-server/tests/responses_websocket_test.rs | Adds WebSocket continuation assertions for prompt_cache_key forwarding/omission. |
| crates/agentic-server/tests/responses_test.rs | Adds HTTP + SSE typed vs passthrough coverage for prompt_cache_key, including null behavior. |
| crates/agentic-server-core/tests/web_search_tool_test.rs | Verifies prompt_cache_key survives multi-round web search tool execution. |
| crates/agentic-server-core/tests/support/mod.rs | Updates shared test RequestPayload builder with prompt_cache_key. |
| crates/agentic-server-core/tests/dispatch_loop_cassette_test.rs | Updates test request builder with prompt_cache_key. |
| crates/agentic-server-core/src/types/request_response/serde_helpers.rs | Extracts serde helper functions used in request serialization. |
| crates/agentic-server-core/src/types/request_response.rs | Introduces prompt_cache_key field and forwards it into UpstreamRequest; adds unit tests. |
| crates/agentic-server-core/src/executor/upstream.rs | Updates executor tests’ request payload construction to include prompt_cache_key. |
| crates/agentic-server-core/src/executor/rehydrate.rs | Updates executor tests’ request payload construction to include prompt_cache_key. |
| crates/agentic-server-core/src/executor/modes/response.rs | Updates executor tests’ request payload construction to include prompt_cache_key. |
| crates/agentic-server-core/src/executor/modes/conversation.rs | Updates executor tests’ request payload construction to include prompt_cache_key. |
| crates/agentic-server-core/src/executor/engine.rs | Routes compaction trigger calls through the enriched request (enables forwarding new fields like prompt_cache_key). |
| crates/agentic-server-core/src/executor/compaction.rs | Copies prompt_cache_key into the summarization request; enhances compaction tests to capture upstream request bodies. |
| crates/agentic-server-core/benches/executor_throughput.rs | Updates benchmark request builder with prompt_cache_key. |
| .rust-file-sizes.json | Updates tracked file-size stats after refactor. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: zitian.zhao <[email protected]>
|
Hi @franciscojavierarceo, the review feedback has been addressed in e923167, all review threads are resolved, and CI is green. This PR is ready for review when you have a chance. Thanks! |
## 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 Standalone `/v1/responses/compact` currently accepts `prompt_cache_key` as an unmodeled compatibility field and drops it before summary inference. Type the field and forward it through the existing compaction path. The key remains request-scoped: omitted or null values are not inherited from `previous_response_id`. Invalid types return 400 before inference. Update the API docs to include the standalone endpoint. Part of #330. Follows #347 and #389. ## Test Plan - `cargo test --offline -p agentic-server --test compaction_test --quiet` — 11 passed, including explicit/empty, omitted/null, invalid, and stored-history cache-key cases. - `cargo test --offline -p agentic-server --test openapi_test --quiet` - `cargo clippy --offline --all-targets -- -D warnings` - All pre-commit hooks. Signed-off-by: zitian zhao <[email protected]>


Summary
Preserve
prompt_cache_keywhen/v1/responsesuses typed execution. The key now reaches upstream requests over HTTP and WebSocket and stays set across gateway tool rounds and internal compaction inference.The key remains request-scoped: continuations send it only when the client supplies it again. Response-object echoing and the separate
/v1/responses/compactendpoint are outside this request-forwarding change. This is the first slice of #330.Test Plan
cargo test --workspace --no-fail-fastcargo clippy --all-targets -- -D warningspre-commit run --all-files