Correction — my previous comment on this issue was wrong on both counts, and I'd rather retract it clearly than leave it standing.
Wrong #1: "This bug is already fixed on V2." It isn't closed. #51386, #51755 and #52025 are all open against V2 right now. I read retained-image.ts and its test, saw the hard link, and concluded the bug was handled without ever running the actual installer. That was sloppy reasoning and I should have run it first.
Wrong #2: I presented a Node-level file-lock result as if it were the installer's behaviour. It isn't. Here's the corrected picture, all measured on Windows 11 with Git Bash.
The real installer, run against a sandboxed HOME, with the install-dir binary genuinely executing:
running install-dir binary: pid=1185 nlink=1
hash before: e4224d18c3c96826
$ HOME=$SANDBOX bash /tmp/oc-install.sh --version 2.0.19 --no-modify-path
installer exit status : 0
hash after : 100c90202ec358bd
VERDICT: BINARY WAS REPLACED
install.sh:343 uses mv, and under MINGW64 that succeeds over a running executable. So #52025's premise — "the replacement would still hit the lock" — doesn't hold for the curl path with a real Git Bash. That report infers failure from a .NET probe:
[System.IO.File]::Open('...opencode.exe','Open','ReadWrite','None')
That probe does fail, but only because native Win32 callers don't request FILE_SHARE_DELETE. Cygwin/MSYS does, so mv is permitted. The probe measures the wrong caller.
The probe isn't wrong about writing though, and that's where the real bug is:
$ bash install.sh --binary /tmp/payload.exe
cp: cannot create regular file '.../opencode.exe': Device or resource busy
exit=1 NOT REPLACED
So the two install paths differ:
| path |
line |
over a running exe |
| normal download |
:343 mv |
replaced, exit 0 |
--binary |
:354 cp |
fails, "Device or resource busy" |
That is #51755 exactly: cp must open the destination for writing, which a running image refuses, so the documented PowerShell/--binary route can never succeed while OpenCode is running. The rename-to-.old-then-copy workaround in that report is correct, and it's the only thing that can work on that path.
And on retained-image.ts: the hard link does let you unlink a running image, which is real. But the curl installer never calls unlink on the destination, so retaining() isn't what makes that path work. It looks aimed at the bun/package-manager replacement path instead.
Net: I withdraw the claim that this is fixed. What's actually still broken on Windows is shell selection — when bash resolves to the WSL stub the installer never runs against the Windows filesystem at all — plus the cp path above. This issue being closed as V1-only looks right.