Skip to content

Fix BYOK invalid stateful marker retries#317292

Open
PenguinDOOM wants to merge 4 commits into
microsoft:mainfrom
PenguinDOOM:atlas/vscode-byok-openai-ignorestatefulmarker
Open

Fix BYOK invalid stateful marker retries#317292
PenguinDOOM wants to merge 4 commits into
microsoft:mainfrom
PenguinDOOM:atlas/vscode-byok-openai-ignorestatefulmarker

Conversation

@PenguinDOOM
Copy link
Copy Markdown

This fixes the BYOK Responses retry path for InvalidStatefulMarker errors.

When the shared retry flow retries with ignoreStatefulMarker=true, the BYOK OpenAI endpoint now preserves that explicit suppression instead of overwriting it back to false. This keeps retry requests from re-sending a stale previous_response_id while preserving the existing non-ZDR initial-request behavior and ZDR semantics.

Tests added and verified:

  • add focused BYOK regression coverage for explicit retry-time marker suppression
  • preserve non-ZDR initial-request behavior coverage
  • preserve ZDR marker suppression and store=false coverage
  • verify shared Responses API regression coverage remains green

Fixes #316747

 - add BYOK Responses retry regression for ignored stateful marker
 - preserve non-ZDR initial request and ZDR guard coverage
 - keep explicit ignoreStatefulMarker on non-ZDR retries
 - retain existing ZDR and shared Responses behavior
- clarify initial-request default vs retry override
- point retry-time override at parent retry flow
Copilot AI review requested due to automatic review settings May 19, 2026 11:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets a BYOK (OpenAI-compatible) Responses API retry regression where InvalidStatefulMarker retries are supposed to re-send the request without previous_response_id, but the BYOK endpoint path can overwrite the retry’s ignoreStatefulMarker: true.

Changes:

  • Preserve an explicit ignoreStatefulMarker: true in OpenAIEndpoint.createRequestBody() while still enforcing ZDR behavior.
  • Add BYOK unit tests asserting previous_response_id inclusion/omission behavior and store semantics for ZDR vs non-ZDR.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
extensions/copilot/src/extension/byok/node/openAIEndpoint.ts Adjusts how ignoreStatefulMarker is derived for Responses bodies; updates comment around initial-request defaults in makeChatRequest2.
extensions/copilot/src/extension/byok/node/test/openAIEndpoint.spec.ts Adds regression coverage for previous_response_id suppression/preservation and ZDR store behavior.

Comment thread extensions/copilot/src/extension/byok/node/openAIEndpoint.ts Outdated
- keep caller-supplied ignoreStatefulMarker values
- add makeChatRequest2 regression coverage
@PenguinDOOM
Copy link
Copy Markdown
Author

I built and tested it locally and it works without any problems.

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.

BYOK Responses retry for previous_response_not_found re-sends previous_response_id because OpenAIEndpoint overwrites ignoreStatefulMarker

3 participants