Skip to content

Terminal tab not renamed to opencode when launched manually in VS Code integrated terminal, breaking Cmd+Option+K file reference hotkey #27678

Closed as not planned

Description

@Noitidart

Description

When running opencode manually in VS Code's integrated terminal (typing opencode directly, not via the extension's Cmd+Esc launcher), the terminal tab stays named "zsh" instead of being renamed to "opencode". This prevents the Cmd+Option+K file reference hotkey from working because the extension identifies opencode terminals by checking terminal.name === "opencode" (see sdks/vscode/src/extension.ts:35).

Root cause

The bin/opencode entry point is a Node.js wrapper (#!/usr/bin/env node) that uses child_process.spawn() to launch the compiled opencode binary as a child process, keeping the node wrapper alive as a signal forwarder:

zsh → node (wrapper) → opencode (compiled binary)

VS Code's terminal process detection reads the binary filename from the OS process table (via ps/kern_proc). It sees the direct child of zsh as node, not opencode. Since the compiled binary is a grandchild, VS Code never detects it.

This is the same underlying issue as #10993 — Cmd+Option+K fails because the extension checks terminal.name === TERMINAL_NAME and the name never becomes "opencode".

Proposed fix

Replace the Node.js wrapper with a POSIX shell script that execs directly into the compiled binary. On Unix, exec replaces the calling process with the target binary, so the OS process table shows opencode as the direct child of zsh:

zsh → opencode (compiled binary, via exec)

The change is:

  1. bin/opencode becomes a ~25-line POSIX shell script that resolves the binary path and execs into it
  2. bin/opencode-resolve (new) — the existing Node.js detection logic (platform/AVX2/musl), outputs the resolved binary path to stdout instead of spawning+forwarding signals
  3. bin/opencode.cmd (new) — Windows fallback using the Node.js resolver

I have this working locally — confirmed that running the compiled binary directly renames the VS Code terminal tab to "opencode", and Cmd+Option+K works as expected.

Plugins

Official OpenCode Extension

Steps to reproduce

  1. Open VS Code integrated terminal (Ctrl+`)
  2. Type opencode (do NOT use Cmd+Esc)
  3. Observe terminal tab stays "zsh"
  4. Open a file, highlight a line, press Cmd+Option+K
  5. Nothing happens — file reference is not sent to the terminal

Operating System

macOS 26.2

Terminal

VS Code Integrated Terminal

Activity

  1. github-actions commented on May 15, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If this is a distinct issue (specifically tracking the bin/opencode Node.js wrapper process naming fix), it may be worth cross-linking these rather than opening a new report.

  2. Noitidart commented on May 15, 2026

    @Noitidart
    Author

    PR with fix opened here - #27679

  3. github-actions commented on Jul 15, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

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