493 Commits

Author SHA1 Message Date
程序员阿江(Relakkes)
c744213aae fix: align skill market security summaries 2026-07-03 23:32:00 +08:00
程序员阿江(Relakkes)
26b3322fb7 fix: harden skill market normalization 2026-07-03 23:32:00 +08:00
程序员阿江(Relakkes)
5aeab5c206 feat: normalize skill market sources 2026-07-03 23:32:00 +08:00
程序员阿江(Relakkes)
9d08ca4e43 test: add skill market contracts 2026-07-03 23:32:00 +08:00
程序员阿江(Relakkes)
56a4be3d14 feat(desktop): add session activity panel
Move session tasks, background tasks, subagents, and team activity into a floating right-side activity panel with capped section scrolling.

Add subagent run detail tabs backed by the existing session run data so member activity can be inspected from the main chat.

Tested: cd desktop && bun run test -- src/components/activity/SessionActivityPanel.test.tsx

Tested: bun run check:desktop
2026-07-03 23:24:22 +08:00
程序员阿江(Relakkes)
35f43e8289 fix: resolve post-release semantic conflicts
Fix cross-issue regressions found during post-0.4.4 merge review:\n\n- preserve permission mode across clear and empty-session replacement flows\n- keep provider effort passthrough and context-window estimates aligned with runtime metadata\n- invalidate recent project caches and trace message signatures when sessions change\n- recognize Windows ARM64 unpacked package-smoke output\n\nTested: bun test scripts/quality-gate/package-smoke/index.test.ts scripts/quality-gate/runner.test.ts\nTested: bun run check:desktop\nTested: bun run check:server\nConfidence: high\nScope-risk: moderate
2026-07-02 22:11:43 +08:00
程序员阿江(Relakkes)
e6de5fde3a fix(provider): default provider requests to direct proxy mode (#953)
Refs: #896, #953

Make provider network proxy mode explicit so desktop sidecar system proxy env does not affect provider connectivity tests or OpenAI-compatible proxy requests unless System proxy is selected.

Tested: bun test src/server/__tests__/network-settings.test.ts src/server/__tests__/providers.test.ts src/server/__tests__/proxy-network-settings.test.ts
Tested: cd desktop && bun run test -- src/stores/settingsStore.test.ts src/__tests__/generalSettings.test.tsx --run
Tested: bun run check:server
Tested: cd desktop && bun run lint
Tested: cd desktop && bun run build
Confidence: high
Scope-risk: moderate
2026-07-02 21:29:31 +08:00
程序员阿江(Relakkes)
531ce4063d fix: honor bypass permission mode (#910)
Make bypassPermissions skip permission-approval ask decisions while preserving explicit denies and tools that require user interaction. Keep desktop permission mode state authoritative by waiting for server/CLI confirmation and persisting CLI-originated mode broadcasts.

Tested:
- bun test src/utils/permissions/permissions.test.ts
- bun test src/server/__tests__/conversations.test.ts -t "permission switch|permission restart|permission-mode broadcasts|permission changes made before|bypass permissions back to default|runtime-only model switch"
- bun test src/server/__tests__/ws-memory-events.test.ts
- cd desktop && bun run test -- src/stores/chatStore.test.ts --run
- bun run check:server

Scope-risk: moderate
2026-07-02 21:23:30 +08:00
程序员阿江(Relakkes)
78d85f0c64 fix(desktop): apply active provider before first prompt (#844)
Materialize the active provider runtime for empty-session first prompts before the WebSocket prewarm and user message are sent. This keeps a clean install that adds a MiniMax provider from starting the first turn without the selected provider runtime.

Tested: bun test src/server/__tests__/conversations.test.ts -t "MiniMax provider turn"
Tested: bun test src/server/__tests__/websocket-handler.test.ts src/server/__tests__/conversations.test.ts -t "prewarm|active provider id|MiniMax provider turn|first-turn runtime synchronization"
Tested: cd desktop && bun run test -- --run src/pages/EmptySession.test.tsx -t "draft runtime|active provider runtime|creates a new session"
Tested: cd desktop && bun run test -- --run src/components/controls/ModelSelector.test.tsx -t "defaults blank provider-scoped runtime selections|selects provider-scoped runtime models"
Tested: cd desktop && bun run lint
Tested: cd desktop && bun run build
Not-tested: bun run check:desktop, unrelated full-suite failures in MessageList timestamp formatting and TabBar AbortSignal cleanup blocked the gate.
Confidence: medium
Scope-risk: narrow
2026-07-02 21:02:58 +08:00
程序员阿江(Relakkes)
2e52133a64 fix(provider): pass reasoning effort for proxies (#905)
Tested:
- bun test src/services/api/claudeEffort.test.ts src/server/__tests__/proxy-transform.test.ts src/utils/__tests__/thinking.test.ts
- bun run check:server
- git diff --check

Not-tested:
- bun run verify / coverage

Confidence: high
Scope-risk: narrow
2026-07-02 21:01:42 +08:00
程序员阿江(Relakkes)
7b2477f492 fix(server): keep history session timestamps stable (#951)
Use transcript activity timestamps for session list ordering instead of JSONL mtime, and skip duplicate runtime metadata appends.

Tested: bun test src/server/__tests__/sessions.test.ts --test-name-pattern "metadata-only writes|duplicate runtime metadata"
Tested: bun test src/server/__tests__/sessions.test.ts
Tested: bun run check:server
Confidence: high
Scope-risk: moderate
2026-07-02 21:01:19 +08:00
程序员阿江(Relakkes)
c324aee51d fix: bound git-info git probes (#908)
Tested: bun test src/server/__tests__/sessions.test.ts -t "git-info"

Tested: bun run check:server

Confidence: high

Scope-risk: narrow
2026-07-02 21:01:16 +08:00
程序员阿江(Relakkes)
2c5c904c0a fix(provider): add experimental beta kill switch (#929)
Add a provider-level disableExperimentalBetas setting that writes CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 into managed provider runtime env, keeps stale parent env isolated, and exposes the toggle in desktop provider settings.

Tested: bun test src/server/__tests__/provider-runtime-env.test.ts --test-name-pattern "experimental betas|stale proxy"
Tested: bun test src/server/__tests__/providers.test.ts --test-name-pattern "experimental betas|POST /api/providers should create a provider|PUT /api/providers/:id should update a provider"
Tested: bun test src/server/__tests__/conversation-service.test.ts --test-name-pattern "experimental beta kill switch"
Tested: cd desktop && bun run test -- --run src/__tests__/generalSettings.test.tsx -t "experimental beta headers|Tool Search"
Tested: cd desktop && bun run test -- --run src/lib/__tests__/providerSettingsJson.test.ts
Tested: bun run check:server
Tested: cd desktop && bun run build
Not-tested: bun run verify
Confidence: high
Scope-risk: moderate
2026-07-02 21:01:14 +08:00
程序员阿江(Relakkes)
c6be08e471 fix(desktop): restore skill command history (#926)
Preserve user-invoked skill command metadata during session restore,
WebSocket replay, and session search while continuing to hide malformed
command breadcrumbs.

Tested:
- bun test src/server/__tests__/sessions.test.ts
- bun test src/server/__tests__/ws-memory-events.test.ts
- bun test src/server/__tests__/searchService.sessions.test.ts
- cd desktop && bun run test -- --run src/stores/chatStore.test.ts
- bun run check:server
- cd desktop && bun run build
- git diff --check

Not-tested:
- bun run check:desktop did not complete because an existing MessageList timestamp assertion fails independently of this change.

Confidence: high
Scope-risk: narrow
2026-07-02 21:01:06 +08:00
程序员阿江(Relakkes)
547f95a599 fix(desktop): hide auto-dream task cards (#887)
Fixes #887.

Emit terminal SDK bookends for auto-dream completion, failure, and stop paths so the desktop task state can close instead of remaining running.

Keep dream background task events out of the transcript while preserving lifecycle tracking in the background task drawer.

Tested: bun test src/tasks/DreamTask/DreamTask.test.ts

Tested: cd desktop && bun run test src/stores/chatStore.test.ts --run

Tested: cd desktop && bun run test src/components/chat/MessageList.test.tsx --run -t auto-dream

Tested: bun run check:server

Tested: cd desktop && bun run lint

Tested: cd desktop && bun run build

Not-tested: full bun run verify / coverage gates; this is a scoped local issue fix.

Confidence: high

Scope-risk: narrow
2026-07-02 21:01:04 +08:00
程序员阿江(Relakkes)
2228524462 fix: reduce sidecar transcript memory pressure (#933)
Stream inspection transcript aggregation and avoid trace/message polling paths that repeatedly hydrate large session files.

Tested: bun run check:server
Tested: bun run check:desktop
Confidence: high
Scope-risk: moderate
2026-07-02 21:00:48 +08:00
程序员阿江(Relakkes)
c15c465b0b fix: ignore Read pages for non-PDF files (#928)
Treat pages as PDF-only during validation and execution so model-supplied pages on images or text files do not loop on invalid parameter errors.

Tested:
- bun test src/tools/FileReadTool/FileReadTool.test.ts
- bun run check:server

Confidence: high
Scope-risk: narrow
2026-07-02 21:00:17 +08:00
程序员阿江-Relakkes
8508f8588b
Merge pull request #902 from zhbdesign/patch-7
修复第三方API在响应中返回的model与请求的modelid不一致导致上下文显示200000
2026-07-02 15:44:01 +08:00
程序员阿江-Relakkes
705f34b535
Merge pull request #919 from zhbdesign/patch-14
修复非git项目在新会话执行git命令导致加载慢
2026-07-02 15:42:57 +08:00
程序员阿江-Relakkes
18a05d693f
Merge pull request #920 from zhbdesign/patch-15
优化会话中最近项目列表加载慢
2026-07-02 15:42:39 +08:00
程序员阿江(Relakkes)
f08aee351d Merge remote-tracking branch 'origin/main'
# Conflicts:
#	src/query/stopHooks.ts
2026-07-01 20:25:30 +08:00
程序员阿江(Relakkes)
84c5685b1a fix(runtime): update domestic provider model presets
Tested:
- bun test src/server/__tests__/provider-presets.test.ts src/server/__tests__/provider-runtime-env.test.ts src/utils/model/modelContextWindows.test.ts src/utils/__tests__/thinking.test.ts src/server/__tests__/conversation-service.test.ts src/server/__tests__/settings.test.ts
- bun run check:server
- git diff --check

Not-tested:
- bun run verify
- coverage gates

Confidence: high
Scope-risk: moderate
2026-06-27 16:51:43 +08:00
zhb
4e59c2feb5
优化会话中最近项目列表加载慢
优化会话中最近项目列表加载慢
2026-06-26 10:05:35 +08:00
zhb
78a9e26476
修复非git项目在新会话执行git命令导致加载慢
修复非git项目在新会话执行git命令导致加载慢
2026-06-26 08:48:53 +08:00
zhb
2e6caa358c
修复第三方API在响应中返回的model与请求的modelid不一致导致上下文显示200000
修复第三方API在响应中返回的model与请求的modelid不一致导致上下文显示200000
2026-06-23 20:03:58 +08:00
zhb
192ed4bdce
修复第三方API在响应中返回的model与请求的modelid不一致导致上下文显示200000
修复第三方API在响应中返回的model与请求的modelid不一致导致上下文显示200000
2026-06-23 19:27:36 +08:00
程序员阿江(Relakkes)
08c2d8cf5b fix(desktop): separate goal continuation turns
Emit a visible Goal continuing local-command marker before managed /goal continuations, then preserve it through server events, session history, and desktop history restore.

Render the marker as a compact divider so a new assistant continuation after end_turn is visually separated from the previous assistant output.

Related: #901

Tested: bun test src/query/stopHooks.test.ts src/server/__tests__/ws-memory-events.test.ts src/server/__tests__/sessions.test.ts && cd desktop && bun run test MessageList.test.tsx chatStore.test.ts

Tested: bun run check:server

Tested: bun run check:desktop

Not-tested: live release build and Windows v0.4.3 repro path; keep issue open until release validation.

Scope-risk: moderate

Confidence: high
2026-06-23 19:20:03 +08:00
程序员阿江(Relakkes)
96ce12d84b fix(runtime): keep goal loop alive on evaluator errors
Goal prompt-hook evaluator failures now become blocking continuation feedback instead of non-blocking hook errors, so an active goal is treated as incomplete and the loop keeps working.

Tested: bun test src/utils/hooks/execPromptHook.test.ts src/query/stopHooks.test.ts src/goals/goalState.test.ts

Tested: bun run check:server

Scope-risk: moderate

Confidence: high
2026-06-23 19:05:54 +08:00
程序员阿江(Relakkes)
c907144788 fix(server): cache session list summaries
Reduce repeated /api/sessions?limit=400 scans by caching per-file JSONL list summaries keyed by mtime and size. This targets #894 diagnostics where sidebar refreshes reported client_api_request_failed timeouts on session list and inspection paths.

Tested: bun test src/server/__tests__/sessions.test.ts

Tested: bun run check:server

Tested: temporary source server /api/sessions?limit=400 first call 0.80s; after waiting past the 5s list cache TTL, second call 0.03s with identical 399 session IDs.

Not-tested: Windows release build retest for #894 diagnostics timeout.

Confidence: high

Scope-risk: narrow
2026-06-23 17:54:20 +08:00
程序员阿江(Relakkes)
3ba8b44a23 fix: preserve cache token usage in live sessions
Map CLI result cache_read_input_tokens/cache_creation_input_tokens into the desktop websocket usage payload, and count cache read/write tokens in the active session header token badge.

Fixes locally: #842

Tested: bun test src/server/__tests__/websocket-handler.test.ts

Tested: cd desktop && bun run test -- src/pages/ActiveSession.test.tsx --run

Tested: bun run check:server

Tested: bun run check:desktop

Not-tested: live Windows v0.4.3 reproduction; GitHub issues remain open until release and retest.

Confidence: high

Scope-risk: narrow
2026-06-23 16:31:51 +08:00
程序员阿江(Relakkes)
46f612abd5 feat: allow deleting trace sessions
Adds an idempotent DELETE /api/traces/:sessionId path that removes only the local trace JSONL file and invalidates trace read cache. The Trace list now exposes a trash action behind a confirmation dialog that states chat history is not deleted.

Tested: bun test src/server/__tests__/trace-capture.test.ts

Tested: cd desktop && bun run test -- src/pages/TraceList.test.tsx --run

Tested: bun run check:server

Tested: bun run check:desktop

Tested: Browser smoke with temporary CLAUDE_CONFIG_DIR verified the Trace list delete button and confirmation dialog on ?traceWindow=1.

Constraint: GitHub issue #868 remains open until a release ships and post-release retest passes.

Confidence: high

Scope-risk: moderate
2026-06-23 16:20:11 +08:00
程序员阿江(Relakkes)
6bd19712e8 fix: bypass proxy for loopback provider checks
Provider connectivity tests now pass the actual upstream URL and loopback no-proxy rules into proxy fetch option resolution, including IPv6 loopback. This closes the local test/connectivity gap in the #896 proxy compatibility work without closing GitHub issues before release.

Tested: bun test src/utils/proxy.test.ts src/server/__tests__/providers.test.ts src/server/__tests__/network-settings.test.ts src/services/api/client.test.ts

Tested: bun run check:server

Not-tested: Windows dev-sidecar real-machine retest and release build confirmation for #896.

Confidence: medium

Scope-risk: narrow
2026-06-23 16:03:36 +08:00
程序员阿江(Relakkes)
bec556679f fix: bypass local provider proxy for loopback targets
Preserve loopback NO_PROXY entries when Electron or manual network settings inject proxy environment variables, and make the Anthropic client skip Bun proxy fetch options for local desktop provider proxy base URLs.

Tested: bun test src/utils/proxy.test.ts src/services/api/client.test.ts src/server/__tests__/network-settings.test.ts src/server/__tests__/conversation-service.test.ts

Tested: cd desktop && bun run test -- electron/services/sidecarManager.test.ts --run

Tested: bun run check:server

Tested: bun run check:native

Not-tested: Windows dev-sidecar real-machine retest for #896; current Mac can only prove loopback proxy bypass behavior and native packaging.

Confidence: medium

Scope-risk: moderate
2026-06-23 15:55:03 +08:00
程序员阿江(Relakkes)
6e9c13f032 fix: capture direct provider trace headers
Trace direct provider calls from the effective Request metadata so headers carried by Request input are sanitized and persisted instead of being dropped when init.headers is empty.

Tested: bun test src/server/__tests__/trace-capture.test.ts src/server/__tests__/proxy-network-settings.test.ts

Tested: bun run check:server

Confidence: high

Scope-risk: narrow
2026-06-23 15:36:21 +08:00
zhb
e23d2e4046
修复goal中途停止
修复goal中途停止
2026-06-23 10:58:49 +08:00
程序员阿江(Relakkes)
2e6fe17b58 fix(server): allow unicode mcp server names
Allow MCP server names to use Unicode letters and numbers while continuing to reject spaces and separators.

Tested: bun test src/server/__tests__/mcp.test.ts

Tested: bun run check:server

Confidence: high

Scope-risk: narrow
2026-06-23 00:47:20 +08:00
程序员阿江(Relakkes)
9aaf3c9e5f fix: resolve desktop startup and provider regressions
Fixes #827, #857, #860, #885.

Reproduced #827 with a delayed pasted-image FileReader result that reappeared after send; fixed by invalidating stale paste callbacks after submit or session switch.

Reproduced #857 with TCP accepting while /health stayed unhealthy; fixed Electron sidecar readiness to require HTTP /health status ok before continuing.

Reproduced #860 through OpenAI-compatible sampling param pass-through and missing GLM-5.2 context metadata; fixed sampling params to be opt-in and added GLM-5.2 context windows for preset and core resolution.

Reproduced #885 with a truncated long sidebar title lacking a row tooltip; fixed by exposing the full title on the session row.

Tested: cd desktop && bun run test -- src/components/chat/ChatInput.test.tsx src/components/layout/Sidebar.test.tsx --run

Tested: cd desktop && bun test electron/services/sidecarManager.test.ts

Tested: bun test src/server/__tests__/proxy-transform.test.ts src/server/__tests__/provider-presets.test.ts src/services/compact/autoCompact.test.ts

Tested: bun run check:server

Tested: bun run check:desktop

Tested: bun run check:native

Confidence: high

Scope-risk: moderate
2026-06-23 00:38:28 +08:00
程序员阿江(Relakkes)
c2355205dc fix(agent): stabilize background task continuations
Fixes #870, #884, #886.

Route backgrounded sync Agent tool activity through the same parent-tagged event path as detached agents, recover incomplete tool-use streams with the non-streaming fallback, and suppress structured-output local-agent terminal notifications from re-entering the model.

Tested: bun test src/tools/AgentTool/agentToolUtils.test.ts src/utils/taskNotificationPolicy.test.ts src/services/api/streamFallback.test.ts src/server/__tests__/proxy-streaming.test.ts

Tested: bun run check:server

Confidence: high

Scope-risk: moderate
2026-06-23 00:09:35 +08:00
程序员阿江(Relakkes)
a090070352 fix(server): repair provider proxy and cron permissions
Fix #845 by starting a lightweight standalone provider proxy for CLI-only OpenAI-compatible desktop providers, avoiding a fixed localhost:3456 proxy when the desktop server is not running.

Fix #847 by passing explicit --permission-mode bypassPermissions for scheduled task subprocesses alongside the dangerous-skip flag.

Tested: bun test src/utils/managedEnv.test.ts src/server/__tests__/provider-runtime-env.test.ts src/server/__tests__/cron-scheduler-launcher.test.ts

Tested: bun run check:server

Confidence: high

Scope-risk: moderate
2026-06-22 23:45:15 +08:00
程序员阿江(Relakkes)
2f8c2a9a70 fix: resolve first issue 809 batch
Fixes local Batch A from #809+ triage: configurable scheduled task timeout (#809/#846), OpenAI proxy trace request headers (#836), title generation auth strategy (#854), and unresolved parallel tool card settlement (#889).

Tested: bun test src/server/__tests__/cron-scheduler-launcher.test.ts

Tested: bun test src/server/__tests__/title-service.test.ts

Tested: bun test src/server/__tests__/proxy-network-settings.test.ts

Tested: cd desktop && bun run test -- --run src/stores/chatStore.test.ts

Tested: bun run check:server

Tested: bun run check:desktop

Not-tested: bun run verify and coverage were not run because this is a local batch checkpoint, not a PR-ready/push-ready handoff.

Confidence: high

Scope-risk: moderate
2026-06-22 22:45:26 +08:00
程序员阿江(Relakkes)
e944db1e2f fix(cli): avoid Anthropic preflight during onboarding
Keep first-run CLI setup local-first by building only local onboarding steps.
Remove the startup preflight that pinged Anthropic/OAuth endpoints before any explicit login or model request.

Fixes #859.

Tested: bun test src/components/onboardingSteps.test.ts
Tested: bun run check:server
Not-tested: bun run verify; check:coverage; check:policy
Confidence: high
Scope-risk: narrow
2026-06-22 22:10:17 +08:00
zhb
eb5a1b0278
优化停止,出现API Error: Stream ended without receiving any events
优化停止,出现API Error: Stream ended without receiving any events
2026-06-21 13:35:52 +08:00
程序员阿江(Relakkes)
9111c0c242 fix(server): close prewarm idle timer race in CLI-startup blind window
#865 added guards against the prewarm_session/user_message concurrency
race, but both keyed on isSessionTurnActive (messageSent===true).
messageSent only flips true after CLI startup completes, so during the
startup window a user turn is registered yet invisible to the guards — the
prewarm idle timer could still arm on, and later fire against, an active
turn, killing the CLI and leaving the UI stuck on "执行中".

- Add hasPendingOrActiveUserTurn() (turn registered regardless of
  messageSent) and use it for both prewarm guards, covering the blind window.
- Structurally disarm the timer when a turn completes (clearPrewarmState in
  bindActiveUserTurnCompletion), so a timer armed by the race never outlives
  the turn regardless of ordering.
- Add test hooks + 3 regression tests: blind-window turn not killed, active
  turn not killed, truly-idle session still reclaimed.
2026-06-20 16:17:08 +08:00
zhb
db1ebabe40
优化客户端几乎同时发送 prewarm_sessionuser_messageclearPrewarmState 什么也没清除,导致kill CLI,客户端永远收不到 status: idle 或 error,页面卡在"执行中"
Added safety checks to prevent prewarm idle timer from interrupting active sessions.
2026-06-19 00:45:57 +08:00
程序员阿江(Relakkes)
348de336e1 fix(streaming): retry transient mid-stream errors instead of failing the turn
Mid-stream api_error/overloaded_error SSE events (e.g. a local provider such
as LM Studio rejecting a malformed tool_call) arrive inside the 200 SSE body,
bypassing withRetry — which only guards stream creation — so they were
surfaced as a terminal API error that ended the turn with no retry.

Add withStreamRetry around queryModel: when an attempt produced zero output
(no tool_use block completed, so query.ts never started a tool — safe w.r.t.
the double-tool-execution hazard, inc-4258), re-establish the stream and retry
up to CLAUDE_STREAM_TRANSIENT_RETRY_MAX times (default 2) before surfacing the
error. Covers both the streaming and non-streaming query wrappers; adds unit
tests for the retry loop and the transient-error classifier.
2026-06-16 22:51:04 +08:00
程序员阿江(Relakkes)
92430ba001 Merge branch 'claude/serene-ptolemy-36ca25': background subagent tool activity (#829) 2026-06-16 16:02:00 +08:00
程序员阿江(Relakkes)
54a8f3107c fix(desktop): support 1M provider context declarations (#814)
Add per-model 1M capability flags for custom providers and persist them through provider settings.
When a model is marked as 1M-capable, runtime env uses the local [1m] marker and the desktop form auto-fills a 1000000-token context window when needed.

Tested: bun test src/server/__tests__/providers.test.ts -t "custom providers can mark main and role models as 1M-capable"
Tested: cd desktop && bun run test -- generalSettings.test.tsx -t "normalizes blank model mappings|saves 1M model declarations"
Tested: bun run check:desktop
Tested: bun run check:server
Not-tested: bun run verify / coverage gates were not run for this scoped local handoff.
Confidence: high
Scope-risk: moderate
2026-06-16 14:03:07 +08:00
程序员阿江(Relakkes)
1c554dc30d fix: stream background subagent tool activity to desktop (#829)
Background (run_in_background) subagents run detached from the main query loop, so their tool_use/tool_result never reached the desktop and their cards stayed on "no tool activity" even after completion. Route the activity through the SDK event queue as agent_tool_activity, re-emitted by the ws handler as tool_use_complete/tool_result tagged with the parent Agent tool_use id, so the UI groups them under the agent card like synchronous subagents.
2026-06-16 14:00:25 +08:00
程序员阿江(Relakkes)
8813dff5b1 Merge branch 'claude/wonderful-burnell-b76630': first-token timeout fix (#826) 2026-06-15 23:35:08 +08:00
程序员阿江(Relakkes)
e7a59592de fix(streaming): honor request timeout while waiting for the first token (#826)
The configured request timeout (API_TIMEOUT_MS) only feeds the SDK client
timeout, which on a streaming request is cleared the moment response headers
arrive. Slow local/3P models return 200 headers fast but spend minutes
prefilling before the first SSE token, so that window was governed by the idle
watchdog (CLAUDE_STREAM_IDLE_TIMEOUT_MS, 240s) -- a separate env users cannot
configure. The configured timeout therefore never applied to slow prefill, so
raising it had no effect (#826, follow-up to #449).

Split the stream watchdog into phases: use a first-token budget (tied to the
user's request timeout via CLAUDE_STREAM_FIRST_TOKEN_TIMEOUT_MS) until the first
chunk arrives, then switch to the shorter mid-stream idle budget. The overall
max-duration cap (#766) still backstops trickling bodies; CLI defaults fall back
to prior behavior.
2026-06-15 23:34:32 +08:00