- Match codex-acp and codex_acp client identifiers in IsCodexClientUserAgent so ACP Codex requests bypass use_siwc and use outer Codex OAuth credentials.
- Add regression tests with the full @agentclientprotocol/codex-acp User-Agent covering SIWC bypass selection and Codex HTTP/WebSocket execution paths.
Closes: #8011
- Add DeleteAntigravityReasoningReplayItemsIfUnchangedWithSnapshot in internal/cache to atomically return the newly written tombstone snapshot across local memory and Home KV modes.
- Update scope.cacheSnapshot in prepareAntigravityGeminiReasoningReplayPayloadDocWithOptions when conditional invalidation succeeds so the next turn's Commit CAS persists instead of silently dropping replay state.
- Add regression tests covering memory/KV commit recovery after pairing degradation and concurrent-write isolation.
Closes: #7997
- Validate that HTTP 2xx CountTokens responses are valid JSON objects before checking in-band errors or token counts, returning 502 Bad Gateway on empty, HTML, malformed, or non-object bodies.
- Strictly parse numeric totalTokens as a non-negative int64 via strconv.ParseUint before translation, rejecting missing, fractional, negative, or overflowing values while preserving explicit zero counts.
- Add hermetic regression tests covering invalid HTTP 200 CountTokens responses across formats alongside valid zero and positive counts.
Closes: #7992
- Return a retryable 502 zero-output status error in executeClaudeNonStream when an HTTP 200 SSE stream yields no valid JSON payload, preserving context errors and avoiding replay commits or credits failure-state resets.
- Add hermetic regression tests covering empty, HTML, and sentinel-only SSE bodies across Claude and OpenAI formats while confirming valid SSE responses without finishReason still succeed.
Closes: #7991
- Return a retryable 502 when an upstream HTTP 200 stream contains no valid SSE JSON payload.
- Cover empty and HTML responses while preserving valid terminal synthesis without finishReason and credits failure state.
Closes: #7990
- Guard websocket stream authentication logging so nil credentials do not panic.
- Add regression coverage for compact and required-websocket nil-auth paths.
Closes: #7970
- Emit a truncated 502 stream error when Meta closes before response.completed or response.incomplete.
- Record failed usage with accumulated details and cover the regression with an end-to-end stream test.
Closes: #7971
- Retain the pre-refresh grant identity when initializing signature cache metadata for legacy credentials.
- Add a regression test proving cached Claude thinking signatures remain recoverable after the first token rotation.
Closes: #7968
- Replace ClaudePositiveMaxTokens with ClaudeMaxTokensRaw to forward raw JSON numeric max_tokens verbatim (including 0 for Claude cache pre-warming and >65536 values for Gemini 4 long decodes) without silent filtering, truncation, or clamping.
- Remove silent maxOutputTokens capping from GeminiVertexExecutor so Vertex requests (including Gemini 4 long decodes up to 1,048,576 tokens) follow official Vertex API semantics.
- Avoid intermediate slice allocation in ClaudeStopSequences with ForEach.
- Synchronize captured request bodies via buffered channels in claude_generation_config_regression_test.go and add end-to-end gemini-interactions coverage.
- Centralize Claude max_tokens, stop_sequences, and output_config.format parsing in internal/translator/common/request.go to filter invalid/non-positive values and clamp huge max_tokens deterministically.
- Use the shared helpers in Gemini, Antigravity, and Interactions Claude request translators, adding Interactions response_format mapping and removing dead schema deletes.
- Apply provider output token capping across all Vertex execute/stream paths before the payload config barrier, using float comparison to close fractional and overflow bypasses.
- Add unit and executor regression tests covering translators, Antigravity Claude 5.5 prompt fallback, and Gemini/Vertex API key and service account paths.
- Select top-level caller system placement from the initial advisor tool declaration to keep the conversation prefix stable.
- Apply the same advisor-aware layout to message and count-token requests and cover both phases with a regression test.
Closes: #7941
- Scope Claude signature recovery and writes to the active credential.
- Preserve scoped cache continuity across verified token refreshes.
- Fail closed for unscoped recovery and credential replacement.
- Add stream and non-stream multi-account isolation regression coverage.
Closes: #7960
- Convert Imagen requests and responses consistently across API-key and service-account execution paths.
- Handle non-streaming Imagen JSON directly on stream APIs while preserving final payload rule ordering.
Closes: #7955
- Scope pooled transports by stable auth identity and a digest of the refresh grant.
- Add a regression test proving replacement credentials use a distinct TCP connection.
Closes: #7961
- Prevent buffered Gemini policy text from reaching clients after scanner failures.
- Reject truncated successor frames and cover Gemini and Vertex authentication paths.
Closes: #7956
- Parse structured and header retry hints for HTTP 503 capacity responses.
- Verify the propagated delay is used by model cooldown scheduling.
Closes: #7957
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.
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.
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.
- Retain pending Gemini filter errors when trailing stream frames contain no visible content.
- Reuse zero-output inspection so valid code and media content still disambiguate buffered filter frames.
- Add streaming regressions for terminal metadata, empty media placeholders, and executable code content.
Closes: #7918
- Retain candidate grounding metadata when terminal SSE chunks omit it.
- Add a regression test for citations from an earlier response chunk.
Closes: #7919
- 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