Skip to content

Linux: Bash tool waits for timeout after SIGTERM, then reports ChildProcess.kill in 1.19.5 #59925

Closed as not planned

Description

@KalininVD

Description

On Linux, a Bash tool command that terminates its own shell with SIGTERM is not reported as finished promptly. OpenCode waits for the configured tool timeout instead.

I tested kill -TERM $$ with timeout=1000 in both the interactive TUI and opencode run:

Version Interactive TUI Non-interactive opencode run
1.18.33 Reports a timeout after about 1.2 seconds Reports a timeout after about 1.2 seconds
1.19.5 Unknown: ChildProcess.kill (kill -TERM $$ ) Unknown: ChildProcess.kill (kill -TERM $$ )

In 1.19.5, the error also arrives after approximately the configured timeout. The OpenCode session remains usable.

Expected: detect that the child exited due to SIGTERM and promptly report its termination signal or corresponding exit status, without waiting for the timeout or reporting a kill error.

Control: the same command run directly through /bin/bash -c terminates in approximately 2 ms with SIGTERM. A Bash tool call containing exit 139 also returns promptly; a normal sleep 10 with a 1-second tool timeout produces the regular timeout message.

These tests used ordinary host processes, outside containers and bubblewrap, with external plugins disabled using --pure.

Related: #52202 reports the same error text on Windows. This reproduction is Linux-specific; I have not established whether the root cause is shared.

Plugins

External plugins disabled with --pure.

OpenCode version

1.18.33 and 1.19.5, Linux x64 baseline binaries.

Steps to reproduce

Use an authenticated OpenCode installation. Run each scenario with the version being tested. The model used for these tests was openai/gpt-6.1-sol.

Interactive TUI

From an empty temporary directory, launch the TUI with this initial prompt:

mkdir -p /tmp/opencode-signal-repro
cd /tmp/opencode-signal-repro
opencode --pure --model openai/gpt-6.1-sol --prompt \
  'Run exactly one Bash tool call with command="kill -TERM $$" and timeout=1000 milliseconds. Do not wrap or change the command, retry it, or run other tools. Report the exact tool result.'

Observe the Bash tool result in the TUI. The single quotes above preserve literal $$ for the tool shell.

Non-interactive CLI

From the same temporary directory:

opencode run --pure --model openai/gpt-6.1-sol --format json <<'PROMPT'
Run exactly one Bash tool call with command="kill -TERM $$" and timeout=1000 milliseconds. Do not wrap or change the command, retry it, or run other tools. Report the exact tool result.
PROMPT

Verify that the emitted Bash tool input is exactly:

{"command":"kill -TERM $$","timeout":1000}

In 1.19.5, the tool event contains:

{
  "status": "error",
  "error": "Unknown: ChildProcess.kill (kill -TERM $$ )"
}

In 1.18.33, the tool status is completed, but its output incorrectly says:

shell tool terminated command after exceeding timeout 1000 ms.

The command sends SIGTERM only to its own disposable tool shell. No project files, Python dependencies, or core dumps are needed.

Operating System

Ubuntu 22.04.4 LTS, Linux x86_64.

Terminal

Interactive: Linux PTY running the standard OpenCode TUI.

Non-interactive: Bash with stdin supplied through a pipe/heredoc and JSON output captured to a file.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the detailed report and the side-by-side comparison between versions.

    Versions 1.18.33 and 1.19.5 are both OpenCode v1 (opencode-ai). v1 now only gets fixes for critical bugs, such as data loss, security problems, or crashes and breakage with no workaround. A misleading or delayed result after a command sends SIGTERM to its own tool shell doesn't fall into that group, so this is unlikely to be fixed in v1.

    All active development is on v2 (@opencode/cli, 2.x), which has a completely separate implementation of the shell tool. Please try it. If the same thing happens on v2, or if you think this is more critical than it looks, reply here with the v2 version and what you saw.

    Related issues:

  2. KalininVD commented on Oct 29, 2026

    @KalininVD
    Author

    Retested on Linux with the official v2.2.0 binary using the same Bash tool input: command="kill -TERM $$", timeout=1000. The issue does not reproduce: signal termination is reported promptly, without waiting for the timeout or producing a ChildProcess.kill error.

    For v1, I have submitted a fix in #59956, with regression tests and manual TUI verification against stock 1.19.5. No code was ported from v2.2.0 because its Shell API uses different contracts.

    I understand that v1 only accepts critical fixes; I'm sharing the v2 verification result and the existing v1 PR for maintainer consideration.

  3. opencodejr commented on Oct 29, 2026

    @opencodejr

    Closing this as not planned. The SIGTERM/ChildProcess.kill behaviour was reported on v1 (1.18.33 and 1.19.5), and v1 now only gets critical fixes. We left this open for a day in case it also happened on v2 or was more serious than it looked, and haven't heard back.

    If you can reproduce it on v2 (@opencode/cli, 2.x), please open a new issue with the v2 version and steps, or reply here. Thanks again for the detailed report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions