Commit Graph

1251 Commits

Author SHA1 Message Date
Luis Pater
feb6398456 feat(auth): increase Codex proactive refresh lead to 96 hours and improve rejected token handling
- Update Codex outer refresh lead time to 96 hours to prevent upstream token invalidation.
- Ensure proper token refreshing and background recovery for rejected unexpired JWTs and in-stream 401 errors.

Closes: #6742
2026-10-19 01:41:19 +08:00
sususu
a68c7d8ed7 fix(signature): strip OpenRouter private RouterSuffix on official and non-OpenRouter upstreams
- Only preserve OpenRouter dot-delimited router suffixes when the upstream baseURL is openrouter.ai / *.openrouter.ai
- Strip RouterSuffix down to the native GPT/Grok/Meta envelope when forwarding to official tokens (chatgpt.com, api.openai.com, api.x.ai) or non-OpenRouter third-party providers (while keeping native api.meta.ai fail-closed against cross-caller envelopes)
- Strip RouterSuffix before storing GPT signatures in the Codex reasoning replay cache
2026-10-18 20:57:01 +08:00
sususu
be9fbd9429 feat(signature): support router-suffixed GPT/Grok envelopes and multi-family Responses targets
- Allow optional dot-delimited alphanumeric router suffixes (such as OpenRouter endpoint_slug metadata) in InspectGPTReasoningSignature and InspectGrokEncryptedContent
- Preserve matching target-family signatures (Grok, Gemini, Claude, Kimi, SWE) in sanitizeOpenAIResponsesReasoningEncryptedContentWithCompatModel when served through Responses routers
2026-10-18 13:03:50 +08:00
sususu
674dbe8fd1 fix(signature): support Meta Muse signatures across third-party Responses providers
- Gate MetaExecutor signature sanitization by baseURL so custom/third-party meta-api-key endpoints replay router-suffixed Meta Muse envelopes while native api.meta.ai stays native-only
- Pass resolved target model (with requested-model fallback for aliased deployments) through Codex, Codex WebSocket, and OpenAI-compat Responses sanitization paths
- Broaden Meta Muse model-id boundary matching (muse, meta/muse, muse_*, meta-muse-*) and allow Meta envelopes in the Codex reasoning replay cache
- Reuse CodexReplaySignatureForTarget in Claude-to-Codex request translation and avoid duplicating streamed thought summaries on Interactions reasoning done events
2026-10-18 13:03:50 +08:00
sususu
cc5682c563 fix(signature): replay OpenRouter router-suffixed Meta Muse signatures
OpenRouter serves meta/muse-* through its Responses API and returns
encrypted_content as the native Meta envelope plus "." and a 67-char
alphanumeric routing suffix. The strict Meta inspector rejected that form,
so it was classified unknown and stripped on every path, including the
compat Meta-target path that previously kept unknown blobs.

- Accept an optional "."+[A-Za-z0-9]{1,128} router suffix after a valid
  native envelope and expose it as RouterSuffix; replay stays verbatim
- Replace the keepMeta flag with a Meta policy: Meta-family targets on the
  Codex executor allow routed envelopes regardless of is-compat, while the
  native Meta executor stays native-only (suffix acceptance by api.meta.ai
  is unverified)
- Live-checked on OpenRouter: native part matches the api.meta.ai header
  and bucket shape (5/5), suffixed, native-only and suffix-tampered replays
  are consumed, native-body tamper is silently dropped

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-18 13:03:50 +08:00
sususu
7a0b7563e9 feat(signature): recognize Meta Muse reasoning envelopes and gate replay by target
- Add InspectMetaReasoningSignature transport-shape validation (canonical unpadded base64url, observed 43e3da0e01 header, 45 + 1024*2^k decoded buckets) and SignatureProviderMeta detection/compatibility wiring
- Make Meta Responses sanitization native-only so GPT, foreign, and unknown signatures never replay to Meta, while compat paths preserve Meta envelopes only for Meta-family target models
- Preserve recognized Meta signatures through Claude-protocol request translation for muse-* targets and drop them for other targets; never supplement them as Devin sealed signatures
- Cover with synthetic-fixture unit tests only; verified same-model, cross-model, and Claude-ingress live replay plus wrong-upstream stripping on an isolated debug CPA
2026-10-18 13:03:50 +08:00
Luis Pater
db1bab011d feat(runtime): narrow Claude per-minute rate-limit cooldown when short Retry-After is present
- Add `ParseClaudeRateLimitResetForError` to inspect response bodies and avoid inheriting hours-long unclassified unified resets for explicit per-minute rate limits.
- Update Claude standard and fast-direct executors to use the body-aware rate-limit parser when handling upstream error responses.

Closes: #6719
2026-10-18 10:50:40 +08:00
Luis Pater
3a0722984a feat(meta): filter subscription usage telemetry from SSE streams and responses
- Filter `response.subscription_usage` events and associated metadata across Meta streaming and non-streaming executors.
- Ensure subscription telemetry is stripped from OpenAI Responses SSE streams and WebSocket forwarders.
2026-10-18 03:20:24 +08:00
Luis Pater
b8d4e14a8e feat(runtime): optimize antigravity schema sanitization to scale linearly with declarations
- Refactor antigravity tool schema sanitization to process declarations and elements in a single pass.
- Avoid quadratic whole-document rewrites for payloads with many function declarations.
- Preserve original array whitespace and untouched elements during byte splicing.

Closes: #6714
2026-10-18 02:50:03 +08:00
Luis Pater
4f2e52709d feat(runtime): detect upstream stream truncation across executors and proxy handlers
- Track finish signals and message stops in stream executors to handle premature upstream closures.
- Enhance Claude SSE state observation and error injection for truncated stream connections.

Closes: #6707
2026-10-17 20:42:18 +08:00
Luis Pater
ad9e456d4a feat(claude): support between_tools thinking disable type and adaptive fallbacks
- Add `DisableType` support to plugin host adapters and registry mappings.
- Route disabled thinking to `between_tools` for models like Claude Sonnet 5.5.
- Fall back to low-effort adaptive thinking for models that reject disabled states.

Closes: #6698
2026-10-17 13:56:34 +08:00
Luis Pater
e13bc9a1f0 feat(claude): synthesize adaptive thinking block binding for preserved-thinking models
- Synthesize an adaptive thinking object and inject `drop_block` prefix mismatch behavior for preserved-thinking models when thinking is omitted but signed thinking blocks are present.
- Prevent thinking object and block binding injection when tool choice forces tool use.
- Update tests to cover omitted thinking and forced tool choice behaviors for preserved-thinking models.

Closes: #6697
2026-10-17 11:32:46 +08:00
Luis Pater
911f49cbd4 feat(claude): add automatic thinking block binding and beta policy for preserved-thinking models
- Automatically inject `drop_block` prefix mismatch behavior for preserved-thinking models when replaying signed thinking blocks.
- Append the required thinking-binding-controls beta header whenever requests carry `thinking.block_binding`.
- Expand Haiku 5.5 and related model detection to correctly support assistant prefill drops and token validations.

Closes: #6692
2026-10-17 02:56:09 +08:00
Luis Pater
b946d54e4b feat(devin): add account-wide quota exhaustion tracking and credential cooldown refresh
- Introduce Devin quota exhaustion detection for daily and weekly usage windows with reset timestamp parsing.
- Apply credential-scoped 429 status errors with reset-based Retry-After for Devin quota limits.
- Support automatic quota revalidation and early credential cooldown release upon confirmed usage recovery.

Closes: #6690
2026-10-17 02:18:41 +08:00
Luis Pater
088e445715 test(meta): handle client disconnect gracefully after terminal stream events
- Track delivery of terminal response events in Meta stream execution.
- Prevent client cancellation errors from being marked as API failures if the terminal event was already delivered.
- Add unit tests for Meta stream client disconnection behavior before and after terminal events.

Closes: #6688
2026-10-16 23:23:33 +08:00
Luis Pater
7604d3df3e feat(claude): add session date pin retention to preserve continuity across credential switches
- Add `session-date-pin-days` configuration option with a 7-day default retention.
- Store session date pins independently of continuity state to prevent re-anchoring on credential switches or idle gaps.
- Strip caller-supplied current date reminders from the first user message to avoid duplication.

Closes: #6682
2026-10-16 22:53:30 +08:00
Luis Pater
355fd10e76 feat(pluginhost): add content-addressed shadow copies for dynamic library loading
Closes: #6672
2026-10-16 12:04:22 +08:00
eli
2d7f5377e4 feat(vertex): honor full /publishers/ prefix in API-key base-url
The API-key vertex executor previously always appended
"/v1/publishers/google/models/{model}:{action}" to whatever base-url the
credential carried, so a base-url that already encoded the resource path
(e.g. "https://aiplatform.googleapis.com/v1/projects/{p}/locations/{l}/publishers/google/models")
would produce a duplicated "/v1" and return 404.

This change teaches the helper to:
  1. detect a base-url that already contains "/publishers/" and use it
     as-is (preserving any projects/locations segment), and
  2. skip inserting "/v1" when the trimmed base already ends in a
     version segment such as "/v1" or "/v1beta1".

Short third-party hosts like "https://zenmux.ai" keep working unchanged;
real Vertex API-key setups can now write the full resource prefix into
base-url to pick a specific project/location (e.g. us-central1 for
gemini-4-argon).

Includes a table-driven unit test covering empty, bare host, /v1,
/publishers/-full-prefix, v1beta1, and countTokens variants.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-15 18:36:57 +08:00
Luis Pater
207d119dac Merge pull request #6642 from trukhinyuri/fix/xai-web-search-unsupported-args
fix(xai): drop web_search options the Responses API rejects
2026-10-15 12:01:01 +08:00
Yuri Trukhin
bbfd7886ee fix(xai): drop web_search options the Responses API rejects
OpenAI Responses clients can attach search_context_size to the web_search
tool. The xAI Responses API rejects that option with HTTP 400 "Argument not
supported: search_context_size", which fails the whole turn on grok models.

Strip every web_search option xAI rejects (external_web_access and
search_context_size) through one table, and keep forwarding the options it
accepts: filters, user_location and search_content_types.
2026-10-15 05:20:24 +02:00
Luis Pater
ceb4397f1e feat(executor): drop trailing thought-only model turns in Gemini Vertex requests
- Add `DropGeminiTrailingThoughtOnlyContent` calls to Vertex executor request pipelines.
- Prevent Vertex upstream validation rejections caused by trailing model reasoning turns.

Closes: #6630
2026-10-15 08:05:58 +08:00
Luis Pater
4e8a4125ac feat(config): add operator overrides for Claude header defaults and client request ID modes
- Add `anthropic-beta-strip`, `anthropic-beta-append`, `inject-diagnostics`, and `client-request-id` options to `ClaudeHeaderDefaults`.
- Support `on`, `off`, and `passthrough` modes for `client-request-id` header handling in Claude requests.
- Sanitize and normalize configured beta override lists and client request ID configuration values.

Closes: #5093
2026-10-15 00:57:18 +08:00
Luis Pater
9db0729f5f feat(config): add operator overrides for Claude header defaults and client request ID modes
- Add `anthropic-beta-strip`, `anthropic-beta-append`, `inject-diagnostics`, and `client-request-id` options to `ClaudeHeaderDefaults`.
- Support `on`, `off`, and `passthrough` modes for `client-request-id` header handling in Claude requests.
- Sanitize and normalize configured beta override lists and client request ID configuration values.

Closes: #5093
2026-10-15 00:57:02 +08:00
Luis Pater
5efe97582c feat(antigravity): flatten multi-branch tool unions for Claude model requests
- Introduce `CleanJSONSchemaForAntigravityClaudeTool` and model-aware schema sanitization helpers to flatten multi-branch `anyOf`/`oneOf` unions specifically for Antigravity Claude tool parameter schemas.
- Preserve multi-branch union support for Gemini model variants while preventing Claude backend HTTP 400 validation errors on nested unions.
- Ensure proper inheritance of nullable markers and idempotency across the translator and executor chain.

Closes: #3662
2026-10-14 21:43:22 +08:00
Luis Pater
b3dc6c3fe5 refactor(config): move tls-handshake-timeout-seconds to root request configuration
- Relocate `tls-handshake-timeout-seconds` from `upstream.claude` to root-level request settings.
- Update configuration structures, validation logic, and tests accordingly.

Closes: #6615
2026-10-14 20:59:02 +08:00
Luis Pater
345cc9d5a8 feat(claude): add timeout and retry logic for silent TLS handshakes
Closes: #6615
2026-10-14 20:23:35 +08:00
Luis Pater
7f2f17d76f feat(gemini): treat MALFORMED_FUNCTION_CALL as retryable API error in Claude translation
- Translate Gemini `MALFORMED_FUNCTION_CALL` responses into Claude API error payloads instead of refusal stop reasons.
- Capture translated stream errors in Gemini and Vertex executors to ensure proper error propagation, usage reporting, and state management.

Closes: #6606
2026-10-14 12:08:35 +08:00
Luis Pater
a19a8ecde3 feat(registry): add gemini-3.8 model variants and update test cases
- Update model identifiers to `gemini-3.8-flash-high` and `gemini-3.8-flash` in executor tests.

Closes: #6602
2026-10-14 10:17:01 +08:00
Luis Pater
0d18d3b365 feat(claude): support model-specific default max tokens from registry in OpenAI chat completions
- Introduce `defaultClaudeChatMaxTokensForModel` to determine default max tokens based on model metadata and fallback rules.
- Update `ConvertOpenAIRequestToClaude` to apply model-specific default max tokens and handle null `max_tokens` or `max_completion_tokens`.
- Implement `stripTranslatedDefaultMaxTokens` in Claude executor to allow payload default rules to override synthesized max tokens when omitted by the caller.

Closes: #6601
2026-10-14 08:40:02 +08:00
Luis Pater
57d005fe6c fix(codex): strip out-of-range int64 numeric bounds from tool schemas
Closes: #6579
2026-10-14 03:45:14 +08:00
Luis Pater
40ce0e0121 feat(kimi): support schema normalization for namespaced tools and input tool lists
Closes: #6578
2026-10-14 03:12:26 +08:00
Luis Pater
7795de19ca feat(sse): implement CodexSSEScanner for improved event data handling
Closes: #6575
2026-10-14 02:54:02 +08:00
Luis Pater
51952a7b2f feat(httptransport): add request-scoped HTTP transport decorator
- Introduce `sdk/httptransport` package with `Decorator`, `WithDecorator`, `WithoutDecorator`, `InheritDecorator`, and `Decorate` functions.
- Propagate transport decorators from incoming HTTP request contexts in `BaseAPIHandler.GetContextWithCancel`.
- Apply transport decoration after client transport selection across proxy-aware, Devin, uTLS, and Antigravity HTTP clients.

Closes: #5616
2026-10-13 13:01:12 +08:00
Luis Pater
a0fd8448f5 fix(schema): preserve multi-branch anyOf/oneOf unions during schema sanitization
- Retain multi-branch `anyOf` and `oneOf` unions instead of flattening them into a single branch.
- Normalize `oneOf` to `anyOf` on native Gemini/Antigravity schema carriers while preserving `oneOf` when standard constraints are allowed.
- Materialize required-only union branches using parent object properties.
- Strip null and boolean `false` branches from unions, applying `nullable: true` and description hints where appropriate.

Closes: #3662
2026-10-13 10:04:32 +08:00
Gracjan Kubicki
97ba1e8961 fix(claude): keep prompt cache when tool_search discovers the first deferred tool
Anthropic keeps the prompt cache when deferred tools are added, but not when a request goes from no deferred tool to one. Codex hides deferred tools until a search returns them, so the request after the first discovery always missed the cache. Native tool search now declares one constant deferred anchor tool ahead of discovered tools, so discoveries only append to tools[].
2026-10-12 20:28:18 +02:00
Luis Pater
fb87727da0 Merge pull request #6543 from RoySRose/pr/claude-oauth-wrapped-full-mcp-name
fix(claude): restore passthrough MCP tools wrapped with their full mcp__ name
2026-10-13 00:53:07 +08:00
Luis Pater
a27799ec2b Merge pull request #6548 from gracjankubicki/fix/tool-search-golden-date
test(claude): pin executor clock in tool_search disabled golden
2026-10-12 21:45:38 +08:00
Luis Pater
1e37b52b2a fix(executor): preserve websocket sessions across reload and auth removal
Closes: #6549
2026-10-12 19:42:54 +08:00
Gracjan Kubicki
77cf88b088 test(claude): pin executor clock in tool_search disabled golden
The OAuth path injects a currentDate reminder, so the golden recorded on 2026-10-11 failed on any other day. Pin claudeCodeCurrentTimeFunc to the recording day and reset Claude diagnostics in renderToolSearchExecutorGolden.
2026-10-12 10:26:17 +02:00
Luis Pater
7b0319fb1c feat(codex): support Sign in with ChatGPT 2026-10-12 11:45:25 +08:00
RoySRose
02fc76b149 fix(claude): restore passthrough MCP tools wrapped with their full mcp__ name
With cloaked Claude OAuth, the model sometimes emits a caller-owned MCP tool
under the request-local virtual server while keeping the tool's full name,
e.g. mcp__<virtual>__mcp__<server>__<tool>. The existing recoveries only
handle the <server>__<tool> and <tool> tails, so this form is forwarded as an
undeclared tool name and the client cannot dispatch it.

Add a first recovery step that maps the suffix back when it is exactly the
full name of a declared passthrough tool. Ambiguous suffixes still fail
closed through the existing recovery path.
2026-10-12 11:53:16 +09:00
Luis Pater
a27183143e fix(antigravity): drop trailing thought-only model turns
Closes: #6530
2026-10-11 20:45:18 +08:00
Luis Pater
15d2148bc2 fix(gemini): ensure trailing user turn for function response with media
Closes: #6524
2026-10-11 17:58:34 +08:00
Luis Pater
ce518c9bcf test(claude): cover a reload between tool_search fallback and translation 2026-10-11 14:26:57 +08:00
Luis Pater
29bd0415b9 fix(claude): pin upstream.claude.tool-search per request 2026-10-11 14:21:00 +08:00
Luis Pater
03a3cfecb5 feat(claude): honor upstream.claude.tool-search in executor, catalog and server 2026-10-11 14:08:49 +08:00
Luis Pater
8eed08efc8 fix(claude): drop cache_control from deferred tool_search tools 2026-10-11 11:20:09 +08:00
Luis Pater
11f04c2077 feat(codex): advertise tool search only for natively supported Claude routes 2026-10-11 11:09:17 +08:00
Luis Pater
52992659ec feat(claude): fall back to pre-tool-search translation on unsupported upstreams 2026-10-11 11:06:04 +08:00
Luis Pater
48ad3487b2 feat(executor): add Responses tool_search strip and legacy model helpers 2026-10-11 11:01:28 +08:00