Skip to content

v6.8.49#422

Merged
luispater merged 8 commits intomainfrom
plus
Mar 9, 2026
Merged

v6.8.49#422
luispater merged 8 commits intomainfrom
plus

Conversation

@luispater
Copy link

No description provided.

thebtf and others added 7 commits March 8, 2026 15:59
The Gemini v1internal (cloudcode-pa) and Antigravity Manager endpoints
require camelCase "systemInstruction" in request JSON. The current
snake_case "system_instruction" causes system prompts to be silently
ignored when routing through these endpoints.

Replace all "system_instruction" JSON keys with "systemInstruction" in
chat-completions and responses request translators.
- Update README.md with All API Hub entry in English
- Update README_CN.md with All API Hub entry in Chinese
…gistration

When new OAuth auth files are added while the service is running,
`applyCoreAuthAddOrUpdate` calls `coreManager.Register()` (which upserts
into the scheduler) BEFORE `registerModelsForAuth()`. At upsert time,
`buildScheduledAuthMeta` snapshots `supportedModelSetForAuth` from the
global model registry — but models haven't been registered yet, so the
set is empty. With an empty `supportedModelSet`, `supportsModel()`
always returns false and the new auth is never added to any model shard.

Additionally, when all existing accounts are in cooldown, the scheduler
returns `modelCooldownError`, but `shouldRetrySchedulerPick` only
handles `*Error` types — so the `syncScheduler` safety-net rebuild
never triggers and the new accounts remain invisible.

Fix:
1. Add `RefreshSchedulerEntry()` to re-upsert a single auth after its
   models are registered, rebuilding `supportedModelSet` from the
   now-populated registry.
2. Call it from `applyCoreAuthAddOrUpdate` after `registerModelsForAuth`.
3. Make `shouldRetrySchedulerPick` also match `*modelCooldownError` so
   the full scheduler rebuild triggers when all credentials are cooling
   down — catching any similar stale-snapshot edge cases.
fix: use camelCase systemInstruction in OpenAI-to-Gemini translators
docs: add All API Hub to related projects list
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 refines the authentication manager's scheduling mechanism by ensuring that supported models for authentication entries are accurately and promptly reflected. It introduces a dedicated function to refresh an authentication's model set in the scheduler, preventing issues where newly added or updated configurations might be overlooked. Additionally, it enhances the scheduler's resilience by improving how it handles model cooldown errors and updates project documentation.

Highlights

  • Documentation Update: Added 'All API Hub' project to both English and Chinese README files, expanding the list of CLIProxyAPI-based projects.
  • Gemini API Translation Fix: Corrected the field name from system_instruction to systemInstruction in the Gemini OpenAI request and response translation logic for improved compatibility.
  • Auth Manager Scheduler Refresh: Introduced a new RefreshSchedulerEntry method in the auth.Manager to explicitly rebuild an authentication's supported model set in the scheduler, ensuring newly registered or updated auths are properly recognized.
  • Scheduler Cooldown Error Handling: Modified the scheduler's retry logic to specifically handle modelCooldownError, allowing for better recovery from temporary model unavailability.
  • Service Integration: Integrated the RefreshSchedulerEntry call into the applyCoreAuthAddOrUpdate function within the sdk/cliproxy/service.go to ensure that authentication entries are correctly reflected in the scheduler's model set immediately after model registration.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • README.md
    • Added 'All API Hub' project description.
  • README_CN.md
    • Added 'All API Hub' project description in Chinese.
  • internal/translator/gemini/openai/chat-completions/gemini_openai_request.go
    • Updated system_instruction to systemInstruction.
  • internal/translator/gemini/openai/responses/gemini_openai-responses_request.go
    • Updated system_instruction to systemInstruction.
  • sdk/cliproxy/auth/conductor.go
    • Added RefreshSchedulerEntry method.
    • Modified shouldRetrySchedulerPick to include modelCooldownError.
  • sdk/cliproxy/auth/conductor_scheduler_refresh_test.go
    • Added new test file for scheduler refresh and cooldown error handling.
  • sdk/cliproxy/service.go
    • Called RefreshSchedulerEntry after model registration for auths.
Activity
  • No human activity has been recorded on this pull request yet.
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.

@luispater luispater merged commit 0687472 into router-for-me:main Mar 9, 2026
1 of 2 checks passed
@luispater luispater deleted the plus branch March 9, 2026 01:34
Copy link

@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 introduces a critical fix for the authentication scheduler, ensuring newly added or updated credentials are immediately available for routing by explicitly refreshing the scheduler entry after models are registered for an auth. While addressing these functional improvements, two security issues were identified: a potential rate limit bypass and session hijacking vulnerability in the websocket connection handling, and an LLM safety issue where system instructions are downgraded to user-level authority during translation. The changes also include a new RefreshSchedulerEntry method in the auth.Manager, comprehensive tests, an adjustment to the retry mechanism for graceful error handling, and minor updates to documentation and the Gemini translator for consistency.

Comment on lines +225 to +233
m.mu.RLock()
auth, ok := m.auths[authID]
if !ok || auth == nil {
m.mu.RUnlock()
return
}
snapshot := auth.Clone()
m.mu.RUnlock()
m.scheduler.upsertAuth(snapshot)

Choose a reason for hiding this comment

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

medium

For improved readability and to avoid multiple RUnlock calls, you can restructure this section. The goal is to fetch and clone the auth within a single locked block, then perform the scheduler update outside the lock. This makes the lock's scope clearer and the code flow more linear, improving maintainability.

    var snapshot *Auth
	m.mu.RLock()
	if auth, ok := m.auths[authID]; ok && auth != nil {
		snapshot = auth.Clone()
	}
	m.mu.RUnlock()

	if snapshot == nil {
		return
	}
	m.scheduler.upsertAuth(snapshot)

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.

4 participants