You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(api): OpenCode Go ignores caller cancellation and the configured request timeout #2511
OpenCode Go does not honour the caller's metadata.abortSignal and the configured request timeout the way the merged providers do. Cancelling a request mid-flight does not stop the streaming calls or the model lookup, and a completion that lands after the cancel is still delivered to the caller.
Evidence on main
The provider does not race its SDK promise through rejectOnAbort (src/api/providers/utils/abort-signal.ts:226), so a cancellation during SDK retry backoff or a request that never settles waits for the transport.
The caller signal is handed to the SDK instead of a per-request bridge. The pinned openai SDK does signal.addEventListener('abort', () => controller.abort()) in client.mjs and never removes the listener, so a long-lived caller signal accumulates one listener and one request controller per request.
Nothing re-checks the signal after the stream ends, so an iterator that closes without throwing - which the SDK does when it converts an aborted read into a normal end - reports success.
src/api/providers/opencode-go.ts races only its completePrompt paths (rejectOnAbort at lines 897, 967 and 1025); the streaming paths at the for await loops have no race, so cancellation delivered while the request is pending is not what produces the error in the current tests.
Expected
The provider follows the shared contract exactly as requesty.ts (#1537) and zoo-gateway.ts (#2430) do: bridge the caller signal and dispose it on every exit path, race the SDK promise and the model lookup through rejectOnAbort / resolveModelWithAbort, guard the emit loop and the post-loop end, and normalise an SDK-side abort with isRequestAborted so a cancellation surfaces as AbortError with the message The <provider> request was aborted.
Scope
Provider file plus its spec. No change to utils/abort-signal.ts or utils/request-timeout.ts; the timeout-versus-body-consumption question is tracked separately in #2486.
Activity