Skip to content

Make response caching safe for Anthropic streaming compaction blocks #1034

Description

@afourniernv

Scope

This only affects Relay's optional response cache when an Anthropic request enables server-side compaction or carries a prior compaction block. Ordinary Anthropic traffic is out of scope, and the first live SSE stream is forwarded correctly.

The data-loss edge case occurs when a streamed request actually triggers compaction: cached replay cannot currently reproduce the native compaction_delta lifecycle. Related cache keys also omit the Anthropic beta/version headers, and replay must preserve missing versus explicit-null fields.

#1035 fixes the separate stream-aggregation bug.

Resolution

Until native replay and header-aware keys are implemented, bypass response caching for compaction-enabled and continuation requests. Partial, malformed, or legacy compaction entries must always miss and run live.

Anthropic compaction documentation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions