Skip to content

Conversation

@dkundel-openai
Copy link
Collaborator

Summary

  • trigger response.cancel even when audio hasn't started
  • mark the response as stopped so a new one can start

Testing

  • pnpm build
  • CI=1 pnpm test
  • pnpm lint

https://chatgpt.com/codex/tasks/task_i_68409f83804883318c5bf86f8a0457ca

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

LGTM

@dkundel-openai
Copy link
Collaborator Author

Still need to validate this myself. So do not merge

@seratch seratch marked this pull request as draft June 5, 2025 03:07
@changeset-bot
Copy link

changeset-bot bot commented Jun 5, 2025

🦋 Changeset detected

Latest commit: 5f7cf58

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@openai/agents-realtime Patch
@openai/agents Patch
@openai/agents-extensions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dkundel-openai dkundel-openai marked this pull request as ready for review June 5, 2025 17:41
id: z.string().optional(),
conversation_id: z.string().optional(),
max_output_tokens: z.number().or(z.literal('inf')).optional(),
id: z.string().optional().nullable(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

had to mark all of these as nullable since optional() in Zod now explicitly requires nullable()

const feedbackText = getRealtimeGuardrailFeedbackMessage(result);
this.sendMessage(feedbackText);
break;
const firstTripwireTriggered = results.find(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be the same behavior as before. Just makes it more explicit that we trip on the first guardrail

'interruptedByGuardrail',
this.#interruptedByGuardrail[responseId],
);
if (this.#interruptedByGuardrail[responseId]) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without this there might be jankyness since other guardrail checks might have been kicked off already. So this makes sure that we are only tripping once per response

@dkundel-openai dkundel-openai merged commit 68ff0ba into main Jun 5, 2025
5 checks passed
@dkundel-openai dkundel-openai deleted the codex/fix-realtime-session-interruption-bug branch June 5, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants