Skip to content

fix: preserve prompt_cache_retention across Responses execution - #413

Merged
haoshan98 merged 3 commits into
vllm-project:mainfrom
skyloevil:preserve-cache-retention
Oct 5, 2026
Merged

haoshan98 merged 3 commits into
vllm-project:mainfrom
skyloevil:preserve-cache-retention

Conversation

@skyloevil

@skyloevil skyloevil commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

prompt_cache_retention survives raw HTTP pass-through today, but is dropped when storage, continuation, or built-in tools route a request through typed execution. Preserve the legacy in_memory and 24h values through that path, including tool rounds, multi-agent execution, and compaction.

OpenAI defines prompt_cache_retention as the prompt-cache retention policy: in_memory selects in-memory retention, while 24h selects extended retention up to 24 hours, where supported. This is distinct from storing Responses history and from prompt_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.

  • Validate the two wire values on HTTP and WebSocket entry points and expose them in OpenAPI.
  • Keep retention request-scoped: restoring history does not inherit the parent's policy. Typed execution omits absent/null values; raw HTTP keeps an explicit null.
  • Document upstream support limits. Forwarding does not implement cache lifetime or guarantee backend support; capability enforcement and prompt_cache_options remain 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 f591cee and 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 warnings and pre-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.

@haoshan98
haoshan98 merged commit 8f8cb0f into vllm-project:main Oct 5, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants