- Replace OpenAI-formatted event: error frames in GeminiAPIHandler.forwardGeminiStream with single-line Google RPC error JSON payloads carrying integer code, message, and status fields for google.golang.org/genai compatibility.
- Preserve existing upstream Google RPC error details when present and normalize plain-text or non-Gemini JSON error payloads into valid Google RPC error objects.
- Update pre-first-token keep-alive failure assertions and add regression tests covering post-commit SSE errors and post-thought Antigravity MALFORMED_FUNCTION_CALL termination.
Closes: #8547
Authorize acp/ models via Home local-plugin-dispatch and run
the selected plugin executor without upstream credentials.
Validate plugin version, config digest, host/Home fences, and
the authorized model across execute, stream, and count paths,
while falling back to credential dispatch for legacy Home.
Preserve before-auth interception, usage attribution, payload
finalization, and router exclusions for delegated requests.
Expose static executor models and avoid reusing resident
shadow plugin images on reload.
- Read all values from both `reference_image_urls` and `reference_image_urls[]` form keys via `PostFormArray` in `videosCreateRequestFromForm`.
- Parse JSON-encoded reference arrays and split comma-separated values only at URL boundaries so RFC 2397 `data:` URLs and URLs with embedded or consecutive commas remain intact.
- Add multipart and form-urlencoded regression tests verifying both parsed form payloads and upstream xAI `reference_images` mapping.
Closes: #8218
- Extract string elements from array prompts and guard optional request parameters in convertCompletionsRequestToChatCompletions against JSON null while preserving legacy integer logprobs compatibility.
- Emit JSON null for empty or null finish_reason and require usage.IsObject() in both streaming and non-streaming /v1/completions response converters so usage: null does not bypass empty-chunk filtering.
- Add regression unit tests for /v1/completions request/response conversion and tighten the legacy truncated-stream test assertion to check SSE error.message.
Closes: #8216
- Parse POST /v1beta/models/*action using strings.LastIndex so model IDs and aliases containing colons route cleanly to generateContent, streamGenerateContent, and countTokens.
- Reject missing colons, empty model names, and empty methods with HTTP 404 while preserving the existing unsupported-method 404 response.
- Add regression tests covering single/multiple-colon model IDs and invalid action path edge cases.
Closes: #8217
- Replace ": keep-alive\n\n" SSE comment heartbeats with empty SSE frames ("\n\n") across Gemini streamGenerateContent and Interactions streaming endpoints to stay compatible with google.golang.org/genai.
- Override StreamForwardOptions.WriteKeepAlive in forwardGeminiStream and forwardInteractionsStream so mid-stream pauses and continuity waits emit empty SSE frames without affecting other protocols.
- Update Gemini pre-first-token keep-alive assertions and add regression tests covering pre-first-token and mid-stream SSE keep-alive frames.
Closes: #8164
- Extract the interactions stream chunk forwarder into forwardInteractionsChunks and guard chunk reads and channel sends with done and cliCtx.Done() cancellation signals.
- Add deterministic unit and HTTP disconnect regression tests verifying the forwarding goroutine closes its output channels and exits cleanly on cancellation.
Closes: #8141
- Add a default branch to the method switch in GeminiHandler to return HTTP 404 with a structured invalid_request_error JSON payload instead of an empty 200 OK.
- Reject empty :method suffixes in the action path as 404 not found and add regression tests covering unsupported, misspelled, and empty methods.
Closes: #8140
- Normalize Google/Gemini invalid_request_error input token limit messages in claudeErrorDetailFromText by prepending Anthropic's canonical "prompt is too long: " prefix so Claude Code can trigger automatic compaction.
- Match "input token count" followed by an optional parenthesized count and "exceeds the maximum" while avoiding double-prefixing and preserving non-matching errors.
- Add regression tests covering JSON responses, committed SSE errors, parenthesized count variants, idempotency, non-400 statuses, and output-token-limit false positives.
Closes: #8003
Introduce SourceModelID as the canonical provider-qualified
source behind each published route and store the Devin catalog
with bare IDs, qualifying it only at publication and lookup.
Generalize Copilot's published-route selection, cooldown
migration, websocket matching, and execution resolution to
Devin, and match OAuth settings and payload rules against the
canonical source so aliases and prefixed routes share config.
Handle qualified model IDs from newer Homes, preserve explicit
prefixed alias names, and resolve Devin auto effort against
catalog-supported levels instead of defaulting to high.
- Preserve upstream stream bootstrap headers via streamHeaderError and forward them on direct error responses without allowing bootstrap replay.
- Short-circuit terminal request-stop and unoverridden RequestTerminatedError outcomes before Home retryRoundPending waits and avoid re-evaluating inner errors across continue/stop wrappers.
- Add regression tests covering stream bootstrap stop/terminated headers, Home retryRoundPending short-circuiting, and continue-overridden 400 credential failover.
Closes: #7740
- Publish Copilot catalog and plugin models with native IDs, aliases, and auth prefixes while preserving suffixed routes.
- Route requests through exact registered Copilot models and send the resolved native model upstream.
- Reconcile Copilot model states and route metadata against published routes; document Copilot support in OAuth alias and error configuration.
- Add gzip/x-gzip support to the shared request body decoder with the configured decoded-size cap, and drop Content-Encoding after a successful decode so nothing downstream decodes or forwards it again.
- Switch ClaudeMessages and ClaudeCountTokens to handlers.ReadRequestBody, and mirror the change in the plugin auth pre-decode path (gzip support, plus /v1/messages and /v1/messages/count_tokens in handlerDecodesBody) and the request-log capture decoder.
Closes: #7711
- Add TerminateScope to plugin and executor after-auth interceptor responses so plugins can refuse a single selected credential with exact scope "credential" while keeping request-scoped termination as default.
- Exclude refused credentials for the remainder of the request across normal, count, streaming, Home dispatch, retry rounds, and Antigravity credits fallback without mutating shared cooldown state.
- Preserve real upstream error precedence over plugin credential refusals and plugin refusal precedence over local non-upstream errors, with regression tests across pluginhost, handlers, and auth conductor paths.
Closes: #7656
- Enforce MaxRetryCredentials, request-scoped stop rules, TOS_VIOLATION, VALIDATION_REQUIRED, and 401/400 termination gates across Antigravity credits execution and streaming paths.
- Tighten shouldAttemptAntigravityCreditsFallback and 429 quota classification so transient rate limits, short cooldowns, and non-quota errors never trigger whole-pool credits sweeps.
- Prevent HTTP bootstrap retries from replaying pre-output stream errors on stop, TOS, or unoverridden validation failures, while preserving continue overrides and TOS credential deactivation state.
Closes: #7658
- Add session-scoped instruction baselines with validation, expiration, and optional KV storage.
- Preserve instruction state across HTTP and WebSocket turns, rejecting invalid or unreconstructable session requests.
- Prevent internal session markers from reaching upstream or request logs.
- Add Kind as the leading field on pluginapi.ResponseInterceptRequest with model_list, execution, and count_tokens constants, and document fallback and open-map metadata rules.
- Populate Kind across all five response interceptor construction sites (auth-manager execute/count, plugin-executor execute/count, and WriteModelListResponse) and verify leading-byte RPC serialization and /v1/models/{id} detail routing.
Closes: #7655
Store bounded local read, dial, and stream errors as diagnostics
instead of rendering them inside API RESPONSE sections, and render
them in the downstream RESPONSE section after status selection.
Prevent handler-synthesized payloads from appending to executor
capture or fabricating upstream responses for failed attempts.
- Read nested body/error HTTP status codes in parseCodexWebsocketErrorWithCooling and clearCodexReasoningReplayOnWebsocketError so Retry-After and request headers are preserved on typeless WebSocket errors.
- Guard responsesSSEPayloadHasError and SSE error inference behind explicit event/payload type checks so non-error frames such as response.metadata containing body.error are not rewritten into terminal errors.
- Build OpenAI Responses stream error and failed chunks directly through ojson.Doc with single-exit serialization, supporting scalar error strings without map mutations.
- Preserve valid top-level and body envelope HTTP error status codes when normalizing typeless Codex SSE failures and Responses SSE frames.
- Normalize scalar and blank WebSocket error fields purely via ojson.Doc.
Normalize string websocket errors without discarding their messages. Recognize untyped and body-wrapped failures across SSE, websocket, and duplex paths while retaining status, headers, and sequence numbers.
Cover transport and format combinations, replay invalidation, credential status precedence, and Responses framing with regression tests.
- Add bio_policy, cyber_policy_violation, misalignment_policy_violation, content_policy_violation, and image_content_policy_violation to request-fault codes so policy rejections stop failover without cooling down credentials.
- Unify trusted error JSON extraction across auth, model-not-found, credit-balance, and request-fault checks while restricting wrapper unwrapping and policy-text matching to prevent prompt-echo false positives.
- Map typeless policy error codes and body.error layouts consistently across Codex SSE/WebSocket, Responses, xAI, and Claude stream translation paths, filling blank messages with official fallback copy.
- Exclude known credential quota and cooldown errors from recoverable duplex error preservation in forwardResponsesWebsocket so opts.suppressError and terminal error handling still apply after response.created.
- Add regression tests verifying usage_limit_reached and model_cooldown consult the replay guard while request and client rate-limit errors stay on the duplex path.
Closes: #7586
- Unpin and exclude the failed credential when a full response.create on a persistent Responses WebSocket fails with a pre-commit quota or auth error.
- Propagate excluded auth IDs through handler metadata into mixed and Home stream selection while blocking replay once any downstream frame is committed.
- Add regression tests for pre-commit 429 failover, post-commit non-replay, and Home repeated excluded-auth rejection.
Closes: #7585
- Tag Gemini-family zero-output HTTP 502 errors and translated Claude MALFORMED_FUNCTION_CALL error payloads with ErrorCodeTransientTransport across Antigravity, Gemini, Vertex, and AI Studio executors so Conductor skips credential cooldown while preserving per-request rotation and cross-provider failover.
- Update existing Claude MALFORMED_FUNCTION_CALL conductor tests to assert failed execution results and failed usage metrics without placing credentials into cooldown.
- Add unit and HTTP handler regression tests verifying uncooled rotation, cross-provider failover, and groundingChunks-only Claude fallback paths across Gemini-family executors.
Closes: #7571
- Wrap the final 429 in a poolCooldownTerminalError at the Execute/ExecuteCount/ExecuteStream boundaries when every candidate credential for the model is blocked and at least one is in a timed cooldown, preserving the upstream error body and status while marking IsModelCooldown so the Claude handler appends the reset time.
- Compute the Retry-After from the earliest auto-recovery across all blocked candidates (including non-cooldown timed blocks) so the client sees the pool's real recovery instead of the last attempt's hint.
- Add regression coverage for both cooldown variants across the three execution paths, the available-candidate guard, mixed-block earliest deadlines, the sub-floor hint clamp, and the Claude handler end-to-end.
Closes: #7521
- Build interceptor metadata in WriteModelListResponse from the authenticated gin context (caller_scope, access_provider, frontend_auth_metadata) instead of always passing nil.
- Reuse requestCallerScope so model-list requests share the same irreversible caller handle as execution paths, enabling per-key catalog filtering including ?key= credentials.
- Forward the same metadata to the request lifecycle tracker and add regression tests for identity forwarding, metadata isolation, and unauthenticated nil metadata.
Closes: #7524
- Detect MALFORMED_FUNCTION_CALL, UNEXPECTED_TOOL_CALL, and MALFORMED_RESPONSE with zero visible output before bootstrap commit, reasoning replay caching, or usage finalization across Antigravity, Gemini, Vertex, and AI Studio executors.
- Withhold only contentless leading shell frames while keeping thought chunks unbuffered for TTFT, and align Claude response error handling and stream completion flags while preserving valid partial outputs.
- Add unit, executor, bootstrap failover, and cross-module HTTP regression tests covering credential rotation and HTTP 502 exhaustion.
Closes: #7513
Co-authored-by: Dylan <1990016@gmail.com>
Co-authored-by: lzt404 <2596933790@qq.com>
- Add Builder.WithPluginInterceptorHost so embedders can install a custom PluginInterceptorHost that survives startup and reload; the server wraps it to keep plugin model routing, executor dispatch, lifecycle, and websocket observers delegated to the internal plugin host.
- Add Hooks.OnConfigApplied invoked after each successful config apply so embedders can reinstall executor wrappers and other caller-owned runtime state.
- Cover the delegated interceptor host with nil-safety, skip-forwarding, capability-detection, and real execute-chain regression tests.
Closes: #7499
Co-authored-by: Dylan <1990016@gmail.com>
Co-authored-by: lzt404 <2596933790@qq.com>
- Capture bounded per-attempt upstream status, masked headers, response chunks, and transport or stream errors when request-log is false.
- Bind synchronized deferred capture to the HTTP request context and preserve partial HTTP bodies and WebSocket dial or reconnect failures.
- Mask Cookie headers alongside Set-Cookie so forced error logs do not expose session credentials.
Closes: #7420
Co-authored-by: Dylan <1990016@gmail.com>
Co-authored-by: lzt404 <2596933790@qq.com>
- Retain and persist rejected Claude unified quota signals alongside active cooldown deadlines so out-of-order completions, restarts, and dual-layer quota wraps keep accurate window metadata.
- Populate anthropic-ratelimit-unified-* headers on Claude quota modelCooldownError responses aligned with Retry-After while keeping SafeResponseHeaders restricted to trusted retry headers.
- Exclude non-Claude, Cloudflare challenge, and ordinary per-minute rate-limit cooldowns from unified subscription quota header synthesis across selector and scheduler paths.
Closes: #7417
Co-authored-by: Dylan <1990016@gmail.com>
Co-authored-by: lzt404 <2596933790@qq.com>
- Start a connection-scoped downstream Ping keepalive loop immediately after upgrading the Responses WebSocket connection instead of waiting for stream forwarding to begin.
- Guard background Ping writes with non-blocking mutex acquisition so active data writes are not contended while blocked Ping writes are still interrupted on terminal close.
- Preserve the socket cancellation cause in response forwarding and add regression coverage for post-upgrade, upstream-bootstrap, and blocked-Ping close paths.
Closes: #7407
Co-authored-by: Dylan <1990016@gmail.com>
Co-authored-by: lzt404 <2596933790@qq.com>
- Hijack mock CONNECT proxy connections before writing 200 OK and forward buffered client bytes so TLS ClientHello records are not truncated under CPU contention, while isolating Codex refresh test journals.
- Wait for client request payloads and test completion before closing mock websocket connections in Codex keepalive upload tests.
- Cancel the in-flight HTTP upstream context before writing response.incomplete downstream during local websocket interrupts.
Closes: #7379
Co-authored-by: Dylan <1990016@gmail.com>
- Track SSE event newline boundaries across streamed image chunks and suppress keep-alive comments while inside an incomplete SSE event.
- Reset streaming keep-alive tickers when downstream bytes are written and ensure terminal error events start on a clean SSE boundary.
Closes: #7330
- Skip auto-injecting hosted image_generation tools on Responses-Lite models and strip unsupported complexity fields from declared image_generation tools on ChatGPT Codex /responses requests.
- Route forced hosted image_generation turns on Responses-Lite models to the compatible GPT-Image-2 base model (default gpt-5.4-mini) with normalized reasoning configuration.
- Map upstream image_generation_user_error terminal events to HTTP 400 Bad Request with actionable remediation guidance for unsupported complexity errors.
Closes: #7270
- Forward terminal 429 quota and model-cooldown errors with trusted Retry-After headers when websocket credential failover is exhausted.
- Suppress 1012 HTTP replay on pinned continuation 429 failures when no alternative local or Home credential is eligible.
- Add regression tests covering multi-credential rotation, single-credential exhaustion, expired alternatives, and Home failover.
Closes: #7256
- Start TTFT timing before invoking direct plugin executors in both non-streaming and streaming handler paths.
- Record first-packet arrival for non-streaming responses and observe protocol-aware stream chunk TTFT events before publishing usage.
Closes: #7253