Skip to content

Commit a704bbd

Browse files
fix(opencode): pass --method curl to the native updater
OpenCode's curl-installed binary lives at ~/.opencode/bin/opencode. T3 Code already recognizes that path as the provider's own installer, but it ran `opencode upgrade` without a method, so OpenCode had to infer the method from `process.execPath`. That inference fails when the binary is launched through a wrapper or shim, and the update fails with: Could not detect the installation method. Pass --method to choose how to upgrade OpenCode. Tell OpenCode the method explicitly for this installer path. Both OpenCode 1.x and 2.x support `--method curl`, and the path is the curl installer's location on every platform.
1 parent ed52af3 commit a704bbd

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/provider-opencode/src/server/driver.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,8 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
751751
assert.isNull((yield* resolveUpdate(generation, launcher)).update);
752752
assert.deepStrictEqual((yield* resolveUpdate(generation, native)).update?.args, [
753753
"upgrade",
754+
"--method",
755+
"curl",
754756
]);
755757
}
756758
}),

‎packages/provider-opencode/src/server/driver.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ export const openCodeUpdateFor = (generation: ProbedOpenCode["generation"]) =>
8686
provider: DRIVER_KIND,
8787
npmPackageName: generation === "v2" ? "@opencode/cli" : "opencode-ai",
8888
nativeUpdate: {
89-
args: ["upgrade"],
89+
// `isOpenCodeNativeCommandPath` is the curl installer's own binary. Name the
90+
// method so OpenCode does not have to infer it from `process.execPath`, which
91+
// fails when the binary is launched through a wrapper or shim.
92+
args: ["upgrade", "--method", "curl"],
9093
isCommandPath: isOpenCodeNativeCommandPath,
9194
requiresCommandPath: true,
9295
},

0 commit comments

Comments
 (0)