Skip to content

fix: layer 2 — unify internal and pkg/llmproxy config types#408

Merged
KooshaPari merged 1 commit intoclean-mainfrom
fix/full-sdk-unification
Feb 25, 2026
Merged

fix: layer 2 — unify internal and pkg/llmproxy config types#408
KooshaPari merged 1 commit intoclean-mainfrom
fix/full-sdk-unification

Conversation

@KooshaPari
Copy link
Copy Markdown
Owner

Summary

Eliminates the import-cycle-prone alias pattern in pkg/llmproxy/config by moving SDKConfig and StreamingConfig definitions directly into the pkg layer. Adds air.toml for hot-reload dev tooling.

Changes

  • pkg/llmproxy/config/sdk_config.go (deleted): Removed type alias file that re-exported internal/config.SDKConfig
  • pkg/llmproxy/config/sdk_types.go (new): Inline definitions of SDKConfig and StreamingConfig — no longer depends on internal/config for these types
  • air.toml (new): Hot-reload config for air dev server targeting cmd/server

Motivation

The alias pattern (type SDKConfig = internalconfig.SDKConfig) creates a direct import dependency from pkg/ to internal/. Moving the types to pkg/ makes the dependency graph cleaner and avoids future circular import issues.

Stack Position

Layer 2 of stacked merge (base: clean-main, depends on Layer 1)

Test plan

  • go build ./... passes
  • go vet ./... passes
  • No import cycle errors
  • All callers of config.SDKConfig still compile (type is structurally identical)

- Add SDK types to pkg/llmproxy/config
- Remove sdk_config.go (was causing type conflicts)
- Add air.toml for hot reload development
- Build succeeds with unified types
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @KooshaPari, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the configuration type definitions within the llmproxy package to resolve potential import cycle issues by making SDKConfig and StreamingConfig self-contained. Additionally, it integrates the air hot-reload development tool to streamline the development workflow for the server component.

Highlights

  • Configuration Refactoring: Eliminated an import-cycle-prone alias pattern by moving SDKConfig and StreamingConfig definitions from internal/config directly into pkg/llmproxy/config.
  • Developer Tooling: Introduced air.toml to enable hot-reloading for the cmd/server during development.
Changelog
  • air.toml
    • Added air configuration for hot-reloading the cmd/server application during development.
  • pkg/llmproxy/config/sdk_config.go
    • Removed the file containing type aliases for SDKConfig and StreamingConfig that previously pointed to internal/config.
  • pkg/llmproxy/config/sdk_types.go
    • Introduced a new file defining the SDKConfig and StreamingConfig structs directly within the pkg/llmproxy/config package.
Activity
  • The pull request is part of a stacked merge, specifically "Layer 2", building upon "Layer 1" and based on clean-main.
  • The author has outlined a test plan including go build, go vet, verification of no import cycle errors, and ensuring all callers of config.SDKConfig still compile.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to refactor configuration types to resolve an import cycle by moving SDKConfig and StreamingConfig to the pkg layer. This is a good architectural improvement. However, the implementation has introduced code duplication by not removing the original struct definitions from the internal package. This creates a maintainability issue. Additionally, the new air.toml configuration file for hot-reloading contains a minor redundancy. I've provided specific comments and suggestions to address these points.

Comment on lines +6 to +31
type SDKConfig struct {
// ProxyURL is the URL of an optional proxy server to use for outbound requests.
ProxyURL string `yaml:"proxy-url" json:"proxy-url"`

// ForceModelPrefix requires explicit model prefixes (e.g., "teamA/gemini-3-pro-preview")
// to target prefixed credentials. When false, unprefixed model requests may use prefixed
// credentials as well.
ForceModelPrefix bool `yaml:"force-model-prefix" json:"force-model-prefix"`

// RequestLog enables or disables detailed request logging functionality.
RequestLog bool `yaml:"request-log" json:"request-log"`

// APIKeys is a list of keys for authenticating clients to this proxy server.
APIKeys []string `yaml:"api-keys" json:"api-keys"`

// PassthroughHeaders controls whether upstream response headers are forwarded to downstream clients.
// Default is false (disabled).
PassthroughHeaders bool `yaml:"passthrough-headers" json:"passthrough-headers"`

// Streaming configures server-side streaming behavior (keep-alives and safe bootstrap retries).
Streaming StreamingConfig `yaml:"streaming" json:"streaming"`

// NonStreamKeepAliveInterval controls how often blank lines are emitted for non-streaming responses.
// <= 0 disables keep-alives. Value is in seconds.
NonStreamKeepAliveInterval int `yaml:"nonstream-keepalive-interval,omitempty" json:"nonstream-keepalive-interval,omitempty"`
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While moving these struct definitions here from the internal package is the right direction to fix the import cycle, the original definitions in internal/config/sdk_config.go have not been removed. This has introduced code duplication, as SDKConfig and StreamingConfig are now defined in both pkg/llmproxy/config/sdk_types.go and internal/config/sdk_config.go.

To complete this refactoring correctly and avoid future maintenance issues, the definitions in internal/config/sdk_config.go should be replaced with type aliases that point to these new definitions in the pkg layer. This will create a single source of truth.

Here is a suggested implementation for internal/config/sdk_config.go:

// in internal/config/sdk_config.go
package config

import (
	pkgconfig "github.com/router-for-me/CLIProxyAPI/v6/pkg/llmproxy/config"
)

// SDKConfig is an alias to pkg/llmproxy/config.SDKConfig.
type SDKConfig = pkgconfig.SDKConfig

// StreamingConfig is an alias to pkg/llmproxy/config.StreamingConfig.
type StreamingConfig = pkgconfig.StreamingConfig

Comment thread air.toml

[watcher]
watch_exts = ["go", "yaml", "yml", "json", "toml"]
ignore_paths = [".git", "node_modules", "vendor", "tmp", ".air"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The paths listed in ignore_paths are already included in exclude_dir on line 10. According to the air tool's documentation, exclude_dir is sufficient for excluding directories from being watched, which makes this ignore_paths entry redundant. You can safely remove this line to simplify the configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 25, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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 fix/full-sdk-unification

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 merged commit 3ce3456 into clean-main Feb 25, 2026
4 of 6 checks passed
@KooshaPari KooshaPari deleted the fix/full-sdk-unification branch February 25, 2026 10:09
KooshaPari pushed a commit that referenced this pull request Mar 28, 2026
feat: dynamic model fetching for GitHub Copilot
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.

1 participant