anomalyco / anomalyco/opencode

core: session warming should target sessions currently open in the client

Open
#41,003 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 7, 2026.

2.0
Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

V2 session warming currently appears to be globally enabled and based on a fixed time window. When warming is enabled, any session that receives a prompt is kept warm for approximately 30 minutes, even if it is no longer open or being viewed in the client.

This may cause unnecessary model requests and resource usage, especially when only a small number of sessions actually need to remain warm.

Environment

  • opencode version: opencode2 v0.0.0-next-16927
  • OS: Linux 6.6.87.2-microsoft-standard-WSL2 (WSL2, linux x64)
  • Terminal: TERM=xterm-256color; terminal program and color terminal are unavailable
  • Shell: /bin/bash
  • Install/channel: next
  • Active plugins: /home/wuyao/.config/opencode/plugins/slim-tools.ts

Reproduction

  1. Enable V2 session warming globally with "warming": true in the opencode configuration.
  2. Send a prompt in one or more sessions.
  3. Close or stop viewing one of those sessions while leaving the opencode client running.
  4. Wait during the configured warming duration, which defaults to approximately 30 minutes.
  5. Observe that the session continues to receive periodic keep-alive model requests.

Expected Behavior

Session warming should preferably target only sessions that are currently open in the client, since those are the sessions most likely to require preserved provider-side prompt caches or other short-lived session state.

It would also be useful to support per-session warming configuration or an explicit client-to-server list of sessions that should remain warm.

Actual Behavior

Session warming is configured globally and appears to identify sessions as warmable based on whether they recently received a prompt. The default duration is approximately 30 minutes, regardless of whether the session is still open in the client.

This definition of “recently active session” may be broader than necessary and can result in keep-alive requests for sessions that are no longer in use.

Additional Context

The current warming configuration exposes a global setting and a duration:

  • warming: globally enables or disables warming
  • warming.duration: time after the last active request to keep a session warm, defaulting to 30 minutes
  • warming.interval: interval between keep-alive requests, defaulting to 4 minutes

A possible improvement would be to use the client’s currently open session state as the primary warming criterion, while retaining an explicit configuration option for background or multi-client use cases.

No error or stack trace is available. The behavior is expected to be consistent whenever warming is enabled.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.