Commit Graph

2708 Commits

Author SHA1 Message Date
Luis Pater
8564142fb0 fix(claude): preserve non-result block positions during tool result alignment
- Maintain non-tool-result content blocks at their original indices in `AlignClaudeToolResults` instead of moving them after results.
- Reorder tool results in-place into their original slot indices based on preceding tool use IDs.

Closes: #5484
2026-09-07 01:09:18 +08:00
Luis Pater
5dc428f392 fix(gemini): append trailing user turn for requests ending with model content
- Ensure Gemini, AI Studio, Vertex, and Antigravity requests end with a user turn to prevent upstream errors when trailing with model content.
- Preserve trailing turns that contain a function response and skip trailing adjustments for `countTokens` actions or Claude models.
- Introduce boundary normalization helpers to validate both leading and trailing turn roles.

Closes: #5358
2026-09-06 23:41:12 +08:00
Luis Pater
0e85eb46f3 fix(xai): support compaction fallback from payload input or previous response id
- Fall back to request payload input items or `previous_response_id` during websocket compaction when transcript snapshot is empty.
- Preserve `previous_response_id` in prepared request body for xAI execution.

Closes: #5205
2026-09-06 22:16:06 +08:00
Luis Pater
70f4560452 feat(antigravity): add conversation compaction support and capsule encryption
- Add payload detection and preparation helpers for compaction triggers and summary generation.
- Implement AES-GCM sealing and unsealing to store and restore opaque compaction capsules across turns.
- Support expanding compaction capsules into developer context for downstream turns.
- Provide summary text extraction across Gemini, Claude, and OpenAI response formats.
- Add builders for compaction non-stream JSON responses and SSE stream frames.

Closes: #5094
2026-09-06 21:51:47 +08:00
Luis Pater
00c63a5669 feat(pluginhost): expose outbound HTTP wire profile to plugin requests
- Add HTTPWireProfile to sdk/pluginapi on HTTPRequest with wire_profile JSON tag
- Decode wire_profile in host callbacks for flat and nested RPC payloads
- Match header casing in httpwire ordered_conn and allow non-HTTP handshakes
- Apply wire profile settings (HTTP/1.1 enforcement, auto compression disable, header ordering) in plugin host HTTP client
- Preserve proxy configuration, custom TLS dialers, redirect handling, and connection lifecycle

Closes: #5062
2026-09-06 20:41:58 +08:00
Luis Pater
c76dfd4e0e chore(codex): update codex user-agent to 0.153.3
- Update default Codex executor user-agent and model override headers to `codex-tui/0.153.3`.

Closes: #5521
2026-09-06 15:27:15 +08:00
sususu
580df36423 feat(usage): propagate session and parent session hierarchy to usage reporting queue
- Reuse coresession.ExtractSessionInfo across HTTP headers and request payloads to unify canonical session prefix namespaces with the scheduler.
- Extract hierarchical session identities in two phases: initial extraction from request headers on entry, and authoritative deep extraction once request payloads and metadata are available.
- Support Claude Code multi-level subagents (X-Claude-Code-Agent-Id, metadata.agent_id) and Codex thread fork lineages.
- Propagate SessionID and ParentSessionID across ClientRequestMetadata, UsageReporter, and coreusage.Record without root_session_id.
- Include session_id and parent_session_id in queuedUsageDetail for Home LPushUsage forwarding and Redis consumption with self-loop guards.
- Add comprehensive test coverage for canonical headers, body extraction, ghost parent elimination, and self-referential loop guards.
2026-09-06 10:45:32 +08:00
Luis Pater
5ab0bca040 fix(codex): scope usage limit errors to credentials and parse flexible quota resets
- Mark Codex usage limit errors as credential-scoped across HTTP and WebSocket executors.
- Support both top-level and nested error structures with case-insensitive matching when parsing retry-after resets.
- Propagate prevalidated candidate context to session affinity and built-in selectors during auth selection.

Closes: #5529
2026-09-06 06:20:20 +08:00
Luis Pater
7c2f6ce0d1 fix(claude): avoid mid-conversation system splicing for advisor calls or results
- Detect advisor tool calls and advisor results in conversation history.
- Preserve forwarded system prompt blocks in top-level system instead of splicing them into message turns or prepending reminders.
- Prevent message index shifts that break layout bindings for encrypted advisor results and trigger upstream 400 errors.

Closes: #5470
2026-09-06 05:55:42 +08:00
Luis Pater
084f25c798 fix(watcher): preserve concurrent file updates during auth snapshot rescans
- Track auth revisions and file observations to detect changes that occur while background auth scans are in flight.
- Invalidate and drop stale scanned auth records in `refreshAuthState` when concurrent file modifications or deletions are observed.
- Reject out-of-order delayed snapshot updates in `dispatchAuthUpdates` using watcher-local revision counters.

Closes: #5528
2026-09-06 05:36:32 +08:00
Luis Pater
9dfddd613d fix(aistudio): normalize thinking level to uppercase
- Normalize `generationConfig.thinkingConfig.thinkingLevel` to canonical uppercase enum values (`MINIMAL`, `LOW`, `MEDIUM`, `HIGH`).
- Prevent upstream HTTP 400 invalid argument errors caused by case-sensitive validation.

Closes: #5481
2026-09-06 04:14:41 +08:00
Luis Pater
31ec43621b chore(models): remove gpt-5.4 and gpt-5.4-mini models
- Remove `gpt-5.4` and `gpt-5.4-mini` specifications from registry models.
- Remove deprecated `gpt-5.4` configuration from Codex client models.
2026-09-06 03:56:06 +08:00
Luis Pater
5208aec703 fix(codex): preserve empty supported_reasoning_levels array
- Retain `supported_reasoning_levels` as an empty array instead of deleting the key when no reasoning levels are supported or compatible.
- Continue deleting `default_reasoning_level` when reasoning levels are empty.
2026-09-05 04:01:25 +08:00
Luis Pater
c77b136943 feat(models): add gpt-6-astra model and update codex client configurations
- Add `gpt-6-astra` model specifications and capabilities to registry models.
- Update Codex client models configuration and instructions for `gpt-6-astra`.
- Bump default Codex client version and user-agent to `0.153.3` in model fetcher tool.
2026-09-05 03:35:14 +08:00
rome-xi
acf919ce50 perf(antigravity): batch reasoning replay mutations 2026-09-04 18:53:21 +08:00
sususu
f6d19a329c fix(gemini): ensure functionResponse normalizes to user role in Gemini request normalizer 2026-09-04 18:21:37 +08:00
sususu
f2041a2c78 fix(antigravity): use ContentHasGeminiFunctionResponse instead of gjson projection 2026-09-04 18:21:37 +08:00
sususu
e56fae88c0 fix(translator): flush pending developer notice before intervening user turn 2026-09-04 18:21:37 +08:00
sususu
0fe19ede90 fix(translator): preserve Gemini prompt cache by demoting mid-session developer messages (#5490)
- Responses API: only hoist developer/system messages before conversation starts to systemInstruction, keeping token 0 cache prefix immutable. Demote mid-session developer messages to user role and merge consecutive user turns via MergeAdjacentGeminiUserContents without crossing functionResponse boundaries.
- Tool Call Buffer: buffer mid-session developer messages during pending function calls and emit after functionResponse, preserving valid tool pairing and reason replay.
- Chat Completions API: apply the same leading/mid-session distinction for system/developer messages and guard against empty parts.
- Claude Messages API: align role: "developer" in messages with role: "system", demoting to <system-reminder> user turns and avoiding upstream 400s.
- Validation: update ValidateGeminiFunctionCallPairing to allow intervening user turns before functionResponse, matching upstream Antigravity tolerance.
- Role Normalization: ensure functionResponse turns in Antigravity are always normalized to role: "user".
2026-09-04 18:21:37 +08:00
sususu
4a5ab534f8 feat(claude): harden probe and helper request classification, diagnostics isolation, and late cloaking
- Require exactly one non-reminder text block matching quota/test/probe/./Hi for probe request matching.
- Identify title helper requests via expanded session title patterns.
- Implement post-payload bidirectional probe reclassification: strip CPA diagnostics and billing tags on probes, while restoring continuity if declassified.
- Preserve caller-owned and payload-supplied diagnostics on probe requests.
- Gate late sensitive-word obfuscation strictly on cloaked requests in Execute and ExecuteStream.
- Add comprehensive end-to-end tests for probe classification, diagnostics isolation, and late cloaking.
2026-09-04 15:23:31 +08:00
sususu
de4aa60028 feat(claude): add Fable 5.1 reporting outcomes block and post-payload reconciliation
- Inject '# Reporting outcomes' system block for Fable 5.1 / Mythos 5.1 models matching Claude Code 2.1.258 tengu_dapper_lagoon behavior.
- Support both string-format and block-array system prompts for Fable reporting injection.
- Add reconcileClaudeCodeFableModelAfterPayload to reconcile model additions when payload rules override model or thinking.
- Reliably re-add reporting block if omitted after payload rules modify system blocks.
- Drop injected thinking.display on Fable models when payload changes thinking type from adaptive to disabled.
- Enhance payload rule path tracking with ancestor target matching in ApplyPayloadConfigWithTrackedPaths.
2026-09-04 15:23:31 +08:00
sususu
d7052c96af feat(claude): add 2.1.258 dynamic beta headers, model fallbacks, and paired cache TTL
- Introduce 2.1.258 dynamic betas: thinking-display-updates-2026-08-18, server-side-fallback-2026-06-01, and fallback-credit-2026-03-24.
- Prune effort-2025-11-24 on Haiku models, probes, and when thinking is disabled.
- Prune thinking-display-updates on disabled thinking and probe/helper turns.
- Identify Fable 5.1 / Mythos 5.1 models with boundary checks and inject default fallbacks and adaptive thinking display.
- Strictly pair 1h cache control with extended-cache-ttl-2025-04-11, stripping TTL on probes and subagents.
2026-09-04 15:23:31 +08:00
sususu
086ad91bd9 feat(claude): implement 2.1.258 billing header fingerprint chain and upstream request continuity
- Assemble x-anthropic-billing-header strictly following official 2.1.258 binary sequence: cc_version -> cc_entrypoint -> cch -> cc_workload -> cc_is_subagent -> cc_prev_req -> cc_prompt_id.
- Track upstream request-id in thread-safe bounded session continuity state and inject into subsequent turns as cc_prev_req.
- Generate and enforce RFC 4122 UUIDv4 cc_prompt_id per user prompt turn, preserving it across tool continuations while suppressing it on probes and title helpers.
- Detect subagents via agent headers and session metadata to emit cc_is_subagent=true.
- Harmonize diagnostics and continuity lifecycles to prevent uncommitted or truncated streams from corrupting state.
- Exclude x-anthropic-billing-header system blocks from sensitive-word zero-width space injection.
2026-09-04 15:23:31 +08:00
sususu
1c45093d10 fix(antigravity): tighten replacement offset guard in tool provenance degradation
Enforce strict monotonic offset ordering (replacement.start <= last) when
splicing degraded tool provenance IDs to reject unknown zero offsets and
prevent overwriting the payload prefix.
2026-09-04 09:45:49 +08:00
Luis Pater
aa36527752 fix(translator/claude): downgrade strict mode when schema misses required properties
- Recursively inspect JSON schema properties to detect optional fields not listed in the `required` array.
- Downgrade `strict` to false when schemas contain optional properties to prevent backend HTTP 400 rejections.

Closes: #5463
2026-09-04 02:02:19 +08:00
Luis Pater
6a26e92a8c fix(translator/interactions): avoid tool name collisions with Antigravity intrinsic tools
- Prefix colliding tool names (`read_file`, `write_file`, `execute_code`) with `external_` when sending requests upstream to Antigravity models.
- Strip the `external_` prefix from Antigravity responses so clients receive the original tool names.
- Apply the name mapping across tool definitions, tool calls, tool results, and tool choice in both Chat Completions and Responses translators.

Closes: #5462
2026-09-04 01:55:33 +08:00
Luis Pater
9ec2bc21c1 Merge pull request #5435 from huangruiteng/codex/openai-compat-bounded-rate-limit-waits
fix(openai-compat): honor bounded rate-limit waits
2026-09-04 01:41:53 +08:00
Luis Pater
649a8bdb6f feat(plugin): omit stream chunk history on payload chunks for schema v5
- Bump plugin schema version to 5 and introduce `SchemaVersionStreamChunkOmitHistory`.
- Omit `HistoryChunks` on payload stream chunks for schema version 5+ to avoid per-chunk cloning and serialization overhead.
- Conditionally accumulate and clone history chunks only when legacy plugins with schema version < 5 are active.

Closes: #5451
2026-09-04 01:19:50 +08:00
Luis Pater
ba2cdea3b9 fix(translator/claude): handle incomplete status and terminal state on max_tokens
- Map Claude `max_tokens` stop reason to `response.incomplete` with `max_output_tokens` incomplete details.
- Propagate `incomplete` status to trailing output items across streaming and non-streaming responses.
- Defer and track output item finalization to ensure correct status and arguments when turns are truncated.

Closes: #5439
2026-09-04 00:39:18 +08:00
rome-xi
e44432ab85 perf(antigravity): batch replay degradation rewrites (#5461) 2026-09-03 23:51:04 +08:00
Luis Pater
f804fb5f30 fix(translator/claude): defer message_delta and cache streaming usage
- Cache token usage metrics from streaming chunks instead of prematurely finalizing content blocks.
- Defer `message_delta` and `message_stop` emissions until encountering a finish reason, a trailing usage chunk, or stream completion.

Closes: #5419
2026-09-03 22:14:30 +08:00
Luis Pater
728ea8b855 fix(translator/gemini): nest image parts inside functionResponse
- Embed image parts under `functionResponse.parts` as `inlineData` instead of appending them as sibling parts to the function response.

Closes: #5415
2026-09-03 21:53:49 +08:00
Luis Pater
2a6b87aca0 feat(openai): send periodic ping control frames during responses websocket streaming
- Add `writePing` to responses websocket writer to emit Ping control frames.
- Send periodic keep-alive Ping frames based on streaming configuration during response forwarding.
- Reset keep-alive interval upon receiving data chunks and abort session if ping write fails.

Closes: #5413
2026-09-03 21:27:23 +08:00
Luis Pater
291cfb87ef feat(codex): support orphan delegation compatibility via orphan-delegation-compatibility
- Add `codex.orphan-delegation-compatibility` configuration option and mirror it to SDK configuration.
- Convert orphan Codex delegation outputs into standard user messages for requests with `X-Openai-Subagent: collab_spawn`.
- Integrate orphan delegation rewriting into OpenAI responses request handling pipeline.

Closes: #5401
2026-09-03 20:21:24 +08:00
Luis Pater
d577e630b1 feat(routing): make subagent session affinity configurable via session-affinity-subagents
- Add routing.session-affinity-subagents (defaulting to true) to RoutingConfig.
- Unify subagent parent credential inheritance across all providers by removing hardcoded provider/model blacklists.
- When session-affinity-subagents is false, isolate subagents and distribute them via the fallback selector.
- Ensure changing session-affinity-subagents is a no-op when session-affinity is false.
- Preserve alias isolation and failure isolation invariants.

Closes: #5417
2026-09-03 17:05:35 +08:00
Luis Pater
63fdd77f80 Merge pull request #5436 from router-for-me/models
fix(models): apply Home-provided model capabilities during execution
2026-09-03 16:32:54 +08:00
hkfires
cdda333cd2 fix(codex): clear unsupported reasoning levels 2026-09-03 13:25:56 +08:00
hkfires
c6dd82144b refactor(kimi): use request thinking helper 2026-09-03 13:10:30 +08:00
hkfires
6ff680e90a feat(auth): use home model capabilities for thinking 2026-09-03 13:10:30 +08:00
hkfires
1ecf0cb602 fix(models): preserve home model capability metadata 2026-09-03 13:10:29 +08:00
huangruiteng
6f16121554 fix(openai-compat): honor bounded rate-limit waits 2026-09-03 11:12:09 +08:00
sususu
df7e04ea28 fix(claude): upgrade default Claude Code baseline and fingerprint to 2.1.258
- Bump default Claude Code version baseline from 2.1.220 to 2.1.258 to resolve upstream 400 version gate error
- Update Stainless SDK package version to 0.112.1 and runtime version to v26.3.0
- Refresh default device profile, billing header build hashes, and cloaking signatures
- Decouple unconfirmed client OS/Arch test assertions from host runner platform
- Update config.example.yaml and test suites across executor and helps packages
2026-09-03 10:21:13 +08:00
Luis Pater
bdcccfb8e0 chore(registry): remove "minimal" level from dynamic_allowed definitions in models
- Cleaned up unused "minimal" level from dynamic levels across multiple model definitions.
2026-09-02 23:33:22 +08:00
Luis Pater
dacae58228 feat(registry): add claude fable 5.1 and gemini 3.8 flash models
- Add `claude-fable-5-1` model definition with thinking configuration and multimodal capabilities.
- Add `gemini-3.8-flash` and `gemini-3.8-flash-high` model definitions across Google and Antigravity registries.
2026-09-02 23:27:56 +08:00
Luis Pater
272c1cff4e fix(antigravity): bypass quota cooldowns and credit hints when cooling is disabled
- Bypass short cooldown checks and recording in execution flows when cooling is disabled globally or per auth.
- Skip marking credits permanently disabled and refreshing credit hints when cooling is disabled.
- Export quota cooldown status helper functions for auth and configuration evaluations.

Closes: #4793
2026-09-02 22:01:55 +08:00
Luis Pater
d0fb44ca95 fix(antigravity): strip tool config, labels, and session id in token counting
- Strip `request.toolConfig`, `request.labels`, and `request.sessionId` from the payload before dispatching count tokens requests.

Closes: #4749
2026-09-02 21:08:21 +08:00
Luis Pater
02c02cda50 fix: harden concurrent session handling, listener lifecycle, and token accounting
- Use `context.AfterFunc` and buffered delivery in websocket relay sessions to avoid per-request goroutine leaks.
- Synchronize in-flight puts and drain queued connections upon mux listener close.
- Ensure home streaming log writer goroutines terminate cleanly when the log client is unhealthy.
- Prevent integer arithmetic overflow in token breakdown validations and calculations.
- Clone request headers in logging middleware to prevent concurrent mutation issues.
- Implement standard `io.WriterTo` return signature for file body sources.

Closes: #4709
2026-09-02 20:02:42 +08:00
Luis Pater
8deeb4ac31 fix(antigravity): preserve unsigned gemini thinking blocks with trailing carriers
- Precompute carrier context in signature validation to preserve unsigned Gemini thinking blocks followed by valid trailing carriers.
- Avoid dropping unsigned thinking blocks during request translation for Gemini models.
- Validate carrier directions and placement against adjacent semantic content blocks.

Closes: #4628
2026-09-01 21:56:18 +08:00
Luis Pater
15231e9fdc fix(antigravity): support native thinking signatures without prefixes in claude translator
- Emit provider-native signatures without model group prefixes in Claude responses.
- Validate client-provided signatures directly and restrict signature cache recovery to omitted signatures.

Closes: #4445
2026-09-01 20:36:26 +08:00
Luis Pater
893abbabc2 feat(translator): support cache write tokens in claude responses
- Extract cache write tokens from OpenAI and Codex usage details.
- Map cache write tokens to Claude `cache_creation_input_tokens` for streaming and non-streaming responses.

Closes: #4262
2026-09-01 19:56:40 +08:00