Repository navigation
Conversation
…ThinkFlowLab#345) A first-byte or mid-stream stall longer than the read deadline used to return 502 and leave the bundled OpenCode runtime retrying silently, so the chat stayed on "thinking" until reload. End the live turn after an unanswered failure, stream the terminal state, and keep 120s as the default whole-read timeout, overridable with OPENDIRECTOR_MODEL_READ_TIMEOUT.
|
@Birfy please resolve conflicts |
…meout # Conflicts: # packages/core/src/opendirector/agent/native.py
Ran: Release checks green on 8248c59 (13/13); local Non-blocking question: a mid-stream stall also ends with the same "no data in time" copy as a zero-byte timeout, but skips Coordinator: ping after this Reviewer PASS and green CI on this SHA. This skill does not merge. |
Summary
Fixes #345.
When the model gateway waited longer than the fixed 120s read deadline and forwarded no bytes, it returned 502 and the bundled OpenCode runtime retried the same request (five hardcoded retries on 502, with 2s-scale backoff). The live turn never reached a terminal state: the panel stayed on "thinking", and
interruptedonly appeared after a reload.This change:
forwardedBytes == 0) as the end of the turn: close the gateway, stop the harness process, and stream anendevent withstatus: interruptedand a timeout error. A user stop remainsstopped.OPENDIRECTOR_MODEL_READ_TIMEOUT(seconds). Invalid, non-positive, or missing values keep the default. The inbound harness HTTP parse still has its own 180s bound; that bound no longer caps a longer configured upstream read.OpenCode 1.19.5 still hardcodes retry-on-502 (up to five times). There is no supported
OPENCODE_CONFIG_CONTENTretry policy in this version, so this PR does not invent a config key the runtime would ignore. Ending the turn after the first unanswered failure is what stops the silent re-sends.Suggested labels:
type:bug,area:agent,area:harness,area:provider.Test plan
Reproduction used a silent local TCP listener as the model endpoint (no provider account, no paid calls). A harness stand-in retried 502 up to six times and would otherwise hang. After the fix, the assistant turn ends after one attempt.
Commands and results (Asia/Shanghai, Python 3.13.5, httpx 0.28.1, isolated checkout
/tmp/od-wt-345frommainffa16c46,PYTHONPATH=packages/core/src:apps/api/src):The one failure,
test_rejects_removed_runtime_and_invalid_selection_before_acceptance, returned 503 (default 未安装,请安装 CLI 并登录。) instead of 409. This checkout does not have the bundled OpenCode install (npm ciwas not run; the box was at inode capacity). That path is unchanged by this PR and was not treated as a regression.Not run / not claimed:
OPENDIRECTOR_REAL_CLI=1bundled OpenCode integration (binary not installed here).endevent (useAssistantChat); the API test asserts that event and the persistedinterruptedstatus. A headed click-through of the assistant panel was not performed, so visual wording/layout was not independently verified.CI on this PR should run the repository release checks, including the Python and merge-marked native tests.