Repository navigation
fix: preserve prompt_cache_retention across Responses execution - #413
Merged
Merged
Conversation
Signed-off-by: zitian zhao <[email protected]>
Signed-off-by: zitian zhao <[email protected]>
skyloevil
marked this pull request as ready for review
October 3, 2026 07:55
skyloevil
requested review from
bbrowning,
franciscojavierarceo,
haoshan98,
jiahuei,
leseb,
maralbahari,
noobHappylife,
qandrew and
tjtanaa
as code owners
October 3, 2026 07:55
haoshan98
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prompt_cache_retentionsurvives raw HTTP pass-through today, but is dropped when storage, continuation, or built-in tools route a request through typed execution. Preserve the legacyin_memoryand24hvalues through that path, including tool rounds, multi-agent execution, and compaction.OpenAI defines
prompt_cache_retentionas the prompt-cache retention policy:in_memoryselects in-memory retention, while24hselects extended retention up to 24 hours, where supported. This is distinct from storing Responses history and fromprompt_cache_options.ttl, which expresses a minimum cache lifetime. Available policies depend on the upstream model; this PR preserves the requested value without implementing retention or guaranteeing cache reuse. See the OpenAI prompt caching guide.prompt_cache_optionsremain separate work.Part of #330. Includes the standalone compaction cache-key forwarding from #412, now merged into main. Wire values checked against openai-python.
Test Plan
After merging main at
f591ceeand resolving the overlapping compaction fields and appended tests:cargo test --locked -p agentic-server-core --lib compaction— 49 passed.cargo test --locked -p agentic-server --test compaction_test --test responses_test --test responses_websocket_test— 140 passed.cargo test --locked -p agentic-server --features openapi --test openapi_test— 9 passed.cargo clippy --locked --all-targets -- -D warningsandpre-commit run --all-files— passed.The initial implementation also passed the core unit suite and web-search tool-round suite. Tests capture upstream requests for JSON/SSE parity, invalid values rejected before inference, SQLite continuation omission/null/override, every tool round, and compaction snapshots. They verify request preservation rather than cache hits against a live model.