642 Commits
Author SHA1 Message Date
Chenyme f18624b17d fix(console): improve parsing logic for console usage status and add tests for edge cases 2026-10-21 19:43:49 +08:00
Chenyme eaca3d0e11 fix(console): add bounds checking for budgetCents in parseConsoleUsageStatus and enhance related tests 2026-10-21 19:33:06 +08:00
Chenyme 838aca3c8f chore: bump version to v3.1.8 and implement auto-delete feature for unlinked Console accounts 2026-10-21 19:22:41 +08:00
Huan-zhaojun a23e465483 fix(test): accept Transport.Protocols as HTTP/2 switch on Go 1.27 2026-10-21 11:46:24 +08:00
Chenyme 4e220e815c feat: implement transient retry tracking and enhance related tests 2026-10-18 10:27:06 +08:00
Chenyme 716d8475f2 Merge branch 'main' into fix/voice-ws-timeout-and-stt-billing 2026-10-16 15:18:38 +08:00
Chenyme dbd1a29fda fix: enhance request timeout handling to distinguish between cancellation and deadline expiration 2026-10-16 15:18:24 +08:00
Chenyme c9c3e7ddb2 Merge branch 'main' into feat/auto-disable-degraded-accounts 2026-10-16 14:39:45 +08:00
Chenyme 659ee8ca69 refactor: enhance request retry configuration and auto-disable logic; update documentation and tests for clarity 2026-10-15 13:44:11 +08:00
Chenyme 837993aa02 Merge branch 'main' into feat/legacy-http-proxy 2026-10-15 11:32:34 +08:00
Chenyme 0a3efcc459 feat: enhance proxy URL normalization and test logic 2026-10-15 11:32:17 +08:00
Chenyme 1e434d1d3d Merge branch 'main' into fix/video-retry-account-scope-bypass 2026-10-15 11:10:12 +08:00
Chenyme 6cd06ea5e7 fix: add recovery test for video job on worker shutdown 2026-10-15 11:10:00 +08:00
Chenyme bc05e1d5ca Merge pull request #1065 from Solaris-star/oss/1064-a88cd8808c
fix(gateway): cool down Build accounts after unknown 403
2026-10-15 10:06:18 +08:00
Chenyme 9fce943981 Merge branch 'main' into pr/1062 2026-10-15 01:25:37 +08:00
Chenyme 23793f3e0d fix: ensure requestId is included in Imagine websocket responses for accurate event handling 2026-10-15 00:46:28 +08:00
Chenyme bedc88feb6 feat: enhance SSO flow with consent token handling and cookie management 2026-10-15 00:09:31 +08:00
Chenyme 16143fb695 Merge branch 'main' into fix/device-consent-token 2026-10-14 23:35:04 +08:00
Chenyme 2f29773bed fix: refine requestId filtering in imagine collector to enhance image handling 2026-10-14 23:28:01 +08:00
carfeii 6ea58d3a89 fix(voice-ws): observe request timeout and bill confirmed STT duration regardless of transport outcome
Two issues in the voice/STT WebSocket proxy:

1. The established proxy never watched c.Request.Context().Done(), so
   server.requestTimeout had no effect on a quiet, already-admitted
   session: the account lease, concurrency slot, and upstream connection
   stayed open past the configured deadline until a transport error
   occurred on either side. Added a watcher that closes the session once
   the request context is canceled, extracted as watchRequestTimeout so
   it is unit-testable without a real WebSocket upgrade.

2. STT billing was gated on the downstream client closing cleanly
   (successful == ErrorCode == ""), even though the cost is already
   incurred the moment the upstream sends a confirmed transcript.done
   duration. A client that received a complete transcription and then
   disconnected abnormally left EstimatedCostInUSDTicks at zero,
   understating usage against the key's billing limit. Billing is now
   keyed on having a confirmed duration, not on how the transport ended.
2026-10-05 18:21:45 +08:00
inter b789e8466d feat(settings): support auto-disable degraded accounts in management UI and filter bound accounts by ID 2026-10-04 22:22:31 +08:00
inter 6c19399527 feat(gateway): auto-disable degraded accounts 2026-10-04 22:22:31 +08:00
inter ea563c31ce feat(egress): support legacy authenticated HTTP proxy format 2026-10-04 22:12:27 +08:00
carfeii 31bbe64dc9 fix: video job retry can bypass client key account scope
Every other account-selection path (text chat, image generation, voice,
voice websocket) threads the requesting client key's AccountScope through
to beginSelectionSessionForKey. The video job's background retry/recovery
worker (runVideoJob) used the unscoped beginSelectionSession instead, so
once the job's originally pinned account failed, the fallback search for a
replacement ignored the client key's provider/tier restrictions entirely.

A client key restricted to e.g. Super-tier accounts could end up consuming
a Free-tier (or wrong-provider) account's quota purely because its pinned
account hit a transient failure, silently widening access beyond what the
key was configured to allow.

media.Job already stores ClientKeyID, so the fix looks up that key and
passes its AccountScope into beginSelectionSessionForKey, matching every
other selection path. Added a regression test
(TestVideoRetryDoesNotEscapeClientKeyAccountScope) that fails against the
prior code (confirmed: the out-of-scope account was used) and passes with
the fix.
2026-09-30 15:26:04 +08:00
Solaris-star a88cd8808c fix(gateway): cool down Build accounts after unknown 403 2026-09-29 17:02:07 +08:00
noodledon cfc5865df7 fix(web): fetch consent_token and send browser form headers in SSO→Build device flow
xAI's device approval now renders a consent page on accounts.x.ai
containing a hidden consent_token JWT, and POSTs to
auth.x.ai/oauth2/device/approve without it — or without the
Origin/Referer/Sec-Fetch headers a real form submit carries — return
403 'Request could not be verified'. Web→Build conversion failed for
every account.

After the verify 303, GET the consent page, scrape consent_token, and
POST it back with browser-style navigation headers. Verified live
against auth.x.ai: approve now 303s to /oauth2/device/done and the
token endpoint returns access+refresh tokens.
2026-09-26 17:05:58 +08:00
li abc5c294f9 fix(web): device approve 带上 consent_token,修复 convert-to-build 403
xAI 在 device 授权流程新增了一次性 consent_token(ES256 JWT, typ=consent+jwt),
放在 /oauth2/device/consent 页面里,approve 必须回传,否则 403
"Request could not be verified"。旧流程没取这个令牌,导致 SSO→Build 全部换不出。

verify 之后 GET consent 页面解析 consent_token,再随 approve 一起提交。
2026-09-25 20:37:20 +08:00
volcanolin 8038dca603 fix(web): filter imagine websocket events by requestId to prevent stale gallery frame crosstalk 2026-09-22 15:44:49 +08:00
Chenyme 9dda42ae41 feat: align Grok Build 1.0.40 headers and catalog-driven reasoning menus 2026-09-22 01:17:29 +08:00
lij768423-svg 7f3f3d3ce0 fix: withhold vis<8 and plaintext-ratio dumps; count streamed visible only
requestRetry still leaked grok-4.6 dumps after the short-usage patch:
fake-enc/burst required visible >= minOutput, plaintext thinking vetoed
the dump detectors, and chat usage.completion inflated visible tokens.

Withhold when reasoning>=80 or ciphertext meets the floor and the visible
flush is <2s. Plaintext thinking still withholds if flush<2s and
reasoning/output >= 0.8. Cipher-only HasThinking waits until visible text
has streamed for 2s, or the stream ends. Visible tokens come from
streamed content only.

Does not enable requestRetry and does not change lab Docker/VERSION
defaults.
2026-09-12 10:55:54 +08:00
Chenyme 9af368104a Merge branch 'main' into fix/console-tool-choice-empty-tools 2026-09-09 11:35:09 +08:00
Chenyme 6db9f67fbe fix: drop tool_choice when tools is empty 2026-09-09 11:34:14 +08:00
Chenyme e5285ebeb6 fix: filter non-object root union branches safely 2026-09-09 11:08:25 +08:00
Chenyme 7d1b424626 fix: prevent allocation size overflow in reasoning replay 2026-09-09 10:57:06 +08:00
Chenyme dd05325023 Merge branch 'main' into pr/1041 2026-09-09 10:49:06 +08:00
Chenyme ca392e6890 fix: restore reasoning context for multi-turn tool calls 2026-09-09 10:31:00 +08:00
Solaris-star df4dde39ca fix(console): ensure tool_choice is dropped when tools is empty 2026-09-08 08:46:13 +08:00
ctermiii 3de758e793 fix(cli): auto-heal missing reasoning blocks in responses history
- support pipe-delimited call_id lookup (callId|itemId) for pi coding agent
- automatically backfill missing reasoning blocks before function_call in normalizeInputItems
- fallback to recent reasoning proof in conversation history when cache is cold
- prevents tool call deadlocks and infinite repetition in long-running agent loops
2026-09-05 16:37:23 +08:00
ctermiii 5d19ccffbc fix(cli): resolve deep schema refs when flattening multi-branch oneOf roots
- recursively collect properties and required fields across $defs branches in root oneOf/anyOf
- eliminate root-level union rejections from strict upstream validators
- preserve compatibility with single nullable $ref roots
2026-09-05 13:59:44 +08:00
ctermiii 72a3a3475c fix(cli): aggressively flatten root anyOf/oneOf to clean object schema
- completely delete anyOf/oneOf keys from root parameter schema
- merge all properties, required fields, and definitions into root object
- guarantees xAI upstream receives clean type=object schema, eliminating 'root schema is an anyOf/oneOf union with a non-object branch' rejection
2026-09-05 13:44:49 +08:00
ctermiii 22ac653a57 fix(cli): filter non-object branches from tool parameter anyOf/oneOf roots
- normalizeBuildFunctionParametersRoot now discards non-object branches (e.g. string/null) in anyOf/oneOf roots
- hoists single remaining object branch as clean object root with explicit type=object
- fixes xAI 400 rejection: 'tool parameter root must be an object type (root schema is an anyOf/oneOf union with a non-object branch)' on Codex/MCP tools
2026-09-05 12:08:06 +08:00
ctermiii 8641a78233 fix(conversation): restore reasoning context in multi-turn chat tool calling
- add ReasoningCache to map call_id to upstream reasoning proof (encrypted_content)
- capture reasoning block during response.completed (stream) and ConvertResponseJSON (sync)
- restore reasoning block before assistant tool_calls when converting Chat Completions messages
- prevents xAI Build upstream reasoning token drop and infinite loop in multi-turn tool calling
2026-09-05 11:27:26 +08:00
Chenyme 7ebc46c7ac fix: allow manual routes to reuse compatibility aliases 2026-09-02 18:37:32 +08:00
Chenyme 15bf810ace fix: cap account cooldown from upstream Retry-After 2026-09-02 18:04:26 +08:00
Chenyme 155ebba7d5 fix(cli): alias Codex view_image tool for Grok Build 2026-09-02 13:42:02 +08:00
Chenyme 9b80510055 Merge branch 'main' into fix/web-free-video-duration-cap 2026-09-01 11:17:26 +08:00
Chenyme eadfece376 fix: cap free-tier video duration before upstream 2026-09-01 11:16:49 +08:00
Chenyme 08de857a75 Merge branch 'main' into pr/1029
# Conflicts:
#	backend/internal/transport/http/inference/handler_test.go
2026-09-01 10:20:27 +08:00
Chenyme c25705e106 Merge branch 'main' into fix/audit-output-loop-error-code 2026-08-31 23:48:16 +08:00
Chenyme 44807b28ac fix: avoid allocation size overflow in schema normalization 2026-08-31 23:48:02 +08:00