Skip to content

fix(responses): preserve streamed response IDs for conversation continuation - #869

Merged
grahamking merged 1 commit into
mainfrom
gk-1564
Sep 29, 2026
Merged

grahamking merged 1 commit into
mainfrom
gk-1564

Conversation

@grahamking

@grahamking grahamking commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Chat-backed Responses streams added a resp_ prefix to response IDs, but stored history remained keyed by the upstream ID. Follow-up requests using the returned ID silently lost prior turns.

Now we preserve the upstream ID during streaming, matching buffered responses and history storage.

Fixes: https://linear.app/nvidia/issue/SWITCH-1564

Assisted-by: Pi:GPT 6 Astra medium
Reviewed-by: Claude:Opus 5.5 medium
Signed-off-by: Graham King grahamk@nvidia.com

Summary by CodeRabbit

  • Bug Fixes
    • OpenAI Responses now retains the original source or target message ID as the response ID, instead of modifying IDs with a prefix. When neither message ID is available, the response uses resp_switchyard as a fallback. This keeps response identifiers consistent with the upstream message when translating streaming events.

…nuation

Chat-backed Responses streams added a resp_ prefix to response IDs, but stored history remained keyed by the upstream ID. Follow-up requests using the returned ID silently lost prior turns.

Now we preserve the upstream ID during streaming, matching buffered responses and history storage.

Fixes: https://linear.app/nvidia/issue/SWITCH-1564

Assisted-by: Pi:GPT 6 Astra medium
Reviewed-by: Claude:Opus 5.5 medium
Signed-off-by: Graham King <grahamk@nvidia.com>
@grahamking
grahamking requested a review from a team as a code owner September 29, 2026 12:58
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 600aa3c9-7eb5-438d-971c-4ff0ead0b71f

📥 Commits

Reviewing files that changed from the base of the PR and between a601a9a and 00b67e3.

📒 Files selected for processing (2)
  • crates/switchyard-translation/src/codecs/responses/stream.rs
  • crates/switchyard-translation/tests/stream_translation.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The Responses stream translator now uses the target or source message ID unchanged. If neither ID exists, it uses resp_switchyard. A streaming test checks that an OpenAI Chat event ID is preserved in the emitted response.id.

Changes

Response ID preservation

Layer / File(s) Summary
Message ID mapping and stream test
crates/switchyard-translation/src/codecs/responses/stream.rs, crates/switchyard-translation/tests/stream_translation.rs
The translator uses the target or source message ID unchanged, with resp_switchyard as the fallback. A streaming test checks that chatcmpl-test remains unchanged in response.id.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Merge Risk: ⚪ Minimal · up to 00b67

Streamed chat-backed responses retain the upstream ID used to restore continuation history. No actionable merge blocker is evident.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving streamed response IDs for conversation continuation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

A rabbit checks the stream at dawn
The message ID hops through unchanged
No extra prefix trails behind
A fallback waits when IDs hide
The test confirms the path is sound

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

@grahamking
grahamking enabled auto-merge (squash) September 29, 2026 13:12
@grahamking
grahamking merged commit 15684f9 into main Sep 29, 2026
16 checks passed
@grahamking
grahamking deleted the gk-1564 branch September 29, 2026 13:41
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