Skip to content

Commit ede41df

Browse files
only21milclaude
andauthored
fix(opencode): OpenCode installs T3 can't identify no longer get an Update button that hangs (pingdotgg#28278)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent cf5e6d3 commit ede41df

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ const resolveUpdate = (generation: "v1" | "v2", binaryPath: string) =>
462462
);
463463

464464
it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
465-
"updates an npm-global OpenCode 2 install as @opencode/cli and a 1.x one as opencode-ai",
465+
"updates npm-global OpenCode by generation and runs upgrade only for its own installer's path",
466466
() =>
467467
Effect.gen(function* () {
468468
const root = NodeFS.realpathSync(
@@ -493,6 +493,21 @@ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
493493
assert.isNull(
494494
(yield* resolveUpdate("v1", NodePath.join(v2Prefix, "bin", "opencode"))).update,
495495
);
496+
const executable = (...segments: ReadonlyArray<string>) => {
497+
const path = NodePath.join(root, ...segments);
498+
NodeFS.mkdirSync(NodePath.dirname(path), { recursive: true });
499+
NodeFS.writeFileSync(path, "#!/bin/sh\n");
500+
NodeFS.chmodSync(path, 0o755);
501+
return path;
502+
};
503+
const launcher = executable("launcher", "opencode");
504+
const native = executable(".opencode", "bin", "opencode");
505+
for (const generation of ["v1", "v2"] as const) {
506+
assert.isNull((yield* resolveUpdate(generation, launcher)).update);
507+
assert.deepStrictEqual((yield* resolveUpdate(generation, native)).update?.args, [
508+
"upgrade",
509+
]);
510+
}
496511
}),
497512
);
498513

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const openCodeUpdateFor = (generation: ProbedOpenCode["generation"]) =>
8383
nativeUpdate: {
8484
args: ["upgrade"],
8585
isCommandPath: isOpenCodeNativeCommandPath,
86+
requiresCommandPath: true,
8687
},
8788
});
8889

0 commit comments

Comments
 (0)