33 Commits
Author SHA1 Message Date
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
inter 6c19399527 feat(gateway): auto-disable degraded accounts 2026-10-04 22:22:31 +08:00
Chenyme 95915fad28 refactor: enhance quality hold logic and replay safety across accounts 2026-08-31 10:34:58 +08:00
lij768423-svg 31557e8089 docs: match requestRetry comments to TUI hold and stub withhold
enabled stays false. A stub plus visible output at the deadline is
withheld, not released as late ciphertext. Floor-met short dumps and
previous_response_id / hosted-tool turns are held when intercept is on.
2026-08-28 11:37:37 +08:00
lij768423-svg f343670fa7 fix: treat short encrypted_content stubs as missing thinking
Non-empty ciphertext is not proof of reasoning. HasThinking now requires
encrypted_content / Anthropic signature to meet max(256B, 4 bytes per
usage reasoning token). A hold-expired short greeting billed as heavy
thinking, or a barely-over-floor flush in under a second, is withheld.

Recommended requestRetry values stay 30s / minOutput 8 / 6 attempts /
fail_closed / 12h / 15m idle, plus the new floor knobs. enabled remains
false so stock installs do not intercept.
2026-08-27 19:03:27 +08:00
Chenyme 017d94a065 Merge remote-tracking branch 'origin/main' into pr/989
# Conflicts:
#	backend/internal/application/gateway/quality_retry.go
#	backend/internal/application/gateway/quality_retry_scan.go
#	backend/internal/application/gateway/quality_retry_test.go
#	backend/internal/infra/config/config.go
#	backend/internal/infra/config/config_test.go
#	backend/internal/transport/http/account/handler.go
#	backend/internal/transport/http/account/handler_test.go
#	backend/internal/transport/http/inference/handler.go
#	backend/internal/transport/http/inference/handler_test.go
#	config.example.yaml
2026-08-20 20:25:02 +08:00
Chenyme 2aace693e9 fix: avoid withholding late-thinking streams after the quality hold deadline 2026-08-20 20:19:22 +08:00
Chenyme 1316ed730b feat: add privacy-safe request diagnostics and bounded retention 2026-08-20 19:45:35 +08:00
lij768423-svg 6b288f209c fix: lengthen requestRetry hold so grok-4.6 thinking is not withheld
3s hold cuts encrypted thinking that arrives at end-of-stream, which
fills audits with HTTP 200 · error and quality_degraded retries.
Match the production lab defaults: 30s hold, minOutput 8, 12h
missing-thinking cooldown, 15m idle cooldown, grok-4.6 probe model.

requestRetry.enabled stays false in built-in Go defaults so existing
configs do not flip on upgrade; config.example.yaml now recommends it on.
2026-08-20 17:18:05 +08:00
lij768423-svg bb2dc424d0 fix: allow clearing account cooldown and configure empty-stream penalty
Empty SSE idle timeouts currently write a hardcoded 24h cooldown via
qualityIdleAccountCooldown. Toggling enabled does not reset health, so a
single-account pool stays on 429 upstream_cooling until the operator
edits sqlite and restarts.

Add POST /api/admin/v1/accounts/:id/clear-cooldown (API + UI) which
zeros failure_count/cooldown_until/last_error. UpdateHealth already
publishes InvalidationAccountHealthChanged, so runtimeStore=memory
selector overlays are replaced.

Expose qualityGuard.requestRetry.idleAccountCooldown (1m–168h, default
24h) independently of missing-thinking accountCooldown. PATCH enabled
while cooling returns enabledDoesNotClearCooldown so the UI can warn.

Closes #976
2026-08-20 09:11:24 +08:00
lij768423-svg 78c17a83b3 fix: allow clearing account cooldown and configure empty-stream penalty
Empty SSE idle timeouts currently write a hardcoded 24h cooldown via
qualityIdleAccountCooldown. Toggling enabled does not reset health, so a
single-account pool stays on 429 upstream_cooling until the operator
edits sqlite and restarts.

Add POST /api/admin/v1/accounts/:id/clear-cooldown (API + UI) which
zeros failure_count/cooldown_until/last_error. UpdateHealth already
publishes InvalidationAccountHealthChanged, so runtimeStore=memory
selector overlays are replaced.

Expose qualityGuard.requestRetry.idleAccountCooldown (1m–168h, default
24h) independently of missing-thinking accountCooldown. PATCH enabled
while cooling returns enabledDoesNotClearCooldown so the UI can warn.

Closes #976
2026-08-20 02:38:32 +08:00
Chenyme d76c74f407 feat: record trusted client IPs 2026-08-19 15:06:17 +08:00
lij768423-svg 2ef3b0ac2f feat: cool missing-thinking accounts and list them in quality guard
First no-thinking withhold puts the account on a 24h scheduling
cooldown without disabling it. A later miss after that cooldown
expires disables the account. Quality-guard degrade-accounts now
includes quality_degraded retries as missing_thinking so operators
can see the rotated accounts.
2026-08-19 11:42:50 +08:00
Chenyme 43b17d866c Merge branch 'main' into pr/959
# Conflicts:
#	backend/internal/infra/config/config.go
2026-08-18 17:31:09 +08:00
lij768423-svg 506b4e46f9 feat: withhold missing-thinking streams and retry another account
Hold thinking-model SSE until reasoning appears or enough visible
output arrives with none. Do not deliver that first body; switch
accounts up to five more times. After six misses, fail closed with
503 instead of sending a no-thinking reply. Default off.
2026-08-18 09:26:35 +08:00
lij768423-svg ae05b4f749 feat: bound auto-assign share and per-cycle migrations
Add optional routing.autoAssignMaxNodeShare and
autoAssignMaxMigrationShare. Default 0 keeps the historical unbounded
first-pass evacuation and the existing 200-move repair ceiling. Values
in [0.05, 1] cap how many active accounts one healthy node may absorb
and how many already-bound accounts may move in one cycle.
2026-08-17 22:20:01 +08:00
Chenyme 2428f17d34 fix: harden probe recovery and prevent false thinking isolation 2026-08-15 12:01:26 +08:00
Chenyme c7ddda2366 perf: optimize large account pool selection and precise health invalidation 2026-08-14 11:30:45 +08:00
Chenyme 56072a50b4 feat: support PostgreSQL connection URL from environment 2026-08-04 21:11:06 +08:00
Chenyme 810b3b4fbb feat: isolate upstream connection pools by account 2026-08-04 18:31:28 +08:00
Chenyme 69e5fdd82f feat: integrate egress quality guard with managed identity and Compose 2026-08-04 14:48:50 +08:00
Chenyme a4d2111692 perf: harden billing ledger recovery and bound quota refresh memory 2026-07-23 01:42:37 +08:00
Chenyme 858509b7cb perf: finalize large-pool segmented selection and remove shadow mode 2026-07-23 00:21:03 +08:00
Chenyme 8695bb629f perf: batch acknowledged writes and atomic billing settlement 2026-07-23 00:20:03 +08:00
Chenyme 9c583fd167 perf: finalize concurrency safety and infrastructure validation 2026-07-23 00:19:22 +08:00
Chenyme c050086530 refactor: update reasoning replay cache configuration 2026-07-18 01:43:52 +08:00
yang d55eb6eab7 feat: add server-side reasoning replay cache for multi-turn Grok Build
对齐 CLIProxyAPI 的 xAI Reasoning Replay:在客户端不回传 thinking
signature / encrypted_content 时,由网关代持并注入上一轮可回放 items。

变更摘要:
- 新增 ReasoningReplayRepository 与 Memory/Redis 实现
- 新增 pkg/reasoningreplay:normalize/filter/insert/store/apply/capture
- CLI Adapter:出站前 Apply,成功响应 CaptureBody 写回;compact 清理
- 配置 routing.reasoningReplayEnabled/TTL/maxEntries(默认开启)
- settings 热更新时保留回放配置;补充改造文档与场景单测

不包含:通用 HTTP 响应缓存、Console/Web 路径、管理端 UI 开关。
2026-07-17 18:07:04 +08:00
real f9e9b4521f feat: normalize Build video routing and prefer Free accounts 2026-07-17 11:01:09 +08:00
Chenyme d2eecc4041 feat: Improved gateway multi-Provider routing and runtime concurrency management. 2026-07-15 10:58:25 +08:00
Chenyme fedbfbbf11 Merge remote-tracking branch 'origin/main' into pr/623
# Conflicts:
#	backend/internal/application/gateway/service.go
#	backend/internal/application/media/service.go
#	frontend/src/shared/i18n/index.ts
2026-07-14 23:53:40 +08:00
hamburg 9b661ead11 feat(settings): make public API base URL configurable with request preference
Expose frontend.publicApiBaseURL and frontend.preferRequestBaseURL through
the admin settings API and UI so operators can control image/public URL
generation without editing YAML or restarting the process.

Resolution priority is now switch-aware:
1. request-derived base when preferRequestBaseURL is enabled
2. configured publicApiBaseURL when set
3. request-derived base as fallback
4. http://127.0.0.1:8000 as last resort

Also hot-update /api/admin/v1/system so docs examples reflect the live
configured base URL after settings changes.
2026-07-14 18:58:30 +08:00
氕氙 5cee3d2f9a feat: add Grok Console provider 2026-07-13 22:53:37 +08:00
Chenyme a16837c9ea feat: Refactor the project using Go to support Grok Build & Grok Web. 2026-07-13 15:28:07 +08:00