From d08754d1b4264613df03322f0cfa766e9d910f42 Mon Sep 17 00:00:00 2001 From: acamq <179265037+acamq@users.noreply.github.com> Date: Wed, 11 Mar 2026 13:28:12 -0600 Subject: [PATCH] fix(auto-update): pipe bun install output and restore other-deps preservation test background-update-check.ts was using runBunInstall() which defaults to outputMode:"inherit", leaking bun install stdout/stderr into the background session. Reverted to runBunInstallWithDetails({ outputMode: "pipe" }) and explicitly logs result.error on failure. Restores the accidentally deleted test case asserting that sibling dependencies (e.g. other:"1.0.0") are preserved in package.json after a plugin version sync. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- .../checker/sync-package-json.test.ts | 22 +++++++++++++++++++ .../hook/background-update-check.ts | 8 +++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/hooks/auto-update-checker/checker/sync-package-json.test.ts b/src/hooks/auto-update-checker/checker/sync-package-json.test.ts index 3d5fe2325..c83774810 100644 --- a/src/hooks/auto-update-checker/checker/sync-package-json.test.ts +++ b/src/hooks/auto-update-checker/checker/sync-package-json.test.ts @@ -198,6 +198,28 @@ describe("syncCachePackageJsonToIntent", () => { }) }) + describe("#given cache package.json with other dependencies", () => { + it("#then other dependencies are preserved when updating plugin version", async () => { + const { syncCachePackageJsonToIntent } = await import("./sync-package-json") + + const pluginInfo: PluginEntryInfo = { + entry: "oh-my-opencode@latest", + isPinned: false, + pinnedVersion: "latest", + configPath: "/tmp/opencode.json", + } + + const result = syncCachePackageJsonToIntent(pluginInfo) + + expect(result.synced).toBe(true) + expect(result.error).toBeNull() + + const content = readFileSync(join(TEST_CACHE_DIR, "package.json"), "utf-8") + const pkg = JSON.parse(content) as { dependencies?: Record } + expect(pkg.dependencies?.["other"]).toBe("1.0.0") + }) + }) + describe("#given malformed JSON in cache package.json", () => { it("#then returns parse_error", async () => { cleanupTestCache() diff --git a/src/hooks/auto-update-checker/hook/background-update-check.ts b/src/hooks/auto-update-checker/hook/background-update-check.ts index 692b2b81b..0875c23a5 100644 --- a/src/hooks/auto-update-checker/hook/background-update-check.ts +++ b/src/hooks/auto-update-checker/hook/background-update-check.ts @@ -1,5 +1,5 @@ import type { PluginInput } from "@opencode-ai/plugin" -import { runBunInstall } from "../../../cli/config-manager" +import { runBunInstallWithDetails } from "../../../cli/config-manager" import { log } from "../../../shared/logger" import { invalidatePackage } from "../cache" import { PACKAGE_NAME } from "../constants" @@ -13,7 +13,11 @@ function getPinnedVersionToastMessage(latestVersion: string): string { async function runBunInstallSafe(): Promise { try { - return await runBunInstall() + const result = await runBunInstallWithDetails({ outputMode: "pipe" }) + if (!result.success && result.error) { + log("[auto-update-checker] bun install error:", result.error) + } + return result.success } catch (err) { const errorMessage = err instanceof Error ? err.message : String(err) log("[auto-update-checker] bun install error:", errorMessage)