Skip to content

feat(responses): add replay-safe output helper#1806

Open
raashish1601 wants to merge 2 commits intoopenai:masterfrom
raashish1601:contributor-06/openai-node-1791
Open

feat(responses): add replay-safe output helper#1806
raashish1601 wants to merge 2 commits intoopenai:masterfrom
raashish1601:contributor-06/openai-node-1791

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

  • add a client-side
    esponse.output_as_input helper for replay-safe manual Responses API turns
  • preserve reasoning/message ordering and normalize computer_call_output items to valid input shapes
  • add focused helper and resource-surface tests

Validation

ode ./node_modules/jest/bin/jest.js tests/responsesItems.test.ts --runInBandn- ode ./node_modules/prettier/bin/prettier.cjs --check src/lib/ResponsesParser.ts src/resources/responses/responses.ts tests/api-resources/responses/responses.test.ts tests/responsesItems.test.tsn-
ode ./node_modules/eslint/bin/eslint.js src/lib/ResponsesParser.ts src/resources/responses/responses.ts tests/api-resources/responses/responses.test.ts tests/responsesItems.test.ts`n

Notes

  • ests/api-resources/responses/responses.test.ts still needs the repo mock server on 127.0.0.1:4010; starting scripts/mock --daemon was blocked here by
    pm exec reporting ECOMPROMISED Lock compromised while installing @stdy/cli@0.19.7.

ode ./node_modules/typescript/bin/tsc --noEmit --pretty false still hits the repo's existing missing example-only deps for @azure/identity, express, and
ext.

@raashish1601 raashish1601 requested a review from a team as a code owner March 28, 2026 15:02
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2810769c3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/resources/responses/responses.ts Outdated
)._thenUnwrap((rsp) => {
if ('object' in rsp && rsp.object === 'response') {
addOutputText(rsp as Response);
addOutputAsInput(rsp as Response);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize cancel responses before returning Response

Adding output_as_input to Response makes this helper look universally available on APIPromise<Response> results, but only create/retrieve run hydration; cancel() still returns the raw parsed object (this._client.post(...)) without addOutputAsInput. In practice, code that reads response.output_as_input after client.responses.cancel(...) will get undefined at runtime even though the type is non-optional, so this helper should be applied consistently on cancel as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@singhshiva39758-alt singhshiva39758-alt left a comment

Choose a reason for hiding this comment

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

Hii bro
New game
Top level game

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