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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.