Skip to content

Reset Responses stub output for each new request - #282

Open
sylvesterkaczmarek wants to merge 3 commits into
openai:mainfrom
sylvesterkaczmarek:fix/responses-stub-request-reset
Open

Reset Responses stub output for each new request#282
sylvesterkaczmarek wants to merge 3 commits into
openai:mainfrom
sylvesterkaczmarek:fix/responses-stub-request-reset

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

Make the Responses API stub backend restart its deterministic fake-token sequence for every new API request.

The stub accepts the standard new_request flag but currently ignores it, while its token position lives in the module-global token_queue. A second request therefore starts wherever the previous request stopped rather than from the beginning of the stub response.

Fixes #281.

Fix

Reset token_queue to fake_tokens.copy() when new_request=True before returning the first token.

Regression coverage

Adds a deterministic test that:

  • consumes the first two fake tokens;
  • starts a new request;
  • verifies the next token is again fake_tokens[0].

The fake response content, automatic wraparound behavior, setup interface, and simulated latency are otherwise unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown

Note

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
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.

Responses stub backend does not reset fake output on new requests

1 participant