- Keep pending Gemini filter errors when trailing usage or finish frames contain no real content.
- Cover terminal metadata and empty text carrier regressions for Claude non-stream execution.
Closes: #7915
- Clamp Claude thinking budgets when the model output limit reduces maxOutputTokens below an accepted requested ceiling.
- Add regression coverage for Antigravity Sonnet and Opus models, including case-insensitive model resolution.
Closes: #7916
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.
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.
- 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.
- Scope Antigravity permanent failures, balances, hints, cooldowns, Home KV keys, and refresh state by credential registration.
- Fence late asynchronous publications and reclaim retired in-process state after same-ID credential replacement.
- Add regression coverage for standalone and Home KV paths, including zero-epoch replacements and equal timestamps.
Closes: #7795
- Defer replayAccumulator.Commit in executeClaudeNonStream and cacheAntigravityReasoningReplayFromResponse in Execute until after ApplyPatchTranslationError, empty translation output, and TranslatedClaudeErrorPayload checks pass.
- Preserve pre-grounding response bytes for Execute replay extraction while relying on Commit's existing context.WithoutCancel detachment and leaving non-2xx body reads unchanged by design.
- Add KV-backed regression tests covering rejected apply_patch and translated Claude error turns across both non-streaming paths as well as successful persistence.
Closes: #7888
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.
- Inspect top-level JSON error payloads on HTTP 2xx responses in Execute and route them through shared upstream error bookkeeping while deferring credits failure state clearing until response success is confirmed.
- Evict credential-scoped idle pooled transports on all 403 and 401 errors across Antigravity execute, streaming, and count-tokens paths, including mid-stream SSE error frames.
- Add regression tests covering HTTP 200 in-band errors in Execute and keep-alive connection eviction on HTTP and mid-stream 403/401 errors.
Closes: #7882
- Detach caller context cancellation inside antigravityReasoningReplayAccumulator.Commit so completed turns still persist thoughtSignature ledgers to KV if the client disconnects immediately after the terminal chunk.
- Allow ExecuteStream deferred commitReplay to proceed after terminal delivery when both streamErr and caller ctx.Err() are context.Canceled, while still blocking commit on upstream read errors or incomplete streams.
- Add KV-backed regression tests covering post-terminal disconnects, direct canceled-context commits, mid-stream cancellation, and live-context upstream cancellation errors.
Closes: #7881
- Populate request.model with a normalized models/<baseModel> identifier when absent or blank before deleting top-level model in AntigravityExecutor.CountTokens, while preserving caller-supplied request.model values and falling back to top-level model if req.Model is empty.
- Delete request.stream before payload finalization so non-counting streaming flags are stripped while user payload override and filter rules remain the final semantic barrier.
- Add regression tests covering request.model population across all Antigravity request formats, passthrough normalization edge cases, request.stream stripping, and payload finalizer ordering.
Closes: #7865
- 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
- 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
- Resolve CanonicalSessionIDMetadataKey and pass original request payloads and metadata to session.ExtractSessionInfo in antigravityReasoningReplayClientSessionKey so body subagent, task, thread, conversation, Codex multi-agent, and LCP identities stay isolated while preserving existing Claude Code, execution-session, prompt-cache, and session namespace priorities.
- Prevent plain metadata.user_id values from overriding execution sessions and skip reasoning replay when fork indicators appear without an identifiable child session ID.
- Add regression tests covering parallel subagents, body session fields, LCP canonical sessions, Codex multi-agent headers, priority invariants, and unidentified forks.
Closes: #7839
- 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
- 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
- Attach X-Goog-User-Project whenever a non-empty project_id is available across generation, countTokens, fetchAvailableModels, credits loadCodeAssist, PrepareRequest, HttpRequest, and fetch_antigravity_models requests before custom header overrides.
- Scope automatic injection in PrepareRequest and HttpRequest to Cloud Code PA endpoints or matching per-auth base_url targets, and clear stale headers when switching credentials on a reused request.
- Apply cross-origin redirect header stripping across Antigravity executor HTTP clients and disable redirects in fetch_antigravity_models so project IDs cannot leak across origins.
Closes: #7837
- Default missing, null, or blank minimumCreditAmountForUsage values on GOOGLE_ONE_AI entries to 0 while skipping invalid, negative, or non-finite values.
- Require finite positive credit amounts meeting a non-negative minimum threshold in both loadCodeAssist parsing and cached balance availability checks so zero balances are never treated as available.
- Add race-tested regression tests covering omitted, null, blank, zero, negative, and non-finite credit and minimum threshold values.
Closes: #7798
- Guard maybeRefreshAntigravityCreditsHint, queueAntigravityCreditsRefresh, and updateAntigravityCreditsBalanceForTask so Cloud Code PA credits queries are skipped when antigravity-credits is disabled or the auth is Disabled/StatusDisabled.
- Skip ensureAntigravityProjectID and post-refresh credits queueing in refreshTokenWithOptions (and guard ensureAntigravityProjectID directly) for Disabled/StatusDisabled credentials while keeping OAuth token refresh active.
- Add synctest-based race-safe regression tests for Issue #7785 and enable AntigravityCredits in existing credits unit test fixtures that exercise loadCodeAssist.
Closes: #7785
- Enforce active short-cooldown checks at CountTokens entry without credits bypass and share model-aware schema sanitization with buildRequestDoc before payload finalization.
- Route CountTokens HTTP 429 responses through shared 429 state bookkeeping with single idle-transport eviction per response and bound CountTokens response reads to 1 MiB.
- Add regression tests covering short-cooldown gating, 429 bookkeeping, bounded response reads, model schema sanitization, and payload-finalizer ordering.
Closes: #7786
- Skip overwriting functionCallingConfig.mode with VALIDATED in buildRequestDoc when the request already specifies mode NONE under camelCase or snake_case proto-JSON paths, canonicalizing non-canonical NONE strings in place.
- Add regression tests covering OpenAI Chat Completions, OpenAI Responses, Claude, Gemini, proto-JSON alias spellings, and final payload rule precedence on Antigravity Claude models.
Closes: #7792
- Evict non-reusable ephemeral xAI websocket ID states when their last in-flight stream ends, while preserving explicit session states from options or request metadata.
- Add 24-hour idle TTL expiration with periodic background cleanup and in-flight protection to xaiWebsocketIDStateStore without bounding total entry count.
- Coordinate persistent session and ID state acquisition and teardown under store.mu so CloseExecutionSession and bulk shutdown clear both stores atomically.
Closes: #7746
- 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
- Short-circuit AntigravityExecutor.HttpRequest with a request-scoped 503 when tos-pause-window is active before token acquisition or upstream dialing.
- Normalize outgoing Host from the request URL, allocate a fresh header map without mutating caller headers, adopt updated auth snapshots after token refresh, and apply per-credential header:* attributes consistently with buildRequestDoc and CountTokens.
- Strip credential-configured custom headers, custom Host, and Authorization on cross-origin redirects, with race-checked regression tests.
Closes: #7824
- 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
- Mark Antigravity 403 VALIDATION_REQUIRED and 401 inference/auth errors as credential-scoped and close idle pooled transports on 403 TOS_VIOLATION and VALIDATION_REQUIRED.
- Propagate non-429 credential-scoped cooldowns to auth-level retry state and model projections so sibling models stop selecting blocked credentials.
- Separate refresh-clearable auth/grant cooldowns from non-auth credential cooldowns across OAuth refresh, token rotation, shadow unwrapping, and restart recovery.
Closes: #7814
- Delegate SOCKS5/SOCKS5H Transport.DialContext calls in BuildHTTPTransport through proxy.ContextDialer so caller deadlines and cancellation abort stalled dials and handshakes without adding a fixed dialer timeout.
- Isolate Antigravity project-discovery HTTP/1.1 transports via newAntigravityProjectDiscoveryHTTPClient with deferred CloseIdleConnections so canceled credential acquisition cancels abandoned in-flight dials without affecting the shared pool.
- Add SOCKS5/SOCKS5H cancellation, deadline, tunnel, and HTTP client regression tests verifying prompt request exit and peer socket closure.
Closes: #7819
- Set httpReq.Host from the resolved loadCodeAssist base URL and apply static credential-scoped header:* attributes without reading pooled caller Gin contexts or session IDs.
- Invoke applyAntigravityTOSState on bounded 403 responses in updateAntigravityCreditsBalanceForTask while reusing task/epoch and context cancellation guards so superseded refreshes cannot arm pool-wide TOS pauses.
- Add race-tested regression tests covering Host resolution and overrides, detached background header safety, and active versus superseded/canceled 403 TOS_VIOLATION handling.
Closes: #7820
Resolve Copilot routes from Home-provided model info when Home is
enabled, allowing models absent from the local catalog to execute,
stream, and count tokens. Attach resolved info before after-auth
interception and skip the local catalog refresh in Home mode.
Expose Copilot device-login completion and model discovery through
the SDK. Fix Codex token counting for string inputs, string message
content, and role-only messages.
- Carry typed OpenAI reasoning arrays through streamed and non-streamed Responses without changing their bytes.
- Replay signed thoughts only on the Devin route and cover fragmented and late signatures across tool turns.
Closes: #7805
- 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
- Scan all parts of the first user turn in generateStableSessionIDFromContentsForAuth for the first non-empty text part so multimodal turns retain a stable sessionId across turns.
- Normalize model names to lowercase in buildRequestDoc, geminiToAntigravityDocForAuth, and Execute routing, including lowercase fallback lookup when capping maxOutputTokens.
- Add regression tests covering multimodal Turn 1 session ID stability and case-insensitive Claude, Gemini Pro, and image model handling.
Closes: #7760
- Apply explicitly configured max-idle-conns-per-host even when lower than the base transport limit while preserving larger base limits when omitted, and include explicitness in antigravityTransportKey to avoid cache collisions across reloads.
- Treat max-idle-conns-per-host <= 0 as short-lived connection mode (MaxIdleConnsPerHost = -1) consistent with idle-conn-timeout <= 0 and ProxyConnectionPoolConfig, and align pool cap comments and docs with the 210s limit.
Closes: #7758
- Capture and emit thoughtSignature on non-thought text parts and preserve standalone empty-text signature carriers in convertStreamChunksToNonStream.
- Flush pending text or thought segments at signed and same-chunk part boundaries while preserving whitespace text separated by signatures.
- Add unit and end-to-end regression tests covering non-thought signatures, empty-text carriers, same-chunk boundaries, and whitespace preservation.
Closes: #7755
Add copilot presets to the registry models catalog and intersect
them with per-account /models capabilities, so usable credentials
get cold-start preset routes before discovery and account data
overrides limits, modalities, thinking and endpoint afterwards.
Replace the persisted metadata catalog with an immutable
in-memory Auth.CopilotCatalog with preset and unavailable
sentinels, preserving or revoking it across reloads, account
and origin changes, and re-resolving routes on each attempt.
Run discovery in a dedicated worker pool with per-account
transport, queued cancellation and skip-persist commits, gate
native-executor plugin models on catalog availability, and
remove login-time catalog fetch and embedded effort lists.
Add cmd/fetch_copilot_models to export the raw upstream /models
response atomically without modifying the stored credential.
BREAKING CHANGE: upstream-only Copilot models without a registry
preset are no longer routed, and the persisted copilot_catalog
metadata, ReadCatalog and string FetchCatalog APIs are removed
- Route Antigravity execution-time OAuth refreshes through a Manager refresh coordinator that serializes per-credential refreshes, persists rotated tokens with detached cancellation, updates in-flight MarkResult auth state, and keeps Home-dispatched snapshots isolated from local credentials.
- Preserve non-cancellation context values such as httptransport.Decorator and custom round trippers via context.WithoutCancel while stripping execution-scoped RequestProxyURL across OAuth refresh, project discovery, and credits hint refreshes.
- Add race-tested regression tests covering single refresh persistence, client cancellation, project discovery failure, safety-window crossing, unsupported attachments, Home isolation, request preparation context preservation, and proxy isolation.
Closes: #7749
- Classify genuinely missing Antigravity project_id as a credential-scoped 503 instead of HTTP 400 so broken credentials cool down and rotate.
- Preserve underlying cause chains, transient transport classification, and request-retry round eligibility for transport timeouts, internal discovery deadlines, and incomplete or transient onboardUser failures.
- Preserve full upstream response bodies, single-attempt discovery after token refresh, and structured TOS_VIOLATION and 429 metadata across loadCodeAssist and onboardUser responses.
Closes: #7751
- 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
- Add a requestScoped flag and IsRequestScoped method on statusErr so executor errors can explicitly opt into request-scoped handling without affecting ordinary status errors.
- Return a request-scoped 503 via newAntigravityTOSPauseStatusErr across Execute, executeClaudeNonStream, ExecuteStream, and CountTokens so the conductor stops immediately without rotating or cooling healthy credentials.
- Add executor and manager regression tests covering non-streaming, Claude non-streaming, streaming, and token-counting paths under an active TOS pause.
Closes: #7748
- Publish a known-unavailable credits hint after inspecting paidTier.availableCredits when the array is missing, empty, or lacks a parseable GOOGLE_ONE_AI entry.
- Bound loadCodeAssist response reads with io.LimitReader and validate JSON before publishing to avoid unbounded reads or false negative hints.
- Add race-tested unit tests covering empty/unmatched availableCredits, stale positive hint replacement, oversized bodies, and invalid JSON responses.
Closes: #7750
- Attach per-auth RoundTripper before prepareRequestAuth and retry once after 401 while fencing credential epoch and version.
- Select text-capable models without forcing gpt-5 on non-Codex/OpenAI providers and restrict max_output_tokens=16 to Codex.
- Honor caller cancellation across preparation, refresh, and stream drain without recording failure or cooldown, with unit and end-to-end tests.
Closes: #7737
Force the stream hint for the OpenAI-to-Claude response translator
whenever ExecuteStream is used, even if the original request set
stream:false or omitted it. Keep the original request unchanged
and add coverage for omitted, true, and false values.
Use GeminiTokenCountJSON for Gemini-format requests instead of
falling back to OpenAI usage JSON, and reuse the shared Claude
input_tokens helper for Claude and OpenAI Response formats.
- Publish Copilot catalog and plugin models with native IDs, aliases, and auth prefixes while preserving suffixed routes.
- Route requests through exact registered Copilot models and send the resolved native model upstream.
- Reconcile Copilot model states and route metadata against published routes; document Copilot support in OAuth alias and error configuration.
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.
- Route errPrepare through the same error pipeline as execution errors in all four conductor paths (Execute/CountTokens/Stream/Home): record RetryAfter and CredentialScope, match request-scoped error rules, stop on stop-actions and invalid requests, and preserve the upstream attempt via markUpstreamExecutionAttemptFromContext plus annotateTrustedRetryAfterByHint/syncPreferredUpstreamError so stop responses keep their retry hint.
- Mark upstream attempts only at real HTTP boundaries (OAuth token refresh, project discovery) and propagate upstream Retry-After and credential scope from Antigravity prepare failures, while keeping local missing-credential errors and status-less transport faults from being misclassified or outranking a genuine upstream rejection.
Closes: #7726