Commit Graph

4687 Commits

Author SHA1 Message Date
Luis Pater
a1eeb60ec3 fix(codex): disable supports_image_detail_original for non-codex catalog routes
- Reset supports_image_detail_original to false in nullCodexClientRequiredOptions and non-template modality metadata while preserving image input modalities.
- Add regression coverage ensuring Claude and non-Codex routes advertise supports_image_detail_original as false while pure Codex template models keep it enabled.

Closes: #7209
2026-11-03 10:42:27 +08:00
Luis Pater
d38997717d fix(management): honor targeted OAuth re-login across all built-in providers
- Bind oauthRecoveryTarget, return target_auth_id, validate account/organization/domain identity, update the target credential in place, and report post-login verification outcomes across Antigravity, Kimi, Kimi-AI, Claude, xAI, Meta, and Devin OAuth sessions.
- Support auth_index-only target lookup, preserve target filenames during targeted saves without triggering legacy filename migration, and extend AuthGrantFingerprint with api_key and session_token fallbacks.
- Add regression tests covering targeted re-login, identity/organization/domain mismatch rejection, xAI partial identity preservation, and post-login inference verification across built-in providers.

Closes: #7204
2026-11-03 10:15:13 +08:00
Luis Pater
24b0454811 fix(antigravity): map safety and filter finish reasons to refusal in claude response translator
- Map upstream safety and content-filter finishReason values to Claude stop_reason "refusal" across streaming, non-streaming, and grounded web search response paths while preserving tool_use precedence.
- Prevent trailing streaming chunks with an empty finishReason from overwriting a previously recorded non-empty finishReason while keeping HasFinishReason set so buffered web search text still drains.
- Add unit tests covering non-streaming refusal mappings, empty-part streaming safety refusals, trailing empty finishReason chunks, and grounded web search finish reasons.

Closes: #7201
2026-11-03 08:43:02 +08:00
Luis Pater
e25b7dafa0 fix(devin): sanitize embedded exec tool phrases and stop retrying request-caused 403 errors
- Rewrite embedded exec_command and write_stdin phrases across all Devin tool descriptions regardless of tool name or mixed occurrences so Codex code-mode exec tools are not rejected.
- Classify Devin MCP configuration and content-policy 403 permission_denied errors as request faults in clienterror.IsRequestFault so the conductor neither retries nor cools down credentials.

Closes: #7198
2026-11-03 08:40:02 +08:00
Luis Pater
0130d6f38c fix(claude): keep Fable-only 429 rejections model-scoped when 5h headers are omitted
- Treat a rejected overage or 7d_oi response with an allowed 7d window and omitted 5h headers as model-scoped while keeping present malformed or exhausted 5h utilization credential-scoped.
- Add unit and executor regression tests verifying that Fable weekly rejections without 5h headers do not cool the credential or block sibling Opus requests.

Closes: #7197
2026-11-03 08:17:15 +08:00
Luis Pater
e582706557 fix(auth): prevent auto-refresh spin for disabled credentials with rejected refresh tokens
- Defer refresh scheduling to access token expiry or unschedule when a disabled credential encounters a terminal refresh error or holds an unchanged rejected refresh token.
- Preserve access token expiry scheduling on early return in refreshAuthForRequestAtEpoch and retain StatusDisabled when expired disabled credentials are unscheduled.
- Add regression coverage verifying disabled Codex credentials with rejected refresh tokens and unexpired access tokens do not spin the auto-refresh loop.

Closes: #7183
2026-11-03 03:47:11 +08:00
Luis Pater
6e6afab99a refactor: migrate gjson, sjson, and base64 to MoeForge/moego
- Replace tidwall/gjson and tidwall/sjson with github.com/MoeForge/moego/ojson
  and encoding/base64 with github.com/MoeForge/moego/base64 across the main
  module and examples
- Introduce cross-method *ojson.Doc request rewriting pipelines across
  thinking, signature, client/codex, runtime/executor/helps, pluginhost, and
  all provider executors with FinalizePayloadDoc as the final semantic barrier
- Convert all consecutive JSON mutations (>= 2 Set/SetRaw/Delete operations)
  to batch edits on ojson.Doc
- Upgrade read-only byte paths to ojson.GetBytesNoCopy,
  ojson.GetManyBytesNoCopy, and util.ParseGJSONBytesNoCopy with explicit
  strings.Clone ownership protection across streaming and persistent state
- Use base64.StdEncoding.ValidateString for zero-allocation signature checks
  and base64.EncodeDataURL for single-allocation data URL construction
v8.0.52
2026-11-03 03:05:04 +08:00
Supra4E8C
be2563ff74 docs: update Xcode sponsorship copy 2026-11-03 00:03:35 +08:00
Supra4E8C
b1a3e50bdc docs: remove OpenLux sponsorship from READMEs 2026-11-03 00:00:42 +08:00
sususu98
d7af371173 Merge pull request #7167 from sususu98/fix/pluginhost-model-stream-ownership-7159
fix(pluginhost): scope model execution streams to the owning plugin and instance
2026-11-02 18:22:07 +08:00
sususu
d96b194168 fix(pluginhost): reject model stream registration after concurrent teardown 2026-11-02 18:09:08 +08:00
sususu98
533687e418 Merge pull request #6315 from SomSamantray/fix/antigravity-aicode-scope
fix(auth/antigravity): request aicode OAuth scope
2026-11-02 18:04:07 +08:00
sususu98
f31d60aadb Merge pull request #7166 from sususu98/fix/request-logging-finalize-on-panic-7161
fix(api/middleware): finalize request logging on handler panic
2026-11-02 17:53:08 +08:00
sususu98
ef04e83ae9 Merge pull request #7165 from sususu98/fix/credential-dedup-connection-pool-7163
fix(config): include connection-pool settings in credential deduplication keys
2026-11-02 17:53:01 +08:00
sususu98
32e3fd550d Merge pull request #7164 from sususu98/fix/transport-cache-panic-unlock-7162
fix(helps): release TransportCache mutex on builder panic and retire purged entries
2026-11-02 17:52:55 +08:00
sususu98
06ec5eac72 Merge pull request #7187 from sususu98/fix/gemini-omitted-content-role-7186
fix(translator): normalize omitted and function roles in Gemini ingress translators
2026-11-02 10:17:07 +08:00
sususu
c888ff72d4 fix(translator): normalize omitted and function roles in Gemini ingress translators
- Normalize Gemini contents[].role in OpenAI, Claude, and Codex request translators via NormalizeGeminiTurnRole (mapping function/tool to user and inferring omitted/unrecognized roles from functionCall/functionResponse parts or previousRole without copying raw bytes)
- Support snake_case function_call and function_response parts consistently across Gemini ingress translators
- Skip appending a trailing empty outer message in ConvertGeminiRequestToOpenAI when a turn only contains functionResponse parts
- Add regression tests for omitted roles, role alternation, snake_case tool parts, and functionResponse turns

Fixes #7186
2026-11-02 10:12:44 +08:00
Luis Pater
7cad1cb7df Merge pull request #7142 from gabrielrinaldi/fix/grok-video-1.5-lite
fix(xai): support Grok Imagine Video 1.5 Lite
v8.0.51
2026-11-02 01:07:10 +08:00
Luis Pater
3ac384983e fix(gemini): preserve parallel responses tool output batches across developer notices
- Allow collectOpenAIResponsesFunctionCallOutputs to continue collecting tool outputs across intervening developer and system messages while pending tool calls remain.
- Compute the subsequent history slice start from one past the last consumed output index to handle non-contiguous output collection accurately.
- Add regression tests covering parallel text and image tool outputs across developer and system notices, turn boundaries, and orphan outputs.

Closes: #7177
2026-11-02 01:04:13 +08:00
Luis Pater
00b7677102 fix(translator): preserve developer roles in responses to chat completions
- Preserve original developer message roles, content, and relative positions when converting OpenAI Responses input items to Chat Completions messages while keeping unsupported attachment refusal scoped to user turns.
- Add translator and openai-compat executor regression tests covering system, developer, user, assistant, and tool-call message ordering across streaming and non-streaming requests.

Closes: #7174
2026-11-02 01:03:01 +08:00
Luis Pater
4448b96e4c Merge pull request #7113 from zoidypuh/pr/muse-1414-client-headers
fix(meta): add Muse tool namespace for subscription requests
2026-11-02 00:49:56 +08:00
Luis Pater
ec06c3cb8b fix(translator): normalize numeric schema constraints when converting parameters (#7149)
- Recursively convert string-encoded integer values on JSON Schema numeric constraint keywords (minLength, maxLength, minItems, maxItems, minProperties, maxProperties) to JSON numbers while keeping parameters to parametersJsonSchema conversion.
- Traverse only valid schema and subschema containers so string literals and non-schema extension metadata remain untouched.
- Add regression tests covering Gemini, Antigravity, OpenAI, Claude, Codex, and Interactions request translation paths.

Closes: #7149
2026-11-01 23:42:37 +08:00
Luis Pater
53ff2f9e74 feat(pluginhost): expose per-entry name and logo for multi-entry OAuth plugins
- Add AuthProviderEntry and AuthProviderEntries in sdk/pluginapi, forward entries over auth.identifier RPC, and send multi_auth_providers in lifecycle requests.
- Normalize per-entry OAuth display metadata with plugin metadata fallbacks in RegisteredPluginInfo while preserving legacy fields when entries are omitted.
- Expose HTML-sanitized oauth_provider_entries in management plugin list responses alongside oauth_provider and oauth_providers.

Closes: #7170
2026-11-01 22:46:17 +08:00
Luis Pater
24f9744013 Merge pull request #7143 from router-for-me/fix/codex-no-refresh-token-spin
fix(auth): prevent Codex refresh spin without refresh tokens
2026-11-01 22:29:52 +08:00
Luis Pater
ce39bc620f feat(pluginstore): support plugin locales normalization and management passthrough
Closes: #7110
2026-11-01 22:16:29 +08:00
sususu
a5795047bf fix(api/middleware): finalize request logging on handler panic
Defer wrapper.Finalize(c) in RequestLoggingMiddleware, stamp a 500 status when
a handler panics before writing a response, and mark the wrapper finalized so
outer recovery middleware does not reopen a second streaming log writer. Also
pass the chunk channel and stream writer by value to processStreamingChunks to
avoid racing with Finalize clearing wrapper fields.

Fixes #7161
2026-11-01 22:06:36 +08:00
sususu
8643ea56d5 fix(config): include connection-pool settings in credential deduplication keys
Include normalized per-credential connection-pool settings in Gemini/Interactions
and Vertex-compatible API key deduplication keys so entries that differ only in
connection-pool configuration are not silently dropped during sanitization.

Fixes #7163
2026-11-01 22:04:06 +08:00
Luis Pater
f7331b5197 fix(pluginhost): deframe same-format plugin executor streams and gate hooks v8.0.50 2026-11-01 21:29:23 +08:00
Luis Pater
aca8dfe0f4 Merge pull request #7154 2026-11-01 21:29:23 +08:00
Luis Pater
08437a6742 fix(codex): keep shortened gateway mcp tool names readable in claude translator
- Strip intermediate hex instance identifiers from overlong gateway-namespaced MCP tool names so the shortened 64-character candidate preserves both the server words and the distinct tool name.
- Reuse shortenNameIfNeeded as the base candidate function in buildShortNameMap to keep single-name shortening and reverse tool name mapping consistent.

Closes: #7155
2026-11-01 21:21:33 +08:00
sususu
3698b1597a fix(pluginhost): scope model execution streams to the owning plugin and instance
Bind modelStreamBridge entries to the caller's plugin ID and callback instance
so host.model.stream_read and host.model.stream_close reject cross-plugin or
cross-instance access. Also close model streams when callback instances or
plugins are torn down.

Fixes #7159
2026-11-01 20:17:56 +08:00
sususu
8a82bed582 fix(helps): release TransportCache mutex on builder panic and retire purged entries
Ensure TransportCache.Get and detachMatching always release c.mu via defer
when a caller-supplied callback panics, preventing the cache mutex from being
permanently wedged after recovery. Also mark entries as retired in Purge() to
match evictLocked, CloseKey, and detachMatching.

Fixes #7162
2026-11-01 20:07:46 +08:00
sususu
a21814ec60 docs(config): note connection-pool pruning boundaries on save
Credential connection-pool blocks are intentionally absent from the default-value pruning whitelist: a block already present on disk is merged in place and survives, and only zero-valued blocks that exist solely in an in-memory Config are pruned.

Also note that the block is excluded from nested-key pruning, because a removed pool sub-key can mean either delete or inherit the group value.

Comments only, no behavior change.
2026-11-01 19:46:44 +08:00
Supra4E8C
9513c2d5dc docs(auth): explain Codex refresh token key requirement 2026-11-01 18:07:44 +08:00
Luis Pater
d65840fb5c fix(xai): append identity hash to credential filenames to prevent collisions
- Hash the original email or subject into the xAI credential filename so distinct accounts that sanitize identically no longer overwrite each other.
- Migrate pre-hash and identity-subset predecessors on re-login, keeping the richest known filename and preserved settings without claiming foreign files.

Closes: #7145
2026-11-01 15:28:05 +08:00
Luis Pater
9037d5430d fix(openai): drop output-only content_token_count from replayed responses websocket items
- Sanitize only upstream-originated replay copies (transcript merge and tool-call repair cache entries) so another credential cannot reject them as unknown input.
- Match passthrough members by decoded key name across duplicates and escaped spellings, drop objects emptied by removal, and leave client input, downstream payloads, and invalid JSON unchanged.

Closes: #7146
2026-11-01 15:27:05 +08:00
Rick7C2
41c03b7451 fix(pluginhost): normalize same-format plugin executor streams through the stream translator
Plugin executor streams whose output format equaled the requested format bypassed stream translation, so SSE-framed chunks ("data: {...}" plus "data: [DONE]") reached the OpenAI/Gemini handlers unchanged. Those handlers add their own "data:" prefix and terminal marker, producing a doubled "data: data:" prefix and a duplicated [DONE] on the wire.

Built-in executors always run TranslateStream, and the registered same-format translators strip that framing. Route same-format plugin executor streams through the same translation instead of returning the channel or payload unchanged. Formats without a same-format translator keep the existing behavior via the TranslateStream fallback, which returns the payload unchanged, and the OpenAI Responses usage-details fixup still runs after translation.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-01 06:55:20 +00:00
Luis Pater
675debc068 Merge pull request #7141 from Ruanyuxi1337/fix/release-flusher-idle
fix(home): keep the release flusher idle when nothing is pending
2026-11-01 14:34:54 +08:00
Luis Pater
a96e640d88 fix(auth): keep sign-in-required Codex credentials quarantined across manual refresh
- Fail forced refreshes when rejected refresh tokens remain unchanged without disk rotation and preserve rejected access token markers across no-op refreshes.
- Require a valid active access token when sign-in is required before restoring active routing status during refresh and lifecycle updates.
- Return the redacted credential entry view from the v8 management credential refresh endpoint.

Closes: #7135
2026-11-01 14:27:47 +08:00
Luis Pater
ecbaa6c710 fix(devin): route compound fast thinking levels to upstream fast variants
- Resolve strict "<level>-fast" requests (parenthesis suffix or body thinking_level) to "<base>-<clamped-level>-fast" in ResolveDevinChatModelUID instead of silently falling back to the default effort.
- Treat a bare "fast" request as the default-effort fast variant so "(fast)" no longer resolves to the plain default UID; private aliases, special families, and the lightning tier keep their existing handling.
- Add regression coverage for the fast suffix and body-level forms plus pinning cases for private aliases and lightning models.

Closes: #7144
2026-11-01 14:27:46 +08:00
HunterSThompson
bb6e1aa8c0 fix(meta): include Muse namespace in tool-bearing requests 2026-11-01 14:27:45 +08:00
HunterSThompson
5d8fddd338 chore(meta): match Muse Code 1.4.14 client headers
Subscription keys return HTTP 403 client_attestation_denied when the
request still looks like muse-build/1.3.0. Stamp the headers captured
from Muse Code 1.4.14-R7309.1: muse-build/1.4.14, X-Client-Id tbh:exec,
and a fresh session id set.
2026-11-01 14:27:43 +08:00
sususu98
f692d93e27 Merge pull request #7101 from sususu98/feat/proxy-connection-pool
feat(proxy): add opt-in per-api-key upstream connection pooling
2026-11-01 14:24:39 +08:00
sususu
fd02b720e6 fix(proxy): stamp keepalive on uTLS dialers, rebind stale compat executors, and close retired pools outside fence lock 2026-11-01 14:20:38 +08:00
sususu
893958e401 fix(proxy): decline pooling when http.DefaultTransport is not *http.Transport 2026-11-01 14:14:16 +08:00
sususu
6c231c2332 fix(proxy): lazily allocate uTLS pools and close fenced transports 2026-11-01 14:14:16 +08:00
sususu
638f5f55e0 fix(proxy): honour per-key pool opt-in and isolate pools per runtime
- Keep an empty connection-pool block as an opt-in. Synthesising it to nil
  silently disabled pooling for `connection-pool: {}` and for keys inheriting
  an empty group block.
- Fold the transport kind into the pool key and pool the Claude Code uTLS
  transport per credential. Anthropic upstreams previously shared one
  transport across keys and ignored the key's pool settings.
- Fence generations per publisher instead of process-wide. Building or
  reloading one service no longer retires the pools another service is
  still serving, which degraded it to one transport per request.
2026-11-01 14:14:16 +08:00
sususu
9f0c9ff420 docs(config): document per-api-key connection pools
Describe the api-keys `connection-pool` block in the shipped template: writing it
is the opt-in, pools stay per key, authenticated proxy URLs are isolated by a
digest of their proxy credentials, the defaults are a 300s idle window and two
idle connections per host, and zero or negative values disable keep-alives. Note
that no global pooling switch exists and that Antigravity keeps its own
antigravity.connection-pool settings.
2026-11-01 14:14:16 +08:00
sususu
34a01b7602 feat(proxy): pool upstream transports per api key
Give the generic proxy-aware clients a reusable transport per api-key
credential, driven by the `connection-pool` block added in the previous commit.

- Pools are keyed by credential scope (auth ID, then path/source, then a digest
  of refresh/access/API-key material, then anonymous), normalized proxy target
  (authenticated proxies fold a SHA-256 digest of user:pass into the key so each
  proxy identity or sticky-session username keeps its own pool without storing
  plaintext secrets in the cache key or logs), and the resolved settings. Two
  keys therefore never share a TCP/TLS connection regardless of whether the
  proxy is unauthenticated, authenticated, direct, or inherited.
- Capacity is a 512-entry LRU: one key keeps a warm pool, 100 keys keep one each,
  and 100000 keys fall back to the historical one-transport-per-request behavior
  when the cache is full. Each transport is bounded to MaxIdleConnsPerHost
  instead of the cloned default of 100 idle sockets, so idle sockets stay at
  capacity*max no matter how many keys exist.
- Dead peers are detected without request timeouts: 30s TCP keepalive on every
  dialed connection (including SOCKS5, which used proxy.Direct before) plus the
  idle timeout, 300s by default. Measured against ollama.com, an idle pooled
  connection was still reusable after 600s; the 90s that used to bound this path
  was net/http's own IdleConnTimeout, not an upstream limit.
- Explicit 0 or negative values disable keep-alives (including when proxy-url is
  empty), invalid durations are parsed once per pool instead of warning per
  request, and pooling works with or without an explicit proxy-url while keeping
  priority for context-injected RoundTrippers when proxy-url is empty.
- Config snapshots carry a generation so a request holding an obsolete snapshot
  cannot repopulate the cache after a reload. Generation 0 means the config never
  passed the fence and stays poolable, so callers that build their own config are
  not silently downgraded.
2026-11-01 14:14:16 +08:00
sususu
bf834311e6 feat(config): add per-api-key connection-pool settings
Add an optional `connection-pool` block to the api-key config surface: group
level on codex/claude/gemini/vertex/openai-compatibility entries and per key
inside `keys`. There is deliberately no global switch, so enabling reuse for one
key cannot change the transport lifecycle of another provider or OAuth identity.

- `connection-pool` joins the v8 shared key fields, so a group block is flattened
  into every key and each key may override it.
- A per-key block merges onto the group block: fields the key does not mention
  (or sets to null) keep inheriting the group value. Replacing the whole block
  would silently drop the group's `enabled: true` when a key only overrides a
  timeout.
- The resolved block reaches executors on `Auth.ProxyConnectionPool` (deep-copied
  on clone so auth snapshots never share mutable state). Writing the block is the
  opt-in; only an explicit `enabled: false` turns pooling off for that key.
- OpenAI-compatible keys use the same field-level inheritance against their
  provider group default, and watcher config diffs report connection-pool
  changes on hot reload.
2026-11-01 14:14:16 +08:00