Skip to content

migrate #1314: feature(ampcode): Improves AMP model mapping with alias support#471

Closed
KooshaPari wants to merge 1577 commits intomainfrom
migrated/router-20260225060000-feature_ampcode-alias
Closed

migrate #1314: feature(ampcode): Improves AMP model mapping with alias support#471
KooshaPari wants to merge 1577 commits intomainfrom
migrated/router-20260225060000-feature_ampcode-alias

Conversation

@KooshaPari
Copy link
Owner

Migrated from upstream PR router-for-me#1314 (feature/ampcode-alias) with fallback-theirs

luispater and others added 30 commits January 15, 2026 03:27
feat(translator): add function name to response output item serialization

- Included `item.name` in the serialized response output to enhance output item handling.
This change introduces environment variable interpolation for volume paths, allowing users to customize where configuration, authentication, and log data are stored.

Why: Makes the project easier to deploy on various hosting environments that require decoupled data management without needing to modify the core docker-compose.yml..

Key points:

Defaults to existing paths (./config.yaml, ./auths, ./logs) to ensure zero breaking changes for current users.

Follows the existing naming convention used in the project.

Enhances portability for CI/CD and cloud-native deployments.
- Updated `ideType` to `ANTIGRAVITY` in request payload.
- Introduced tier-selection logic to determine default tier for onboarding.
- Added `antigravityOnboardUser` function for project ID retrieval via polling.
- Enhanced error handling and response decoding for onboarding flow.
…parison functions

feat(auth): fetch and update Antigravity project ID from metadata during filestore operations

- Added support to retrieve and update `project_id` using the access token if missing in metadata.
- Integrated HTTP client to fetch project ID dynamically.
- Enhanced metadata persistence logic.
- Added `metadataEqualIgnoringTimestamps` to compare metadata while ignoring volatile fields.
- Prevented redundant writes caused by changes in timestamp-related fields.
- Improved efficiency in filestore operations by skipping unnecessary updates.
…ations

This change removes the translation logic for several non-standard, proprietary extensions used to configure thinking/reasoning. Specifically, support for `extra_body.google.thinking_config` and the Anthropic-style `thinking` object has been dropped from the OpenAI request translators.

This simplification streamlines the translators, focusing them on the standard `reasoning_effort` parameter. It also removes the need to look up model information from the registry within these components.

BREAKING CHANGE: Support for non-standard thinking configurations via `extra_body.google.thinking_config` and the Anthropic-style `thinking` object has been removed. Clients should now use the standard `reasoning_effort` parameter to control reasoning.
luispater and others added 23 commits February 1, 2026 05:29
Introduce `Filter` rules in the payload configuration to remove specified JSON paths from the payload. Update related helper functions and add examples to `config.example.yaml`.
Add CLIProxyAPI Tray information to README
Add CLIProxyAPI Tray section to README_CN.md
…-error-logs-max-files

feat(logging): make error-logs-max-files configurable
…e-sync-race-condition

fix: prevent race condition in objectstore auth sync
…treaming-finish-reason-tool-calls

fix(antigravity): preserve finish_reason tool_calls across streaming chunks
…hange-error-status-code

fix: change HTTP status code from 400 to 502 when no provider available
Uses centralized context keys for accessing mapped and fallback models.

This change deprecates the string-based context keys used in the AMP fallback handlers in favor of the `ctxkeys` package, promoting consistency and reducing the risk of typos.
The authentication conductor now retrieves fallback models using the shared `ctxkeys` constants.
Improves AMP request handling by consolidating model mapping logic into a helper function for better readability and maintainability.

Enhances error handling for premature client connection closures during reverse proxy operations by explicitly acknowledging and swallowing the ErrAbortHandler panic, preventing noisy stack traces.

Removes unused method `findProviderViaOAuthAlias` from the `DefaultModelMapper`.
Migrates the AMP module to a new unified routing system, replacing the fallback handler with a router-based approach.

This change introduces a `ModelRoutingWrapper` that handles model extraction, routing decisions, and proxying based on provider availability and model mappings.
It provides a more flexible and maintainable routing mechanism by centralizing routing logic.

The changes include:
- Introducing new `routing` package with core routing logic.
- Creating characterization tests to capture existing behavior.
- Implementing model extraction and rewriting.
- Updating AMP module routes to utilize the new routing wrapper.
- Deprecating `FallbackHandler` in favor of the new `ModelRoutingWrapper`.
refactor(api): centralize config change logging
refactor(codex): remove codex instructions injection support
Addresses an issue where thinking signature validation fails due to model mapping and empty internal registry.

- Implements a fallback mechanism in the router to use the global model registry when the internal registry is empty. This ensures that models registered via API keys are correctly resolved even without local provider configurations.
- Modifies `GetModelGroup` to use registry-based grouping in addition to name pattern matching, covering cases where models are registered with API keys but lack provider names in their names.
- Updates signature validation to compare model groups instead of exact model names.

These changes resolve thinking signature validation errors and improve the accuracy of model resolution.
Addresses a Claude API requirement where assistant messages with tool use must have a thinking block when thinking is enabled.

This commit injects an empty thinking block into assistant messages that include tool use but lack a thinking block. This ensures compatibility with the Claude API when the thinking feature is enabled.
…grated/router-20260225060000-feature_ampcode-alias
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

Important

Review skipped

Too many files!

This PR contains 191 files, which is 41 over the limit of 150.

📥 Commits

Reviewing files that changed from the base of the PR and between 23c05ea and 79cf3ec.

⛔ Files ignored due to path filters (2)
  • assets/cubence.png is excluded by !**/*.png
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (191)
  • .github/required-checks.txt
  • .github/workflows/docker-image.yml
  • .github/workflows/pr-path-guard.yml
  • .github/workflows/pr-test-build.yml
  • .github/workflows/release.yaml
  • .gitignore
  • .goreleaser.yml
  • Dockerfile
  • README.md
  • README_CN.md
  • cmd/server/main.go
  • config.example.yaml
  • docker-compose.yml
  • docs/sdk-access.md
  • docs/sdk-access_CN.md
  • examples/custom-provider/main.go
  • examples/http-request/main.go
  • go.mod
  • internal/access/config_access/provider.go
  • internal/access/reconcile.go
  • internal/api/handlers/management/api_tools.go
  • internal/api/handlers/management/auth_files.go
  • internal/api/handlers/management/config_basic.go
  • internal/api/handlers/management/config_lists.go
  • internal/api/handlers/management/oauth_sessions.go
  • internal/api/middleware/request_logging.go
  • internal/api/middleware/response_writer.go
  • internal/api/modules/amp/amp.go
  • internal/api/modules/amp/fallback_handlers.go
  • internal/api/modules/amp/fallback_handlers_characterization_test.go
  • internal/api/modules/amp/fallback_handlers_test.go
  • internal/api/modules/amp/model_mapping.go
  • internal/api/modules/amp/proxy.go
  • internal/api/modules/amp/proxy_test.go
  • internal/api/modules/amp/response_rewriter.go
  • internal/api/modules/amp/routes.go
  • internal/api/server.go
  • internal/auth/claude/anthropic_auth.go
  • internal/auth/claude/oauth_server.go
  • internal/auth/codex/oauth_server.go
  • internal/auth/iflow/iflow_auth.go
  • internal/browser/browser.go
  • internal/cache/signature_cache.go
  • internal/cache/signature_cache_test.go
  • internal/cmd/anthropic_login.go
  • internal/cmd/auth_manager.go
  • internal/cmd/iflow_login.go
  • internal/cmd/login.go
  • internal/cmd/openai_login.go
  • internal/cmd/qwen_login.go
  • internal/cmd/run.go
  • internal/config/config.go
  • internal/config/oauth_model_alias_migration.go
  • internal/config/oauth_model_alias_migration_test.go
  • internal/config/oauth_model_alias_test.go
  • internal/config/sdk_config.go
  • internal/constant/constant.go
  • internal/logging/global_logger.go
  • internal/managementasset/updater.go
  • internal/registry/model_definitions.go
  • internal/registry/model_definitions_static_data.go
  • internal/registry/model_registry.go
  • internal/routing/adapter.go
  • internal/routing/ctxkeys/keys.go
  • internal/routing/executor.go
  • internal/routing/extractor.go
  • internal/routing/extractor_test.go
  • internal/routing/provider.go
  • internal/routing/providers/apikey.go
  • internal/routing/providers/oauth.go
  • internal/routing/rewriter.go
  • internal/routing/rewriter_test.go
  • internal/routing/router.go
  • internal/routing/router_test.go
  • internal/routing/router_v2_test.go
  • internal/routing/testutil/fake_handler.go
  • internal/routing/testutil/fake_proxy.go
  • internal/routing/types.go
  • internal/routing/wrapper.go
  • internal/runtime/executor/aistudio_executor.go
  • internal/runtime/executor/antigravity_executor.go
  • internal/runtime/executor/cache_helpers.go
  • internal/runtime/executor/claude_executor.go
  • internal/runtime/executor/claude_executor_test.go
  • internal/runtime/executor/codex_executor.go
  • internal/runtime/executor/gemini_cli_executor.go
  • internal/runtime/executor/gemini_executor.go
  • internal/runtime/executor/gemini_vertex_executor.go
  • internal/runtime/executor/iflow_executor.go
  • internal/runtime/executor/logging_helpers.go
  • internal/runtime/executor/openai_compat_executor.go
  • internal/runtime/executor/proxy_helpers.go
  • internal/runtime/executor/qwen_executor.go
  • internal/runtime/executor/thinking_providers.go
  • internal/runtime/executor/token_helpers.go
  • internal/runtime/executor/usage_helpers.go
  • internal/store/gitstore.go
  • internal/thinking/apply.go
  • internal/thinking/provider/antigravity/apply.go
  • internal/thinking/provider/claude/apply.go
  • internal/thinking/provider/claude/apply_test.go
  • internal/thinking/provider/gemini/apply.go
  • internal/thinking/provider/geminicli/apply.go
  • internal/thinking/provider/openai/apply.go
  • internal/translator/antigravity/claude/antigravity_claude_request.go
  • internal/translator/antigravity/claude/antigravity_claude_request_test.go
  • internal/translator/antigravity/gemini/antigravity_gemini_request.go
  • internal/translator/antigravity/openai/chat-completions/antigravity_openai_request.go
  • internal/translator/antigravity/openai/responses/antigravity_openai-responses_request.go
  • internal/translator/claude/gemini-cli/claude_gemini-cli_request.go
  • internal/translator/claude/gemini/claude_gemini_request.go
  • internal/translator/claude/openai/chat-completions/claude_openai_request.go
  • internal/translator/claude/openai/chat-completions/claude_openai_response.go
  • internal/translator/claude/openai/responses/claude_openai-responses_request.go
  • internal/translator/codex/claude/codex_claude_request.go
  • internal/translator/codex/claude/codex_claude_response.go
  • internal/translator/codex/gemini-cli/codex_gemini-cli_request.go
  • internal/translator/codex/gemini/codex_gemini_request.go
  • internal/translator/codex/openai/chat-completions/codex_openai_request.go
  • internal/translator/codex/openai/chat-completions/codex_openai_response.go
  • internal/translator/codex/openai/responses/codex_openai-responses_request.go
  • internal/translator/codex/openai/responses/codex_openai-responses_request_test.go
  • internal/translator/gemini-cli/claude/gemini-cli_claude_request.go
  • internal/translator/gemini-cli/gemini/gemini-cli_gemini_request.go
  • internal/translator/gemini-cli/openai/chat-completions/gemini-cli_openai_request.go
  • internal/translator/gemini-cli/openai/chat-completions/gemini-cli_openai_response.go
  • internal/translator/gemini-cli/openai/responses/gemini-cli_openai-responses_request.go
  • internal/translator/gemini/claude/gemini_claude_request.go
  • internal/translator/gemini/gemini-cli/gemini_gemini-cli_request.go
  • internal/translator/gemini/gemini/gemini_gemini_request.go
  • internal/translator/gemini/openai/chat-completions/gemini_openai_request.go
  • internal/translator/gemini/openai/chat-completions/gemini_openai_response.go
  • internal/translator/gemini/openai/responses/gemini_openai-responses_request.go
  • internal/translator/init.go
  • internal/translator/openai/claude/openai_claude_request.go
  • internal/translator/openai/claude/openai_claude_request_test.go
  • internal/translator/openai/claude/openai_claude_response.go
  • internal/translator/openai/gemini-cli/openai_gemini_request.go
  • internal/translator/openai/gemini/openai_gemini_request.go
  • internal/translator/openai/openai/chat-completions/openai_openai_request.go
  • internal/translator/openai/openai/responses/openai_openai-responses_request.go
  • internal/util/claude_model_test.go
  • internal/util/gemini_schema.go
  • internal/util/gemini_schema_test.go
  • internal/util/translator.go
  • internal/watcher/clients.go
  • internal/watcher/diff/config_diff.go
  • internal/watcher/events.go
  • internal/watcher/synthesizer/config.go
  • internal/watcher/synthesizer/config_test.go
  • internal/watcher/synthesizer/file.go
  • internal/watcher/synthesizer/file_test.go
  • internal/watcher/synthesizer/helpers.go
  • internal/watcher/synthesizer/helpers_test.go
  • internal/watcher/watcher.go
  • sdk/access/errors.go
  • sdk/access/manager.go
  • sdk/access/registry.go
  • sdk/api/handlers/claude/code_handlers.go
  • sdk/api/handlers/gemini/gemini-cli_handlers.go
  • sdk/api/handlers/gemini/gemini_handlers.go
  • sdk/api/handlers/handlers.go
  • sdk/api/handlers/handlers_stream_bootstrap_test.go
  • sdk/api/handlers/openai/openai_handlers.go
  • sdk/api/handlers/openai/openai_responses_compact_test.go
  • sdk/api/handlers/openai/openai_responses_handlers.go
  • sdk/api/management.go
  • sdk/auth/antigravity.go
  • sdk/auth/claude.go
  • sdk/auth/codex.go
  • sdk/auth/filestore.go
  • sdk/auth/iflow.go
  • sdk/auth/manager.go
  • sdk/auth/qwen.go
  • sdk/auth/refresh_registry.go
  • sdk/cliproxy/auth/conductor.go
  • sdk/cliproxy/auth/oauth_model_alias.go
  • sdk/cliproxy/auth/oauth_model_alias_test.go
  • sdk/cliproxy/auth/selector.go
  • sdk/cliproxy/auth/selector_test.go
  • sdk/cliproxy/auth/types.go
  • sdk/cliproxy/builder.go
  • sdk/cliproxy/executor/types.go
  • sdk/cliproxy/service.go
  • sdk/cliproxy/service_oauth_model_alias_test.go
  • sdk/cliproxy/types.go
  • sdk/cliproxy/watcher.go
  • sdk/config/config.go
  • test/builtin_tools_translation_test.go
  • test/config_migration_test.go
  • test/thinking_conversion_test.go

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch migrated/router-20260225060000-feature_ampcode-alias

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@KooshaPari
Copy link
Owner Author

Superseded by layered CI-fix PR flow. Continuing in ci/fix branch PR #508.

@KooshaPari KooshaPari closed this Feb 26, 2026
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.