Commit Graph

1577 Commits

Author SHA1 Message Date
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
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
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
2026-11-26 17:52:15 +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
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
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
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
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
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
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
e7767a3ba8 fix(antigravity): prevent stale credits balance resurrection after removal or failure reset
- Delete stale cached credits balances from both local memory and Home KV when loadCodeAssist reports absent GOOGLE_ONE_AI credits, preserving the absent-entry invariant for skipped entries.
- Clear cached credits balances alongside hint resets in clearAntigravityCreditsFailureState, using versioned Home KV CAS transitions so failed invalidations retain retry state and concurrent refreshes are never wiped.
- Add regression tests covering standalone, Home KV, error-retention, concurrent-refresh, and rolling-upgrade scenarios.

Closes: #8158
2026-11-26 03:36:24 +08:00
Luis Pater
4183021383 fix(antigravity): eliminate credits hint recovery race in executor and tests
- Extract shared credential-scoped credits refresh key helpers and update recovery tests to await the scoped refresh entry instead of a bare auth ID.
- Atomically check and clear unavailable credits hints under the hint scope lock so concurrent credit balance refreshes cannot be clobbered.
- Add regression tests covering atomic unavailable-hint clearing and concurrent recovery against positive hint publication.

Closes: #8162
2026-11-26 03:24:58 +08:00
Luis Pater
568c717a96 fix(aistudio): finalize zeroOutputGuard when wsStream closes without StreamEnd
- Flush remaining buffered relay SSE frames and unconditionally finalize zeroOutputGuard on non-canceled EOF when wsStream closes without MessageTypeStreamEnd.
- Extract the stream-consumption goroutine into an unexported consumeStream helper and add regression tests covering candidate shells, non-candidate shell flushing, post-commit abnormal finish, and canceled contexts.

Closes: #8161
2026-11-26 03:06:19 +08:00
Luis Pater
c9fc5d5abf fix(antigravity): preserve non-empty groundingMetadata when trailing SSE chunk carries empty object
- Track whether captured groundingMetadata contains any fields via ojson ForEach so trailing empty objects cannot overwrite earlier non-empty metadata while preserving explicit empty objects when no non-empty metadata was seen.
- Write preserved non-empty groundingMetadata back into templateDoc unconditionally so trailing empty groundingMetadata objects are replaced.
- Add non-streaming assembly unit tests covering trailing empty objects, latest non-empty precedence, and explicit empty-object compatibility.

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

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

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

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

Closes: #8138
2026-11-26 01:32:07 +08:00
Luis Pater
24fb240c51 fix(executor): escape opts.Alt query parameter in Gemini and Vertex executors
- Escape opts.Alt with url.QueryEscape at all six upstream URL construction sites across GeminiExecutor and GeminiVertexExecutor to prevent query parameter injection and URL parsing errors.
- Rename the shadowed local url string variables to endpointURL at those sites and add regression tests covering Execute and ExecuteStream for Gemini and Vertex API key and service account paths.

Closes: #8137
2026-11-26 01:22:57 +08:00
Luis Pater
8cb15f2787 fix(vertex): filter non-terminal SSE usageMetadata in streaming executors
- Filter non-terminal SSE usageMetadata in both Vertex service-account and API-key streaming paths before translation while preserving internal usage accounting and trailing usage-only frames after a finish signal without traceId.
- Add regression tests covering API-key and service-account streaming across Gemini, OpenAI, and Claude formats for single-frame and split-terminal usage delivery.

Closes: #8134
2026-11-26 01:11:22 +08:00
Luis Pater
542dacc093 fix(executor): evaluate filter blocks before recording finish signals in Gemini and Vertex streams
- Check GeminiFilterBlockMessage and geminiPromptBlockErrorMessage before flushing buffered filter frames or setting sawFinishReason across GeminiExecutor and both GeminiVertexExecutor streaming loops so terminal and consecutive filter-blocked frames with promptFeedback.blockReason return HTTP 400.
- Preserve finish-signal tracking when a buffered frame is flushed by a subsequent normal response frame.
- Add streaming regression tests covering single and consecutive filter-blocked frames with SAFETY and PROHIBITED_CONTENT across Gemini, Vertex API key, and Vertex service account paths.

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

Closes: #8122
2026-11-25 22:51:33 +08:00
Luis Pater
0c6681923c fix(translator): guard null Gemini generation fields and support snake_case in Claude requests
- Require numeric validation for maxOutputTokens, topP, topK, and thinkingBudget so null or invalid values no longer coerce to 0 or disable thinking while keeping temperature omitted per #4071 and #4383.
- Support snake_case Gemini SDK fields for generation_config, thinking_config, function_declarations, parameters_json_schema, and mixed thinking summary paths.
- Align stripTranslatedDefaultMaxTokens in ClaudeExecutor with the translator's Gemini generationConfig and positive maxOutputTokens alias selection.

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

Closes: #8098
2026-11-25 19:49:55 +08:00
Luis Pater
db276e8b1b fix(executor): fix Vertex Imagen panic, Meta response.done, and Antigravity tests
- Guard nil bufio.Scanner before calling scanner.Err() on Vertex Imagen streaming paths for both service account and API key auth.
- Recognize and normalize Meta response.done terminal events across streaming and non-streaming translation paths with regression tests.
- Align Antigravity issue 7000 boundary and apply_patch empty-stream test assertions with single-part system instructions and issue 7990 transient zero-output retries.
2026-11-25 19:02:53 +08:00
Luis Pater
b47cd8e8f9 Merge pull request #8119 from router-for-me/home
feat(home): delegate Home dispatch to plugin executors
2026-11-25 18:13:04 +08:00
hkfires
27e7618dc8 fix(home): report antigravity project discovery failures
Publish upstream 401 and 429 responses from Antigravity project
discovery during home auth preparation so credential failures are
attributed using the effective token and upstream model.

Thread the upstream model through prepareHomeRequestAuth via
context and generalize the home credential failure publisher to
support non-401 statuses. Add coverage for execute, stream, and
count paths, including delegated plugins and refreshed tokens.
2026-11-25 17:36:53 +08:00
hkfires
ad2edae0b6 feat(home): delegate Home dispatch to plugin executors
Advertise ready executor plugins and their supported credential
providers in Home auth dispatch, and let Home select a plugin via
executor_plugin. Resolve the live plugin bound to the credential
provider, prepare credentials through the provider preparer
including Antigravity token refresh, and preserve the upstream
model and model info for plugin execution.

Add the ExecutorAuthProviders capability over the plugin RPC
boundary and surface unavailable Home plugin executors as a
terminal 503 without retrying other credentials.
2026-11-25 16:29:20 +08:00
Luis Pater
531aea156a fix(util): normalize numeric protobuf Schema.Type enums in Gemini schemas
- Decode numeric protobuf Schema.Type enum values (1..7) to lowercase JSON Schema type strings via *ojson.Doc in NormalizeJSONSchemaNumericConstraints while preserving literals and special property keys.
- Normalize schemas prior to nested wrapper cleaning, Claude 5.5 structured output prompt fallback, Interactions response_format emission, and snake_case Gemini pass-through schema fields.
- Add regression tests covering schema cleaners, Antigravity executor paths, and Gemini-ingress translators.

Closes: #8032
2026-11-25 11:41:46 +08:00
Luis Pater
ffa5511251 feat(thinking): parse extra_body.google.thinking_config on OpenAI Chat requests
- Parse thinking_level/thinkingLevel and thinking_budget/thinkingBudget from Google extra_body thinking_config variants as a lower-precedence fallback in OpenAI effort extraction and Antigravity intent routing.
- Apply the same fallback precedence during OpenAI Chat to Antigravity and Gemini request translation so upstream thinkingConfig matches extracted reasoning_effort metadata.
- Add unit and executor regression tests covering snake_case/camelCase variants, precedence rules, and Antigravity grouped-model routing.

Closes: #8018
2026-11-25 11:07:29 +08:00
Luis Pater
d71e9dcd7d fix(auth): recognize codex-acp user agents in Codex SIWC bypass
- 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
2026-11-25 11:07:27 +08:00
Luis Pater
e9dd8bada7 fix(executor): refresh replay cache snapshot after pairing-failure invalidation
- 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
2026-11-24 11:29:54 +08:00
Luis Pater
9bce482522 fix(antigravity): reject invalid HTTP 200 responses in CountTokens
- 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
2026-11-24 10:41:12 +08:00
Luis Pater
d1bdee850b fix(antigravity): reject empty SSE responses in non-stream execution
- 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
2026-11-24 10:21:19 +08:00
Luis Pater
20be744e80 fix(antigravity): reject empty successful streams
- 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
2026-11-24 10:00:44 +08:00
Luis Pater
14a95b19e2 fix(antigravity): preserve thinking-group output caps
- Preserve smaller caller output limits while applying thinking-group catalog caps.
- Clamp Claude thinking budgets and normalize output token aliases before payload rules run.

Closes: #7985
2026-11-24 09:48:07 +08:00
Luis Pater
335b69879d fix(codex): handle nil auth in websocket streams
- Guard websocket stream authentication logging so nil credentials do not panic.
- Add regression coverage for compact and required-websocket nil-auth paths.

Closes: #7970
2026-11-24 07:26:32 +08:00
Luis Pater
32625f13de fix(meta): report clean eof before terminal event
- 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
2026-11-24 07:22:22 +08:00
Luis Pater
38067a2997 fix(antigravity): align outbound request wire format
- Preserve normalizer request IDs and correlation labels while generating slash-delimited native fallbacks.
- Normalize native tool output keys and single-part system instructions across Antigravity request paths.

Closes: #7967
2026-11-24 07:06:16 +08:00
Luis Pater
06225fcf6e fix(antigravity): preserve signature cache scope on first refresh
- 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
2026-11-24 07:06:15 +08:00
sususu98
62c419e049 fix(translator,executor): preserve native Claude max_tokens and remove Vertex silent cap
- 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.
2026-11-24 00:17:13 +08:00
sususu98
ac415c083a fix(translator,executor): harden Claude generation constraints and Vertex max output token cap
- 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.
2026-11-23 23:29:33 +08:00
Luis Pater
f73b8132d0 fix(claude): stabilize advisor system prompt placement
- 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
2026-11-23 23:00:31 +08:00