Skip to content

[Bug]: OpenCode version probes can run indefinitely and consume CPU when CLI wrapper hangs #8681

Description

@stijnhoste

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. On Linux, expose opencode through a shell wrapper that invokes a version manager before executing the real CLI. In this case, ~/.local/bin/opencode contains:
#!/bin/bash
export MISE_MINIMUM_RELEASE_AGE=0
mise use -g "opencode" || exit 1
exec mise x "opencode" -- "opencode" "$@"
  1. Start T3 Code with OpenCode provider discovery enabled.
  2. Let the wrapper's mise use -g opencode or mise x opencode -- opencode --version invocation stall.
  3. Leave T3 Code running and inspect the process tree.

Expected behavior

The OpenCode version probe should have a short timeout. If the CLI or wrapper does not return, T3 Code should terminate the full probe process group and report that the provider could not be checked.

Repeated provider discovery or a second T3 Code instance should not leave additional stuck probes.

Actual behavior

Two T3 Code server processes each retained a stuck OpenCode version probe for more than an hour:

t3code server
└─ /bin/bash ~/.local/bin/opencode --version
   └─ mise x opencode -- opencode --version
      └─ mise use -g opencode

Observed process ages and CPU use:

PID      PPID     CPU    ELAPSED   COMMAND
2675712  2675259  34.4%  4478s    mise x opencode -- opencode --version
2853595  2852657  34.2%  4005s    /bin/bash ~/.local/bin/opencode --version

The child mise processes were actively consuming CPU rather than sleeping. During sampling:

  • system load average reached 8.96 on an 8-thread CPU
  • CPU temperature reached 90°C in balanced mode
  • system context switches reached roughly 80,000 to 100,000 per second
  • the desktop became sluggish and the fan remained at high speed

Closing the probe owners or terminating the stuck process trees removes the load. Running the installed OpenCode binary directly avoids the wrapper path.

Impact

Major degradation or frequent failure. A provider availability check can remain alive indefinitely, consume CPU, heat the machine, and make the desktop sluggish.

Version or commit

T3 Code 0.0.35

Environment

  • Arch Linux, x86_64
  • T3 Code package: t3code-bin 0.0.35-1
  • OpenCode: 1.18.21, installed through mise
  • OpenCode is exposed on PATH through a shell wrapper
  • Power profile during measurement: balanced

Logs or stack traces

There was no crash or stack trace. The evidence was the live process tree and elapsed process time. T3 Code had not timed out or reaped either probe after more than 4,000 seconds.

Suggested fix

Apply a bounded timeout to provider version and health probes. On timeout or server shutdown, terminate the spawned process group, including shell-wrapper and version-manager descendants.

Workaround

Point T3 Code directly at the installed OpenCode binary instead of the wrapper, or restart T3 Code and manually terminate any leftover opencode --version / mise probe processes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions