Harden iFlow proxy requests to match CLI behavior#142
Open
redzrush101 wants to merge 6 commits intoMirrowel:devfrom
Open
Harden iFlow proxy requests to match CLI behavior#142redzrush101 wants to merge 6 commits intoMirrowel:devfrom
redzrush101 wants to merge 6 commits intoMirrowel:devfrom
Conversation
Add signed-header fallback and base-url failover while fixing env OAuth credential loading/refresh so proxy calls are less likely to get blocked.
Owner
|
Gotta give it a couple of days to verify |
MasuRii
added a commit
to MasuRii/LLM-API-Key-Proxy
that referenced
this pull request
Feb 27, 2026
Resolve conflicts in iFlow provider by preserving existing retry/context-failure handling while integrating PR Mirrowel#142 signed-header fallback and base URL failover logic.
Author
ye good |
Consolidate follow-up fixes after initial hardening: add captured-header parity and metadata propagation, preserve usage details, introduce sticky session/conversation IDs, and fix reasoning regressions by removing forced disabled-thinking defaults while enabling thinking by default.
75bd2e0 to
407032e
Compare
…ication Include httpx.RemoteProtocolError in the error type tuple for api_connection classification. This error occurs when a peer closes the connection without sending a complete message and should be treated as a transient connection issue rather than an unhandled exception.
…handler Wrap stream_handler in a retry loop with exponential backoff for transient connection errors (RemoteProtocolError, ConnectError, ReadTimeout, NetworkError). Retries up to 3 times with 1s/2s/4s backoff before re-raising for higher-level error handling. Changes: - Add CONNECTION_ERROR_TYPES tuple and CONTEXT_WINDOW_ERROR_PATTERNS as module-level constants for reuse and clarity - Add MAX_CONNECTION_RETRIES and RETRY_BACKOFF_BASE configuration - Restructure stream_handler with while-loop retry around the stream context manager, re-creating the stream on each retry attempt - Add context window error detection from HTTP error response bodies to surface token limit issues explicitly - Import asyncio for async sleep during backoff
- Detect empty choices array in HTTP 200 responses - Detect zero completion_tokens with non-zero prompt_tokens - Detect empty assistant messages (no content/reasoning/tool_calls) - Detect streams that complete without any data chunks - Raise non-retryable context_window_exceeded error for these cases - Prevents quota waste from repeated failed requests
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
glm-5in iFlow hardcoded models.Validation
oauth_creds.jsonmapping.iflow/glm-5andiflow/kimi-k2.5.Important
Enhance iFlow proxy requests to match CLI behavior with improved signed-header handling, OAuth credential management, and API base fallback support.
iflow_provider.py.iflow_auth_base.py.glm-5in hardcoded models iniflow_provider.py.get_api_base_candidates()andget_api_base()iniflow_auth_base.pyfor API base URL management._refresh_token()iniflow_auth_base.pyto handle env-loaded credentials without file IO.get_api_details()iniflow_auth_base.pyto support env-based credentials._build_iflow_headers()iniflow_provider.pyto include optional signature headers._should_fallback_base()iniflow_provider.pyfor handling specific HTTP status codes.iflow/glm-5andiflow/kimi-k2.5through proxy endpoint.This description was created by
for 97e1449. You can customize this summary. It will automatically update as commits are pushed.