Commit Graph
1461 Commits
Author SHA1 Message Date
Sofwan 4f384fe4be feat: terminate model output loops with split content/reasoning thresholds
A looping upstream stream burns account quota and the client context window
until the response budget is exhausted. Track consecutive identical deltas
and terminate the stream once a channel exceeds its ceiling.

Content and reasoning keep separate counters. high/xhigh effort reasoning
legitimately repeats the same short marker ("so", "hmm", "wait", list
bullets) far more often than visible output does, so a single shared
counter truncates valid deep-thinking responses. Reasoning is therefore
allowed a higher ceiling (256) than visible content (128).

The content ceiling also has to clear legitimate visible repetition:
markdown horizontal rules and ASCII table borders stream as long runs of
an identical single-character delta ("-", "=", "|").
2026-08-22 03:12:50 +08:00
Chenyme d6f6e9f5f8 Merge pull request #991 from chenyme/video
fix: align video generation with current mediaGenInput protocol
2026-08-20 20:54:15 +08:00
Chenyme 46cfa374af fix: align video generation with current mediaGenInput protocol 2026-08-20 20:48:59 +08:00
Chenyme 26b9b1e444 Merge pull request #989 from lij768423-svg/feat/request-retry-hold-defaults
fix: lengthen requestRetry hold so grok-4.6 thinking is not withheld
2026-08-20 20:30:54 +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 7d908f6633 Merge pull request #983 from jeikl/feat/request-audit-payloads-and-retention
feat(audit): 请求审计中新增不同账号调度详情、完整HTTP请求/响应报文、默认7天全量日志记录等完整诊断生命周期重要功能
2026-08-20 19:57:19 +08:00
Chenyme 1316ed730b feat: add privacy-safe request diagnostics and bounded retention 2026-08-20 19:45:35 +08:00
Chenyme c07fa0b61e Merge remote-tracking branch 'origin/main' into pr/983
# Conflicts:
#	backend/internal/transport/http/inference/handler.go
2026-08-20 19:40:37 +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
Chenyme be89e48db9 Merge pull request #971 from chenyme/guard
feat: isolate account-bound proxy leases
2026-08-20 16:50:10 +08:00
Chenyme 68e3399821 Merge branch 'main' into guard 2026-08-20 16:38:56 +08:00
Chenyme 435469f948 Merge pull request #984 from lij768423-svg/fix/responses-abort-failed
fix: emit response.failed with required model for Grok TUI serde
2026-08-20 16:38:20 +08:00
Chenyme 5f4bbc68b4 Merge branch 'main' into fix/responses-abort-failed 2026-08-20 16:31:06 +08:00
Chenyme 868b836ae5 fix: emit protocol-safe response.failed events for empty streams 2026-08-20 16:30:52 +08:00
Chenyme ddd12bd86e Merge pull request #981 from lij768423-svg/fix/clear-account-cooldown
fix: allow clearing account cooldown and configure empty-stream penalty
2026-08-20 16:14:58 +08:00
Chenyme 0772fb1c7a Merge branch 'main' into fix/clear-account-cooldown 2026-08-20 16:10:15 +08:00
Chenyme 0fb3a04124 fix: preserve quality strikes when clearing cooldown 2026-08-20 16:09:58 +08:00
Chenyme cab6f35dcc Merge pull request #980 from lij768423-svg/fix/empty-completed-retry
fix: retry empty completed streams instead of waiting for idle
2026-08-20 16:07:05 +08:00
Chenyme 7dd96657dd Merge branch 'main' into pr/980
# Conflicts:
#	backend/internal/application/gateway/quality_retry_scan.go
2026-08-20 15:38:29 +08:00
Chenyme a2f2687b33 fix: retry terminal empty streams without misclassifying tool output 2026-08-20 15:32:25 +08:00
Chenyme 384b6d5a11 Merge pull request #979 from lij768423-svg/fix/hold-tools-schema
fix: hold TUI tool-schema and after-tool agent turns
2026-08-20 15:21:01 +08:00
Chenyme 7e71bf09ae Merge branch 'main' into fix/hold-tools-schema 2026-08-20 15:15:47 +08:00
Chenyme d93547dc19 fix: avoid replaying hosted tools during quality retries 2026-08-20 15:15:31 +08:00
Chenyme e6b39bdf88 Merge pull request #978 from lij768423-svg/fix/responses-annotations
fix: fill required output_text.annotations for Grok CLI serde
2026-08-20 15:03:53 +08:00
Chenyme 3f3b2f575a Merge pull request #977 from lij768423-svg/fix/quality-thinking-evidence
fix: treat only streamed thinking as quality-hold evidence
2026-08-20 15:03:28 +08:00
Chenyme 5f156cd3f5 fix: preserve real thinking evidence across protocol conversion 2026-08-20 14:56:31 +08:00
lij768423-svg 24ce972b37 fix: emit response.failed with required model for Grok TUI serde
TUI 0.2.93 treats any response.incomplete as fatal max_tokens_truncation,
ignoring incomplete_details.reason, so stream aborts killed the turn.
serde also requires model on response.failed / completed; a missing key
fails deserialization. Always emit response.failed and fill model from
stream metadata or the last seen response event.
2026-08-20 11:43:29 +08:00
lij768423-svg 9bb6b48549 fix: hold TUI after-tool turns instead of skipping in-flight results
Grok TUI tools run locally. The next /v1/responses body already contains
function_call_output; retrying it on another account only regenerates the
model turn and does not re-execute tools. Skipping hold on that body let
0-thinking dumps through on the common agent loop.
2026-08-20 11:43:29 +08:00
lij768423-svg c560c495e2 fix: emit response.failed with required model for Grok TUI serde
TUI 0.2.93 treats any response.incomplete as fatal max_tokens_truncation,
ignoring incomplete_details.reason, so stream aborts killed the turn.
serde also requires model on response.failed / completed; a missing key
fails deserialization. Always emit response.failed and fill model from
stream metadata or the last seen response event.
2026-08-20 11:43:23 +08:00
lij768423-svg dcb687ad69 fix: hold TUI after-tool turns instead of skipping in-flight results
Grok TUI tools run locally. The next /v1/responses body already contains
function_call_output; retrying it on another account only regenerates the
model turn and does not re-execute tools. Skipping hold on that body let
0-thinking dumps through on the common agent loop.
2026-08-20 11:43:23 +08:00
Jeik d76070aa4e fix(frontend): use DialogDescription asChild to prevent DOM nesting warning 2026-08-20 10:41:28 +08:00
Jeik 86010fc55c feat(audit): add response body recording, stream reassembly, and audit log retention settings 2026-08-20 10:36:07 +08:00
Jeik 9d841a2757 feat(audit): capture complete client HTTP request headers, metadata and fix audit detail inspection 2026-08-20 10:22:46 +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 ac37721db2 fix: retry empty completed streams instead of waiting for idle
response.completed / [DONE] with zero tokens used to keep the quality
hold in Wait until the idle timeout. The client already had HTTP 200
headers and saw a 50–120s Retrying spinner.

Finish the peek immediately and surface errQualityEmptyStream so the
attempt loop rotates. Open empty hangs still wait for idle and do not
fail-open as HTTP 200.
2026-08-20 09:11:24 +08:00
lij768423-svg b411d041d4 fix: hold TUI tool-schema turns, skip only in-flight tool results
Grok TUI declares a tools array on every agent request, including the
first thinking turn. Skipping hold on that schema forwarded
missing-thinking streams as HTTP 200.

Keep the replay-safety skip for in-flight tool output
(function_call_output, tool_result, role=tool). Compact skip and
previous_response_id pinning are unchanged.
2026-08-20 09:11:24 +08:00
lij768423-svg 78ff3b6ac1 fix: fill required output_text.annotations for Grok CLI serde
Grok CLI treats annotations as a required field. A missing key fails
deserialization with "missing field annotations" and the TUI retries
the turn. Keep existing citation arrays untouched.
2026-08-20 09:11:24 +08:00
lij768423-svg d1aeb775d0 fix: treat only streamed thinking as quality-hold evidence
Usage.reasoning_tokens, empty reasoning items, and the Chat SSE stub
are not proof of thinking. Degraded upstreams fill those fields and
then dump visible tokens, so the hold used to fail-open as 200.

Require reasoning/summary deltas or encrypted_content before delivering.
An empty stub waits until terminal so ciphertext that arrives at the end
is not withheld.
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
lij768423-svg dc87764154 fix: retry empty completed streams instead of waiting for idle
response.completed / [DONE] with zero tokens used to keep the quality
hold in Wait until the idle timeout. The client already had HTTP 200
headers and saw a 50–120s Retrying spinner.

Finish the peek immediately and surface errQualityEmptyStream so the
attempt loop rotates. Open empty hangs still wait for idle and do not
fail-open as HTTP 200.
2026-08-20 01:14:32 +08:00
lij768423-svg 68e5881433 fix: fill required output_text.annotations for Grok CLI serde
Grok CLI treats annotations as a required field. A missing key fails
deserialization with "missing field annotations" and the TUI retries
the turn. Keep existing citation arrays untouched.
2026-08-20 01:14:24 +08:00
lij768423-svg 731e95b924 fix: hold TUI tool-schema turns, skip only in-flight tool results
Grok TUI declares a tools array on every agent request, including the
first thinking turn. Skipping hold on that schema forwarded
missing-thinking streams as HTTP 200.

Keep the replay-safety skip for in-flight tool output
(function_call_output, tool_result, role=tool). Compact skip and
previous_response_id pinning are unchanged.
2026-08-20 01:14:24 +08:00
lij768423-svg c9c10a3fbd fix: treat only streamed thinking as quality-hold evidence
Usage.reasoning_tokens, empty reasoning items, and the Chat SSE stub
are not proof of thinking. Degraded upstreams fill those fields and
then dump visible tokens, so the hold used to fail-open as 200.

Require reasoning/summary deltas or encrypted_content before delivering.
An empty stub waits until terminal so ciphertext that arrives at the end
is not withheld.
2026-08-20 01:07:01 +08:00
Chenyme c0d7c94e2c feat: isolate account-bound proxy leases 2026-08-19 16:59:53 +08:00
Chenyme 909bb8109f chore: bump version to v3.1.4 v3.1.4 2026-08-19 15:23:56 +08:00
Chenyme c9916f6581 Merge pull request #970 from chenyme/client_ip
feat: record trusted client IPs
2026-08-19 15:11:06 +08:00
Chenyme d76c74f407 feat: record trusted client IPs 2026-08-19 15:06:17 +08:00
Chenyme e7f6137dc0 Merge pull request #967 from lij768423-svg/feat/skip-tui-compaction-hold
fix: skip quality hold for Grok TUI compaction prompts
2026-08-19 13:58:35 +08:00
Chenyme d4fcb7334e Merge remote-tracking branch 'origin/main' into pr/967
# Conflicts:
#	backend/internal/application/gateway/quality_retry.go
#	backend/internal/application/gateway/quality_retry_test.go
#	backend/internal/application/gateway/responses_compaction.go
#	backend/internal/application/gateway/responses_compaction_test.go
2026-08-19 13:53:26 +08:00