@devries-cameron20 / t3code-1 / commits / 9b6c77fb0d
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(opencode): pass --method curl to the native updater (#34169)

Co-authored-by: Mohamed Sayed <MohamedSayed0573@users.noreply.github.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Mohamed Sayed Ali committed Nov 12, 2026 at 01:18 UTC 9b6c77fb0de9d8943aaf14c8a4aa1f84634e0c69
2 files changed +21 -4
packages/provider-opencode/src/server/driver.test.ts
+3 -3
@@ -815,9 +815,9 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
815 const native = executable(".opencode", "bin", "opencode");
816 for (const generation of ["v1", "v2"] as const) {
817 assert.isNull((yield* resolveUpdate(generation, launcher)).update);
818 - assert.deepStrictEqual((yield* resolveUpdate(generation, native)).update?.args, [
819 - "upgrade",
820 - ]);
818 + const update = (yield* resolveUpdate(generation, native)).update;
819 + assert.deepStrictEqual(update?.args, ["upgrade", "--method", "curl"]);
820 + assert.strictEqual(update?.env?.HOME, root);
821 }
822 }),
823 );
packages/provider-opencode/src/server/driver.ts
+18 -1
@@ -93,15 +93,32 @@ function isOpenCodeNativeCommandPath(commandPath: string): boolean {
93 );
94 }
95
96 +function openCodeNativeHome(commandPath: string): string | null {
97 + const slashed = commandPath.replaceAll("\\", "/");
98 + const match = /\/\.opencode\/bin\/opencode(?:\.exe)?$/i.exec(slashed);
99 + if (!match) return null;
100 + return match.index === 0 ? "/" : slashed.slice(0, match.index);
101 +}
102 +
103 /** Update only within the installed package generation; 2.x converts the shared database in place. */
104 export const openCodeUpdateFor = (generation: ProbedOpenCode["generation"]) =>
105 makePackageManagedProviderMaintenanceResolver({
106 provider: DRIVER_KIND,
107 npmPackageName: generation === "v2" ? "@opencode/cli" : "opencode-ai",
108 nativeUpdate: {
102 - args: ["upgrade"],
109 + // `isOpenCodeNativeCommandPath` is the curl installer's own binary. Name the
110 + // method so OpenCode does not have to infer it from `process.execPath`, which
111 + // fails when the binary is launched through a wrapper or shim.
112 + args: ["upgrade", "--method", "curl"],
113 isCommandPath: isOpenCodeNativeCommandPath,
114 requiresCommandPath: true,
115 + // The curl installer writes to `$HOME/.opencode/bin`, so point HOME at the install it replaces.
116 + env: (context) => {
117 + const home =
118 + openCodeNativeHome(context.realCommandPath) ??
119 + openCodeNativeHome(context.resolvedCommandPath);
120 + return home ? { HOME: home } : {};
121 + },
122 },
123 // mise's `opencode` follows releases into 2.x, so it would upgrade 1.x across that line.
124 mise: { tool: "opencode", upgrade: generation === "v2" },