Commit Graph

3752 Commits

Author SHA1 Message Date
Luis Pater
d1702fdffd fix(auth): drop stale auth updates using monotonic watcher revisions
- Track monotonic watcher revisions across persisted auth updates to filter out out-of-order events.
- Validate registration epochs before applying auth updates and deletions to prevent stale state overwrites.
- Synchronize auth status patches through post-persist hooks using detached background contexts.
- Guard auth status modifications with a dedicated handler mutex.

Closes: #5729
2026-09-11 08:18:51 +08:00
Luis Pater
5c80a01ca9 fix(translator): support audio transcription parts in gemini response translation
- Fall back to `audioTranscription.text` when explicit text content is absent in both streaming and non-streaming responses.
- Simplify non-streaming message content assignment using accumulated text content.

Closes: #5722
2026-09-11 07:05:25 +08:00
Luis Pater
942bda9979 fix(translator): preserve unknown thinking signatures in claude to codex compat translation
- Retain assistant thinking blocks with unknown-format string signatures when compatibility translation is enabled.
- Fall back to using the raw signature when provider detection classifies the signature provider as unknown.

Closes: #5710
2026-09-11 04:13:27 +08:00
Luis Pater
fc96a87fa6 feat(auth): support organization-hashed claude credentials and legacy migration
- Disambiguate Claude credential filenames using organization and account UUID hashes to keep multiple organizations distinct.
- Migrate legacy Claude credentials during login and save flows while preserving existing metadata and deleting obsolete files.
- Introduce `WithAuthCreationIntent` context policy across token stores to allow creating missing disabled credentials during login and migration.
- Preserve existing `disabled` status during auth metadata merges when not explicitly specified.

Closes: #5709
2026-09-11 03:58:23 +08:00
Luis Pater
4cd17293a3 fix(translator): relay claude tool result images as user messages for openai
- Extract image parts from Claude tool results and replay them in a user message following tool messages.
- Merge relayed images into existing user message content when present within the same turn.
- Insert a placeholder text for image-only tool results to keep tool message content non-empty.

Closes: #5707
2026-09-11 02:52:04 +08:00
Luis Pater
2912516cea feat(auth): support execution result policy before quota and cooldown mutations
- Introduce `ResultPolicy` interface and adapter to inspect and mutate execution results.
- Apply result policy in `MarkResult` prior to in-memory quota mutation, cooldown persistence, and hook invocation.
- Expose result policy configuration across auth `Manager`, SDK `Builder`, and `Service`.

Closes: #5705
2026-09-11 02:19:22 +08:00
Luis Pater
4efcac7966 fix(translator): support incomplete status and response.incomplete event in responses translation
- Handle `response.incomplete` events as terminal interaction completion events during stream translation.
- Propagate upstream response `status` to interaction response and completed event payloads.

Closes: #5702
2026-09-11 02:03:50 +08:00
Luis Pater
8f23ad0291 fix(codex): inherit template metadata for model aliases and restrict provider capabilities
- Resolve canonical templates using metadata model IDs for model aliases and prefixed routes.
- Apply descriptions, base instructions, and thinking support overrides to matched templates.
- Restrict protocol capabilities and reasoning levels based on provider support.

Closes: #5699
2026-09-11 01:42:30 +08:00
sususu
8461b4e91d chore(codex): update codex user-agent to 0.154.0 2026-09-11 00:30:24 +08:00
Luis Pater
c8f723e0fb feat(usage): propagate upstream base_url across usage records and plugin auth
- Add `BaseURL` field to usage records and host auth file entries.
- Extract `base_url` from auth attributes and metadata during usage reporting.
- Propagate `base_url` through plugin usage adapters and runtime auth callbacks.

Closes: #5693
2026-09-11 00:25:17 +08:00
Luis Pater
5a07045e6d fix(translator): ignore fco output item IDs when extracting responses call ID
- Exclude IDs with `fco_` prefix in `ExtractResponsesCallID` to prevent treating output item IDs as tool call identifiers.
- Ensure tool call outputs without explicit call IDs correctly pair with pending function calls via fallback.

Closes: #5692
2026-09-10 20:34:05 +08:00
Luis Pater
6dce78673f fix(auth): bound force refresh all concurrency using worker pool
- Limit concurrent credential refreshes in `ForceRefreshAll` using a worker pool bounded by `AuthAutoRefreshWorkers`.
- Centralize refresh worker pool size resolution in `refreshWorkers`.
- Check context cancellation prior to refreshing to fast-fail queued credentials.

Closes: #5687
2026-09-10 20:21:11 +08:00
Luis Pater
b8e6ec0ae7 fix(gemini): preserve function call pairing for interrupted calls and replay failures
- Synthesize function response parts for interrupted or missing OpenAI Responses tool calls to maintain strict Gemini call-response pairing.
- Preserve function response ordering matching pending call IDs across parallel and partial tool execution turns.
- Degrade gracefully to the original request payload when Antigravity reasoning replay breaks Gemini function call pairing.

Closes: #5682
2026-09-10 20:01:39 +08:00
Luis Pater
9fad505505 fix(auth): treat cloudflare 520-526 origin errors as transient upstream failures
- Exclude HTTP 5xx status codes from Cloudflare challenge classification to avoid treating origin errors as challenges.
- Tighten Cloudflare challenge detection pattern to require challenge indicators instead of generic HTML tags.
- Include HTTP 520-526 status codes in transient error cooldown handling across auth and model states.
- Support upstream `RetryAfter` hints when calculating recoverable failure cooldown durations.

Closes: #5681
2026-09-10 19:31:08 +08:00
Luis Pater
fd3e662376 fix(antigravity): keep active block open on empty text parts in claude stream
- Only transition and close the previous content block when text parts are non-empty.
- Prevent prematurely emitting `content_block_stop` on active blocks like thinking blocks when encountering empty text parts.

Closes: #5674
2026-09-10 19:07:48 +08:00
Luis Pater
c8ecb4f3c9 fix(openai): process reasoning deltas before content in responses stream
- Process `reasoning_content` deltas before message `content` in streaming chat completion translation.
- Ensure reasoning output items receive incremental text before message creation closes reasoning.

Closes: #5659
2026-09-10 18:59:11 +08:00
Luis Pater
09a29bd345 docs(readme): remove RunAPI sponsor
- Remove RunAPI sponsor entries from English, Chinese, and Japanese README files.
v7.2.157
2026-09-10 18:41:46 +08:00
Luis Pater
638ed7e1cc fix(stream): handle split CRLF across chunk boundaries in SSE validation
- Track trailing carriage returns across chunk boundaries in `sseJSONValidationState`.
- Strip leading newline in subsequent chunks to prevent duplicate newline insertion from split CRLF sequences.
- Reset trailing carriage return state upon stream completion.

Closes: #5657
2026-09-10 17:53:25 +08:00
Luis Pater
4dce5f3a2b fix(translator): ignore null and empty finish reasons in openai to gemini response
- Check that `finish_reason` is a non-empty string before mapping to Gemini `finishReason`.
- Prevent chunks or messages with `null` or empty `finish_reason` from emitting unexpected completion statuses.

Closes: #5651
2026-09-10 17:37:15 +08:00
Luis Pater
dde250f1c3 fix(auth): enable model cooldown and rotation for model not found errors
- Map upstream `model_not_found` errors to HTTP 404 before evaluating generic invalid request types in Codex terminal error handling.
- Prevent treating structured model not found responses as client request faults to preserve credential rotation.
- Recognize model access denial errors to apply model-level cooldown and failover.
- Respect `disable_cooling` configuration during model-level cooldown processing.

Closes: #5635
2026-09-10 12:35:07 +08:00
Luis Pater
3ae9093da8 fix(codex): treat model capacity errors as bootstrap overload failures
- Broaden pattern matching for Codex model capacity errors.
- Classify model capacity rejections as overload bootstrap failures to enable failover.

Closes: #5634
2026-09-10 12:06:01 +08:00
Luis Pater
259130863d fix(openai): preserve nested error details and sequence numbers in responses stream
- Format streaming error payloads with nested error objects matching official OpenAI Responses SSE specifications.
- Extract and propagate sequence numbers from upstream terminal events and framer states.
- Use `json.Number` to prevent precision loss for large integers and token metrics.
- Sanitize sensitive keys recursively across nested error objects without dropping custom fields.
2026-09-10 11:58:36 +08:00
Luis Pater
bd03aabcf1 fix(openai): preserve prewarm input and allow named tool outputs in responses websocket
- Track pending synthetic prewarm response IDs to merge warmup inputs into subsequent delta followups.
- Normalize transcript replacements when followups do not reference the prewarm parent response ID.
- Validate that the `input` field is an array for `response.create` requests.
- Allow `function_call_output` items without a `call_id` when a non-empty tool name is present.

Closes: #5631
2026-09-10 11:20:49 +08:00
Luis Pater
6a73f39627 fix(claude): preserve 1h cache ttl and beta header for subagent requests
- Retain `cache_control` blocks with 1h TTL and `extended-cache-ttl` beta header when explicitly requested by subagents.
- Detect 1h TTL configuration from request payloads and incoming Anthropic-Beta headers.
- Ensure `extended-cache-ttl` beta header is preserved or injected when 1h TTL is present.

Closes: #5629
2026-09-10 10:58:34 +08:00
Luis Pater
d1a024e940 feat(codex): add support for gpt-image-2.5 models
- Register builtin model definitions for `gpt-image-2.5`, `gpt-image-2.5-flare`, and `gpt-image-2.5-sunburst`.
- Update OpenAI image handlers and request routing to recognize GPT Image 2.5 models.
- Support direct image generation and edit execution for GPT Image 2.5 variants in the Codex executor.
- Apply client visibility overrides to hide new builtin image models where appropriate.
v7.2.156
2026-09-10 10:40:53 +08:00
Luis Pater
aedc9e6a39 fix(auth): classify terminal upstream auth failures as non-retryable errors
- Introduce `IsTerminalAuthError` and `NewTerminalAuthError` to identify permanent upstream authentication failures.
- Return terminal auth errors from candidate selection and scheduling when all available credentials fail with unauthorized errors.
- Support `BuildErrorResponseBodyWithError` to format terminal upstream auth errors as non-retryable `upstream_authentication_required` responses.
- Propagate terminal error classifications and the `retryable` field across HTTP and WebSocket response handlers.

Closes: #5645
2026-09-10 10:02:08 +08:00
Luis Pater
3bf787fc1d feat(auth): propagate canonical session id for custom header expansion
- Initialize `util.SessionIDResolver` to resolve session IDs from request contexts, metadata, and headers.
- Ensure canonical session metadata is injected into execution options across execution flows.
- Propagate session context in executors to support `$CPA-SESSION-ID` expansion in custom headers.
- Sync cleared or updated session identities back to execution contexts during conductor execution.

Closes: #5690
2026-09-10 01:43:37 +08:00
Luis Pater
60e5b8bd43 feat(management): add endpoint to refresh auth files
- Add `RefreshAuthFiles` handler to trigger active refresh for single or all auth files.
- Support specifying refresh targets via query parameters or JSON request body.
- Invoke auth manager force refresh operations and return refreshed credential states.

Closes: #5628
2026-09-09 20:05:33 +08:00
Luis Pater
db011593ca Merge pull request #5677 from sususu98/fix/codex-tool-schema-pattern
fix(translator): strip unsupported unicode property escape patterns from tool schemas
2026-09-09 18:22:16 +08:00
sususu
37ce368c50 fix(schema): inspect patternProperties keys and avoid Unicode escape fast-path bypass
- Check for \u in fast-path check to prevent JSON Unicode escapes from bypassing inspection.
- Inspect regex keys under patternProperties and drop keys with unsupported Unicode property escapes.
- Add tests covering Unicode escape representations (\u005c, \u0070, \u0050) and patternProperties keys.
2026-09-09 18:03:39 +08:00
sususu
e56abd56f1 fix(translator): strip unsupported unicode property escape patterns from tool schemas
- Add HasUnsupportedUnicodePropertyEscape in internal/util to detect \p{...} / \P{...} escapes that fail Python re compilation.
- Strip incompatible pattern attributes during tool parameter normalization in codex/claude and openai/claude translators.
- Provide schema-aware fallback stripping in codex executor helps to protect downstream Codex requests without mutating non-schema user data.
- Export unified schema keyword lists in internal/util to eliminate duplication.
- Add comprehensive unit tests covering Artifact fixtures, lookaheads, and user data preservation.

Closes: #5644
2026-09-09 17:49:13 +08:00
Luis Pater
b064b832e2 feat(codex): support model-level quota cooling
- Add `model-level-cooling` configuration option to Codex settings.
- Scope `usage_limit_reached` quota cooldowns to the requested model instead of the entire credential when enabled.
- Propagate model-level cooling checks across HTTP, SSE, and WebSocket execution paths.

Closes: #5619
2026-09-09 11:57:58 +08:00
Luis Pater
a59b1764e7 fix(claude): emit trailing usage chunk and aggregate stream usage
- Emit an OpenAI-compatible trailing usage chunk with an empty choices array on `message_stop`.
- Include `cache_write_tokens` in prompt token details for OpenAI response translations.
- Parse usage from `message.usage` and buffer Claude stream usage across chunks to merge input and output token counts.
- Ensure observed streaming usage details are published on completion or stream failure.

Closes: #5617
2026-09-09 10:48:05 +08:00
Luis Pater
0796d6d133 feat(plugin): add host session affinity lookup callback
- Decode and validate host affinity lookup requests for provider, model, and session ID.
- Query the active auth manager for session affinity bindings and status.
- Return lookup responses containing the auth index, observation timestamp, and credential availability state.

Closes: #5604
2026-09-09 03:25:42 +08:00
Luis Pater
7fac6b15bc fix(codex): strip schema dialect keywords from tool parameters
- Recursively strip `$schema` and `$id` dialect keywords from tool parameter schemas.
- Ensure object schemas and union object types retain an empty `properties` map.
- Re-encode normalized parameters without escaping HTML entities.

Closes: #5612
v7.2.155
2026-09-09 01:33:09 +08:00
Luis Pater
4fde97f414 fix(gemini): reorder trailing text before function responses in user turns
- Reorder Gemini user turn parts so text parts precede `functionResponse` parts.
- Prevent upstream provider validation failures (e.g., Vertex AI 400 errors) caused by text following tool results in the same turn.
- Apply user part reordering during Claude-to-Gemini request translation and when merging adjacent Gemini user contents.

Closes: #5607
2026-09-09 01:19:09 +08:00
Luis Pater
c6327a86c9 feat(plugin): preserve raw json in management responses on schema version 6
- Bump plugin ABI `SchemaVersion` to 6 and add `SchemaVersionRawManagementResponse`.
- Skip HTML entity escaping for plugin management JSON responses on schema version 6 and above.
- Retain legacy HTML escaping behavior for plugins with schema versions prior to 6.

Closes: #5605
2026-09-09 00:45:45 +08:00
Luis Pater
454452d5da Merge pull request #5626 from nichaoshou/fix/healthz-access-log
fix(logging): silence successful health probes while preserving errors
2026-09-09 00:31:32 +08:00
Luis Pater
d0bb908ce4 fix(gemini): normalize responses tool call outputs and resolve alternate call ids
- Extract Responses API call IDs prioritizing dedicated tool call fields (`call_id`, `tool_call_id`, `callId`) over generic `id`.
- Normalize tool call outputs against preceding calls using multi-pass matching (explicit ID, function name, and FIFO fallback).
- Fall back to tool output `name` when resolving function response names for unmapped call IDs.

Closes: #5602
2026-09-09 00:24:37 +08:00
Luis Pater
f39702a2c4 Merge pull request #5625 from router-for-me/fix/issue-5608-plugin-store-rate-limit
fix(plugin-store): reduce release checks and honor shared GitHub rate-limit cooldowns
2026-09-09 00:03:04 +08:00
chaoshou
a163c5e7ed fix(logging): silence only successful health probes 2026-09-08 19:17:20 +08:00
sususu
1119ef1424 fix(session): harden canonical UUIDv8 normalization for empty prefixes and context roots
- Reject bare/empty session prefixes after unwrapping rather than projecting an empty string into a shared ghost UUIDv8.
- Include ctx:v1: and ctx: in knownSessionPrefixes to ensure identical canonical UUIDv8 projection for context root hashes.
- Strip known prefixes iteratively to support layered prefixes such as derived:ctx:v1:.
- Document knownSessionPrefixes as a transitional compatibility table slated for deprecation when session extractors emit canonical UUIDv8 directly.
- Add regression unit test coverage for empty prefixes, context root prefix parity, chained prefix unwrapping, and golden UUIDv8 assertion.
2026-09-08 19:12:48 +08:00
chaoshou
e026cbf4e9 fix(api): skip access logging for health probes 2026-09-08 18:41:38 +08:00
Supra4E8C
3639d92421 fix(plugin-store): add network scope handling for shared GitHub API cooldowns 2026-09-08 18:35:32 +08:00
rome-xi
d8f2dceef7 perf(antigravity): batch functionResponse name repairs
Repair placeholder functionResponse names with part-local sjson and one
Index splice of the request body, matching the sibling content-edit path
instead of one full-body sjson.SetBytes per repaired name.
2026-09-08 18:32:26 +08:00
Luis Pater
20e3f731ea feat(auth): export helper functions for headless antigravity oauth
- Add `ExchangeAntigravityCode`, `FetchAntigravityUserInfo`, and `CompleteAntigravityOAuth` helpers for programmatic authentication.
- Introduce `BuildAntigravityAuthURL` and `AntigravityDefaultCallbackURI` to support custom and default redirect flows.
- Refactor Antigravity credential record assembly into `BuildAntigravityAuth`.

Closes: #5593
2026-09-08 18:22:01 +08:00
Supra4E8C
8c0ad8ccf2 fix(plugin-store): honor shared GitHub API rate-limit cooldowns 2026-09-08 18:18:25 +08:00
Supra4E8C
54b17ce8f7 fix(plugin-store): coalesce and throttle cached release checks 2026-09-08 18:04:29 +08:00
Luis Pater
1d5f7b2ac3 fix(auth): strip monotonic clock reading from quota cooldown deadlines
- Strip monotonic clock readings using `Round(0)` on calculated quota retry and recover deadlines.
- Ensure quota cooldown times rely on wall-clock timestamps across model and auth states.

Closes: #5590
2026-09-08 17:58:56 +08:00
Supra4E8C
1c9d7194e0 fix(plugin-store): only check releases for installed update sources 2026-09-08 17:53:22 +08:00