Skip to content

feat(executor): fix payloadModelRulesMatch for unconditional rules#927

Merged
KooshaPari merged 3 commits intomainfrom
fix/pr-11-event-order-rebased
Mar 28, 2026
Merged

feat(executor): fix payloadModelRulesMatch for unconditional rules#927
KooshaPari merged 3 commits intomainfrom
fix/pr-11-event-order-rebased

Conversation

@KooshaPari
Copy link
Copy Markdown
Owner

@KooshaPari KooshaPari commented Mar 28, 2026

Summary

Rebased version of PR #924 to resolve merge conflicts with main.

  • Fix: Empty Name in a rule means 'applies to all models'
  • Tests: 6 test functions covering 30+ test cases for split-count regression coverage

Files Changed

  • pkg/llmproxy/executor/payload_helpers.go (fix)
  • pkg/llmproxy/executor/payload_helpers_test.go (367 lines, new)
  • pkg/llmproxy/auth/qwen/qwen_token.go (minor)
  • sdk/auth/filestore.go (path-injection fix)

Supersedes PR #924 (rebased onto current main, conflicts resolved by keeping PR branch version).

Summary by CodeRabbit

  • New Features

    • Added MiniMax thinking provider support for enhanced AI reasoning capabilities.
    • Improved proxy configuration handling with enhanced URL validation and sanitization.
  • Bug Fixes

    • Fixed payload rule matching logic for empty model lists.
    • Enhanced error handling for invalid proxy URLs.
  • Chores

    • Restructured internal package organization for better maintainability.
    • Removed legacy documentation files.

claude added 3 commits March 27, 2026 20:18
…r packages

This commit removes redundant split files that were created during the refactor
split, consolidating each package back to a single implementation source:

management package:
- Removed auth_file_mgmt.go, auth_gemini.go (duplicates of auth_files.go)
- Removed auth_helpers.go, auth_file_crud.go, auth_file_patch.go (duplicates)
- Removed auth_kiro.go, auth_status.go (duplicates)
- Removed auth_anthropic.go, auth_antigravity.go, auth_codex.go
- Removed auth_github.go, auth_iflow.go, auth_kilo.go, auth_kimi.go, auth_qwen.go

executor package:
- Removed kiro_streaming_event_parser.go, kiro_streaming_transform.go
- Removed kiro_streaming_websearch.go, kiro_streaming_fallback.go
- Removed kiro_auth.go, kiro_transform.go, kiro_streaming_init.go

config package:
- Removed the entire split config module (config_io.go, config_persistence.go,
  config_providers.go, config_types.go, config_validation.go)

The canonical implementations in the monolith files remain unchanged.

Additional changes:
- Updated import paths from sdk/auth to sdk/cliproxy/auth across affected files
- Added Minimax thinking provider package
- Fix payloadModelRulesMatch to treat empty Name as unconditional rule
- Add regression tests for split-count coverage (conditional vs unconditional)
- Tests cover protocol matching, alias targeting, and filter rules
- Include TestPayloadModelRulesMatch, TestPayloadModelCandidates
- Include TestApplyPayloadConfigWithRoot_* (6 test functions, 30+ cases)
- Add path-escape validation to resolveAuthPath
- Ensure all file paths stay within configured base directory
- Normalize paths with filepath.Clean before validation
- Fixes CodeQL go/path-injection alerts
@gemini-code-assist
Copy link
Copy Markdown

Warning

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

@KooshaPari KooshaPari merged commit 9dd8941 into main Mar 28, 2026
1 check was pending
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Caution

Review failed

The pull request is closed.

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a5856ef3-a543-4c78-9f18-675aa5aacb1b

📥 Commits

Reviewing files that changed from the base of the PR and between a840496 and 91b3d67.

📒 Files selected for processing (122)
  • CODE_REFACTOR_SUMMARY.md
  • REFACTOR_COMPLETE_SUMMARY.md
  • REFACTOR_SESSION_FINAL_SUMMARY.md
  • REFACTOR_SESSION_SUMMARY.md
  • SDK_INTEGRATION_STATUS.md
  • go.mod
  • pkg/llmproxy/api/handlers/management/config_lists.go
  • pkg/llmproxy/api/handlers/management/handler.go
  • pkg/llmproxy/api/modules/amp/amp.go
  • pkg/llmproxy/api/modules/amp/model_mapping.go
  • pkg/llmproxy/api/modules/amp/secret.go
  • pkg/llmproxy/api/modules/modules.go
  • pkg/llmproxy/api/server.go
  • pkg/llmproxy/auth/antigravity/auth.go
  • pkg/llmproxy/auth/claude/utls_transport.go
  • pkg/llmproxy/auth/copilot/oauth.go
  • pkg/llmproxy/auth/diff/config_diff.go
  • pkg/llmproxy/auth/diff/diff_generated.go
  • pkg/llmproxy/auth/diff/model_hash.go
  • pkg/llmproxy/auth/diff/models_summary.go
  • pkg/llmproxy/auth/diff/oauth_excluded.go
  • pkg/llmproxy/auth/diff/oauth_model_alias.go
  • pkg/llmproxy/auth/diff/openai_compat.go
  • pkg/llmproxy/auth/gemini/gemini_auth.go
  • pkg/llmproxy/auth/kiro/aws_auth.go
  • pkg/llmproxy/auth/kiro/background_refresh.go
  • pkg/llmproxy/auth/kiro/codewhisperer_client.go
  • pkg/llmproxy/auth/kiro/oauth.go
  • pkg/llmproxy/auth/kiro/oauth_web.go
  • pkg/llmproxy/auth/kiro/refresh_manager.go
  • pkg/llmproxy/auth/kiro/social_auth.go
  • pkg/llmproxy/auth/kiro/sso_oidc.go
  • pkg/llmproxy/auth/kiro/usage_checker.go
  • pkg/llmproxy/auth/qwen/qwen_auth.go
  • pkg/llmproxy/auth/qwen/qwen_token.go
  • pkg/llmproxy/auth/synthesizer/config.go
  • pkg/llmproxy/auth/synthesizer/context.go
  • pkg/llmproxy/auth/synthesizer/helpers.go
  • pkg/llmproxy/auth/synthesizer/synthesizer_generated.go
  • pkg/llmproxy/auth/vertex/vertex_credentials.go
  • pkg/llmproxy/cmd/anthropic_login.go
  • pkg/llmproxy/cmd/antigravity_login.go
  • pkg/llmproxy/cmd/cursor_login.go
  • pkg/llmproxy/cmd/generic_apikey_login.go
  • pkg/llmproxy/cmd/github_copilot_login.go
  • pkg/llmproxy/cmd/iflow_cookie.go
  • pkg/llmproxy/cmd/iflow_login.go
  • pkg/llmproxy/cmd/kilo_login.go
  • pkg/llmproxy/cmd/kimi_login.go
  • pkg/llmproxy/cmd/kiro_login.go
  • pkg/llmproxy/cmd/login.go
  • pkg/llmproxy/cmd/minimax_login.go
  • pkg/llmproxy/cmd/openai_device_login.go
  • pkg/llmproxy/cmd/openai_login.go
  • pkg/llmproxy/cmd/qwen_login.go
  • pkg/llmproxy/cmd/roo_login.go
  • pkg/llmproxy/cmd/run.go
  • pkg/llmproxy/cmd/setup.go
  • pkg/llmproxy/cmd/thegent_login.go
  • pkg/llmproxy/cmd/vertex_import.go
  • pkg/llmproxy/config/config_io.go
  • pkg/llmproxy/config/config_persistence.go
  • pkg/llmproxy/config/config_providers.go
  • pkg/llmproxy/config/config_types.go
  • pkg/llmproxy/config/config_validation.go
  • pkg/llmproxy/config/sdk_config.go
  • pkg/llmproxy/executor/aistudio_executor.go
  • pkg/llmproxy/executor/antigravity_executor.go
  • pkg/llmproxy/executor/claude_executor.go
  • pkg/llmproxy/executor/codex_executor.go
  • pkg/llmproxy/executor/gemini_cli_executor.go
  • pkg/llmproxy/executor/gemini_executor.go
  • pkg/llmproxy/executor/gemini_vertex_executor.go
  • pkg/llmproxy/executor/github_copilot_executor.go
  • pkg/llmproxy/executor/iflow_executor.go
  • pkg/llmproxy/executor/kilo_executor.go
  • pkg/llmproxy/executor/kimi_executor.go
  • pkg/llmproxy/executor/logging_helpers.go
  • pkg/llmproxy/executor/oauth_upstream.go
  • pkg/llmproxy/executor/openai_compat_executor.go
  • pkg/llmproxy/executor/openai_models_fetcher.go
  • pkg/llmproxy/executor/payload_helpers.go
  • pkg/llmproxy/executor/payload_helpers_test.go
  • pkg/llmproxy/executor/qwen_executor.go
  • pkg/llmproxy/executor/thinking_providers.go
  • pkg/llmproxy/interfaces/error_message.go
  • pkg/llmproxy/logging/global_logger.go
  • pkg/llmproxy/registry/model_registry.go
  • pkg/llmproxy/thinking/apply.go
  • pkg/llmproxy/thinking/provider/iflow/apply.go
  • pkg/llmproxy/thinking/provider/minimax/minimax.go
  • pkg/llmproxy/thinking/strip.go
  • pkg/llmproxy/translator/antigravity/gemini/antigravity_gemini_request.go
  • pkg/llmproxy/translator/gemini-cli/gemini/gemini-cli_gemini_request.go
  • pkg/llmproxy/translator/gemini/gemini-cli/gemini_gemini-cli_request.go
  • pkg/llmproxy/translator/gemini/gemini/gemini_gemini_request.go
  • pkg/llmproxy/translator/openai/claude/openai_claude_response.go
  • pkg/llmproxy/util/provider.go
  • pkg/llmproxy/util/provider_test.go
  • pkg/llmproxy/util/proxy.go
  • pkg/llmproxy/util/util.go
  • pkg/llmproxy/util/util_test.go
  • pkg/llmproxy/watcher/clients.go
  • pkg/llmproxy/watcher/config_reload.go
  • pkg/llmproxy/watcher/diff/config_diff.go
  • pkg/llmproxy/watcher/diff/model_hash.go
  • pkg/llmproxy/watcher/diff/models_summary.go
  • pkg/llmproxy/watcher/diff/oauth_excluded.go
  • pkg/llmproxy/watcher/diff/oauth_model_alias.go
  • pkg/llmproxy/watcher/diff/openai_compat.go
  • pkg/llmproxy/watcher/dispatcher.go
  • pkg/llmproxy/watcher/events.go
  • pkg/llmproxy/watcher/synthesizer/config.go
  • pkg/llmproxy/watcher/synthesizer/context.go
  • pkg/llmproxy/watcher/synthesizer/file.go
  • pkg/llmproxy/watcher/synthesizer/helpers.go
  • pkg/llmproxy/watcher/watcher.go
  • sdk/auth/filestore.go
  • sdk/config/config.go
  • test/amp_management_test.go
  • test/builtin_tools_translation_test.go
  • test/thinking_conversion_test.go

📝 Walkthrough

Walkthrough

This PR relocates internal package structures to public pkg/llmproxy namespace across the codebase, removes config infrastructure files (io/persistence/validation/types), introduces a new SDK config structure, and adds minimax thinking provider support with related thinking-effort enhancements.

Changes

Cohort / File(s) Summary
Documentation cleanup
CODE_REFACTOR_SUMMARY.md, REFACTOR_COMPLETE_SUMMARY.md, REFACTOR_SESSION_FINAL_SUMMARY.md, REFACTOR_SESSION_SUMMARY.md, SDK_INTEGRATION_STATUS.md
Removed session documentation and status tracking files totaling ~560 lines.
Config package restructuring
pkg/llmproxy/config/config_io.go, config_persistence.go, config_providers.go, config_types.go, config_validation.go
Deleted entire configuration infrastructure including YAML loading/persistence (~295, ~670, ~37, ~620, ~460 lines respectively), sanitization routines, and type definitions. Environment override logic, comment preservation, and validation removed.
SDK config update
pkg/llmproxy/config/sdk_config.go
Modified to define new SDKConfig struct with ProxyURL field; removed internalconfig import dependency.
Import migration: Config
pkg/llmproxy/api/.../*, pkg/llmproxy/auth/.../*, pkg/llmproxy/executor/.../*, pkg/llmproxy/cmd/.../*, pkg/llmproxy/watcher/.../*, pkg/llmproxy/util/.../*, ~50+ files
Updated all imports from internal/config to pkg/llmproxy/config, affecting Config type references across handlers, auth modules, executors, and utilities.
Import migration: Translator & Auth
pkg/llmproxy/translator/.../*, pkg/llmproxy/auth/.../*, pkg/llmproxy/watcher/events.go
Relocated translator and auth imports from internal/ to pkg/llmproxy/ namespace including Gemini common, Codex, and Kiro auth modules.
Payload & stream handling
pkg/llmproxy/executor/payload_helpers.go, pkg/llmproxy/executor/payload_helpers_test.go, pkg/llmproxy/translator/openai/claude/openai_claude_response.go
Enhanced empty models/rules matching logic; refactored OpenAI→Claude response streaming with upfront stream detection and flattened control flow; added 367 lines of payload helper unit tests.
Thinking providers
pkg/llmproxy/thinking/provider/minimax/minimax.go, pkg/llmproxy/thinking/apply.go, pkg/llmproxy/thinking/provider/iflow/apply.go, pkg/llmproxy/thinking/strip.go
Added minimax provider registration; extended iFlow config parsing for reasoning effort with normalized modes (None/Auto/Level); updated MiniMax field deletion and iFlow JSON path pruning.
SDK integration
sdk/config/config.go, sdk/auth/filestore.go, pkg/llmproxy/util/proxy.go
Switched type aliases from pkgconfig.* to llmproxyconfig.*; refactored auth path resolution to validate base-directory containment; expanded proxy URL handling with sanitization and nil client allocation.
Test & build
go.mod, test/amp_management_test.go, test/builtin_tools_translation_test.go, test/thinking_conversion_test.go
Reformatted go.mod indentation; updated test imports to pkg/llmproxy packages; added minimax provider to thinking conversion tests.
Minor updates
pkg/llmproxy/auth/vertex/vertex_credentials.go, pkg/llmproxy/executor/thinking_providers.go, pkg/llmproxy/interfaces/error_message.go, pkg/llmproxy/registry/model_registry.go
Added Vertex auth directory constant; added minimax blank import; updated misc/interfaces package paths.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

HELIOS-CODEX, HELIOS-CODEX-L0, refactor, package-migration

Poem

🐰 From internal depths to pkg light so bright,
Config's structure now dances in public sight,
Minimax whispers join the thinking choir,
Handlers and proxies climb the package spire!
Refactored and relocated with code-review care.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pr-11-event-order-rebased

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 KooshaPari deleted the fix/pr-11-event-order-rebased branch March 29, 2026 07:09
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