[Bug] Windows: shell tool dies process-wide with "opencode-pty request timed out" after long service-mode session; only full reboot recovers

Ouverte
#65,175 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
12/100
Type d'issue
Bug
Clarté
À clarifier
Activité
Active
Stack technique
powershell, typescript
Domaine
backend

Piste de recherche

Start from the shell/PTY tool path in the TypeScript server and the source of the opencode-pty request timed out error, then reproduce with serve --service on Windows and inspect the managed-service logs around the run= id and shell-output 404/499 entries. Read #61644 for ConPTY teardown and #52049/#53416 for managed-service replacement before changing anything. The goal is a minimal trigger and a distinct dead-PTY error, not a patch from this thread.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area/service platform/windows type/bug version/v2
Description

On Windows, after several hours of continuous use of opencode serve --service, the shell tool stopped working process-wide. Every command — including echo hi — failed immediately with:

opencode-pty request timed out

The failure was instant, not after the requested tool timeout. It affected the main session, subagents, other existing sessions, and brand-new sessions created afterwards: no session on that server instance had a working shell. File tools (read/write/edit/grep/glob), web search and model calls kept working, and the local model server stayed healthy, so the machine itself was fine.

I was connected through the Android client and could not restart the desktop process. Restarting the OpenCode client/app did not help: the server log shows no new cli starting line, and every entry kept run=c9657fd3 from the original 05:07:54Z start. A full Windows reboot fixed it immediately — the log then shows two fresh managed-service starts, at 13:36:12Z (run=63e68047, v2.3.0) and 13:36:18Z (run=b9a8957b, v2.3.2 after auto-update).

So a client restart is not enough; only a machine reboot cleared the wedged PTY service.

Plugins

None.

OpenCode version

2.3.0 at failure (channel=latest, local=false, args="[\"serve\",\"--service\"]"). Rebooted into 2.3.2 via auto-update.

Steps to reproduce
  1. Run OpenCode 2.3.0 on Windows in service mode (serve --service) for several hours.
  2. Connect from the Android app, open and switch several workspaces, and run many shell commands including at least one backgrounded command.
  3. Shell requests begin failing instantly with opencode-pty request timed out. Confirm fresh sessions and subagents fail identically.
  4. Restart the client app: no help, the managed service keeps the same run= id. Perform a full OS reboot: fixed.

I cannot confirm which step is causal. This is what happened, not a minimised reproducer.

Operating System

Windows (PC; exact build not recorded).

Terminal

OpenCode Android app as remote client; the desktop service spawned C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.EXE.

Evidence

Verbatim opencode.log lines (UTC):

2026-11-20T05:07:54.425Z ... message="cli starting" version=2.3.0 channel=latest local=false args="[\"serve\",\"--service\"]" run=c9657fd3
2026-11-20T06:20:40.167Z ... GET /api/shell/sh_.../output http.status=499
2026-11-20T06:27:41.949Z ... GET /api/shell/sh_.../output http.status=404
2026-11-20T06:43:47.132Z ... POST /api/experimental/session/<id>/wait http.status=499
2026-11-20T13:36:12.541Z ... message="cli starting" version=2.3.0 ... run=63e68047
2026-11-20T13:36:18.083Z ... message="cli starting" version=2.3.2 ... run=b9a8957b

Notes on the evidence: the exact string opencode-pty request timed out was not in opencode.log; it was returned by the tool layer to the agent. The 499s are client-cancelled long polls and also occur on earlier days, so they are context, not proof of cause. The shell-output 404 suggests the backgrounded shell disappeared. The strongest discriminator is that a brand-new session failed identically, so this is not session-local state.

Related issues
  • #61644 — Windows ConPTY teardown hangs, leaked OpenConsole.exe, same error string; open and still reproducing at v2.3.0. The hang also occurs when deleting a session removes its terminals.
  • #52049 / #53416 — Windows managed service replacement can lose persistent terminals.
  • #63384 — browser/attach RPC hangs producing long 499s alongside /api/event.
Questions for maintainers
  • Is there a supported way to restart only the shell/PTY subsystem from a client or an HTTP endpoint, without killing the session?
  • Should a dead PTY service return a distinct, actionable error instead of a generic request timeout?
  • Was anything in 2.3.2 changed in this area, or should I re-test on the latest build?
Langage dominant
TypeScript
Étoiles
227k
Forks
30.7k
Merge moyen
3 h 57 min
PR mergées (30 j)
484

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de anomalyco/opencode

Toutes les issues de anomalyco/opencode

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.