3607 Commits

Author SHA1 Message Date
Luis Pater
17a65ee547 fix(codex): support reasoning_text in openai chat completion responses
- Handle `response.reasoning_text.delta` and `response.reasoning_text.done` stream events for delta reasoning content.
- Extract `reasoning_text` content from output reasoning items in non-streaming responses.

Closes: #5378
v7.2.147
2026-09-01 18:12:52 +08:00
sususu
dc0f7a594b fix(session): derive LCP session ID from rolling prefix keys and harden matcher
- root derived session ID in rolling prefix key to disambiguate conversations with different system prompts
- sanitize matcher config to guarantee MaxPrefixes >= MaxTurns
- tie-break tool parts sorting with digest for determinism
2026-09-01 18:00:13 +08:00
sususu
5679bbf330 fix(auth): optimize session cache LRU capacity eviction
- replace O(N log N) sorting under global write lock with container/list LRU eviction
- track primary alias groups for O(1) group lookup and clean group eviction
- capture timestamps inside lock and add nil receiver guards
2026-09-01 18:00:09 +08:00
sususu
acc1500f60 test(executor): update antigravity interactions test to use valid model 2026-09-01 18:00:04 +08:00
sususu
35e3d97dac fix(registry): remove defunct gemini-3-flash-agent model from antigravity provider
Remove gemini-3-flash-agent and legacy gemini-3.5-flash entries from the embedded antigravity model registry in models.json, as upstream Google Cloud Code / Antigravity endpoints return 500 UNKNOWN for these model IDs. Update excluded model tests to assert against active model gemini-pro-agent instead.
2026-09-01 15:26:57 +08:00
Luis Pater
fae57a3a88 fix(session): support identity and subagent extraction from nested request payloads
- Extract subagent IDs, user IDs, and prompt cache keys from nested `request` objects across session identity, session info, and auth selection.
- Normalize and fall back appropriately when top-level prompt cache key fields are empty strings.
- Inspect nested request fields when validating explicit session identities.
2026-09-01 11:23:38 +08:00
Chén Mù
ed37aa035c Merge pull request #5374 from router-for-me/home
Enhance homeDispatchConn with untrack method and improve connection closure handling
2026-09-01 09:40:15 +08:00
Chén Mù
9ca93840db Merge pull request #5373 from router-for-me/tests
Improve test reliability by avoiding wall-clock time
2026-09-01 09:36:29 +08:00
hkfires
22a57401a1 fix(tests): improve test reliability by avoiding wall-clock time in TTL and cache-eviction tests 2026-09-01 09:24:05 +08:00
hkfires
dbcc4ecd6f feat(home): enhance homeDispatchConn with untrack method and improve connection closure handling 2026-09-01 09:23:41 +08:00
hkfires
8bcae8cf20 docs: document timer granularity and sleep convention in AGENTS.md 2026-09-01 09:23:17 +08:00
Luis Pater
7070785140 fix(auth): preserve upstream status codes in antigravity auth errors
- Introduce `HTTPStatusError` to retain upstream HTTP status codes across Antigravity OAuth and project lookup calls.
- Propagate status codes and retry-after metadata from cause errors in `missingAntigravityProjectIDError`.

Closes: #5368
2026-09-01 08:37:02 +08:00
Luis Pater
f2e2d713b2 fix(auth): propagate upstream error causes in auth selection failures
- Attach candidate upstream errors as causes to scheduler availability and cooldown errors.
- Introduce `errorWithCause` wrapper to extract and display upstream error summaries.
- Enrich auth selection error messages with upstream details and preserve model cooldown errors.
- Forward `Retry-After` response headers for model cooldown errors in Claude Code handler.

Closes: #5365
2026-09-01 08:15:51 +08:00
Luis Pater
ff811577eb fix(auth): isolate subagent session affinity for antigravity and gemini
- Prevent subagent sessions from inheriting parent credentials on Antigravity and Gemini providers and models to mitigate concurrency rate limiting.
- Avoid aliasing subagent session keys to parent fallback keys or mutating parent bindings during subagent result handling.

Closes: #5364
2026-08-31 22:34:58 +08:00
Luis Pater
9721d9939e feat(usage): track streaming execution state in usage records
- Add `Stream` field to usage records, context helpers, and Redis queue payloads.
- Propagate streaming mode across execution handlers, conductors, and usage reporters.

Closes: #5361
2026-08-31 20:29:19 +08:00
sususu
5755d00b1b refactor(session): prune in-memory session tree store in favor of flat KV affinity and pure info extraction
- Replace complex materialized tree structures with lightweight (session_id, parent_id) extraction
- Maintain O(1) flat KV cache for subagent-to-parent prompt cache inheritance
- Add tree_compat.go with deprecated stubs to preserve SDK compatibility
- Add comprehensive regression tests for multi-protocol session headers and payloads
2026-08-31 20:28:15 +08:00
Luis Pater
9fdc460585 fix(claude): preserve tool pairing across intervening system messages
- Preserve pending tool use IDs across message-level system reminders to maintain tool call and result alignment.
- Merge adjacent Gemini request contents for consecutive user and system reminder turns.
- Relax tool response reordering condition and preserve non-response parts in Antigravity executor.
- Align tool results and buffer pending system reminders in OpenAI translator.

Closes: #5354
2026-08-31 19:27:20 +08:00
sususu
c99ce12123 fix(session): harden depth-cap index cleanup, bound lcp fingerprints, and support nested payloads (#5202) 2026-08-31 14:55:37 +08:00
sususu98
c2021cd2fe perf(test): eliminate physical sleeps and normalize mock timeouts in xai and home (#5328)
- Inject test-scoped minPollInterval into XAIAuth to avoid multi-second physical sleeps during device-flow polling tests
- Add TestXAIAuthDefaultPollInterval regression test to verify default production interval remains 5s
- Introduce testOperationTimeout to home Client so mock test clients consistently use short 50ms timeouts
- Fix malformed RESP bulk string length for GET config mock response in TestRunConfigSubscriberLifetimeRejectsInvalidSubscriptionACK
- Add TestDefaultProductionClientTimeouts regression test to verify default production timeouts are preserved
2026-08-31 14:32:24 +08:00
sususu
100c564313 fix(session): harden nil fallback, normalize agent id, and support nested antigravity payloads (#5202) 2026-08-31 14:00:10 +08:00
sususu
8211388946 feat(session): implement Merkle LCP session affinity, session tree, and distributed Home hierarchy (#5202)
- Implement Merkle Longest Common Prefix (LCP) session affinity engine across OpenAI, Claude, Gemini, Interactions, and Responses protocols in sdk/cliproxy/session/lcp.go
- Implement in-memory hierarchical session tree store with dynamic lineage recalculation, reparenting, cycle prevention, and parentIndex descendant cascading in sdk/cliproxy/session/tree.go
- Integrate Merkle prefix matching and hierarchical session tree into SessionAffinitySelector
- Bound SessionCache capacity to 65,536 entries with deterministic eviction
- Support Claude nested metadata parent extraction and Header+Body parent merging
- Enforce TTL expiration checks in touchLocked and bindLocked
- Propagate ParentSessionID in authDispatchRequest and RPopAuthWithSessionHierarchy for distributed Home dispatch
- Add isHierarchyParent in home_session_alias.go covering Claude, Codex, Pi slot, Antigravity, and Gemini caching
- Add comprehensive test suites in lcp_test.go, tree_test.go, selector_lcp_test.go, client_test.go, and home_session_alias_test.go
2026-08-31 11:18:41 +08:00
Luis Pater
81e1b5374f docs(readme): remove LMU sponsor
- Remove LMU sponsorship section and asset across README files.
2026-08-31 10:04:48 +08:00
Luis Pater
9654894c7e Merge pull request #5356 from router-for-me/store
fix(store): close git repos during recovery
2026-08-31 08:45:56 +08:00
hkfires
b908ed5d86 fix(store): close git repos during recovery
Close go-git repository handles across store operations and tests to avoid
leaked handles blocking recovery cleanup. Abort recovery before mutating the
worktree when close failures occur and retain backups when rollback fails.
2026-08-31 08:41:08 +08:00
Luis Pater
d31b15916d feat(executor): support token usage parsing for plugin executors
- Add `ParsePluginExecutorResponseUsage` to extract token usage from non-streaming plugin responses across Claude, Gemini, Interactions, Antigravity, and OpenAI/Codex protocols.
- Add `ObservePluginExecutorStreamUsage` to observe and aggregate token usage across streaming chunks.

Closes: #5340
v7.2.146
2026-08-30 14:51:08 +08:00
Luis Pater
e4119f83b4 fix(xai): use chat base url resolution for image and video requests
- Route image and video generation requests through `xaiChatBaseURL` so OAuth credentials default to the CLI chat proxy endpoint.
- Update `using_api` and base URL definitions to apply to both HTTP chat and media requests.

Closes: #5335
2026-08-30 14:01:18 +08:00
Luis Pater
6c6473f899 fix(openai): ignore empty tool calls array in responses translation
- Ensure the `tool_calls` array is non-empty before stopping reasoning and terminating output items.

Closes: #5333
2026-08-30 13:47:18 +08:00
Luis Pater
12b88f3ad6 fix(auth): synchronize auth lifecycle and registry state with epochs and generations
- Add `RegistrationEpoch` and `Generation` tracking to `Auth` and model registry to prevent stale scheduling and snapshot reconciliation races.
- Implement scheduler removal tombstones and `ApplyClientModelProjections` in the model registry to atomically discard out-of-order state updates.
- Track logical route models across execution results and preserve active model cooldowns during registry reconciliation.
2026-08-30 12:53:39 +08:00
hkfires
7ab999a80f fix(config): add NormalizeHomePort function and update home port handling 2026-08-30 08:59:04 +08:00
Luis Pater
02e3d33c49 chore(codex): update codex client model definitions
- Add missing model schema fields including `multi_agent_reasoning_effort`, `requires_sandboxed_review`, `persistent_instructions`, `guardian_v2`, and `confirmation_policies`.
2026-08-30 01:29:03 +08:00
Luis Pater
c1f3b48999 Merge pull request #5331 from router-for-me/fix-home-refresh-logging
Fix home refresh logging and error handling
2026-08-30 00:46:39 +08:00
Luis Pater
5ff4a31eaf feat(claude): support advisor tool beta header
- Add `advisor-tool-2026-03-01` beta header support when advisor server tools are declared or explicitly requested.
- Ensure proper ordering of the advisor tool beta before advanced tool use and effort betas.
- Inject and preserve advisor tool beta across token counting and fingerprint preservation paths.

Closes: #5330
2026-08-29 14:47:51 +08:00
hkfires
6a489fa84d fix(auth): prefer errors from upstream attempts
Track when executor calls cross an upstream transport boundary and use that
signal to keep model/provider errors from being replaced by later local
preparation, selection, or internal failures.

Mark HTTP, websocket, relay, and usage-tracked transports as upstream
attempts, while avoiding marks for local validation, logging, missing
sessions, and successful websocket handshakes before request send.

Parse relative auth expiry metadata and adjust Antigravity refresh timing.
2026-08-29 12:50:46 +08:00
hkfires
bc918ab276 fix(runtime): log safe home refresh error types 2026-08-29 12:50:45 +08:00
hkfires
e4a8f98913 fix(logging): enhance error diagnostics and logging for home refresh operations 2026-08-29 12:50:45 +08:00
hkfires
9a2201c36a fix(auth): forward Home unauthorized upstream errors
Stop refreshing Home-owned OAuth credentials after upstream 401s.
Preserve marked upstream response bodies for direct responses, usage
records, request logs, and websocket handshake failures.
2026-08-29 12:50:44 +08:00
Luis Pater
c350d3f520 fix(claude): strip trailing thinking blocks from assistant messages
- Strip trailing `thinking` and `redacted_thinking` blocks from the final assistant message during OpenAI responses translation.
- Drop the assistant message if no content blocks remain after stripping trailing thinking blocks.

Closes: #5321
2026-08-29 05:07:19 +08:00
Luis Pater
6f25b9a149 fix(claude): drop unsupported assistant prefill for opus-5 and sonnet-4-6
- Strip trailing assistant prefill messages for Opus 5 and Sonnet 4.6 model families in addition to Fable models during OpenAI responses translation.

Closes: #5319
2026-08-29 04:58:59 +08:00
Luis Pater
07d8156375 fix(claude): collapse consecutive thinking blocks in openai responses translation
- Replace consecutive thinking blocks with the latest reasoning item in assistant messages.
- Flush pending tool use parts upon encountering subsequent reasoning items to maintain proper block separation.

Closes: #5317
2026-08-29 04:26:46 +08:00
Luis Pater
dd5f9e74e4 fix(kimi): normalize tool and function parameter schemas
- Inline local `$ref` pointers and strip `$defs` and `definitions` from tool parameter schemas for Moonshot compatibility.
- Ensure tool parameter root objects declare an explicit `type: "object"`.

Closes: #5316
2026-08-29 01:22:22 +08:00
sususu98
4b2beb3da1 feat(executor): measure effective TTFT with protocol-aware token classification (#5313)
* feat(executor): measure effective TTFT with protocol-aware token classification

- Introduce protocol-aware streaming token classification under internal/runtime/executor/helps
- Implement responses_ttft_helpers.go for OpenAI Responses / Codex WebSocket & SSE streaming
- Filter out container metadata, rate limits, handshake headers, and tool execution outputs
- Implement dual-track firstPacketDuration fallback for abnormal / zero-token stream terminations
- Add TrackHTTPClientRoundTripOnly to bypass false TTFT triggers on first response body reads
- Optimize UsageReporter.ObserveTokenEvent hot path with fast-path RLock short-circuiting (0 B/op)
- Align terminal event completions across SSE, WebSocket streaming, and non-streaming executions
- Add EnsurePublished metric recording fallback for successful terminal turns lacking usage blocks
- Add stub helpers with comprehensive specifications for Chat, Claude, and Gemini protocols

* fix(executor): normalize SSE response.done and terminate incomplete WS streams

* fix(usage): capture first-packet fallback on initial body reads with TrackHTTPClientRoundTripOnly
2026-08-29 01:22:21 +08:00
Luis Pater
be1763e59e fix(claude): fallback to array index when tool call index is omitted
- Fall back to array index in tool calls accumulator when the `index` field is missing.
- Ensure parallel tool calls without explicit indices are accumulated properly during streaming.

Closes: #5058
2026-08-29 01:22:20 +08:00
Luis Pater
677dbe1dc5 fix(claude): emit message_delta when openai streaming finish reason is omitted
- Ensure `message_delta` is emitted on tool call usage chunks and stream completion even if `finish_reason` is missing or null.
- Add `terminalOpenAIFinishReason` fallback to map missing finish reasons to standard stop reasons.
- Consolidate content block finalization into `finalizeOpenAIAnthropicContentBlocks` and delta emission into `emitAnthropicMessageDelta`.

Closes: #5308
2026-08-29 01:22:18 +08:00
Luis Pater
f0de1d008f Merge pull request #5273 from esokullu/codex/add-webbrain-project
docs: add WebBrain to related projects
2026-08-29 01:20:46 +08:00
Luis Pater
d9cea8904b docs: remove BmoPlus sponsorship
- Remove BmoPlus sponsor listings from English, Chinese, and Japanese README files.
- Remove unused `bmoplus.png` image asset.
v7.2.145
2026-08-28 17:29:47 +08:00
Luis Pater
3db0a86c60 fix(management): synthesize persisted auth record before invoking post-persist hook
- Synthesize the saved auth file from disk using `SynthesizeAuthFile` after persisting token records.
- Pass the canonical synthesized auth record to `postAuthPersistHook` instead of the raw input record.

Closes: #5290
2026-08-28 17:28:27 +08:00
Luis Pater
8dd78042e0 fix(proxyutil): enforce HTTP/1.1 ALPN and configure TLS dial context for HTTPS proxies
- Add `buildHTTPSProxyDialTLSContext` to handle HTTPS proxy TLS handshakes with configurable timeout and TLS options.
- Restrict ALPN `NextProtos` to HTTP/1.1 for HTTPS proxy connections to prevent HTTP/2 negotiation issues during proxy CONNECT tunneling.
- Support custom TLS configuration in `httpConnectDialer` for HTTPS proxy connections.

Closes: #5287
2026-08-28 16:50:33 +08:00
Luis Pater
b5cde4ba42 fix(gemini): add default items schema for tool array definitions
- Populate a default string `items` schema on tool array definitions missing an items property for Gemini and Antigravity.
- Add helper to identify array declarations across single strings and type lists during schema normalization.

Closes: #5292
2026-08-28 13:21:50 +08:00
sususu
3e20d662a7 Revert "fix(home): allow home config to override default port"
This reverts commit 1502ac826d.
2026-08-28 11:38:17 +08:00
sususu
7bc16ee3db fix(auth): preserve round-robin successor across ready view rebuilds
Keep round-robin rotation stable in the scheduler fast path when
credentials enter cooldown or are removed. Replace the numeric readyView
cursor modulo normalization with ID-based successor binary search,
aligning readyView with RoundRobinSelector.
2026-08-28 09:17:57 +08:00