GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — v2.2.6 regression: shell tool returns empty output (exit 0) for every command when Store PowerShell 7 resolves to its app-execution alias · Issue #62512 · anomalyco/opencode

v2.2.6 regression: shell tool returns empty output (exit 0) for every command when Store PowerShell 7 resolves to its app-execution alias #62512

New issue
Copy link
New issue
Copy link
Closed
#62522
Closed
v2.2.6 regression: shell tool returns empty output (exit 0) for every command when Store PowerShell 7 resolves to its app-execution alias#62512
#62522
Copy link

Description

@Supernatural-cpp
Supernatural-cpp
opened on Nov 7, 2026
Issue body actions

Description

On v2.2.6, when "shell": "pwsh" is the value that takes effect and PowerShell 7 comes only from the Microsoft Store, every shell command returns exit=0 with empty output. The resolver hands the app-execution alias to spawn instead of a real executable:

command="C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShell_8wekyb3d8bbwe\pwsh.exe"

Before v2.2.6 the same config fell back to Windows PowerShell 5.1 — the wrong shell, but commands ran and their output came back. That is exactly what #55255 reported. #61952 fixed the detection and turned the symptom into a silent failure, which is worse: the tool reports success, the model receives an empty result and reasons over "nothing" instead of seeing an error.

Setting "shell" to the packaged exe path makes the same commands work again, so the whole difference is the resolved path.

Environment

  • opencode 2.2.6, installed via npm global
  • Windows 11 (10.0.26300); only the TUI/CLI is installed, there is no desktop app on this machine
  • PowerShell 7.6.9 installed from the Microsoft Store only — Test-Path 'C:\Program Files\PowerShell\7\pwsh.exe' returns False, so pwsh.exe exists only as an app-execution alias under %LOCALAPPDATA%\Microsoft\WindowsApps
  • config: "shell": "pwsh" in ~/.config/opencode/opencode.jsonc
  • plugin: opencode-windows-encoding (prepends UTF-8 setup; present before and after the upgrade, unrelated)

Steps to reproduce

  1. On Windows 11, install PowerShell 7 from the Microsoft Store only.
  2. Make sure the effective "shell" is the bare name "pwsh" — and that no other config document overrides it with a rooted path (a project-level opencode.jsonc takes precedence over the global one; see the note at the end).
  3. Run any command through the shell tool, e.g. echo probe.

Result, every time: status=exited, exit=0, output.size=0, and the per-call file under <data>/shell/<hash>/*.out is 0 bytes. No error is surfaced anywhere.

Evidence

Two runs on the same machine, one minute apart, with only the effective "shell" differing:

time (UTC) effective "shell" spawn command output
05:36:22 / 05:36:25 rooted packaged path C:/Program Files/WindowsApps/Microsoft.PowerShell_7.6.9.0_x64__8wekyb3d8bbwe/pwsh.exe 87 B / 506 B — ok
05:36:49 / 05:36:56 / 05:37:07 "pwsh" C:\Users\<user>\...\WindowsApps\Microsoft.PowerShell_8wekyb3d8bbwe\pwsh.exe 0 / 0 / 0 — exit 0, empty

session_message rows and the log agree, and the row for (Get-Process -Id $PID).Path is empty too — not a single byte arrives from the child process.

Raw spawning process lines (username replaced with <user>, timestamps UTC):

# failing — alias path
timestamp=2026-11-07T05:36:49.970Z level=INFO run=f771ddc9 message="spawning process" command="C:\\Users\\<user>\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.PowerShell_8wekyb3d8bbwe\\pwsh.exe" args="[\"-NoLogo\",\"-NoProfile\",\"-NonInteractive\",\"-Command\",\"...;\\necho probe\"]" cwd="C:\\Users\\<user>\\Desktop" role=server

# working — rooted packaged path
timestamp=2026-11-07T05:36:25.199Z level=INFO run=62f23242 message="spawning process" command="C:/Program Files/WindowsApps/Microsoft.PowerShell_7.6.9.0_x64__8wekyb3d8bbwe/pwsh.exe" args="[\"-NoLogo\",\"-NoProfile\",\"-NonInteractive\",\"-Command\",\"...;\\n$PSVersionTable\"]" cwd="C:\\Users\\<user>\\Desktop" role=server

Note the shapes: the failing path uses backslashes and sits under %LOCALAPPDATA%; the working path uses forward slashes and is a config literal. which() and the alias fallback both join with Windows semantics and can only emit backslashes, so a forward-slash path is never a resolution result — that is how the two cases can be told apart at a glance in a log.

The child is not hanging: each failing call completes in about 250 ms with exit=0 (from session_message.time.created → time.completed). The output is simply not delivered.

Why this is a regression from #61952

Before #61952, which() had no alias fallback. With the alias invisible to which, executable() returned nothing and select() fell through win() to findExecutable("powershell") — Windows PowerShell 5.1 — which ran commands and returned their output. That is the behaviour described in #55255.

#61952 added:

  • packages/core/src/util/which.ts — which() now returns appExecutionAlias(...), i.e. the alias path itself
  • packages/core/src/shell/select.ts — if (isAppExecutionAlias(shell) || stat(shell)?.isFile()) return shell

So the alias — a path that cannot be stat-ed as a regular file — is now accepted as the shell and passed to spawn. Nothing between resolution and spawn checks that the returned path actually produces output.

Implementation problems around that fix

  • isAppExecutionAlias() accepts any symlink (lstatSync(file)?.isSymbolicLink() === true && existsSync(file)) instead of checking the IO_REPARSE_TAG_APPEXECLINK reparse tag, and its lstatSync is not guarded against EACCES — see issue #62501 for the malformed path that crashes it (...\WindowsApps\python.exe\pwsh.exe).
  • The shell is accepted without any check that it can be stat-ed as a regular file, so an unusable path is indistinguishable from a usable one.
  • The tests added in fix(core): find Microsoft Store PowerShell 7 on Windows #61952 assert resolve(...) === alias.file and which(...) === alias.file — that the resolver echoes its input. They cannot fail for the reason this issue fails. test.skipIf(!alias) also skips them on any machine without a Store app installed, which is most CI.

What a fix should hold

  • Never hand an IO_REPARSE_TAG_APPEXECLINK path to spawn. Resolve it to the packaged exe first (GetPackageFullNameFromFamilyName + GetPackagePathByFullName, or scan C:\Program Files\WindowsApps\Microsoft.PowerShell_*_x64__8wekyb3d8bbwe), and if that fails, fall back with a warning or return an error — never a silent success.
  • Don't cache the resolved package path — see service: cached Store pwsh path goes stale after package update #56381 / Windows: shell runs PowerShell 5.1 with a Store-installed pwsh 7, and a Store update strands the cached path #56738.
  • Test behaviour, not identity. Spawn the resolved path and assert stdout (-Command 'echo ok'); keep a unit-level invariant that the resolver only returns paths that stat reports as regular files.
  • opencode debug shell printing the resolved path, the config document that supplied "shell", and a spawn smoke test. On this machine the hardest thing to find was a project-level config document silently supplying a rooted path; one such command would have shown it immediately.

Note on how this was first reported

The first revision of this issue described the failure as intermittent and included a table that attributed the difference to the opencode version. Both were wrong: the "working" runs were using a rooted path from a project-level opencode.jsonc (not "shell": "pwsh"), and the version table compared two different configs. With that document out of the way, the failure reproduces every time. The report above is the corrected version.

Related: #55255 #61952 #62501 #56381 #56738

Activity

  1. opencodejr commented on Nov 7, 2026

    @opencodejr
    opencodejrBot
    on Nov 7, 2026
    Contributor
    More actions

    Thanks for the detailed report and the log evidence.

    I couldn't reproduce this here because it needs Windows with PowerShell 7 installed only from the Microsoft Store. Our reproduction sandbox runs Linux, and the app-execution-alias code paths only run on Windows. From reading the code, your diagnosis matches what's on dev: since #61952, the shell resolver can return the %LOCALAPPDATA%\Microsoft\WindowsApps\...\pwsh.exe alias path, and that path goes to spawn as-is. That fits the "spawning process" log entries you saw. A maintainer with a Windows machine will need to confirm where the output gets lost.

    A workaround I haven't tested: set "shell" to the absolute path of the packaged exe under C:\Program Files\WindowsApps\Microsoft.PowerShell_<version>_x64__8wekyb3d8bbwe\pwsh.exe. The catch is that this path changes when the Store updates PowerShell (see #56381). Your offer to test a branch on this machine will be useful.

    Related: #62501, which is the same alias-detection code crashing with EACCES on a malformed path.

  2. Supernatural-cpp commented on Nov 7, 2026

    @Supernatural-cpp
    Supernatural-cpp
    on Nov 7, 2026
    Author
    More actions

    Correction: this is deterministic, not intermittent

    Earlier updates in this thread described the failure as intermittent and blamed a cached shell value. That was wrong. The issue body has been rewritten to the corrected report; this comment records what changed and why.

    Short version: a project-level opencode.jsonc was supplying a rooted "shell" path and takes precedence over the global config. So the runs I described as "the same config, but working" were not the same config — every one of them used the rooted path, not "shell": "pwsh". Once that document is out of the way, "shell": "pwsh" fails on every command, reproduced back-to-back in the same minute.

    Two things from that detour are worth keeping:

    • A forward-slash path in a spawning process line is always a config literal. which() and the appExecutionAlias() fallback both join with Windows path semantics, so they can only emit backslashes. That distinguishes "resolved" from "configured" at a glance, and it is how the two cases were finally separated.
    • This failure is easy to misdiagnose as intermittent, because a project-level "shell" silently overrides the global one, and the config file you are editing is not necessarily the one that wins. opencode debug shell that prints the winning document would remove that trap.

    The rest of the earlier analysis still holds and is folded into the rewritten body: silent exit=0 with empty output, the missing stat check on the resolved path, and the echo-of-input tests added in #61952 that cannot catch this class of failure.

  3. Hona
    closed this as completedin #62522on Nov 7, 2026
  4. facebey
    marked shell: shell executable paths with spaces break all shell tool calls (Windows) #62606 as a duplicate of this issue on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.