Commit Graph

1241 Commits

Author SHA1 Message Date
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
Luis Pater
37fe2608ee feat(usage): propagate access provider and native key metadata to usage records
- Inject API key, access provider, and native key flags into the request context during authentication
- Add `IsNativeKey` and `AccessProvider` fields to usage records, plugin API types, and redis queue payloads
- Provide context helper functions and automatic fallback resolution in the usage manager and reporter

Closes: #6509
2026-10-10 22:16:00 +08:00
Luis Pater
cad1b50347 fix(devin): do not seed input token estimates for claude streams
- Avoid seeding `message_start` with full-input token estimates in Devin streaming
- Rely on authoritative cache-aware token usage reported in response frames

Closes: #6505
2026-10-10 21:48:20 +08:00
Luis Pater
5dbd92a0e0 fix(auth): preserve upstream error cooldown on canceled stream contexts
- Record credential and model cooldowns when stream execution encounters an upstream error despite context cancellation
- Prioritize reading ready stream chunks before handling context cancellation in conductor
- Defer Codex websocket disconnect notifications until error frames are delivered to the stream

Closes: #6503
2026-10-10 20:26:36 +08:00
Luis Pater
be8c35f294 fix(claude): ignore invalid and null cache control entries in executor
- Use `isValidClaudeCacheControl` when inspecting `cache_control` fields across system prompts, tools, and message contents
- Prevent null or non-object cache control entries from counting against limits or interfering with TTL normalization and injection logic

Closes: #6491
2026-10-10 08:01:26 +08:00
Luis Pater
d318bcc3af fix(codex): handle late response interrupts on websocket sessions
- Track terminal response IDs per connection to idempotently handle late interrupts targeting completed turns
- Prevent late interrupts from contaminating subsequent requests or returning false errors on idle retained connections
- Add thread-safe diagnostic logging of sanitized interrupt outcomes in the Responses websocket handler

Closes: #6483
2026-10-09 21:35:40 +08:00
Luis Pater
76c87ce91d fix(xai): reset terminal error on websocket connection configuration
- Clear terminal error state when configuring a replacement xAI websocket connection to prevent stale error propagation

Closes: #6480
2026-10-09 20:26:25 +08:00
Luis Pater
e9c8769a7a fix(executor): normalize and restore non-portable tool call IDs
- Normalize tool use and tool result IDs in Claude message payloads to adhere to character constraints
- Encode non-portable tool call IDs in Devin executor responses and restore original IDs before request construction

Closes: #6478
2026-10-09 19:44:24 +08:00
sususu
f8e4a84074 fix(openai-compat): measure streaming TTFT on effective token frames 2026-10-09 19:00:58 +08:00
Luis Pater
2d8ec73b33 fix(claude): preserve mid-conversation effort directives during system insertion
- Skip directive-only system turns when locating the insertion point for mid-conversation system messages
- Prevent system blocks from being prematurely placed before subsequent user turns when effort directives are present

Closes: #6477
2026-10-09 17:43:09 +08:00
Luis Pater
51bde0ff96 fix(codex): preserve resolved upstream model in direct openai image requests
- Check configured upstream models and aliases before normalizing direct OpenAI image model names
- Support requested model resolution across JSON and multipart image payloads

Closes: #6458
2026-10-09 10:10:50 +08:00