Commit Graph

439 Commits

Author SHA1 Message Date
Luis Pater
bdf40d5214 Align Antigravity OAuth, model catalogs and protocol translations 2026-12-01 06:34:18 +08:00
Luis Pater
f5d017afa5 feat(antigravity): complete Hub 2.36.0 v2 parity and origin/dev audit fixes
- Batch A: fix ObserveAntigravitySafetySignals for results[]/embeddingVerdicts/numeric 2/snake_case with structured logrus fields, align used_claude_conservative OR-latch and subagent_type underscore sanitization, unify Anthropic model detection (claude/fable-/opus-/sonnet-/haiku-) across all 11 core sites with C4 linear adjacent-user merge and unified signature provider/cache group resolution, add legObservedPayload continuation retry guard, strip request.stream/snake_case/duplicate toolConfig, and cap non-2xx/unary response reads
- Batch B: enforce 1 MiB OAuth refresh body cap and pre-RTT expiry, add compare-and-delete invalidateAICodeAccessToken on AICode 401 and broad refresh, harden sdk/cliproxy AICode token minter (Antigravity User-Agent, pre-RTT, non-cancelable singleflight, 400 invalid_grant AuthError, 401 retry-once, stale metadata suppression isolated from broad-bearer suppression), tighten status-code-aware NEW-06 scope gating, and pool/cache /v1internal:rewriteUri grounding URL resolution
- Batch C: complete 4 hard-quota 429 substrings, 240s retry ceiling, numeric gRPC 8/14 and missing error.status handling, retry-after-ms header precedence, PayGo X-Goog-User-Project omission helper, 5 snake_case GenerationConfig aliases, BlockReason 5->6 normalization, read-only post-FinalizePayloadDoc GOOGLE_ONE_HELIUM rejection, remaining Mendel cutover flags and rate-limited sign-out-missing-aicode-scope warnings, tieredModelIds + M-04 disabled model filtering, telemetry JSON label scrubbing across all request types, shared bare-token/plt redaction, and allowlisted OAuth error parsing preserving typed 403 TOS/validation metadata
- Batch D: reject empty access_token and non-positive expires_in with proxy/epoch-scoped OAuth singleflight, wire AdaptiveThinking/ThoughtCirculation/DeferredToolLoading/TieredModelIDs through sdk/cliproxy, harden credits quota admission guards, map FormatAntigravity to "antigravity" with mixed-pool LCP mirroring and dual rollback generations, upgrade signature ownership to Get() LRU recency + Home KV SSOT with millisecond PX backfill and NX lease protection, and add bounded 32-leg unary Execute continuation loop
2026-11-30 23:29:47 +08:00
hkfires
c1483b0e89 fix(copilot): pin continuation owner and fail over route errors
Track output item IDs and resolve item_reference inputs to their
owning credential, including for local OAuth model aliases, so
stored Responses continuations stay pinned to the issuing account.

Treat credential-status failures from Copilot route planning as
credential-scoped upstream attempts and route them through the
normal failure pipeline in sync, count, streaming, and Home
execution, enabling cooldown and failover instead of aborting.
2026-11-30 19:52:32 +08:00
hkfires
40471d862c feat(copilot): add home catalog snapshots for fusion routing
Snapshot and restore account catalogs and Fusion entitlements for
Home dispatch, bound to the credential, trusted origin, model, and
expiry. Concrete models carry only endpoint and reasoning defaults,
while entitled Fusion tiers carry the ordered directory and aliases.

Resolve Home routes from the restored catalog, expose the required
SDK API, and pin Fusion continuations via published aliases and the
Home caller scope. Replay completed draft tool exchanges to later
phases, suppress repeated draft actions, and report usage for every
Fusion phase, including failures, with additional-phase attribution.
2026-11-30 18:43:49 +08:00
hkfires
81f52375dc fix(copilot): make fusion tool continuations idempotent
Cache the translated reply for each tool-result submission so
retries replay identical non-streaming and streaming responses
without re-running upstream inference, while failed attempts
release the key and evicted replies return a conflict.

Track delivered tool call IDs across all phases of a turn and
reject upstream repeats of answered calls. Capture draft-only
reasoning, prose, signatures, and encrypted Responses state
before exposing its tool batch, then restore that private
history for Chat, Responses, and Messages continuations
without leaking it to clients or reviewers.

Drop hardcoded temperature/top_p from fusion review requests
that reasoning models may reject, and normalize line endings
in embedded CLI prompts.
2026-11-30 18:43:48 +08:00
hkfires
6bfc65689d refactor(executor): share Claude Messages stream reconstruction 2026-11-30 18:43:47 +08:00
hkfires
abcfd1cd61 feat(copilot)!: add Fusion tiers replacing Auto model
Publish fusion-standard, fusion-high, and fusion-max based on the
Fusion tiers enabled by /meta, instead of the single Auto model.

Route balance through /auto and higher tiers through /model/fusion
with validated solo, cascade, and critique plans, catalog-bounded
fallbacks, and per-phase reasoning efforts. Execute draft, review,
repair, and revision phases without leaking speculative output,
reviewer content, or session tokens to clients.

Pin tool and response continuations to the originating credential,
prevent reissuing answered tool calls, apply payload rules as the
final barrier on routing and inference payloads, and update the CLI
identity and headers to 1.0.117.

BREAKING CHANGE: copilot/auto is no longer published; use
copilot/fusion-standard, copilot/fusion-high, or
copilot/fusion-max instead
2026-11-30 18:43:47 +08:00
hkfires
daecdc90ad feat(copilot): add auto model routing
Add the virtual copilot/auto model for accounts whose /meta
default tier is enabled, resolved from account plan and
published only while the entitlement remains valid.

Select concrete models via /auto with scoring and RL
multi-turn policies, bounded prompt history, token refresh,
duplicate handling, and expiry checks before inference.

Rebuild portable history across Chat, Responses, Messages,
and Gemini route switches, including stored response and
item continuations and Gemini tool-call ID normalization.

Keep Auto state scoped by account, caller, and explicit
session, and redact session and RL state tokens from logs.
2026-11-30 18:43:47 +08:00
Luis Pater
99bc000147 feat(antigravity): align Antigravity Hub 2.36.0 (CL 1031268331) and agy CLI 1.5.18
- Unify labels.cascade_id session ID space, separate affinity-only aliases from identity-equivalent groups, align agent envelope parity before FinalizePayloadDoc, and add pre-first-byte 401 same-credential force-refresh retry-once (with Home force_refresh + rejected_aicode_token_sha256 contract)
- Align Hub 2.36.0 TPU/502/400 retry rules, 240s multi-signal delay cap, 7 hard-billing reasons + HTTP 402 + daily word-boundary markers, AI_POLICY_REQUIRED diagnostics, and bounded-candidate SSEJSONAssembler
- Bump Hub version floor to 2.36.0 (CL 1031268331), 256 MiB stream scanner, continuation leg 2+ parity, budget-exhausted synthetic MAX_TOKENS, usage modality merge, ModelDetails field 48 & THINKING_LEVEL_MAX, single-POST OnboardUser + LRO GET polling, and 2-pass LoadCodeAssist paidTier resolution
- Harden AICode strict single-scope gate, shared grant-scoped 1h cooldown with pinned in-flight guard, 403 LOCATION_NOT_ELIGIBLE & §19.3 zero-ErrorInfo 403 fallback, 43-entry strict denial precedence, paidTier gate, FinishReason +1 shift, safetySettings proto normalization, X-Goog-User-Project omission, Home KV capability consumption, and owner/epoch-scoped KV suppression
2026-11-30 17:36:38 +08:00
sususu98
40beca02c8 perf(payload,handlers): eliminate large base64 allocation amplification
Avoid full-payload copies when evaluating payload rules and reading HTTP
request bodies, cutting heap allocation amplification on multi-megabyte
base64 requests by >80% with zero behavioral changes:

- Evaluate single-item payload query predicates directly on ojson.Result
  without copying item.Raw into a temporary "[...]" buffer (with exact
  fallback for edge/malformed syntax).
- Resolve clean array "@reverse.<N>" paths via zero-copy ForEach traversal
  instead of ojson.modReverse full-array cloning.
- Fast-path scalar, empty-container ([] / {}), and type-mismatch checks in
  payloadResultEquals to skip moego/json.Unmarshal on large arrays, and use
  bytes.TrimSpace in normalizedPayloadJSON.
- Cache compiled moego/regexp patterns in payload.replace with a bounded map.
- Release originalRequest in ClaudeInputTokenState once disabled or handled,
  and only retain replayRequestPayload in Antigravity stream when replayScope
  is valid.
- Preallocate raw request body buffers from Content-Length (capped at 4 MiB)
  in ReadRawRequestBody to avoid io.ReadAll slice-doubling copies.
2026-11-29 12:22:41 +08:00
Luis Pater
b90c5a587a feat(antigravity): align Hub 2.35.2 / aicode v1alpha protocol, control plane, and cross-tenant isolation
- Cross-tenant session/LCP affinity across model switches, cascade/parent subagent alias extraction and RESP forwarding, automatic subagent custom_agent requestType promotion, credential-scoped reasoning replay isolation, foreign thoughtSignature scrubbing on *ojson.Doc, 14-key payload order, and 270s prompt-cache keepalive guards.
- Shared Google RPC array and HTTP 200 in-band error unwrapping/classification, pre-first-byte same-auth micro-retries for 14 TPU transient errors, expanded quota/billing/policy classification with strict HTTP 403/gRPC 7 TOS validation, and read-only SafetySignals logging.
- 32-leg continuationToken stream resumption, dynamic deprecatedModelIds rerouting, Orchestrator model synthesis, ModelDetails capability persistence, authenticated rewriteUri grounding redirects, FULL_ELIGIBILITY_CHECK, ClaimAICodeBankedQuotaReset, and validated no-redirect dynamic endpointUrl onboarding.
- PKCE S256 OAuth login, downscoped auth/aicode token minting with bounded cache, mutually verified Home RESP aicode-token handoff, grant/digest refresh continuity verification, flat v1alpha *ojson.Doc codec with GOOGLE_ONE_AI fallback experience, businessaicode parent support, and unbroken FinalizePayloadDoc semantic barrier across v1alpha, v1internal, 403 fallback, continuation, and countTokens.
- Full v1alpha control-plane integration (fetchConfig with 8-group proto agySurfaceConfig, typed Mendel flags with conflict rejection, fetchLicenses, prod/preprod consistency, and 2 MiB-guarded KV snapshot publication), auto-mode Mendel routing, real-time v1alpha:fetchQuotaStatus credits refresh with read-only dark-launch shadow comparison and exact int64 comparison, and unified pure-Go Hub 2.35.2 UA + HTTP/1.1-only no-ALPN transport.
2026-11-29 10:40:46 +08:00
sususu98
eca828559c fix(gemini): preserve OpenAI chat tool call IDs and strip them on Vertex (#8576)
Populate functionCall.id and functionResponse.id when translating OpenAI Chat Completions requests to Gemini so parallel calls to the same function retain 1-to-1 correlation, matching the Claude and OpenAI Responses translators.

Extend StripVertexOpenAIResponsesToolCallIDsDoc to also strip tool call IDs for the openai source format on Vertex AI where REST schemas do not define an id field.
2026-11-28 11:04:17 +08:00
Luis Pater
7863a8165c fix(auth): treat message-hash continuations as session aliases instead of subagents
- Exclude the msg prefix from same-prefix hierarchy parent matching in auth session aliasing and usage reporting so Turn 2 message-hash pairs are no longer misclassified as subagents.
- Preserve existing hierarchy parent detection for explicit non-msg session prefixes and agent markers.
- Add regression tests covering SubagentAffinity=false retention, alias binding, rebind-on-never refusal, result cleanup, Home session aliasing, and usage hierarchy filtering.

Closes: #8191
2026-11-26 10:54:08 +08:00
Luis Pater
ba4ca1c27d fix(antigravity): canonicalize tool_config and snake_case max_output_tokens in request builder
- Canonicalize and merge snake_case tool_config and function_calling_config fields into camelCase toolConfig before setting VALIDATED mode on Claude requests, preserving non-conflicting fields without emitting duplicate proto-JSON keys.
- Recognize, cap, and strip all four generationConfig/generation_config maxOutputTokens/max_output_tokens paths across buildRequestForModelDoc and CapAntigravityMaxOutputTokensDoc while merging mixed generation config containers.
- Add regression tests covering Claude tool_config canonicalization, non-Claude max_output_tokens stripping, and snake_case generation_config output capping.

Closes: #8183
2026-11-26 10:08:32 +08:00
Luis Pater
7fa46e9d86 fix(antigravity): commit reasoning replay cache on clean-EOF streams without finishReason
- Track observed candidate output on antigravityReasoningReplayAccumulator and add MarkCleanEOF to mark clean-EOF completions terminal while rejecting empty candidates and incomplete streaming tool calls.
- Add SSEJSONAssembler.HasPending and gate clean-EOF replay commits in ExecuteStream and executeClaudeNonStream on clean context and complete SSE framing.
- Add regression tests covering clean-EOF tool streams, non-stream SSE aggregation, empty candidate cache preservation, and truncated trailing SSE frames.

Closes: #8172
2026-11-26 08:31:54 +08:00
Luis Pater
b11aacdd2b fix(antigravity): enforce claude min thinking budget and max_output_tokens cap
- Strip thinkingConfig and thinking_config in CapAntigravityMaxOutputTokensDoc when clamping a numeric Claude thinking budget would fall below 1024 while leaving non-numeric, dynamic, and level-based configs untouched.
- Recognize numeric snake_case max_output_tokens aliases capped by model MaxCompletionTokens in effectiveMaxTokensDoc and apply the same catalog output cap in buildRequestForModelDoc.
- Add unit tests covering sub-1024 Claude budget stripping, snake_case max_output_tokens handling, and catalog-limit clamping.

Closes: #8165
2026-11-26 07:29:10 +08:00
Luis Pater
50aea0fa71 fix(antigravity): isolate agent envelope sessions across Home accounts without enum scope
- Derive a hashed grantScope fallback in ApplyAntigravityAgentEnvelope when antigravity_model_enum_scope is empty and RegistrationEpoch is zero, using account-level identifiers before falling back to ephemeral tokens while keeping local registration epochs unchanged.
- Add regression tests covering distinct Home accounts, sanitized Home dispatches, shared-project token fallback, same-account access token rotation, and preserved local Manager.Update sessions.

Closes: #8167
2026-11-26 07:26:56 +08:00
Luis Pater
a07d358295 fix(executor): sanitize nested input content parts and empty function_call id in Gemini Interactions
- Extract sanitizeGeminiInteractionsItemDoc on *ojson.Doc and apply it to both top-level input steps and nested input[].content[] parts, compacting dropped nested thoughts and preserving nested function_call IDs.
- Promote non-blank call_id verbatim to id when function_call.id is missing, empty, or whitespace-only before stripping call_id, and skip content traversal on kept top-level thought steps.
- Add regression tests covering nested function_call/thought sanitization, Vertex bare-Tink scoping, verbatim call_id promotion, and combined top-level/nested thought compaction.

Closes: #8153
2026-11-26 02:41:47 +08:00
Luis Pater
389ded4330 fix(executor): support snake_case tool parts and assistant role in Gemini content turn helpers
- Treat leading "assistant" turns equivalently to "model" turns in EnsureGeminiLeadingUserContentDoc.
- Recognize snake_case function_call, function_response, and function_response.parts media in Gemini turn boundary helpers.
- Add regression unit tests covering leading assistant turns, snake_case tool responses with and without nested media, and trailing thought-bearing tool parts.

Closes: #8155
2026-11-26 02:38:09 +08:00
Luis Pater
3e7faea98b fix(executor): treat audioTranscription parts as visible output in Gemini zero-output guard
- Recognize non-empty string audioTranscription and audio_transcription parts in InspectGeminiZeroOutputPayload while preserving thought-only classification.
- Support snake_case audio_transcription parts in OpenAI Chat Completions Gemini streaming and non-streaming response translators so admitted transcripts are delivered to clients.
- Add regression unit tests covering zero-output inspection, non-stream checks, stream guard emission, and OpenAI transcript translation.

Closes: #8150
2026-11-26 02:26:05 +08:00
Luis Pater
b7195395d3 fix(executor): avoid flushing truncated Interactions SSE frames on scanner error
- Guard trailing frame emission in Gemini and Vertex Interactions streaming executors so buffered partial frames are only flushed on clean EOF with an active context, while preserving trailing newline detection via ScanInteractionsSSELines to prevent unterminated whitespace from triggering in-loop flushes.
- Record non-nil scanner errors in internal API response diagnostics before EndApplyPatchStream finalization so raw read failures are never lost while keeping the sanitized 502 downstream apply_patch contract intact.
- Add regression tests covering mid-frame scanner errors, canceled-context diagnostic recording, apply_patch scanner error diagnostics, unterminated whitespace tails, and clean EOF trailing frames.

Closes: #8138
2026-11-26 01:32:07 +08:00
Luis Pater
f4ff417eac fix(vertex): inspect only URL path for API version suffix
- Extract and inspect only the URL path in a shared helps.VertexAPIVersionSuffix helper so bare version-like hostnames such as http://vertex1 or http://v1-gateway still receive /v1 in both Vertex API-key model URLs and Vertex OpenAPI base URLs.
- Add regression tests covering bare version-like hostnames, ports, trailing slashes, and explicit version paths for vertexAPIKeyModelsURL and Vertex OpenAPI base URL builders.

Closes: #8122
2026-11-25 22:51:33 +08:00
Luis Pater
aa1389a355 fix(translator): resolve shortMap tool_choice, snake_case fields, args, and null thinkingBudget
- Resolve single and multi-tool tool_choice names through shortMap (emitting allowed_tools subsets for multi-entry ANY whitelists) and remove the legacy raw-byte helper.
- Support snake_case Gemini SDK fields across request and response tool name mapping and default missing or non-object functionCall.args to "{}".
- Require numeric thinkingBudget and string thinkingLevel values in both Gemini-to-Codex translation and shared thinking config extraction so null values do not disable reasoning.

Closes: #8098
2026-11-25 19:49:55 +08:00
Luis Pater
531aea156a fix(util): normalize numeric protobuf Schema.Type enums in Gemini schemas
- Decode numeric protobuf Schema.Type enum values (1..7) to lowercase JSON Schema type strings via *ojson.Doc in NormalizeJSONSchemaNumericConstraints while preserving literals and special property keys.
- Normalize schemas prior to nested wrapper cleaning, Claude 5.5 structured output prompt fallback, Interactions response_format emission, and snake_case Gemini pass-through schema fields.
- Add regression tests covering schema cleaners, Antigravity executor paths, and Gemini-ingress translators.

Closes: #8032
2026-11-25 11:41:46 +08:00
Luis Pater
14a95b19e2 fix(antigravity): preserve thinking-group output caps
- Preserve smaller caller output limits while applying thinking-group catalog caps.
- Clamp Claude thinking budgets and normalize output token aliases before payload rules run.

Closes: #7985
2026-11-24 09:48:07 +08:00
Luis Pater
38067a2997 fix(antigravity): align outbound request wire format
- Preserve normalizer request IDs and correlation labels while generating slash-delimited native fallbacks.
- Normalize native tool output keys and single-part system instructions across Antigravity request paths.

Closes: #7967
2026-11-24 07:06:16 +08:00
hkfires
f110136af3 fix(thinking): clamp budgets to levels for OpenAI models
OpenAI Chat/Responses and xAI appliers accept effort levels
only, so numeric budgets on hybrid models were not clamped
to supported levels. Clear Min/Max on a copy of the model
info before conversion, preserving catalog capabilities.

Use ClampLevel for the Devin swe-1-7 medium variant so
budget-derived levels select the correct upstream UID.

Add regression tests for Copilot, Devin, and OpenAI-compat
chat covering body and suffix budgets across formats.
2026-11-23 22:45:56 +08:00
hkfires
a516bf3b4f refactor(devin): use canonical thinking clamping
Replace custom Devin level ordering and clampEffort logic with
thinking.ParseLevelSuffix and thinking.ClampLevel, adapting to the
updated ConvertBudgetToLevel signature. Ties now resolve to the
lower effort per canonical rules, updating affected tests.

Document devin as a supported OAuth channel in config.example.yaml
with model alias and excluded model examples.
2026-11-23 22:45:55 +08:00
hkfires
a308c55bcd fix(thinking): correct budget to max level conversion
Add an xhigh upper bound of 32768 so larger budgets map to max
instead of xhigh. Convert translated budgets to adaptive effort
for hybrid Claude and Interactions models in validation rather
than in the Gemini-to-Claude translator, which now preserves the
budget for model-aware handling.

Validate user-defined models before normalization so translated
budgets are clamped to model limits while custom settings are
preserved. Reuse the canonical budget conversion for Devin and
prefer the lower effort on ties only for budget-derived levels.
2026-11-23 22:45:55 +08:00
Luis Pater
2f86992c94 feat(antigravity): route grouped models by requested thinking level 2026-11-23 13:23:05 +08:00
Luis Pater
b8e3bc6647 feat(antigravity): align and minify upstream model requests
Resolve model enums per credential and correlate agent request IDs with session labels. Preserve the reference key order for agent envelopes and remove formatting whitespace when serializing all model requests.
2026-11-23 11:08:44 +08:00
hkfires
9abeef8c56 fix(copilot): flatten native assistant text history
Copilot Chat can ignore assistant history sent as plain text
content blocks, so flatten it to a string even for native
OpenAI requests. Leave annotated blocks and native user
content untouched, and keep payload overrides as final barrier.
2026-11-23 09:50:11 +08:00
Luis Pater
f911b45348 fix(copilot): flatten cross-protocol assistant text and record upstream API logs
- Flatten single-part and multi-part plain-text content arrays on cross-protocol assistant messages to strings in NormalizeCopilotRequest while preserving native Chat arrays, annotated blocks, and multimodal content, and guard Claude empty-string assistant content-to-null conversion behind tool_calls checks.
- Split CopilotExecutor.httpRequest into prepareAuthorizedRequest and doHTTPRequest so RecordAPIRequest runs only after credential and trusted-origin validation, capturing the final post-override wire payload and masked headers without logging direct HttpRequest callers.
- Capture upstream response metadata via RecordAPIResponseMetadata before decompression and header stripping, log non-2xx and non-stream bodies via AppendAPIResponseChunk, and record transport, decode, read, invalid-JSON, upstream-error, and translation failures via RecordAPIResponseError.
- Add request-scoped helps.BindAPIResponseStreamLogger and logging.APIResponseSnapshotter (snapshotted and closed during ResponseWriterWrapper.Finalize) with per-attempt synchronization so asynchronous copilotStream callbacks retain no *gin.Context reference and cannot race with or pollute reused pooled Gin contexts.
- Add regression and race tests covering Copilot Chat assistant text replay, non-stream and SSE stream upstream logging, error paths, payload override finality, multi-attempt retries, and concurrent mid-callback Gin context reuse.
2026-11-23 02:47:44 +08:00
Luis Pater
c6f1d626a6 Merge pull request #7900 from router-for-me/registry
feat(registry): unify copilot and devin published routes
2026-11-22 22:00:23 +08:00
hkfires
f89d408e75 feat(registry): unify copilot and devin published routes
Introduce SourceModelID as the canonical provider-qualified
source behind each published route and store the Devin catalog
with bare IDs, qualifying it only at publication and lookup.

Generalize Copilot's published-route selection, cooldown
migration, websocket matching, and execution resolution to
Devin, and match OAuth settings and payload rules against the
canonical source so aliases and prefixed routes share config.

Handle qualified model IDs from newer Homes, preserve explicit
prefixed alias names, and resolve Devin auto effort against
catalog-supported levels instead of defaulting to high.
2026-11-22 21:36:09 +08:00
Luis Pater
55e5a7ead8 fix(antigravity): use signed int64 session IDs matching Hub format
- Generate random and deterministic session IDs as signed 64-bit decimal values, using FNV-1a for stable IDs.
- Preserve negative signs in reasoning replay keys and test positive/negative ID coverage.

Closes: #7857
2026-11-22 17:20:32 +08:00
Luis Pater
127c50bc76 fix(antigravity): emit uppercase thinkingLevel enum names
- Format request.generationConfig.thinkingConfig.thinkingLevel using uppercase trimmed enum names in the Antigravity thinking applier to match official protojson wire output.
- Add unit and executor regression tests covering uppercase thinkingLevel serialization, fallback levels, idempotency, and payload override precedence, and update existing Antigravity test expectations.

Closes: #7850
2026-11-22 16:51:14 +08:00
Luis Pater
7f22743a07 fix(codex): preserve requested Responses include values by upstream backend
- Expand the Responses-to-Codex translator include allowlist to preserve Codex-verified entries (`web_search_call.action.sources`, `web_search_call.results`, and `output.encrypted_content`) alongside required `reasoning.encrypted_content` while keeping the zero-copy fast path.
- Restore all official OpenAI Responses `include` values in Codex HTTP and WebSocket executors before user payload finalization when targeting non-ChatGPT OpenAI Responses upstreams (SIWC or custom `codex-api-key` endpoints).
- Strip newly allowed Codex-only include entries in xAI and Meta executors before payload finalization to keep shared-translator non-OpenAI behavior unchanged, and add unit and executor regression tests.

Closes: #7833
2026-11-22 15:59:16 +08:00
Luis Pater
14e12fb5d3 fix(antigravity): scope incoming request.sessionId per credential and subagent
- Prefer credential-scoped derived session IDs over raw incoming request.sessionId values when auth.ID is set, and deterministically scope direct incoming session IDs via ScopeAntigravitySessionIDForAuth across standard, image, and web_search requests without synthesizing sessionId when absent.
- Preserve verbatim incoming request.sessionId when auth.ID is empty while keeping reasoning replay keying and final payload barrier rules unchanged.
- Add regression tests covering Gemini, native Antigravity, image, web_search, unenriched direct calls, subagent isolation, anonymous auth preservation, and payload override/filter barriers.

Closes: #7838
2026-11-22 15:54:08 +08:00
Luis Pater
84b838e1c6 fix(antigravity): honor HTTP Retry-After header fallback on 429 responses
- Add ParseRetryDelayWithHeaders in executor helps to fall back to HTTP Retry-After headers (including explicit 0-second hints) when a 429 body carries no retry delay while preserving body precedence and Gemini positive-only semantics.
- Thread httpResp.Header into applyAntigravity429State, decideAntigravity429WithHeaders, and newAntigravityStatusErrWithHeaders across Execute, executeClaudeNonStream, ExecuteStream, and CountTokens, passing nil headers for mid-stream SSE 429 frames.
- Add regression tests covering header fallback, threshold classification, explicit zero-second handling, MarkResult cooldown scheduling, and all four Antigravity request paths.

Closes: #7821
2026-11-22 02:38:04 +08:00
Luis Pater
c813f779ec fix(antigravity): match claude 5.5 low, medium, and max effort variants for structured output
- Introduce a dedicated antigravityClaude55Model matcher covering low, medium, high, max, and reasoning effort suffixes so structured output requests fall back to prompt instructions instead of leaving native responseSchema and forcing VALIDATED tool mode.
- Keep the direct Claude claude55Model matcher scoped to its existing variants in claude_tool_choice.go to avoid changing direct Claude tool_choice normalization.
- Add regression tests covering Antigravity structured-output conversion and direct Claude tool_choice boundaries across all six new effort variants.

Closes: #7823
2026-11-22 02:25:37 +08:00
Luis Pater
7a5dee5207 fix(claude): preserve native haiku helpers on custom base URLs
- Make the prompt caching scope beta optional for Haiku 5.5 helpers without relaxing other identity checks.
- Cover helper detection and verify that streamed title requests preserve the original client and session.

Closes: #7809
2026-11-21 21:06:13 +08:00
Luis Pater
892fc4864c fix(antigravity): harden SSE JSON reassembly and mid-stream error bookkeeping
- Replace ad-hoc pendingJSON buffering in ExecuteStream and executeClaudeNonStream with a bounded SSEJSONAssembler that ignores non-data SSE control lines, resets on genuine empty-line event boundaries, and discards oversized event tails until the next empty line.
- Surface all 400-599 mid-stream JSON error frames in executeClaudeNonStream with replay invalidation, TOS state handling, and 429 bookkeeping instead of letting non-403 errors degrade to synthetic 502 or truncated responses.
- Share 429 bookkeeping across HTTP and mid-stream SSE paths in ExecuteStream and executeClaudeNonStream, and defer clearing prior credits failure state until request success is confirmed.

Closes: #7753
2026-11-21 15:21:19 +08:00
hkfires
7ae771fcb4 feat(copilot): add GitHub Copilot provider support
Add device OAuth login via `--copilot-login`, trusted-endpoint token
exchange, and per-account model catalog discovery with independent
refresh so accounts expose only entitled Chat, Messages, or Responses
routes.

Implement the executor with official CLI parity defaults, cross-protocol
translation, account-scoped thinking, turn linking, and server-side
replay of private reasoning and signatures, keeping payload rules final.
2026-11-20 23:14:11 +08:00
sususu98
2e940ba1e5 test(meta): add regression coverage for incomplete synthesis and refusal fallbacks
- Cover response.incomplete synthesis and multi-part (output_text + refusal) message synthesis in ResponsesStreamOutputTracker and MetaExecutor.ExecuteStream.
- Add empty-delta fallback, response.created delta-state reset, and empty refusal->text fallback tests for Codex OpenAI Chat, Gemini, and Interactions translators.
2026-11-20 19:19:24 +08:00
sususu98
e442c32d4f fix(meta): tighten Responses output synthesis tracking and refusal fallbacks
- Mark unkeyed message response.output_item.done as seen to prevent duplicate terminal synthesis.
- Preserve fallback output_index tracking for ID-bearing events without colliding with shifted item IDs, require item.type == message in Observe, and skip duplicate response.content_part.added frames.
- Guard Claude HasTextDelta on non-empty deltas, skip empty strings in Interactions codexContentText fallback, reset HasMessageTextDelta on OpenAI Chat response.created, and build Gemini refusal parts via ojson.Doc.
2026-11-20 18:57:46 +08:00
sususu98
ca459712c0 fix(meta): synthesize unstreamed Responses messages and translate refusal parts
- Track streamed message items in ResponsesStreamOutputTracker and synthesize missing item/part/delta/done events before terminal response.completed or response.incomplete when upstream omits item-level SSE frames.
- Include response.refusal.delta in HasMeaningfulCodexOutputDelta.
- Support refusal content parts and response.refusal.delta across Codex response translators (OpenAI Chat, Claude, Gemini, and Interactions) with regression tests.
2026-11-20 18:20:36 +08:00
Luis Pater
3a24d03cdd feat(antigravity): scope synthesized request.sessionId per credential
- Derive synthesized Antigravity request.sessionId deterministically from auth.ID and canonical, execution, or derived session identity across non-stream, Claude non-stream, and streaming paths.
- Scope the content-based fallback session ID by auth.ID so credential failovers emit a fresh request.sessionId while keeping explicit request.sessionId values and reasoning replay keys unchanged.
- Add regression tests verifying cross-model stability on the same credential and sessionId rotation across credential failover.

Closes: #7706
2026-11-20 08:30:42 +08:00
Luis Pater
91a3f455ea fix(claude): strip foreign advisor blocks after credential rebind
- Track advisor tool_use_id credential ownership in a bounded sliding-TTL store with shared KV first-writer-wins persistence and record minted blocks from 2xx JSON/SSE responses as well as post-rule accepted requests.
- Strip foreign advisor blocks and empty advisor-only turns via ojson.Doc in Execute, ExecuteStream, and countTokensUpstream before cloaking, payload rules, and CCH signing while preserving own-credential advisor state and paired ordinary tool_result blocks.
- Add regression tests covering streaming/non-streaming rebinds, 429 in-request failover, count_tokens, KV persistence/consistency, sliding TTL renewal, and payload-rule barrier ordering.

Closes: #7638
2026-11-19 23:08:32 +08:00
Luis Pater
6faa8d20b2 fix(codex): strip uniqueItems keyword from tool parameter schemas
- Add "uniqueItems" to the stripIncompatiblePatternsFromJSON fast-path guard and remove schema-level uniqueItems keys in stripIncompatiblePatterns while preserving literal properties.uniqueItems fields and non-schema user data.
- Update NormalizeCodexToolSchemas documentation and add regression tests across tool-schema, helps, and Codex HTTP and WebSocket executors.

Closes: #7690
2026-11-19 21:10:33 +08:00