Skip to content

auto-sync(copilot): merge upstream/main (conflicts with feat/copilot)#7

Merged
conversun merged 42 commits into
feat/copilotfrom
auto-sync/upstream-main-copilot
Jun 22, 2026
Merged

auto-sync(copilot): merge upstream/main (conflicts with feat/copilot)#7
conversun merged 42 commits into
feat/copilotfrom
auto-sync/upstream-main-copilot

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown

Auto-sync from upstream/main (router-for-me/CLIProxyAPI) into feat/copilot.

Reason for manual review: conflicts with feat/copilot

New commits

  • f5484b0 fix(registry): Conform Claude models listing to Anthropic API schema
  • e3301ec fix(registry): Emit Claude model created_at as RFC 3339 string
  • c354f88 feat(api): Route Anthropic /v1/models requests to the Claude format
  • 1ed1f7b Merge branch 'dev' into main
  • 78ba8ba chore: remove Gemini CLI-related translator packages and logic
  • 292456a feat(antigravity): HOME reasoning replay for Gemini models
  • b17d29a fix(antigravity): insert replayed functionCall before matching functionResponse
  • ef19f5f fix(antigravity): address review on replay call_id and args parsing
  • c55157d fix(antigravity): PR review replay scope, signature merge, and tool keys
  • ec8c2c2 test(antigravity): cover invalid-signature replay cache clear
  • aed54ad feat(translator): preserve structured tool_choice in OpenAI response conversions
  • aa2ad99 feat(translator): preserve input_image details in OpenAI response conversion
  • 041a065 Merge branch 'remove-gemini-cli' into dev
  • 1b849b6 feat(translator): attach reasoning_content to assistant and tool messages in OpenAI response conversion
  • 1581700 chore(deps): bump github.com/jackc/pgx/v5 from v5.7.6 to v5.9.2
  • 51aa5ba feat(translator): preserve input_audio fields in OpenAI request conversions
  • 34639c3 feat(translator): defer Codex function call starts until function name is available
  • c44d4fc feat(schema): add removal of $comment and enumDescriptions in JSON schema processing
  • 4c78e40 feat(auth): unify provider key handling with OpenAI compatibility support
  • 75fa626 feat(executor): normalize parallel_tool_calls based on tools presence
  • bc652c7 feat(translator): add support for text.format conversion in OpenAI to Gemini requests
  • 28e2f97 feat(executor): add session isolation for grok-composer models
  • 379167c feat(translator): add benchmarking for convertSystemRoleToDeveloper with large inputs
  • f66376f feat(auth): add per-auth OAuth model alias support
  • 790ec30 feat(config): add support for rebuild_mid_system_message configuration
  • b0ca379 Merge pull request Conform Claude models listing to Anthropic API schema router-for-me/CLIProxyAPI#3834 from dcrdev/main
  • a79ae80 feat(registry): improve model fallback logic and refactor Claude model handling
  • b4bec34 feat(translator): sanitize parametersJsonSchema in OpenAI to Gemini request handling
  • 5771abb feat(management): add ResetQuota endpoint and auth manager quota reset functionality
  • 011ffe1 feat(translator): enforce FIFO order in tool call ID consumption for Gemini requests
  • 57e1bf9 feat(translator): ensure preservation of tool and call IDs in Gemini request and response translations
  • 09179a7 feat(registry): add "max" level and remove deprecated Gemini models
  • 35c3d80 feat(translator): add support for handling video URLs in Gemini requests
  • eb8d0d0 Merge pull request fix(antigravity): HOME Gemini replay and functionCall ordering before functionResponse router-for-me/CLIProxyAPI#3900 from sususu98/fix/antigravity-replay-fc-order-upstream-dev
  • bb414de feat(api): add "max" reasoning depth and service_tiers to Codex client models
  • 9a8098d feat(api): prioritize non-template Codex client models and adjust priority calculation logic
  • 1f21f94 feat(api): implement support for multi-auth expansion in plugin systems
  • 31549af fix(watcher): update Gemini provider name to "gemini-cli" in file synthesizer logic
  • 5bc0c68 feat(pluginhost): improve error handling with HTTP status codes for plugin calls
  • babef2a feat(cliproxy): add unregisterOpenAICompatExecutor and sync runtime configuration
  • 369e560 feat(api): refactor provider key logic for API key usage and add test for compatibility grouping
  • 1f2504e fix(claude): bypass signature sanitizer for non-Claude models (fix(claude): bypass signature sanitizer for non-Claude models router-for-me/CLIProxyAPI#3946)

dcrdev and others added 24 commits June 13, 2026 16:03
Anthropic's List Models response (GET /v1/models) defines each model object
with id, display_name, max_input_tokens, max_tokens, created_at and type.
The Claude case of convertModelToMap emitted an incomplete object: it dropped
max_input_tokens and max_tokens entirely and omitted display_name whenever it
was unset, so the Anthropic-compatible listing did not match the schema it
emulates.

Emit max_input_tokens from ContextLength and max_tokens from
MaxCompletionTokens (the same registry metadata the Gemini case already
surfaces as inputTokenLimit/outputTokenLimit), with fallbacks, and always
emit display_name, falling back to the model ID.
Anthropic's List Models schema types created_at as an RFC 3339 datetime
string, but the Claude case of convertModelToMap emitted model.Created
as a Unix-timestamp integer. Format it with time.RFC3339 so the listing
matches the documented schema.
/v1/models is shared by the OpenAI and Anthropic surfaces and was
dispatched to the Claude format only for claude-cli User-Agents, so
generic Anthropic API clients received the OpenAI format. Distinguish
Anthropic requests by the Anthropic-Version header (sent by every
Anthropic client, never by OpenAI/Codex clients) in addition to the
existing claude-cli check, in both unifiedModelsHandler and
handleHomeModels. Additive and non-breaking for existing clients.
- Deleted `geminicli` provider and related `Apply` logic.
- Removed all translator packages specific to Gemini CLI (Claude, Codex integrations).
- Purged associated test files for Gemini CLI translation.
- Removed `GeminiAuthenticator` and all associated authentication logic (OAuth flows, token handling, refresh logic).
- Deleted internal/executor Gemini OAuth support, including bearer token handling and runtime API logic.
- Purged all tests, configs, and command-line flags specific to Gemini OAuth flows.
- Updated documentation and aliases to reflect Gemini removal.
- Renamed `parseRetryDelay` to `ParseRetryDelay` and `deleteJSONField` to `DeleteJSONField`.
- Updated references in `antigravity_executor` and tests to use the new `helps` package.
- Adjusted import paths and test cases to ensure compatibility with the new location.
- Updated README files to reflect changes in the retry logic references.
- Updated `.github/ISSUE_TEMPLATE/bug_report.md` to remove deprecated Gemini CLI mention.
Add executor-scoped replay cache aligned with Codex HOME replay:
Scope, observe SSE/non-stream responses, store normalized thought_signature
and function_call_part items, apply on the next streamGenerateContent
request, and invalidate on invalid signature responses.

Gemini/flash/agent models use HOME replay; native per-part signature
replay is not wired on upstream/dev. Wire non-stream and stream paths
in antigravity_executor and purge expired entries from signature_cache.

Includes unit tests and HOME-provider-replay documentation.
…onResponse

When HOME replay restores a cached function_call_part and the request
already contains the matching functionResponse, insert a synthetic
role=model content with functionCall (and thoughtSignature) immediately
before that response content instead of writing into the same index.

Add regression tests for user/model functionResponse shapes.
Trim call_id once for matching-function-response checks; use args.Value()
in synthetic model functionCall insertion; guard functionResponse lookup
when call_id is empty.
- Derive replay session from generateStableSessionID when sessionId is absent
- Merge cached thoughtSignature into existing functionCall by call id
- Allow filter to pass function_call_part when only signature replay is needed
- Include native functionCall id in replay dedupe keys
- Add unit tests for signature merge, stable scope, and parallel tool ids
Add executor httptest for upstream 400 clearing HOME reasoning replay
items, and a whitespace call_id matcher regression test for replay
filtering.
…e conversions

- Updated `ConvertOpenAIResponsesRequestToOpenAIChatCompletions` to retain `tool_choice` with raw byte handling.
- Added `TestConvertOpenAIResponsesRequestToOpenAIChatCompletions_PreservesStructuredToolChoice` to ensure function and type fields are preserved in transformations.

Closes: router-for-me#3384
…onversion

- Updated handling in `ConvertOpenAIResponsesRequestToOpenAIChatCompletions` to retain `input_image` detail fields such as `image_url` and `detail`.
- Added `TestConvertOpenAIResponsesRequestToOpenAIChatCompletions_PreservesInputImageDetail` to verify preservation of image details during transformation.

Closes: router-for-me#3385
# Conflicts:
#	internal/api/handlers/management/auth_files.go
#	internal/thinking/provider/geminicli/apply.go
…ssages in OpenAI response conversion

- Enhanced `ConvertOpenAIResponsesRequestToOpenAIChatCompletions` to include `reasoning_content` in assistant and tool call messages.
- Introduced `collectOpenAIResponsesReasoningContent` for aggregating reasoning summaries.
- Added tests to validate reasoning attachment in various scenarios, including empty reasoning, tool calls, and reasoning followed by user messages.

Closes: router-for-me#3397
…versions

- Updated `ConvertOpenAIRequestToGemini` and `ConvertOpenAIRequestToCodex` to handle `input_audio`, retaining `data` and `format` fields.
- Added helper `openAIInputAudioMimeType` for determining MIME types from audio formats.
- Introduced unit tests to validate correct preservation of `input_audio` data and format.

Closes: router-for-me#3447
…e is available

- Updated `ConvertCodexResponseToClaude` to delay emitting `function_call` start events until the `name` field is resolved.
- Introduced `pendingCodexFunctionCall` for buffering incomplete function calls.
- Added tests to ensure proper behavior for deferred starts, including argument buffering and finalization.

Closes: router-for-me#3471
…N schema processing

- Updated JSON schema handling to remove `$comment` and `enumDescriptions` fields during schema transformations.
- Adjusted test cases to validate the removal of these fields both at root and nested levels.
- Expanded unsupported schema keywords to include `$comment` and `enumDescriptions` for Gemini compatibility.

Closes: router-for-me#3512
…port

- Replaced direct `strings.ToLower` usage with `util.OpenAICompatibleProviderKey` for generating provider keys.
- Updated auth and executor workflows to use namespaced keys for OpenAI-compatible providers.
- Adjusted tests to validate namespaced key handling, including new test cases for provider registration and execution logic.
- Added `OpenAICompatibleProviderKey` helper in `util` for consistent key transformations.

Closes: router-for-me#3600
…ence

- Added `normalizeCodexParallelToolCallsForTools` to conditionally remove `parallel_tool_calls` when `tools` are missing or empty.
- Integrated normalization into Codex executor workflows for improved request handling.
- Introduced unit tests to validate behavior across different tool scenarios.

Closes: router-for-me#3903
…to Gemini requests

- Implemented `applyOpenAIResponsesTextFormatToGemini` to handle `json_object` and `json_schema` formats.
- Updated generation config to set appropriate `responseMimeType` and optional `responseJsonSchema`.
- Introduced unit tests to validate correct handling of `text.format` conversion scenarios.

Closes: router-for-me#3721
- Introduced `xaiRequiresIsolatedConversation` to enforce session ID generation for `grok-composer` models.
- Updated request preparation logic to handle isolated conversations by setting `prompt_cache_key` and `x-grok-conv-id`.
- Added unit tests with coverage for session isolation, stateless models, and explicit `prompt_cache_key` scenarios.

Closes: router-for-me#3750
… with large inputs

- Introduced `BenchmarkConvertSystemRoleToDeveloperLargeInput` to evaluate performance on various input sizes and configurations.
- Improved `convertSystemRoleToDeveloper` logic to optimize JSON rebuilding and reduce unnecessary operations.
- Created helper `makeLargeResponsesInputForBenchmark` to generate test data for performance scenarios.

Closes: router-for-me#3751
- Introduced `SetOAuthModelAliasesAttribute` and `OAuthModelAliasesFromAttributes` for managing per-auth model aliases.
- Enhanced OAuth model resolution logic to prioritize per-auth aliases over global aliases.
- Updated metadata handling to extract and sanitize per-account model aliases.
- Added tests to validate alias precedence, empty attributes, and conflict scenarios.

Closes: router-for-me#3764
@github-actions github-actions Bot added the auto-sync-copilot Automated upstream sync (feat/copilot) label Jun 20, 2026
- Introduced `RebuildMidSystemMessage` field in config to move system messages into the top-level Claude system field.
- Updated executor to handle mid-system message rebuilding when enabled via config or auth attributes.
- Added unit tests to verify rebuilding behavior and default behavior when disabled.
- Updated configuration example and API handlers to support the new field.

Closes: router-for-me#3792
…l handling

- Replaced internal model-specific constants with exported defaults (`DefaultClaudeMaxInputTokens`, `DefaultClaudeMaxOutputTokens`).
- Refactored Claude model formatting to centralize schema application in `formatHomeClaudeModel`, with fields like `type`, `display_name`, and token limits.
- Added new unit tests for fallback behavior, metadata fields, and token handling in Claude and Gemini models.
- Removed deprecated test coverage for Amp provider model routes.

Closes: router-for-me#3833
… request handling

- Applied `CleanJSONSchemaForGemini` to ensure compatibility by removing unsupported fields and cleaning schema requirements.
- Added test cases to validate schema transformation, ensuring only necessary `required` fields are retained.
- Enhanced both request and response flows to consistently clean and sanitize tool parameter schemas.

Closes: router-for-me#3863
…set functionality

- Introduced a new `/reset-quota` API endpoint in the management handler to clear quota and cooldown state for auth records.
- Implemented `ResetQuota` method in the auth manager to handle runtime and registry state resets for affected models.
- Added tests to validate quota reset behavior, including proper state updates and registry consistency.
- Refactored utility functions to support deduplication and registered models handling in quota resets.

Closes: router-for-me#3866
luispater and others added 13 commits June 20, 2026 14:01
…Gemini requests

- Updated `ConvertGeminiRequestToOpenAI` to consume `tool_call_id`s in FIFO order, ensuring consistent mapping between calls and responses.
- Added fallback logic for unmatched or extra function responses to generate unique `tool_call_id`s with a `call_` prefix.
- Introduced comprehensive unit tests to validate order enforcement, distinct ID assignment, and fallback behavior.

Closes: router-for-me#3874
…request and response translations

- Updated `ConvertGeminiRequestToClaude`, `ConvertGeminiRequestToCodex`, and their respective response counterparts to include logic for retaining and using tool/call IDs when present from gateway-provided inputs.
- Enhanced pairing logic between function calls and responses to handle custom and auto-generated IDs consistently.
- Introduced tests validating ID preservation and proper behavior in both streaming and non-streaming flows.

Closes: router-for-me#3878
- Added a new "max" level to model `thinking.levels` for enhanced customization.
- Removed deprecated Gemini 3 Pro (High/Low) models and associated fields from the registry.
- Simplified `thinking` attribute structure for `grok-build-0.1` and `grok-composer-2.5-fast` models.

Closes: router-for-me#3901
- Updated `ConvertOpenAIRequestToGemini` to process `video_url` message types, extracting and embedding video metadata (MIME type and base64 data) into Gemini request parts.
- Added corresponding unit tests to validate `video_url` handling, ensuring proper extraction and data preservation.

Closes: router-for-me#3920
…eplay-fc-order-upstream-dev

fix(antigravity): HOME Gemini replay and functionCall ordering before functionResponse
…ent models

- Introduced a new "max" level for reasoning depth in Codex client model configuration, providing maximum problem-solving capability.
- Added `service_tiers` field to model responses for better tier categorization.
- Updated unit tests to validate the inclusion and default behavior of `service_tiers` and the new "max" reasoning depth.
…ority calculation logic

- Added `applyCodexClientNonTemplatePriorities` to assign higher priorities to non-template Codex client models dynamically.
- Implemented `maxCodexClientTemplatePriority` to set base priority for non-template models relative to template models.
- Updated unit tests to validate priority calculation for custom models.
- Added logic to expand single auth JSON payloads into multiple plugin virtual auth records.
- Updated related API endpoints such as `PatchAuthFileStatus` and `DeleteAuthFile` to handle plugin virtual auths with rollback mechanisms.
- Introduced `NormalizePluginOAuthCallbackProvider` and other normalization functions for better handling of OAuth callbacks.
- Enhanced tests to validate multi-auth parsing, rollback behavior, and API response consistency.
…lugin calls

- Added `rpcPluginError` to encapsulate plugin errors with HTTP status codes.
- Enhanced `decodeEnvelopeResult` to preserve and return detailed plugin errors with status codes.
- Introduced `isPluginErrorEnvelope` to identify plugin error envelopes.
- Updated plugin call logic in Unix and Windows loaders to differentiate plugin errors from system errors.
- Added unit tests to verify error handling and status code preservation.
… configuration

- Implemented `unregisterOpenAICompatExecutor` to remove OpenAI-compatible executors dynamically.
- Updated `ensureExecutorsForAuth` to unregister incompatible executors while handling plugin candidates.
- Adjusted runtime configuration logic to ensure proper synchronization during updates with `syncPluginModelRuntime`.
… for compatibility grouping

- Extracted provider key determination into `apiKeyUsageProviderKey` for reuse and better readability.
- Updated `GetAPIKeyUsage` to utilize the new function.
- Added a new test case to validate compatibility grouping logic via `compat_name` attribute.

Closes: router-for-me#3940 router-for-me#3941
…-for-me#3946)

* fix(claude): bypass signature sanitizer for non-Claude models

* test(claude): use subtests for sanitizer gate model cases
@conversun conversun merged commit a0e69be into feat/copilot Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-sync-copilot Automated upstream sync (feat/copilot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants