Skip to content

fix: forward prompt_cache_key in standalone compaction - #412

Merged
maralbahari merged 1 commit into
vllm-project:mainfrom
skyloevil:forward-compact-cache-key
Oct 2, 2026
Merged

maralbahari merged 1 commit into
vllm-project:mainfrom
skyloevil:forward-compact-cache-key

Conversation

@skyloevil

Copy link
Copy Markdown
Contributor

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.

@skyloevil
skyloevil marked this pull request as ready for review October 1, 2026 19:31
@skyloevil
skyloevil marked this pull request as draft October 1, 2026 19:36
@skyloevil
skyloevil marked this pull request as ready for review October 1, 2026 21:38
@maralbahari
maralbahari merged commit e0d86ce into vllm-project:main Oct 2, 2026
20 checks passed
haoshan98 added a commit that referenced this pull request Oct 5, 2026
## 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](https://developers.openai.com/api/docs/guides/prompt-caching).

- 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](https://github.com/openai/openai-python/blob/10f88169b0f3929b4e2528aad7a825df31163156/src/openai/types/responses/response_create_params.py).

## 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.

Signed-off-by: zitian zhao <[email protected]>
Co-authored-by: Hao Shan <[email protected]>
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