Skip to content

v2: shell: no handle at launch to stop/cancel running background commands #36424

Description

@Ploppy3

Summary

Background shell commands do return a call ID — but only on completion, not at launch. This means there is still no way to reference or cancel a running background command while it is executing.

New finding (v2 update)

When a background shell finishes, the completion notification includes a call ID:

id: call_00_GHYwLiUePO5p7d23ATlI7431
state: completed
command: sleep 60 && echo "done"

However, at launch time, the response is simply:

"The command was moved to the background. You will be notified automatically when the command finishes."

No ID, PID, or handle is provided at that point.

What this means

  • The infrastructure does track background commands with an ID — it is simply not exposed at launch.
  • If the ID were returned at launch (same as subagent's ses_... ID), it could enable a kill/cancel mechanism.
  • Currently, the only way to stop a background command is indirect — pkill by name or kill by port — which is fragile and error-prone.

Desired behavior

  1. Return the call ID (e.g. call_00_...) immediately when launching a background shell.
  2. Provide a mechanism (tool or parameter) to cancel/kill a running background command using that ID.

Environment

  • opencode version: 0.0.0-next-15329 (v2 beta, next channel)
  • OS: Linux 7.0.0-27-generic (x86_64, Ubuntu)
  • Terminal: xterm-256color, truecolor
  • Shell: /bin/bash
  • Install/channel: next (v2 beta)

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions