- Add misc.WriteFileAtomic to write credentials into a non-.json temporary file in the target directory with 0600 permissions, sync to disk, close, and atomically rename over the target path while cleaning up temporary files on failure.
- Update FileTokenStore.Save and the Claude, Kimi, xAI, and Vertex SaveTokenToFile implementations to serialize JSON in memory and persist atomically instead of truncating files in place.
- Add regression tests verifying sync ordering, failure cleanup, 0600 permissions, and atomic replacement semantics across all updated auth save paths.
Closes: #8539
Merge parallel functionResponse parts split across consecutive user/function
contents into a single user turn aligned with the preceding model turn's
functionCall order before thought-signature sanitization, name backfill, and
pairing validation.
- Align fast-path detection with slow-path rewrites across split responses,
out-of-order responses (including mixed ID/non-ID and duplicate-ID slots
preferring exact (id, name) matches), intervening non-response contents,
mixed parts, and invalid boundaries (non-object, empty/non-array parts, or
functionCall-bearing non-model contents).
- Normalize whitespace-only response names and support snake_case
function_call/function_response parts in both grouping and empty-name
backfill (including legacy non-array parts), using *ojson.Doc for writes.
- Preserve incomplete, excess (same-turn and separate-turn), interleaved
non-model functionCall, and empty-content boundary histories rather than
dropping or bypassing them so ValidateGeminiFunctionCallPairing still
reports genuine history mismatches accurately.
- Add unit and top-level Gemini reasoning replay regression tests.
- Classify structured insufficient_quota and credit_balance_exhausted errors as credential-scoped HTTP 429 across Codex HTTP, SSE, and WebSocket error paths regardless of model-level cooling.
- Fail over buffered pre-output billing quota rejections before committing downstream SSE or WebSocket streams while preserving in-stream delivery once output or tool events start.
- Add unit and end-to-end API-key-to-OAuth failover regression tests and update stream-bootstrap-buffering configuration comments.
Closes: #8527
- Keep the previous registration on explicit reconfigure rejection, require rollback confirmation after post-accept registration failures, and preserve the current snapshot when reading the plugin directory fails.
- Coordinate scheduler picks across hot reloads with atomic active-record discovery, bounded reload waiting, a single generation-aware retry, and full-tier candidate preservation for replacement schedulers.
- Add deterministic regression tests covering rejected and post-accept reconfigure failures, hot-reload waiting and retries, concurrent publish discovery, across-priorities upgrades, and directory read errors.
Closes: #8519
- Reorder merged tool-response user turns in OpenAI Chat to Gemini translation so follow-up user parts precede functionResponse parts, preventing Vertex AI HTTP 400 errors.
- Preserve relative part order within both the follow-up user parts and the functionResponse group, and update and expand regression test coverage.
Closes: #8520
- Update the third Open assertions in TestUnixPluginReloadAfterShutdownUsesReplacedFile to verify that reopening unchanged plugin content maps a fresh handle and distinct shadow copy instead of reusing a shut-down resident image.
- Assert that the freshly mapped image starts with the baseline shutdown call count rather than inheriting the shut-down image's package globals.
Closes: #8516
Authorize acp/ models via Home local-plugin-dispatch and run
the selected plugin executor without upstream credentials.
Validate plugin version, config digest, host/Home fences, and
the authorized model across execute, stream, and count paths,
while falling back to credential dispatch for legacy Home.
Preserve before-auth interception, usage attribution, payload
finalization, and router exclusions for delegated requests.
Expose static executor models and avoid reusing resident
shadow plugin images on reload.
- Renew the underlying net.Conn read deadline on upstream Ping/Pong heartbeats during in-flight responses while keeping completed-idle sessions and unresponsive peers subject to bounded cleanup.
- Refresh the read deadline when activating a reused session or transitioning an idle duplex socket into a new turn, without letting outbound writes extend an already in-flight silent upstream.
- Track duplex turn and steering state directly in the upstream read loop so downstream backpressure cannot keep completed upstream connections alive, and add deterministic regression tests.
Closes: #8514
- Guard deferred usage publishing in xai, meta, openai_compat, and copilot streaming executors so pre-terminal context cancellations publish failure with captured usage instead of success or silence while preserving success on post-terminal disconnects.
- Add clean-EOF stream truncation detection, upstream terminal failure handling, and response.done translation normalization to xai streaming execution.
- Add regression tests covering mid-stream cancellation, post-terminal disconnects including custom cancel causes, and clean-EOF truncation across all four executors.
Closes: #8223
- Translate Claude SSE error events into response.failed in streaming and failed responses (including native JSON errors) in non-streaming while preserving partial outputs, incomplete call status, and usage.
- Emit tool_choice {"type":"none"} when tools are present and filter declared tools and historical tool_search_output references consistently for allowed_tools with fail-closed handling.
- Add regression tests for error events, tool_choice none, allowed_tools modes and aliases, and mid-stream failures.
Closes: #8224
- Guard deferred stream usage publishing with terminal delivery checks in ExecuteStream and executeResponsesStream so mid-stream cancellations publish failures.
- Raise the ExecuteStream scanner buffer to 50MB and parse SSE frames to detect in-band errors without leaking raw payloads into logs or usage failures.
- Fail clean EOFs missing [DONE] or primary choices.0.finish_reason with a truncated stream error wrapping io.ErrUnexpectedEOF instead of synthesizing [DONE].
Closes: #8220
- Add identity-based allowed_tools resolution shared by ConvertResponsesToolChoiceToGemini and FilterGeminiFunctionDeclarationsByResponsesToolChoice, enforcing exact namespace, local name, and tool-kind matching with fail-closed NONE fallbacks.
- Filter Gemini functionDeclarations in ConvertOpenAIResponsesRequestToGemini for allowed_tools while preserving the full forwardMap for historical tool-call replay.
- Add unit and request-level regression tests covering required/any/auto/none modes, namespace and tool_search entries, shadowing collisions, and kind mismatches.
Closes: #8215
- Treat null, empty, whitespace, and non-string reasoning_effort values as unset so Codex falls back to medium and standard Responses omits reasoning.effort.
- Remove the early break in non-stream reasoning summary extraction so all summary_text items are concatenated into reasoning_content.
- Translate response.failed and error events into OpenAI error payloads in both streaming and non-streaming response translators with regression tests.
Closes: #8219
- Read all values from both `reference_image_urls` and `reference_image_urls[]` form keys via `PostFormArray` in `videosCreateRequestFromForm`.
- Parse JSON-encoded reference arrays and split comma-separated values only at URL boundaries so RFC 2397 `data:` URLs and URLs with embedded or consecutive commas remain intact.
- Add multipart and form-urlencoded regression tests verifying both parsed form payloads and upstream xAI `reference_images` mapping.
Closes: #8218
- Extract string elements from array prompts and guard optional request parameters in convertCompletionsRequestToChatCompletions against JSON null while preserving legacy integer logprobs compatibility.
- Emit JSON null for empty or null finish_reason and require usage.IsObject() in both streaming and non-streaming /v1/completions response converters so usage: null does not bypass empty-chunk filtering.
- Add regression unit tests for /v1/completions request/response conversion and tighten the legacy truncated-stream test assertion to check SSE error.message.
Closes: #8216
- Parse POST /v1beta/models/*action using strings.LastIndex so model IDs and aliases containing colons route cleanly to generateContent, streamGenerateContent, and countTokens.
- Reject missing colons, empty model names, and empty methods with HTTP 404 while preserving the existing unsupported-method 404 response.
- Add regression tests covering single/multiple-colon model IDs and invalid action path edge cases.
Closes: #8217
- Require numeric positive max_tokens/max_completion_tokens, numeric top_p, and non-empty string stop sequences in OpenAI-to-Claude Chat Completions request translation.
- Restore sanitized Claude function tool names from the original OpenAI request across both streaming and non-streaming response translators using only declared function tools.
- Propagate Claude SSE and native JSON error payloads in ConvertClaudeResponseToOpenAINonStream instead of returning a fabricated empty completion.
Closes: #8214
- Remove the unreachable trailing return statement in interactionsStepDeltaToClaude after the exhaustive switch in Interactions-to-Claude stream response translation.
- Restore clean go vet checks for internal/translator/interactions/claude without altering runtime behavior.
Closes: #8405
- Track Vertex streaming partialArgs and args/willContinue tool calls across chunks with cloned payload buffers, bounded continuation thought signatures, and clean step-stop flushing.
- Map candidates.0.finishReason (including snake_case fallback) to incomplete, failed, or completed interaction status in both streaming and non-streaming responses.
- Add regression tests covering streaming tool-call fragments, buffer reuse, thought-signature round-tripping, and finishReason status mapping.
Closes: #8213
- Bump antigravityFallbackVersion to 2.35.2 so pre-refresh and fallback requests report the latest Hub release.
- Add the verified changelist mapping for Hub 2.35.2 (cl=1029311855) so manifest lookups no longer pin back to 2.35.1.
- Update version resolution and User-Agent test expectations to cover 2.35.2 and unmapped version pinning.
Closes: #8212
- 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
- Skip writing responseSchema when snake_case response_schema already exists in generationConfig or generation_config so proto-JSON outputs do not emit duplicate schema keys.
- Add regression tests covering response_schema alongside responseJsonSchema and response_json_schema under both generationConfig and generation_config.
Closes: #8188
- Recognize both camelCase and snake_case function call/response fields across fixCLIToolResponseDocAt and its helpers while preserving each part's original key name.
- Register untagged non-user function-call turns and match fallback response names by call ID before positional fallback.
- Add regression tests covering mixed-casing turns, omitted-role calls, sibling inline_data attachment, and out-of-order snake_case parallel responses.
Closes: #8185
- Guard UpstreamFinishReason caching in ConvertAntigravityResponseToOpenAI to accept only non-empty trimmed JSON strings while preserving uppercase normalization and string cloning.
- Prevent trailing empty, whitespace, or null finishReason chunks from clearing latched reasons such as SAFETY, RECITATION, or MAX_TOKENS and masking them as stop.
- Add regression tests covering trailing usage finalization, DONE fallback synthesis, and blank or null intermediate usage chunks.
Closes: #8186
- Enforce per-model disabled, permanent-unavailability, forced-cooldown, and non-quota cooldown checks in findAllAntigravityCreditsCandidateAuths and prepareAntigravityRequest while preserving late-switched variant admission.
- Track and persist non-capacity non-quota cooldown deadlines separately so a subsequent 503 capacity error cannot mask an active non-quota model cooldown in memory or across restarts.
- Add unit and end-to-end streaming/non-streaming regression tests covering direct model admission, 404-then-503 restart persistence, and switched variant recovery.
Closes: #8182
- 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
- Subtract cachedContentTokenCount from promptTokenCount and set cache_read_input_tokens in streaming message_start while honoring both response.usageMetadata and response.cpaUsageMetadata.
- Track latest response.cpaUsageMetadata counts in streaming Params without prematurely setting HasUsageMetadata so split terminal usage still defers while [DONE] retains accurate fallback counts.
- Add streaming regression tests covering cached token accounting, single-chunk terminal usage, split terminal deferral, [DONE] fallback, web-search mode, and input clamping.
Closes: #8184
- Prune empty extra_content.google and extra_content maps after stripping nested thought_signature fields in the Antigravity Claude Gemini request sanitizer while preserving non-empty sibling keys.
- Add shared extra_content.google.thought_signature scanning and stripping helpers in internal/signature and apply them across Gemini request sanitization and all Antigravity reasoning replay cleanup sites, including duplicate wrapper keys.
- Add regression tests covering single and duplicate extra_content and google wrappers across translator, reasoning replay, and Gemini signature sanitization paths.
Closes: #8179
- Ignore the live remaining countdown on trustedRetryAfterError when evaluating a modelCooldownError in shouldAttemptAntigravityCreditsFallback, deferring to any retry hint on the underlying cause so credits admission uses the stored upstream retry hint.
- Remove the unreachable modelCooldownError check under status 0 in shouldAttemptAntigravityCreditsFallback and add unit and end-to-end regression tests for final-5-minute switched variant cooldowns and non-quota causes.
Closes: #8181
- Treat any part key outside text, thought, and thought signatures as a non-text payload in convertStreamChunksToNonStream so non-text thought parts flush pending buffers and pass through normalizeRawPart intact.
- Add regression tests covering unsigned and signed non-text thought parts, preceding thought text boundaries, and continued dropping of empty unsigned thought text parts.
Closes: #8180
- Preserve valid non-reserved upstream functionCall IDs for non-Gemini models in antigravityClaudeToolUseID and disambiguate rewritten IDs with unique atomic suffixes.
- Replace the per-call non-stream toolIDCounter with the process-wide atomic toolUseIDCounter shared with the streaming translator.
- Add regression tests covering upstream Claude ID preservation, sanitization collision disambiguation, reserved Gemini namespace isolation, and cross-turn fallback uniqueness.
Closes: #8177
- Merge text thought parts per Interactions thought step and attach Claude thinking signatures inline instead of flushing detached empty-text signature carriers or tagging function calls.
- Run Antigravity Claude request signature sanitization during Interactions-to-Antigravity translation so foreign Gemini or invalid signatures are stripped before upstream dispatch.
- Add regression tests covering inline Claude signature attachment, delayed signature-only steps, foreign Gemini signature stripping, and round-trip replay.
Closes: #8178
- Validate that groundingMetadata is a JSON object containing at least one non-blank webSearchQueries string or groundingChunks web URI before triggering web search block synthesis in both streaming and non-streaming Claude response translators.
- Pick the first non-blank string query in webSearchQueryFromGrounding and mark buffered web search fallback text as visible output when non-whitespace so trailing MALFORMED_FUNCTION_CALL does not abort already-emitted text.
- Add streaming and non-streaming regression tests covering empty groundingMetadata, subsequent real grounding chunks, fallback text preservation, and normal thinking/tool translation.
Closes: #8176
- Filter out thought and functionCall parts in antigravityTextContent so internal reasoning is not concatenated into visible Claude web_search text or shifted into grounding citation offsets.
- Add non-streaming and streaming regression tests covering thought parts alongside web search grounding metadata and pre-grounding buffered text.
Closes: #8175
- Track per-request attempted and rejected Antigravity target models across execute, count, and stream bootstrap error paths so session affinity evaluates the variant that actually cooled.
- Resolve requested Antigravity thinking variants outside the manager read lock when credentials hold model states, prioritizing observed attempt variants over pre-interceptor inference.
- Add regression tests covering rebind-on never and quota modes, stream bootstrap 429s, transient 502 preservation, and variant isolation.
Closes: #8171
- Track scope and timestamp ordering in the per-auth credits refresh registry so Home credentials with RegistrationEpoch == 0 cancel and evict superseded tasks while rejecting out-of-order older snapshots.
- Advance and supersede local refresh state from maybeRefreshAntigravityCreditsHint before early returns and scope eviction strictly to exact auth IDs to prevent prefix collisions.
- Guard evicted refresh states with a superseded flag and add Home-mode regression tests covering replacement eviction, stale ordering, TOS pause suppression, and pipe-delimited auth IDs.
Closes: #8169
- Rebind cpa_signature_cache_grant and cpa_signature_cache_grant_binding after RefreshAuthViaHome in Refresh and ensureAccessTokenWithOptions only when account continuity is verified.
- Align Home-dispatched Antigravity credentials with Home's enum scope and home_binding so Claude thinking signature scopes stay consistent across token rotations and rolling Home upgrades.
- Add regression tests covering Home refresh scope preservation, cross-account isolation, and bidirectional rolling-upgrade cache lookups.
Closes: #8168
- 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
- 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
- Replace ": keep-alive\n\n" SSE comment heartbeats with empty SSE frames ("\n\n") across Gemini streamGenerateContent and Interactions streaming endpoints to stay compatible with google.golang.org/genai.
- Override StreamForwardOptions.WriteKeepAlive in forwardGeminiStream and forwardInteractionsStream so mid-stream pauses and continuity waits emit empty SSE frames without affecting other protocols.
- Update Gemini pre-first-token keep-alive assertions and add regression tests covering pre-first-token and mid-stream SSE keep-alive frames.
Closes: #8164