-
Couldn't load subscription status.
- Fork 443
fix: session config breaks tool registration - cannot use tools with … #377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: session config breaks tool registration - cannot use tools with … #377
Conversation
…audio customization - Fix _getMergedSessionConfig to only include tools field when tools are present - Prevent sending empty/undefined tools array which disables tool calls - Add comprehensive tests covering the issue scenarios - Resolves mutual exclusivity between session config and tool functionality Fixes #339
🦋 Changeset detectedLatest commit: c352690 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
…roperty.call - Resolves ESLint error: Do not access Object.prototype method 'hasOwnProperty' from target object - Uses safer Object.prototype.hasOwnProperty.call() pattern to avoid prototype pollution issues - Maintains same test functionality while following ESLint no-prototype-builtins rule
|
Hi @seratch, I’ve pushed the changes to resolve the CI issues. Could you please review the updates when you have a chance? Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked if the change is relevant yet, but can you simplify the changeset like I suggest?
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
- Fix voice config precedence: session config voice now overrides agent default voice - Fix updateSessionConfig test expectations: add agent updates to trigger updateSessionConfig calls - Tests now properly trigger updateSessionConfig by calling updateAgent() - Preserves session config voice setting instead of always using agent default Fixes 4 failing tests: - includes tools in session config when session config is provided - preserves tools when updateSessionConfig is called - does not include tools field when no tools are provided - reproduces the original issue - tools work with config provided
|
@dkundel-openai Although the CI jobs are still failing, the change itself looks good to me for resolving the reported issue. Can you take a look? |
….com/AjayKumbham/openai-agents-js into fix/session-config-tool-registration
…ols are present - Modified #getSessionConfig to only include tools field when #currentTools.length > 0 - Fixes failing test 'does not include tools field when no tools are provided' - Preserves existing behavior for agents with actual tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Hi @dkundel-openai, this PR has passing checks and has already been approved by @seratch. Could you please review when you get a chance? Thanks! |
|
Thanks for your contribution. Since I worked on the GA launch we couldn't merge this directly but I ported your change into #402 |
Summary
Fixes issue #339 where initializing a RealtimeSession with any config object would break tool registration, making it impossible to use tools with audio customization.
Problem
When a RealtimeSession was initialized with session config (even just voice settings), the tool registration became broken because:
_getMergedSessionConfigmethod would includetools: undefinedin session data when no tools were explicitly provided in the configSolution
_getMergedSessionConfigto only include thetoolsfield when tools are actually present and non-emptyChanges
packages/agents-realtime/src/openaiRealtimeBase.tspackages/agents-realtime/test/realtimeSession.test.tsTesting
Added tests covering:
Fixes #339