Conversation
Closed
hao1939
pushed a commit
to hao1939/copilot-api
that referenced
this pull request
Nov 22, 2025
Refactor/core cleanup
basiltt
added a commit
to basiltt/copilot-api
that referenced
this pull request
Mar 16, 2026
…t fixes Critical fixes: - ericc-ch#4 Use WEB_SEARCH_FUNCTION_TOOL.function.name constant instead of hardcoded "web_search" string in interceptor — eliminates silent maintenance trap - ericc-ch#9 Set tool_choice:"none" in second pass to prevent model from re-invoking web search, which would produce unresolvable finish_reason:"tool_calls" for the Anthropic client - ericc-ch#10 Scope Path 2 preflight to only fire when the payload contains a custom tool whose name is in WEB_SEARCH_TOOL_NAMES — prevents firing on every Claude Code request (which always includes Bash/editor tools but never explicitly declares a web search tool) - ericc-ch#18 Move WEB_SEARCH_FUNCTION_TOOL injection into interceptor via new prepareWebSearchPayload() — keeps tool injection co-located with the code that depends on it; handler no longer reaches into service internals Important fixes: - ericc-ch#1 Document rate-limit bypass in interceptor JSDoc and update startup log message to clarify internal calls are not counted against the rate limit - ericc-ch#3 Simplify toolResultContent control flow — results and errors are assigned on every branch before buildSecondPass is called (no more nested try/catch) - ericc-ch#6 getPreflightModel prefers cheap models (mini/flash/haiku/small heuristic) instead of "any model that isn't the request model" - ericc-ch#11 Replace array index cast with Array.at() for natural undefined safety - ericc-ch#13 Use XML delimiters in preflight prompt to prevent quote characters in user messages from breaking the classifier prompt (prompt injection fix) - ericc-ch#14 Add consola.debug calls in interceptor for first/second pass payloads and responses so --verbose is useful for debugging web search issues - ericc-ch#8 Add "// Web search configuration" section comment in State interface Tests updated: - Fix tool_choice test: second pass must use "none", not pass original value - Add prepareWebSearchPayload tests (3 tests) - Add Path 2 scoping tests: bash-only tools skip preflight; web_search custom tool fires preflight (2 tests) - Add empty tools array test for Path 2 skip Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.