anomalyco / anomalyco/opencode
V2 event streams can stall with Kaspersky without an SSE Accept header
@Hona is already working on this.
Since Sep 13, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
On Windows with Kaspersky 21.26 enabled, the V2 CLI can remain on Restarting service... for minutes even though /api/health responds normally. The generated Promise SSE client does not set Accept: text/event-stream, and the initial /api/event response can be delayed beyond the CLI's two-second connection deadline.
I compared the same authenticated requests against one running 2.0.3 backend, without restarting it or changing its configuration:
| Kaspersky state | Unspecified / wildcard Accept (6 requests) | Explicit SSE Accept (3 requests) |
|---|---|---|
| Enabled | 4 timed out at 2.5 s; 2 took 1.3-1.4 s | 3-6 ms |
| Disabled for the comparison | All succeeded in 3-40 ms | 3-5 ms |
| Protection restored | 3 timed out at 2.5 s; 3 took 1.1-1.4 s | 3-4 ms |
The request-header-dependent delay also reproduces with a separate Node HTTP server/client, without OpenCode plugins. This identifies a compatibility problem with the enabled security software, not a particular internal Kaspersky module.
The EventSource specification says user agents may set this header, not that it is mandatory. Setting it by default for Promise SSE requests would improve interoperability; explicit caller headers should remain respected. SvelteKit has a matching Kaspersky report.
OpenCode version
Observed in 2.0.2 and 2.0.3. The default is still missing on v2 at 7a31b5c0f76ce1c06befacc09b47b4fc3c71c408, in packages/httpapi-codegen/src/index.ts and packages/client/src/promise/generated/client.ts.
Steps to reproduce
- On an affected Windows/Kaspersky setup, start the V2 CLI and observe repeated connection timeouts while the backend remains healthy.
- Compare authenticated streaming GET requests to the same
/api/eventendpoint with the default Accept and withAccept: text/event-stream. - The explicitly identified SSE request receives
server.connectedpromptly; the default request can stall until later traffic arrives.
Operating System
Windows x64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.