Commit Graph

5285 Commits

Author SHA1 Message Date
Luis Pater
6021aba94e fix(auth): write auth files atomically via temp file, sync, and rename
- 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
2026-11-27 21:15:44 +08:00
sususu98
54ed2ba201 fix(util): strip empty, whitespace-only, and null enum values in Gemini schema cleaners (#8571) 2026-11-27 19:53:48 +08:00
Luis Pater
91619936f3 Merge pull request #5698 from cookerpapa/fix/model-header-snapshot
fix(registry): isolate empty model header overrides
2026-11-27 12:10:13 +08:00
Luis Pater
e3795562c5 Merge pull request #5689 from cookerpapa/test/session-cache-virtual-time
test(auth): use virtual time for session cache TTL refresh
2026-11-27 12:02:54 +08:00
sususu98
13e0642096 fix(translator): group and align split Gemini functionResponse turns
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.
2026-11-27 09:29:44 +08:00
Luis Pater
42b13fff47 fix(auth): reconcile disabled-era and orphaned unavailable flags
- Clear disabled-era Unavailable state when re-enabling credentials via management handlers, lifecycle transitions, post-save delta merges, and concurrent refresh merges while preserving unresolved sign-in or token-rejection errors.
- Reconcile unexplained StatusActive Unavailable flags with no cooldown deadline or auth error consistently across routing selection, scheduling, model projection, and management cooldown views.
- Add regression tests covering disabled re-enable flows, concurrent persist/refresh races, SIWC diagnostic 401 preservation, and orphaned unavailable reconciliation.

Closes: #8523
2026-11-27 07:55:40 +08:00
Luis Pater
b2e3316262 fix(codex): fail over in-stream billing quota errors during bootstrap buffering
- 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
2026-11-27 07:35:43 +08:00
Luis Pater
47f18e4d82 fix(pluginhost): preserve scheduler routing across reconfigure, hot reload, and dir errors
- 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
v8.1.7
2026-11-27 00:48:00 +08:00
Luis Pater
7fa523657b fix(gemini): place merged follow-up user parts before function responses
- 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
2026-11-27 00:30:59 +08:00
Luis Pater
830b9cac8f test(pluginhost): align unix plugin reload test with fresh-image contract
- 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
2026-11-27 00:25:24 +08:00
Luis Pater
0aaf6d1c3a Merge pull request #8515 from router-for-me/acp
feat(home): add local plugin executor dispatch
v8.1.6
2026-11-26 20:00:35 +08:00
hkfires
6acc778c0f feat(home): add local plugin executor dispatch
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.
2026-11-26 19:16:36 +08:00
Luis Pater
46c3467a2b fix(codex): renew websocket read deadline on active heartbeats and new turns
- 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
2026-11-26 18:26:48 +08:00
Luis Pater
13d87daf65 test(antigravity): wait for expected stream usage records before fencing
- Add waitThinkingGroupUsage in Antigravity thinking-group feedback tests to wait for expected usage records before publishing the usage fence, preventing races with post-close stream accounting.
- Add delayed stream-delivery regression subtests covering stream success and stream-in-band 503 failure usage reporting.

Closes: #8513
v8.1.5
2026-11-26 17:52:15 +08:00
Luis Pater
74b787743b docs: remove Chenju sponsorship listing from READMEs and delete asset 2026-11-26 17:42:39 +08:00
Supra4E8C
fbbc042449 docs: replace Xcode sponsor listing with Paidaxing 2026-11-26 17:02:17 +08:00
Luis Pater
27e298cff4 fix(executor): report canceled and truncated streams as failures across xai, meta, openai_compat, and copilot
- 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
2026-11-26 13:36:00 +08:00
Luis Pater
7075ec9eed fix(translator): handle Claude SSE errors, tool_choice none, and allowed_tools in Responses translator
- 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
2026-11-26 13:35:19 +08:00
Luis Pater
914399f69c fix(kimi): handle stream cancellation, 50MB SSE buffer, and truncated or error frames
- 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
2026-11-26 13:21:36 +08:00
Luis Pater
9cc3ad8f7f fix(util): support allowed_tools tool_choice in OpenAI Responses to Gemini translation
- 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
2026-11-26 12:00:52 +08:00
Luis Pater
6065b82d03 fix(codex): fix null reasoning effort, multi-part summary text, and failed event translation
- 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
2026-11-26 11:59:50 +08:00
Luis Pater
d3ec7abe48 fix(openai): preserve data URLs and repeated form fields for video reference_image_urls
- 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
2026-11-26 11:59:39 +08:00
Luis Pater
9b1484c767 fix(openai): handle ojson null fields and array prompts in legacy completions converter
- 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
2026-11-26 11:45:54 +08:00
Luis Pater
721d22dd64 fix(gemini): split action on last colon to support model IDs containing colons
- 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
2026-11-26 11:41:42 +08:00
Luis Pater
36c837c642 fix(translator): validate optional Claude chat fields, restore tool names, and handle non-stream errors
- 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
2026-11-26 11:38:31 +08:00
Luis Pater
c5d48cb27c fix(translator): remove unreachable return in interactionsStepDeltaToClaude
- 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
2026-11-26 11:17:28 +08:00
Luis Pater
19665c7c41 fix(translator): support Antigravity Interactions streaming tool calls and finishReason status
- 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
2026-11-26 11:12:41 +08:00
Luis Pater
54fc8c4269 fix(antigravity): update Hub fallback and changelist map to 2.35.2
- 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
2026-11-26 10:56:19 +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
0d8d8d08cb fix(antigravity): guard non-object systemInstruction during request normalization
- Delete explicit null systemInstruction values and skip non-object values before setting role in normalizeAntigravitySystemInstructionDoc.
- Add regression tests covering camelCase null, snake_case null, direct normalization, and non-object systemInstruction inputs.

Closes: #8189
2026-11-26 10:31:58 +08:00
Luis Pater
9b7bbcc50e fix(antigravity): preserve snake_case response_schema when normalizing responseJsonSchema
- 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
2026-11-26 10:29:36 +08:00
Luis Pater
3d1069ebf7 fix(antigravity): support snake_case tool calls and responses in fixCLIToolResponseDocAt
- 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
2026-11-26 10:20:12 +08:00
Luis Pater
0b29bf1bae fix(antigravity): ignore empty or null finishReason in OpenAI streaming responses
- 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
2026-11-26 10:17:06 +08:00
Luis Pater
06a6e4bd8c fix(auth): enforce model-level credits admission for direct Antigravity models
- 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
2026-11-26 10:14:20 +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
4c6c90a5fc fix(antigravity): exclude cached tokens in Claude message_start and retain cpaUsageMetadata for [DONE]
- 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
2026-11-26 10:01:54 +08:00
Luis Pater
4f1ab038d9 fix(antigravity): prune empty extra_content wrappers when stripping thought signatures
- 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
2026-11-26 09:49:38 +08:00
Luis Pater
1f4f5fa785 fix(auth): allow switched Antigravity variants to fall back to credits in final cooldown minutes
- 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
2026-11-26 09:47:08 +08:00
Luis Pater
8a5e48d7d3 fix(antigravity): preserve non-text thought parts during non-stream aggregation
- 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
2026-11-26 09:41:07 +08:00
Luis Pater
5d2835c309 fix(antigravity): preserve Claude tool_use IDs and use unique non-stream fallback IDs
- 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
2026-11-26 09:31:33 +08:00
Luis Pater
ed885bdcd9 fix(antigravity): attach Claude thought signatures inline and sanitize Interactions requests
- 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
2026-11-26 09:30:56 +08:00
Luis Pater
1745d0396a fix(antigravity): require non-empty web grounding before synthesizing Claude web search blocks
- 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
2026-11-26 09:27:36 +08:00
Luis Pater
79b61a054d fix(antigravity): skip thought and function call parts in web search text extraction
- 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
2026-11-26 09:14:48 +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
641667c97f fix(auth): check late Antigravity target variants in session affinity quota checks
- 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
2026-11-26 08:28:44 +08:00
Luis Pater
b380182613 fix(antigravity): evict and cancel superseded Home credits refresh tasks
- 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
2026-11-26 08:22:42 +08:00
Luis Pater
2dce19ed2f fix(antigravity): preserve signature cache grant scope across Home OAuth refreshes
- 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
2026-11-26 07:45:39 +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
173baf1de4 fix(gemini): emit empty SSE frames for keep-alive heartbeats
- 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
2026-11-26 07:23:19 +08:00