anomalyco / anomalyco/opencode
SSE /global/event heartbeat floods shared opencode.log at INFO level — 816M lines / 95 GB over 34 days of uptime
Open
@jlongster is already working on this.
Since Sep 6, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Environment
- OpenCode
1.18.27, Linux (Ubuntu 24.04) - Long-lived server started from source:
bun --conditions=browser ./src/index.ts serve --hostname 127.0.0.1 --port 4096(uptime 34 days) - Log:
~/.local/share/opencode/log/opencode.log(shared by all opencode processes on the machine)
What happened
A single long-lived opencode serve (Bun) process wrote ~816,883,425 "global event heartbeat" INFO lines into the shared log file over 34 days of uptime, reaching 95,764,439,991 bytes (~95 GB) on disk.
Evidence from the log itself:
816883425 # rg -c "global event heartbeat" — total matching lines
5127 run=77869d9c # heartbeats in a 50-second window, all one run ID
connectedForMs=2936121857 # ≈ 34 days — matches the process uptime exactly
All heartbeats came from one run= ID. The values of connectedForMs spanned a ~6-hour range (many concurrent SSE subscribers of different ages, each logging its own heartbeat).
Impact
- 95 GB of disk consumed by keep-alive noise in a single append-only file.
- The log is shared: every opencode process on the machine holds it open, so one wedged/long-lived subscriber floods the log for everyone and makes real errors nearly impossible to find (816M junk lines).
- After killing the 34-day-old process, the heartbeat spam stopped completely (1 line / 10s → 0). Fresh servers produce only a couple of heartbeat lines per minute. So the flood is per-connection accumulation over long uptime, not a steady-state rate.
Expected behavior
- SSE keep-alive/heartbeat events should not be logged at INFO level (ideally not logged at all, or only at trace/debug level).
- The shared log file should either rotate or have a size cap, so a single pathological subscriber cannot fill the disk.
Repro
- Start
opencode serve. - Keep one or more SSE
/global/eventsubscribers connected for days. - Watch
~/.local/share/opencode/log/opencode.loggrow unboundedly with"global event heartbeat"lines at a rate proportional to the number and age of open connections.
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.