Commit Graph

4815 Commits

Author SHA1 Message Date
Luis Pater
46d48eb5af fix(openai): start responses websocket keepalive after upgrade
- 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>
2026-11-10 17:36:17 +08:00
Luis Pater
1855209dcd Merge pull request #7403 from router-for-me/home
fix(home): only renew liveness on heartbeat pong
2026-11-10 16:40:33 +08:00
Luis Pater
0e0cab0de6 fix(openai): inject placeholder reasoning_content for compat Claude tool calls
- Add a single-space reasoning_content placeholder on assistant tool-call turns without replayable thinking text when is-compat and request reasoning are active.
- Reconcile tool-call placeholder reasoning after canonical thinking resolution so model suffixes and capability normalization govern final inclusion before payload rules.
- Add unit and executor regression tests covering absent/whitespace thinking, disabled thinking, suffix overrides, and final payload overrides/filters.

Closes: #7398
Co-authored-by: Dylan <1990016@gmail.com>
2026-11-10 16:39:16 +08:00
sususu98
40e5a40fd8 Merge pull request #7397 from sususu98/fix/request-scoped-errors-usage-fail-code
fix(usage,auth): propagate request-scoped error rule classification to usage fail.code
2026-11-10 14:46:58 +08:00
sususu98
18883a57b4 fix(usage,auth): propagate request-scoped error rule classification to usage fail.code 2026-11-10 14:17:12 +08:00
hkfires
c9dad84703 fix(home): only renew liveness on heartbeat pong
Preserve an absolute heartbeat deadline across config,
cluster, and telemetry messages so ordinary subscription
traffic cannot mask a stalled heartbeat. Only an
empty-payload PONG renews liveness and resets reconnect
failures, and messages arriving after the deadline are
treated as timeouts
2026-11-10 13:19:09 +08:00
Luis Pater
13fdcc5e09 fix(thinking): recognize claude thinking.display updates in summary pipeline
- Treat thinking.display="updates" as an enabled reasoning summary mode when extracting Claude summary configuration so translated requests emit target visibility controls such as Antigravity includeThoughts.
- Preserve an existing "updates" display mode when applying enabled summary configuration back onto Claude request documents instead of overwriting it with "summarized".
- Add unit and cross-protocol translation regression tests for Claude thinking.display="updates".

Closes: #7393
Co-authored-by: Dylan <1990016@gmail.com>
2026-11-10 10:56:32 +08:00
Luis Pater
845345845b docs(config): document X-Session-ID guidance for full-history compaction under session affinity
- Document in config.example.yaml and RoutingConfig.SessionAffinity that Merkle LCP compaction matching requires at least 2 shared trailing turns.
- Note that clients whose compaction replaces all earlier turns with a summary should send X-Session-ID or another explicit session ID to preserve credential affinity.

Closes: #7390
Co-authored-by: Dylan <1990016@gmail.com>
2026-11-10 10:50:25 +08:00
Luis Pater
6db7d4b839 fix(claude): extend preserved thinking and per-turn timing gates to Claude Fable 5.2
- Include claude-fable-5-2 in preserved-thinking block binding so replayed signed thinking blocks default to drop_block on prefix mismatch.
- Consolidate 2.1.321 per-turn effort and timing model capability checks to cover Fable 5.2, Sonnet 5.5, and Mythos 5.2 while keeping Haiku 5.5 excluded from timing.
- Update the baseline software profile test failure message to match 0.128.0/v26.12.1 and add regression tests for 2.1.321 timing and preserved thinking.

Closes: #7386
Co-authored-by: Dylan <1990016@gmail.com>
v8.0.63
2026-11-10 08:28:13 +08:00
Luis Pater
1649a002aa Merge pull request #7392 from adamentwistle/fix/claude-cli-baseline-2.1.321
fix(claude): bump Claude Code CLI fingerprint baseline to 2.1.321
2026-11-10 08:20:59 +08:00
Adam
b4e7dbd2c9 fix(claude): bump Claude Code CLI fingerprint baseline to 2.1.321
Anthropic now rejects claude-fable-5-2 from Claude Code versions older than
2.1.290, so every cloaked (non-Claude-Code) request for the model failed with
400 "Claude Code 2.1.280 does not support this model".

Update the emulated CLI baseline to the measured 2.1.321 release:
- User-Agent claude-cli/2.1.321, Stainless package 0.128.0, runtime v26.12.1,
  billing cc_version and default fallback version.
- Rebuild Anthropic-Beta assembly from native 2.1.321 captures:
  thinking-token-count moves after advisor-tool, effort precedes
  dangerous-tool-use, message-threads is added when the body carries a thread
  object, mid-conversation-system is only sent when requested, and the quota
  probe omits the claude-code beta.
- Recognize Fable 5.2 and Haiku 5.5 for progress display, per-turn control and
  effort handling, matching the observed client.
- Add a regression test that reproduces each captured 2.1.321 beta header and
  the billing fingerprint.

Fixes #7386
2026-11-10 00:03:55 +00:00
Luis Pater
714f052618 fix(codex): allow hosted image_generation injection on standard Responses without reasoning
- gate automatic image_generation tool injection for use_responses_lite catalog models on actual Responses-Lite routing (including credential and model header overrides) or presence of reasoning effort
- retract untouched auto-injected image_generation tools during single-pass payload finalization when user payload rules configure reasoning effort or switch to an incompatible route
- update Codex executor and payload barrier regression tests across HTTP and WebSocket streaming and non-streaming paths

Closes: #7384
Co-authored-by: Dylan <1990016@gmail.com>
2026-11-10 04:00:28 +08:00
Luis Pater
19a0a8541f feat(models): add claude-fable-5-2 and gemini-omni-1.2-flash to model registry
- Register Claude Fable 5.2 in the Anthropic collection with thinking levels, image input support, and updated pricing description.
- Register Gemini Omni 1.2 Flash across Google, Vertex, and Gemini CLI collections with thinking token ranges and multimodal input/output support.
2026-11-10 03:09:49 +08:00
Luis Pater
dae6007d1f Merge pull request #7370 from whale9820/feat/oauth-login-proxy
feat(cmd): add -login-proxy flag for CLI OAuth logins
2026-11-10 02:57:42 +08:00
Luis Pater
8de6e3fe3e Merge pull request #7378 from ngvoicu/fix/devin-usage-cache-write
fix(devin): count cache-write tokens in total input
2026-11-10 02:55:57 +08:00
Luis Pater
628e54abf3 fix(watcher): update active auth directory and fsnotify watch on runtime auth-dir changes
- Synchronize Watcher.authDir and rebind the fsnotify directory watch when SetConfig or reloadConfig updates the authentication directory.
- Read the active auth directory across snapshots, full rescans, and incremental file events while discarding stale pre-switch directory events.
- Add regression tests covering runtime auth-dir reloads, shared credential filenames, concurrent SetConfig updates, and stale event isolation.

Closes: #7160
Co-authored-by: Dylan <1990016@gmail.com>
2026-11-10 01:27:39 +08:00
Luis Pater
4b3f2c7ec7 fix(logging): skip request error dumps for unrouted 404 responses
- Exclude unrouted 404 responses without upstream activity or API error evidence from per-request and forced error log dumps so high-frequency probes cannot evict diagnostic dumps from the error-logs-max-files ring.
- Avoid initializing or retaining streaming log writers and temporary part files when Gin matches no route for a 404 response while preserving routed 404 and panic error dumps.

Closes: #7363
Co-authored-by: Dylan <1990016@gmail.com>
v8.0.62
2026-11-10 00:21:22 +08:00
Luis Pater
2c4322c7f0 Merge pull request #7380 from router-for-me/auth
feat(auth): account for pinned and reused traffic in weighted routing
2026-11-09 23:05:55 +08:00
Luis Pater
23e31fe288 fix(executor): stabilize Codex refresh and websocket tests under CPU contention
- 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>
2026-11-09 22:44:41 +08:00
Luis Pater
beb4335954 fix(claude): materialize top-level cache_control in cloaked requests
- Move top-level automatic prompt caching markers onto the last cacheable block and remove the top-level field during ensureCacheControl so cloaked requests avoid TTL mismatches and duplicate breakpoints.
- Extend the Claude cache_control stream scanner and helper routines to account for top-level cache_control when counting, enforcing the 4-block limit, and normalizing or upgrading TTLs.

Closes: #7366
Co-authored-by: Dylan <1990016@gmail.com>
2026-11-09 22:44:37 +08:00
hkfires
216f2947fc feat(home): report reused dispatch turns in usage
Add attempt-scoped HomeSelection metadata carrying the reused and
additional flags, scheduling route model, and credential policy
through usage records to the Redis queue. Mark retained executions
and Codex duplex successors as reused so Home can compensate later
turns after completion without redispatching or reacquiring a
concurrency slot.

Mark split additional-model records as additional so they never add
scheduling charges, while preserving independent per-response
execution IDs for deduplication. Document the deferred accounting
and add coverage across conductor, duplex, reporter, and queue.
2026-11-09 22:31:47 +08:00
sususu98
bce665d7c9 Merge pull request #7374 from sususu98/feat/asymmetric-signature-replay
feat(gemini): support asymmetric thoughtSignature replay KV across Gemini executors and eliminate KV double base64 encoding
2026-11-09 18:57:59 +08:00
sususu98
00c6ae82ca perf(cache): eliminate double base64 encoding for reasoning replay KV arrays 2026-11-09 18:54:46 +08:00
sususu98
cc95661ce4 feat(gemini): support asymmetric thoughtSignature replay KV across Gemini executors 2026-11-09 18:54:46 +08:00
hkfires
e84d4836b7 fix(auth): account pinned traffic in bare weighted routing
Extend weighted pinned accounting beyond session affinity so pinned
and ordinary requests share the same credits even when affinity is
disabled. Route scheduler, legacy, mixed, and bare selector picks
through the shared weighted pool, exclude zero-weight credentials
before priority selection, and preserve single-provider transport
preference for mixed requests.
2026-11-09 18:41:34 +08:00
Dylan
d1218c0a81 Merge pull request #7375 from router-for-me/fix/claude-code-user-agent-extensions
fix(claude): preserve native Claude Code requests with UA extensions
2026-11-09 18:12:40 +08:00
Dylan
5930433014 fix(claude): retain request fields with stabilized client profiles 2026-11-09 18:02:40 +08:00
Dylan
542a525fcf fix(claude): recognize native client user-agent extensions 2026-11-09 18:02:40 +08:00
Luis Pater
aa3fe8eac9 Merge pull request #7377 from router-for-me/home
feat(auth): compensate weighted routing for sticky sessions
2026-11-09 17:34:44 +08:00
Gabriel Voicu
eb6e25abe6 fix(devin): count cache-write tokens in total input
Devin reports the prompt in three disjoint parts: uncached (field 2), cache
write (field 4) and cache read (field 5). The executor summed only uncached +
cache read, so a cache miss on the GPT route (almost all cache write)
reported ~3 input tokens for a full prompt, and the Claude route lost the
written part on every first request. CPA's own token accounting expects the
total to include writes and marked those responses inconsistent; the
Claude-format translator already subtracts read + write from the total.

Live: GPT-6.1 Sol miss was 3 uncached + 6103 written, reported as 3 input;
the next request read 6103 of 6106. Updates the #5910 regression test.
2026-11-09 11:32:35 +02:00
whale9820
bebd92c4c8 feat(cmd): add -login-proxy flag for CLI OAuth logins
Route the CLI OAuth flow through a chosen proxy and persist it as the
new credential's proxy_url, matching the management API's session
proxy behavior.
2026-11-09 15:08:55 +08:00
hkfires
e479ab1253 perf(auth): compact weighted round-robin pools
Replace string pool keys and map-based credit state with SHA-256
digest keys and sorted slice members holding weight, current, and
pending credits in a single allocation. Reservations now retain
only the member index instead of a weights map and auth ID.

Verify full pool identity on digest hits and chain collisions so
unrelated candidate pools never share credits or weights. Update
tests to access pool credits through test helpers.
2026-11-09 14:23:17 +08:00
hkfires
d20451504f feat(auth): compensate weighted routing for sticky sessions
Charge session-affinity hits, parent inheritance, LCP matches,
and pinned requests against the eligible weighted pool without
moving existing bindings, so new sessions favor under-served
credentials and request ratios stay approximately weighted.

Scope settled credits per eligible credential set, capped at
+/-32 pool rounds, with in-flight reservations that commit on
local selection success and release on failure.
2026-11-09 14:23:16 +08:00
hkfires
0561334f06 fix(home): preserve fork kind in home dispatch
Map IsFork metadata to X-Node-Kind: fork when dispatching to
Home so forked sessions keep their lineage kind alongside
explicit kinds such as compaction. Clone dispatch headers
before adding the Home-only header to avoid mutating caller
headers, and cover fork, compaction, and ordinary children
with session hierarchy tests.
2026-11-09 14:18:50 +08:00
sususu98
f36b195e7e perf(antigravity): skip reasoning replay KV for symmetric gemini/interactions protocols 2026-11-09 09:57:21 +08:00
Luis Pater
098af7d543 fix(auth): share and migrate model cooldowns across equivalent model spellings
- Normalize model state, scheduler shard, and cooldown lookups case-insensitively while preserving stored model key casing.
- Atomically migrate route-alias cooldowns to the resolved upstream model key when OAuth model aliases or credentials are updated.
- Add regression tests covering mixed-case alias targets, pre-existing alias cooldown migration, and concurrent persistence windows.

Closes: #7360
2026-11-09 09:35:10 +08:00
Luis Pater
14e577174a fix(pluginhost): support credential-scoped rate limit errors from plugin executors
- Add optional credential_scoped metadata and documented routing/cooldown error code constants to pluginabi.Error so plugin executors can report account-wide 429 limits.
- Preserve credential-scoped classification on rpcError across synchronous RPC envelopes and streaming error callbacks while prioritizing credential quota scope over model-only or cooldown-skipping error codes.
- Recognize credential_quota error codes in core auth cooldown classification and cover whole-credential cooldown propagation and error events with regression tests.

Closes: #7359
2026-11-09 03:19:45 +08:00
Luis Pater
2c5b01f439 fix(claude): disable default upstream connection reuse and revert post-stream draining
- Revert post-message_stop response body draining and detachable request context from Claude streaming execution so completed streams close immediately instead of returning connections to the idle pool.
- Set MaxIdleConnsPerHost to -1 on the default Claude Code uTLS transport to disable idle connection reuse for OAuth and unpooled credentials while preserving the Connection: keep-alive wire header and explicit connection-pool opt-in.
- Add regression tests verifying short-lived default Claude Code connections, explicit per-key pool reuse, and non-reused streaming connections.

Closes: #7357
2026-11-09 02:46:14 +08:00
Luis Pater
681ce41b6e Merge pull request #7281 from duu261/docs/readme-cpa-status
docs(readme): mention cpa-status in Hermes entry
v8.0.61
2026-11-08 22:30:45 +08:00
Luis Pater
0074897481 feat(pluginhost): expose token modality details in usage.handle
- Extend pluginapi.UsageDetail with optional modality token counters matching core usage.Detail.
- Forward independent pointer copies of modality counters in usageAdapter.HandleUsage so plugins receive full breakdown details.
- Add adapter, SDK, and RPC regression tests covering populated, explicit zero, and absent modality counters.

Closes: #7352
2026-11-08 20:52:39 +08:00
Luis Pater
40c16182b8 feat(auth): support session-affinity-rebind-on never mode
- Add the "never" option for routing.session-affinity-rebind-on to preserve established session bindings across all credential failures and refuse cross-credential failover across primary, fallback-key, and Merkle LCP paths.
- Scope retry rounds and Antigravity credits fallback to the bound credential under "never" mode, returning 503 session_auth_retry on transient unavailability and 429 or upstream errors on quota/auth blocks.
- Add unit and end-to-end regression tests covering selector refusal, retry rounds, empty candidate sets, Antigravity credits fallback, and runtime config reload.

Closes: #7348
2026-11-08 15:38:30 +08:00
Luis Pater
05e668cf2d fix(responses): sanitize orphan tool outputs lacking call_id
- Rewrite standalone function_call_output and custom_tool_call_output items without call_id into user messages while preserving paired tool outputs and multimodal content parts.
- Apply orphan tool output sanitization in both Codex Responses request translation and the Responses HTTP/compact handlers while keeping codex_app delegation compatibility intact.
- Add regression tests covering orphan Companion Page outputs, multimodal array outputs, paired tool calls, and HTTP/compact endpoints.

Closes: #7341
2026-11-08 14:46:03 +08:00
Luis Pater
09b3a57981 fix(codex): harden SIWC refresh deferral and expires_in parsing
- Parse expires_in with finite/range checks to prevent duration overflow.
- Introduce ErrSIWCRefreshDeferred sentinel and add macOS pmset deferral diagnostics.
- Expand regression tests and reduce SIWC renewal completion log noise.
2026-11-08 05:06:59 +08:00
Luis Pater
466b28dabc Merge branch 'codex/pr-7311' into dev 2026-11-08 04:48:23 +08:00
Luis Pater
f69db99d5e feat(plugin-store): support opt-in release cache refresh on store listing
- Accept refresh=true or refresh=1 on the plugin store listing endpoint to bypass the 1-hour latest-release cache TTL for installed plugins.
- Track last check timestamps on release cache entries with a 10-second per-key refresh floor while preserving GitHub rate-limit cooldowns and in-flight coalescing.
- Add unit tests and update v8 management API documentation for the refresh query parameter.

Closes: #7333
2026-11-08 04:42:54 +08:00
Luis Pater
0e07108899 Merge pull request #7306 from kdcokenny/docs/swe-2-flash-availability
docs(readme): add SWE-2 Flash to Devin models
2026-11-08 04:16:24 +08:00
Luis Pater
91e0dee827 fix(openai): prevent SSE keep-alive injection mid-line during image streaming
- 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
v8.0.60
2026-11-08 02:02:31 +08:00
Luis Pater
e6931d51e3 fix(translator): preserve standalone Claude output_config.effort on OpenAI requests
- Map explicit output_config.effort to reasoning_effort in ConvertClaudeRequestToOpenAI when the thinking object is omitted.
- Preserve existing budget_tokens, disabled thinking, model suffix, and final payload rule precedence across translation and thinking stages.
- Add regression tests for standalone effort translation, chained thinking normalization, and finalized OpenAICompatExecutor payloads.

Closes: #7327
2026-11-07 23:33:09 +08:00
Luis Pater
ce38c75c62 fix(claude): drain streamed response body after message_stop to reuse upstream connections
- Add NewDetachableContext in executor helpers so upstream requests follow downstream cancellation until message_stop and detach afterward before the handler cancels the request context.
- Close the output stream channel first and then drain up to 64 KiB of the remaining raw upstream response body to EOF so net/http returns completed streaming connections to the idle pool.
- Treat valid message_stop data lines in the translated streaming path as completion before translation so terminal-event cancellation does not abort connection pooling.

Closes: #7326
2026-11-07 21:39:22 +08:00
Luis Pater
69637a662a fix(openai): skip whitespace-only reasoning when opening Claude thinking blocks
- Ignore whitespace-only reasoning deltas and non-streaming reasoning entries when no thinking block is currently active so Anthropic-incompatible blank thinking blocks are never emitted.
- Allow whitespace reasoning segments to extend already-open streaming thinking blocks, tool-call-buffered thinking chunks, and non-streaming thinking builders.
- Add streaming and non-streaming regression tests covering whitespace-only and intra-thought whitespace reasoning.

Closes: #7325
2026-11-07 18:22:20 +08:00