Your bash diagnosis was right, and I think the locking half of it is wrong. Both are worth separating, because the first one is a real trap and the second sends you down a dead end.
The bash half
On a machine like yours, where bash resolves to C:\WINDOWS\system32\bash.exe:
$ where bash
C:\WINDOWS\system32\bash.exe # the WSL launcher
$ bash --version
wsl: Unknown key 'boot.systemd' in ...\.wslconfig:7
GNU bash, version 5.3.9(1)-release (x86_64-pc-linux-gnu) <- Linux bash
$ echo $?
-1
V1's upgradeScriptShell() in packages/opencode/src/installation/index.ts was:
const bashVersion = yield* text(["bash", "--version"])
if (bashVersion) return "bash"
return "sh"
It only checks that the command printed something. The stub prints a full GNU bash banner and then exits -1, so the check passes and the installer gets piped into WSL. It runs inside Linux, $HOME/.opencode/bin is a Linux path, and the upgrade writes to a filesystem the Windows install never reads — which is why the UI can report Installing OpenCode 1.19.3… while --version stays put. Ignoring the exit code there is what makes it silent.
V2 already closes this. installerBash() on dev never returns a bare bash on Windows: it honours OPENCODE_GIT_BASH_PATH, otherwise derives Git Bash from git --exec-path, otherwise fails loudly with "Git Bash is required to update OpenCode". On this machine that derivation resolves:
git --exec-path : C:/Program Files/Git/mingw64/libexec/git-core
derived bash : C:\Program Files\Git\bin\bash.exe (exists)
So on 2.0.x, either install Git for Windows or set OPENCODE_GIT_BASH_PATH, and the upgrade runs natively. V1 has no equivalent — I checked, GIT_BASH doesn't appear anywhere in the V1 tree.
The locking half
"Windows locks that file, so the replace cannot succeed while OpenCode is running" — I couldn't reproduce that, and I think the probe in #52025 is what makes it look true:
[System.IO.File]::Open('...opencode.exe','Open','ReadWrite','None')
→ being used by another process
That's accurate for a native Win32 caller, which doesn't request FILE_SHARE_DELETE. But install.sh:343 is mv, and under MINGW64 that goes through Cygwin, which does request it. Both observations are correct for their own caller.
Running the real V1 installer against a sandboxed HOME with the install-dir binary live:
processes : 597 598 (TUI + background service)
hash before : e4224d18c3c96826
$ HOME=$SB bash install.sh --version 1.19.3 --no-modify-path
installer exit status : 0
hash after : 81bb8ddc61554dd8
VERDICT: BINARY WAS REPLACED
Same-fs and cross-filesystem both replace it. The one path that genuinely can't work over a running exe is cp at install.sh:354, used by --binary — cp has to open the destination for writing:
cp: cannot create regular file '.../opencode.exe': Device or resource busy
exit=1
That's the shape of your .old workaround, and doing rename-aside first is the correct fix for that path rather than a hack.
Caveats
I used ping.exe as the stand-in running binary, not opencode.exe itself — same Windows semantics, but not the same image. And I ran under Git Bash invoked by absolute path, which is why I could get a clean result where your bare bash could not. I didn't test with a live WSL distro present, so I can't say exactly what the stub does in your docker-desktop case — only that its banner passes V1's check and its exit code is non-zero, which is enough for the bug to happen.
The most useful thing here might be surfacing installer stderr on failure. Three separate reports have now misdiagnosed this, and opencode upgrade currently discards it.