Sync upstream v7.2.15 → v7.2.73 (preserve ampeco patches 1-5) - #4
Merged
Conversation
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.
…file uploads - Implemented `TestUploadAuthFile_PreservesPriorityAttributes` to ensure priority attributes and metadata are preserved during auth file uploads. - Updated `UploadAuthFile` logic to utilize `SynthesizeAuthFile` for better handling of generated auth attributes and metadata. Closes: router-for-me#2924
…_text` in OpenAI responses - Added `TestConvertOpenAIChatCompletionsResponseToOpenAIResponses_CompletedOmitsTopLevelOutputText` to ensure `output_text` is excluded in streamed responses. - Added `TestConvertOpenAIChatCompletionsResponseToOpenAIResponses_ToolCallCompletedOmitsTopLevelOutputText` to validate behavior during tool call completions. - Introduced `TestConvertOpenAIChatCompletionsResponseToOpenAIResponsesNonStream_OmitsTopLevelOutputText` to confirm the omission of `output_text` in non-streamed responses. - Expanded test coverage to ensure consistency with native OpenAI responses.
…ripping and sanitize tool call IDs - Introduced tests for `ConvertOpenAIRequestToGemini`, `ConvertOpenAIResponsesRequestToGemini`, and related Claude functions to ensure trailing model-prefill turns are removed. - Enhanced tool call ID handling with `util.SanitizeClaudeToolID` to standardize IDs in Claude-related conversions and tests. - Updated logic in Gemini and Claude translators to handle edge cases for trailing assistant prefill and tool ID sanitization, ensuring compatibility across input variants. Closes: router-for-me#3113
- 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.
This reverts commit 365e8fc.
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.
…et and no level - Updated Gemini, Gemini CLI, and Antigravity logic to delete `thinkingConfig` when `ModeNone` is set, `Budget=0`, and `Level` is empty. - Adjusted tests to validate this behavior across multiple scenarios and models with zero-allowed configurations. - Extended test cases for additional coverage of mixed-model behavior. Closes: router-for-me#3138
…de `properties` field - Added `TestConvertClaudeRequestToOpenAI_ToolSchemaAddsMissingObjectProperties` to validate automatic addition of missing `properties` in `object` schemas. - Introduced `normalizeObjectSchemaProperties` to recursively ensure schemas of type `object` include an empty `properties` field if absent. - Updated `ConvertClaudeRequestToOpenAI` to apply schema normalization for improved compatibility with OpenAI schema expectations. Closes: router-for-me#3165
- Introduced `TestRequestCodexTokenCompletionKeepsConcurrentSessionPending` to validate proper handling of concurrent OAuth sessions. - Refactored Codex OAuth logic to use `newCodexOAuthService` for improved testability. Closes: router-for-me#3171
…roxying - Introduced the `gpt-image-2` model in Codex built-ins and updated visibility logic in the registry. - Added direct proxy support for OpenAI image generation and editing endpoints. - Implemented new execution paths for `/images/generations` and `/images/edit`, ensuring seamless handling for both JSON and multipart payloads. - Expanded test coverage to validate the new model and direct proxy features, including streaming scenarios and error handling.
…able flag - Updated error handling in `RPopAuth` to distinguish `auth_not_found` from transport errors. - Added a new test, `TestPickNextViaHomeClassifiesTransportErrorsAsHomeUnavailable`, to validate correct error classification and retryable property.
…gement save hook - Refactored `ConfigReloadHook` to use `reloadConfigFromWatcher` for consistency. - Added async `reloadConfigAfterManagementSaveAsync` to handle post-save operations. - Introduced `ReloadConfigIfChanged` in watcher for manual trigger support. - Enhanced config reload paths to separate auth synthesis from standard updates. - Updated `applyConfigUpdate` logic to allow more granular reload behaviors. Closes: router-for-me#3235
- Added logic in `ConvertOpenAIResponsesRequestToClaude` to exclude `apply_patch` custom tools. - Introduced `isOpenAIResponsesApplyPatchCustomTool` helper function to identify and filter the tool. - Added `TestConvertOpenAIResponsesRequestToClaude_DropsApplyPatchCustomTool` to validate the behavior. Closes: router-for-me#3243
…tests - Added `normalizeCodexServiceTier` to standardize `service_tier` values (`fast` to `priority`, omit unsupported tiers). - Updated `ConvertClaudeRequestToCodex` to apply normalization logic. - Introduced `TestConvertClaudeRequestToCodex_ServiceTier` to validate behavior across various `service_tier` inputs. Closes: router-for-me#3276 router-for-me#3294
…mations - Added `convertResponsesToolToOpenAIChatTools` and helper methods to handle namespace tools during request conversions. - Enhanced response handling to restore namespace context for function calls using `applyResponsesFunctionCallNamespaceFields` and related utilities. - Updated tests to validate namespace flattening, function call restoration, and non-stream response handling. Closes: router-for-me#3298
…ry logic - Introduced `SetTransientErrorCooldownSeconds` to enable configurable cooldowns for transient errors (e.g., 408/500/502/503/504). - Updated retry scheduling logic to use the new `nextTransientErrorRetryAfter` function. - Modified config parsing to include `transient-error-cooldown-seconds` with support for disabling or defaulting to legacy behavior. - Expanded tests to validate transient cooldown logic with various configurations and edge cases. Closes: router-for-me#3315
… store - Introduced `CooldownStateStore` interface for managing independent cooldown state persistence. - Implemented `FileCooldownStateStore` for storing cooldown states as per-auth `.cds` files with atomic writes and stale file cleanup. - Enhanced `Manager` to support restoring state from `CooldownStateStore` and persisting state changes during auth updates. - Updated tests to validate cooldown state saving, loading, concurrency handling, and error scenarios. Closes: router-for-me#3368
…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
xAI Responses does not accept namespace tool containers, so the executor flattens nested tools before forwarding them upstream. The original namespace support in 8b3670b moved children to the top level but discarded their namespace identity; ca67caf later retained namespace context only for targeted schema simplification. Qualify flattened names to avoid collisions, normalize namespaced function-call history, and restore name plus namespace on HTTP and WebSocket responses. This keeps Codex MCP routing intact without changing the existing xAI tool_search filtering policy.
Use exact namespace separator matching, normalize replay-inserted calls, preserve payloads on JSON update failures, and remove redundant completed-response restoration.
…ing-replay feat(xai): encrypted reasoning replay for Responses/Claude
…n in websocket input Closes: router-for-me#4227
…ce-tool-routing
…-me#4276) Load codex_client_models.json like models.json with validation, revisioned handler reloads, CI bake, and Home-aware updater gates so list IDs still come from Home while templates can refresh on the edge.
…DME files - Introduced logo assets (`Kimi`, `OpenAI`, `Claude`, `Gemini`, `Grok`) under `assets/logo/`. - Updated multilingual README files (`README.md`, `README_JA.md`, `README_CN.md`) to include provider SVG logos and enhance descriptions for supported APIs. - Improved clarity of provider details with tables for better readability.
…tom-tool-search fix(codex): 仅为有模板的纯 Codex 路由保留 tool search
…pted_content (router-for-me#4281) Previously each dropped encrypted_content re-ran sjson.DeleteBytes on the whole body/array per item, causing O(n^2) work on inputs with many reasoning items. Now the array is walked once, editing only offending items in place and lazily building a replacement "input" array via strings.Builder. The builder stays nil (no allocation) when nothing needs sanitizing, and the array is spliced back with a single SetRawBytes call.
…ter-for-me#4285) * fix(executor): strip orphan reasoning ids when store is disabled Codex backend requires store=false and treats reasoning items with an id but no usable encrypted_content as store lookups, which 404 with "Item with id not found". Drop those orphan ids after removing invalid encrypted_content (and when encrypted_content is already missing), while preserving ids when store=true. * fix(executor): skip id delete when reasoning item has no id Avoid sjson.Delete on encrypted_content drops that never carried an id, matching the orphan-id path's Exists() guard.
…earch-history-4282
…rt to distinguish internal X Search traces - Added `clientDeclaredTools` to `xaiInternalXSearchResponseFilter` for improved filtering precision. - Implemented `collectXAIClientDeclaredToolKeys` to register client-declared tools with effective normalization to function calls. - Prevented leakage of internal traces (e.g., `xs_call-*`) while preserving client-declared tools with overlapping names. - Introduced multiple test cases to ensure filter correctness and preserve expected WebSocket response outputs. - Enhanced completed output handling in response filtering. Closes: router-for-me#4282 / PR router-for-me#4284.
- Introduced `xai-api-key` to configuration for supporting xAI provider integration. - Added API key operations: creation, updates, deletion, and sanitization. - Implemented backend enhancements for credential-specific routing, response filtering with model aliasing, and WebSocket handling for xAI services. - Included extensive test coverage to validate configuration parsing, CRUD operations, and the new functionalities. - Updated related modules to handle `xai-api-key`, including the watcher, management handlers, and configuration sanitizers.
…inject Normalize and drop tool_choice entries that reference tools removed by normalizeXAITools before injecting native x_search, then allow x_search in allowed_tools without duplicates so Grok can select the injected tool.
…to resolve variable mismatch during FreeBSD builds
# Conflicts: # .github/workflows/release.yaml # README.md # internal/runtime/executor/claude_executor_test.go # internal/translator/openai/claude/openai_claude_request.go
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.
Summary
v7.2.73into the fork (previous base:v7.2.15, synced Jun 17).7c390a7aClaude Code session caching,28e2f979session isolation,2075f77ccache_tokens handling).Patch survival
reasoningfallback, OpenAI→Claude response): auto-merged, tests pass.cache_controlstrip, Claude→OpenAI request): conflict with upstream's newnormalizeObjectSchemaProperties— both kept.sk-ant-oat01-*): auto-merged, tests pass..github/scripts/refresh-model-catalogs.sh— the post-refresh strip now lives there (single edit, covers all 4 build jobs). Upstream's in-treemodels.jsonno longer carries Claude antigravity entries; the script guard protects against the remote catalog re-adding them.Verification
go build ./...clean,gofmtclean,go vetclean on touched packages.go test ./...passes locally (exit 0).🤖 Generated with Claude Code
https://claude.ai/code/session_012fqS9zcEpky5VLyXMXxvJA