Skip to content

Forward-merge release/0.9 into main - #1129

Open
rapids-bot[bot] wants to merge 1 commit into
mainfrom
release/0.9
Open

rapids-bot[bot] wants to merge 1 commit into
mainfrom
release/0.9

Conversation

@rapids-bot

@rapids-bot rapids-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

Forward-merge triggered by push to release/0.9 that creates a PR to keep main up-to-date. If this PR is unable to be immediately merged due to conflicts, it will remain open for the team to manually merge. See forward-merger docs for more info.

#### Overview

Anthropic compaction changes both the response stream and how later requests continue a conversation. Relay's optional response cache cannot yet reproduce those semantics faithfully, so this PR keeps compaction-related requests on the live provider path while leaving ordinary Anthropic Messages requests cacheable.

It covers requests that enable compaction and follow-up requests that carry a previous compaction block.

- [x] I confirm this contribution is my own work, or I have the right to submit it under this project's license.
- [x] I searched existing issues and open pull requests, and this does not duplicate existing work.

#### Details

- Recognize compaction configured through `context_management`, the top-level `compaction` field, or an `anthropic-beta` compaction token.
- Recognize conversations that continue from an existing compaction content block.
- Treat malformed or incomplete `context_management` declarations as unsafe for caching.
- Keep ordinary Anthropic Messages requests and known non-compaction context-management edits cacheable.
- Report `anthropic_compaction` as the response-cache bypass reason.
- Add unit coverage for compaction, continuation, malformed, and non-compaction request shapes.
- Add an integration test showing that repeated compaction requests both reach the provider and forward the native `compaction_delta` stream.
- Document the cache limitation and bypass behavior.

This complements #1035, which preserves compaction deltas when Relay assembles a live Anthropic stream. That collector fix does not make cached replay of the stream safe.

Validation completed:

- `just test-rust`
- `just test-python`
- `just test-node`
- `just test-go`
- `just docs`
- `just docs-linkcheck`
- `uv run pre-commit run --all-files`

#### Where should the reviewer start?

Start with `anthropic_compaction_requested` in `crates/adaptive/src/response_cache/key.rs`. It contains the cache-eligibility decision. The integration test `anthropic_compaction_streams_bypass_lookup_and_storage` then shows the resulting behavior across two identical requests.

#### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

- Relates to #1034




## Summary by CodeRabbit

* **Bug Fixes**
  * Anthropic Messages requests using server-side compaction or compaction-related beta features now bypass response caching, preserving the native compaction lifecycle.
  * Compaction events are forwarded unchanged during streaming responses.
  * Cache-bypass telemetry now reports the `anthropic_compaction` reason.

* **Documentation**
  * Updated response-cache documentation to describe compaction-related bypass behavior and observability.
  * Documented the known limitation for requests continuing from compaction blocks.

Authors:
  - Maryam Najafian (https://github.com/mnajafian-nv)

Approvers:
  - Will Killian (https://github.com/willkill07)

URL: #1127
@rapids-bot
rapids-bot Bot requested review from a team as code owners September 19, 2026 00:25
@rapids-bot

rapids-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown
Author

FAILURE - Unable to forward-merge due to an error, manual merge is necessary. Do not use the Resolve conflicts option in this PR, follow these instructions https://docs.rapids.ai/maintainers/forward-merger/

IMPORTANT: When merging this PR, do not use the auto-merger (i.e. the /merge comment). Instead, an admin must manually merge by changing the merging strategy to Create a Merge Commit. Otherwise, history will be lost and the branches become incompatible.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 947f4644-167c-473c-bcdf-a842299d5502

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:M PR is medium lang:rust PR changes/introduces Rust code labels Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang:rust PR changes/introduces Rust code size:M PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant