From c33a90320c7541796c411fe6eac7524d1dbef07e Mon Sep 17 00:00:00 2001 From: Nick <105120312+nick-vi@users.noreply.github.com> Date: Tue, 9 Dec 2025 23:07:59 +0200 Subject: [PATCH] fix: resolve 'latest' to actual version when caching plugins (#5292) --- packages/opencode/src/bun/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/bun/index.ts b/packages/opencode/src/bun/index.ts index edf74c310..c0f90e6ca 100644 --- a/packages/opencode/src/bun/index.ts +++ b/packages/opencode/src/bun/index.ts @@ -127,7 +127,18 @@ export namespace BunProc { await runInstall() - parsed.dependencies[pkg] = version + // Resolve actual version from installed package when using "latest" + // This ensures subsequent starts use the cached version until explicitly updated + let resolvedVersion = version + if (version === "latest") { + const installedPkgJson = Bun.file(path.join(mod, "package.json")) + const installedPkg = await installedPkgJson.json().catch(() => null) + if (installedPkg?.version) { + resolvedVersion = installedPkg.version + } + } + + parsed.dependencies[pkg] = resolvedVersion await Bun.write(pkgjson.name!, JSON.stringify(parsed, null, 2)) return mod }