Skip to content

Add tool_search support and compatibility alignment#107

Open
PenguinDOOM wants to merge 10 commits intoRayBytes:mainfrom
PenguinDOOM:support-tool-search
Open

Add tool_search support and compatibility alignment#107
PenguinDOOM wants to merge 10 commits intoRayBytes:mainfrom
PenguinDOOM:support-tool-search

Conversation

@PenguinDOOM
Copy link
Copy Markdown

@PenguinDOOM PenguinDOOM commented May 2, 2026

Summary

  • add VS Code tool_search support for Responses API traffic
  • introduce client compatibility mode handling across OpenAI, Ollama, and websocket routes
  • align compatibility tests and retry/error handling across the affected surfaces

Compatibility Notes

  • ChatMock normalizes Copilot/Codex Responses payloads for chatgpt.com/backend-api/codex/responses rather than trying to fully mirror the public OpenAI Responses API
  • standard OpenAI-compatible tools support remains available in every mode, while VS Code-specific non-standard shims are gated behind client-compat=vscode
  • truncation is accepted from clients but stripped before the upstream request because the Codex backend rejects that parameter
  • store is always pinned to false because Copilot traffic is treated as non-persistent here and the upstream contract requires false

Added In This Update

  • rebaselined the route suite around the current VS Code Responses tool_search contract, with native Responses coverage kept separate from legacy compatibility coverage
  • added targeted regression coverage for native tool_search, tool_search_call, canonical tool_search_output, explicit previous_response_id passthrough, and deferred namespace follow-up on the HTTP responses route
  • added a streaming regression test that locks HTTP SSE passthrough for response.output_item.done events carrying tool_search_call output
  • confirmed the current production implementation already satisfies the required Responses contract, so this follow-up is test-focused rather than a production behavior change

Notes

  • excludes the untracked .serena/ path

Copilot AI review requested due to automatic review settings May 2, 2026 09:01
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.

Pull request overview

This PR adds VS Code-oriented tool_search support and introduces a CLIENT_COMPAT mode to gate/align behavior across the OpenAI, Ollama, and Responses surfaces, with expanded test coverage for these compatibility rules.

Changes:

  • Add CLIENT_COMPAT configuration (default vs vscode) wired through create_app() and the CLI.
  • Normalize/convert Chat Completions-style function tools (including tool_search) into Responses-style tool schema, and enforce compat gating for responses_* extensions.
  • Extend route and model-registry tests to validate unknown model passthrough, upstream error passthrough, and compat-specific behavior (HTTP + websocket).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_routes.py Adds extensive compatibility + tool conversion tests, including websocket coverage and server startup helper.
tests/test_models.py Adds tests for unknown-model passthrough and model listing expectations.
chatmock/routes_openai.py Adds compat gating for responses_* fields and improves upstream error JSON passthrough.
chatmock/routes_ollama.py Adds compat gating for responses_* fields and refactors upstream response handling.
chatmock/responses_api.py Adds CLIENT_COMPAT checks, tool schema detection, tool conversion, and strips additional unsupported fields.
chatmock/model_registry.py Adds public_aliases support and includes them in public model listings/alias normalization.
chatmock/cli.py Adds --client-compat flag and plumbs it into app creation.
chatmock/app.py Adds CLIENT_COMPAT config to the app config defaults.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread chatmock/routes_openai.py
Comment thread chatmock/routes_ollama.py
Comment thread tests/test_routes.py Outdated
Comment thread chatmock/routes_openai.py Outdated
Comment thread chatmock/routes_ollama.py Outdated
PenguinDOOM and others added 5 commits May 2, 2026 18:20
- Prevent forwarding of truncation hints to the upstream as the Codex backend rejects them.
- Set the store field to False to comply with the upstream contract that rejects stored responses.

Co-authored-by: Copilot <copilot@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.

2 participants