anomalyco / anomalyco/opencode

Terminals are killed when their location is evicted after 60 minutes of chat inactivity

Open
#48,691 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 12, 2026.

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

Description

Description

Terminals opened in the desktop app die after about an hour without chat activity in that project. The pane goes blank and the scrollback is gone; the server log shows the location being torn down and rebuilt, followed by fresh "creating session" entries as the app recreates terminals.

Location eviction does not know about terminals. On v2, LocationActivity renews a location only on durable session events, so a running terminal never counts; on dev the LayerMap idle TTL is renewed only by PTY API calls, so an open terminal does not count either. In both cases the eviction runs the Pty finalizer, which kills every running terminal in that location.

I have a fix for v2 with a regression test (a location owning a running terminal is retained past its deadline and evicted once the terminal is gone): https://github.com/iyernaveenr/opencode/tree/naveen_r_iyer/v2-pty-eviction. Happy to open the PR against v2.

Plugins

none

OpenCode version

dev build from source (observed daily on dev bbe4c952d7; v2 7c5a4d01aa confirmed by the test)

Steps to reproduce
  1. Desktop app, open a project, open a terminal in a session and run something.
  2. Send no chat message in that project for 60+ minutes (typing in the terminal does not help).
  3. Come back: the pane is blank, reconnect gets "session not found", and the log shows "location services evicted" (v2) or a fresh "booting location services" (dev).
Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

built-in terminal of the desktop app

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.