Spaces:
Paused
Paused
Commit History
-
feat: detect banned accounts and show status in dashboard (#142)
icebear +1: icebear0828Unverified signature* feat: detect banned accounts and show status in dashboard When upstream returns non-Cloudflare 403, the account is now marked as "banned" instead of silently failing quota fetches with no UI feedback. - Add "banned" to AccountStatus type - usage-refresher: detect 403 ban during quota fetch, auto-recover on success - proxy-handler: detect 403 ban during requests, fallback to next account - Dashboard: rose-colored "Banned"/"已封禁" badge in card/table views - Status filter dropdown includes "Banned" option - acquire() naturally skips banned (status !== "active") * feat: handle 401 token invalidation with auto-retry Previously 401 "token has been invalidated" was passed through to the client without marking the account or trying alternatives. - proxy-handler: 401 → markStatus("expired") + try next account - usage-refresher: 401 → markStatus("expired") during quota fetch - Refresh scheduler will attempt token renewal for expired accounts --------- Co-authored-by: icebear0828 <icebear…ba262d0
-
fix: handle stream disconnection properly in curl transport and proxy handler (#108)
icebear +1: icebear0828Unverified signature1. curl-cli-transport: signal error (not close) when curl exits with non-zero code mid-stream, so downstream readers get a proper error instead of a silent truncation. 2. proxy-handler: catch s.write() failures during streaming to detect client disconnects, abort the upstream curl process, and stop the stream cleanly instead of leaking resources. 3. proxy-handler: don't re-throw after sending error SSE event — the stream is already closing, re-throwing causes unhandled rejection. Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>45525c6
-
feat: tuple schema (prefixItems) support for structured outputs (#77)
icebear +1: icebear0828Unverified signature* feat: tuple schema support — prefixItems auto-conversion for structured outputs Upstream Codex API doesn't support JSON Schema prefixItems (tuple), so we convert tuple schemas to equivalent object schemas on the request side and reconvert the response back to arrays. All three endpoints (OpenAI, Gemini, Responses passthrough) are covered. - New module: src/translation/tuple-schema.ts (convert/reconvert/detect) - prepareSchema() composes tuple conversion + additionalProperties injection - Streaming: buffer text deltas when tupleSchema present, flush reconverted on completion - 23 unit tests for core conversion logic * fix: responses endpoint tuple reconversion + cleanup - Add tuple schema reconversion to /v1/responses (stream + collect), making all three endpoints consistent - Remove unrelated web/src/hooks/use-status.ts from this branch - Add console.warn to silent catch blocks for easier debugging - Add streaming buffer tradeoff comment --------- Co-authored-by: icebear0828 …e25a730
-
refactor: use toErrorStatus() instead of inline duplicate
icebear0828 +1: Claude Opus 4.6Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d9ac395 -
fix: use real reset duration from 429 response + auto-fallback to next account (#65)
icebear0828 +1: Claude Opus 4.6- Parse resets_in_seconds / resets_at from 429 error body instead of using fixed 60s backoff, so rate-limited accounts stay inactive for their actual cooldown period (e.g. 5.5 days for free plans) - Auto-retry with the next available account on 429 before returning error to client (same pattern as model-not-supported retry) - Add window_reset_at as second tiebreaker in least_used scheduling (prefer accounts whose quota resets sooner) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8cde2e9
-
fix: review improvements — schema walker, status helper, UI i18n, CI version skip
icebear0828 +1: Claude Opus 4.61. walkSchema: add patternProperties, if/then/else traversal + cycle detection 2. proxy-handler: extract toErrorStatus() helper, centralize 4x StatusCode casts 3. Header StableText: dynamic t() references for i18n + whitespace-nowrap on status button 4. sync-electron.yml: cancel-in-progress: false + merge two pushes into one Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>6220911 -
fix: recursive additionalProperties injection + upstream error status propagation
icebear0828 +1: Claude Opus 4.61. Add injectAdditionalProperties() to recursively inject `additionalProperties: false` on every object-type node in JSON schemas. Codex API requires this explicitly but OpenAI's native API auto-injects it — our proxy was passing schemas verbatim causing 400s. 2. Fix CONNECT tunnel header parsing in curl-cli-transport: loop to skip intermediate header blocks (CONNECT 200, 100 Continue) before parsing the actual response headers. 3. Extract upstream HTTP status from error messages in non-streaming collect path instead of hardcoding 502. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4779e44
-
fix: pass through cached_tokens from Codex API (#58)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* fix: pass through cached_tokens and reasoning_tokens from Codex API (#55) The proxy was only extracting input_tokens/output_tokens from Codex response usage, dropping input_tokens_details.cached_tokens and output_tokens_details.reasoning_tokens. This caused cached token counts to always show as 0 for downstream clients. Fixed across all three output formats (OpenAI, Anthropic, Gemini) in both streaming and non-streaming modes. Closes #55 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: pass reasoning_tokens through onUsage in Anthropic/Gemini translators The Anthropic and Gemini streaming translators were not forwarding reasoning_tokens via onUsage, unlike the OpenAI translator. Also fixes Gemini non-streaming path leaking cached_tokens: undefined by using conditional spread consistent with other translators. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com> Co-authored-by: Claud…fadda70 -
feat: model-aware multi-plan account routing (#57)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* feat: model-aware multi-plan account routing Different ChatGPT plans have different model access (e.g. Team has gpt-5.4, Free has gpt-oss-*). This adds plan→model mapping discovery and intelligent request routing to prevent model-not-supported errors. - model-store: track which plans can access each model via planMap - model-fetcher: query backend per distinct plan type in parallel - account-pool: model-aware acquire() prefers matching planType accounts - proxy-handler: auto-retry with different account on model-not-supported 4xx Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: patch model-aware routing bugs from PR review - Fix double release when model retry has no available account - Tighten isModelNotSupportedError: add 4xx status guard, drop broad "invalid" keyword - Reuse selectByStrategy() in getDistinctPlanAccounts() instead of duplicated sort - Remove redundant triedEntryIds push Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-autho…90c89b6
-
feat: add proxy pool for per-account proxy routing
icebear0828 +1: Claude Opus 4.6Add proxy pool system allowing different accounts to route through different upstream proxies for IP diversity and risk isolation. Backend: - ProxyPool manager with CRUD, assignment, round-robin, health checks - TlsTransport interface accepts per-request proxyUrl parameter - Both curl-cli and libcurl-ffi transports support per-request proxy - CodexApi forwards proxy through the request chain - REST API at /api/proxies for proxy + assignment management - Periodic health checks (default 5min) via api.ipify.org Frontend: - ProxyPool management section in dashboard - Per-account proxy selector dropdown in AccountCard - Four assignment modes: Global/Direct/Auto(Round-Robin)/Specific Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4ebb914
-
fix: remove unsupported previous_response_id parameter (#30)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* fix: remove unsupported previous_response_id parameter (#29) The Codex backend no longer accepts `previous_response_id`. Sending it causes HTTP 400: "Unsupported parameter: previous_response_id". Remove the injection logic in proxy-handler and clean up related dead code across translation functions and session manager. Closes #29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: remove dead SessionManager (was only used for previous_response_id) SessionManager, session hashing, and onResponseId session storage were only used to track previous_response_id across turns. Since the backend no longer supports this parameter, the entire session system is dead code. Remove it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>3c0eaf7
-
feat: add per-account empty response tracking with email in logs
icebear0828 +1: Claude Opus 4.6Track empty_response_count per account in AccountUsage, exposed via GET /auth/accounts. Logs now include account email for easier debugging. Counter resets on usage reset and rate limit window rollover. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b3dfc6c -
fix: detect empty Codex responses and auto-retry with account rotation (#18)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* fix: detect empty Codex responses and auto-retry with account rotation Codex API intermittently returns HTTP 200 with valid SSE events but zero text deltas. Add EmptyResponseError detection in all three translation layers (OpenAI, Anthropic, Gemini) and a retry loop in proxy-handler that switches accounts on empty responses (up to 3 attempts). - Non-streaming: catch EmptyResponseError → release account → acquire new account → retry with fresh CodexApi (max 2 retries) - Streaming: inject "[Error] Codex returned an empty response" text chunk when response.completed fires with no content - All retries exhausted → 502 with clear error message Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: prevent double-release of account in empty-response retry loop The outer catch block used the original entryId, which was already released when EmptyResponseError switched to a new account. Introduce activeEntryId to track the currently-active account across retries. Also set Em…9d6278d -
fix: harden prompt injection suppression and non-streaming error handling
icebear0828 +1: Claude Opus 4.6Strengthen SUPPRESS_PROMPT to prevent mini models from leaking Codex Desktop identity. Wrap collectTranslator in try/catch to return 502 JSON instead of 500 HTML on non-streaming errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2def35e
-
refactor: architecture audit fixes round 2 (P0-P2)
icebear0828 +1: Claude Opus 4.6- Fix curl subprocess leak on client disconnect (abort signal propagation) - Cap SSE parse buffer at 10MB to prevent memory exhaustion - Fatal error triggers graceful shutdown instead of hard exit - Session hash: 128-bit + JSON.stringify to prevent collisions - Gemini SSE line endings normalized to \n\n - Extract shared translation utils (desktop context, instructions, budgetToEffort) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d6c3bb0
-
refactor: architecture audit fixes (P0-P2 stability & reliability)
icebear0828 +1: Claude Opus 4.6P0: curl header parse timeout (30s), kill curl on stream disconnect via AbortController, cap error response body at 1MB. P1: acquireLock TTL (5min auto-release), atomic config hot-reload, encapsulate 429 counting in AccountPool, graceful shutdown with server.close() + 5s drain period. P2: send error SSE event on stream failure, structured JSON logger, O(1) session LRU eviction via Map insertion order. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b1107bc -
refactor: fingerprint alignment, auto-maintenance, Docker deployment
icebear0828 +1: Claude Opus 4.6Phase 1 - Eliminate fingerprint detection gaps: - Dynamic sec-ch-ua from config chromium_version (aligned with TLS profile) - Inject full fingerprint headers into curl-fetch (OAuth/appcast) - Unify Accept-Encoding based on curl-impersonate detection - Optimize header ordering (single sort pass) Phase 2 - Auto-maintenance: - Structured YAML mutation utility (replace regex hacks) - Auto full-update pipeline on new version detection - Config hot-reload after updates - Exponential backoff token refresh (5 attempts + 10m recovery) - Immediate persistence for critical data (tokens, cf_clearance) - Cookie v2 format with expiry timestamps - Graceful shutdown with 10s timeout protection - Usage counters auto-reset on rate limit window rollover Phase 3 - Docker deployment: - Dockerfile, docker-compose.yml, .dockerignore - Deployment docs in README Fixes: - Extract planType from JWT /auth claim (was looking in /profile) - Backfill missing planType on startup for existing accounts - Show full d…347f81b -
refactor: extract shared proxy handler, eliminate route duplication
icebear0828 +1: Claude Opus 4.6- Extract withRetry() to src/utils/retry.ts (was duplicated 3x) - Create shared proxy-handler.ts encapsulating acquire/stream/release lifecycle - Refactor chat.ts, messages.ts, gemini.ts to use shared handler (-264 lines net) - Convert models.ts from default export to named createModelRoutes() - Extract GEMINI_STATUS_MAP to types/gemini.ts (was duplicated in error-handler) - Add SessionManager.destroy() with interval cleanup + unref - Remove dead captureCookies() method from codex-api.ts - Add stack trace logging to error handler - Fix hardcoded localhost in startup message - Use atomic write-to-temp-then-rename for cookie-jar and account-pool - Add warning logs for previously silent catch blocks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8b777a2