Skip to content

fix: avoid mutating raw schemas for responses tools#5753

Open
pragnyanramtha wants to merge 2 commits into
livekit:mainfrom
pragnyanramtha:codex/openai-responses-raw-schema-copy
Open

fix: avoid mutating raw schemas for responses tools#5753
pragnyanramtha wants to merge 2 commits into
livekit:mainfrom
pragnyanramtha:codex/openai-responses-raw-schema-copy

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

Copy raw function schemas before formatting them for OpenAI Responses tools. The previous formatter added type: function directly to RawFunctionTool.info.raw_schema, which leaked provider-specific fields back into the stored tool schema and allowed callers to mutate nested schema state through the returned provider payload.

Validation

  • .venv/bin/python -m pytest tests/test_tools.py::TestProviderSchemaFormatting -q -> 2 passed
  • .venv/bin/python -m pytest tests/test_tools.py::TestNoParametersSchema tests/test_tools.py::TestProviderSchemaFormatting -q -> 4 passed
  • .venv/bin/ruff format --check livekit-agents/livekit/agents/llm/_provider_format/openai.py tests/test_tools.py -> passed
  • .venv/bin/ruff check livekit-agents/livekit/agents/llm/_provider_format/openai.py tests/test_tools.py -> passed
  • git diff --check -> passed

Note: I used a narrow local venv with livekit-agents, livekit-plugins-openai, pytest, pytest-asyncio, and ruff installed, rather than syncing the full workspace.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@pragnyanramtha pragnyanramtha marked this pull request as ready for review May 17, 2026 03:34
Copilot AI review requested due to automatic review settings May 17, 2026 03:34
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Copy link
Copy Markdown

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

3 participants