From 401baa7385e10874e4288864fe76afc87a732f3c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 6 Feb 2026 11:41:13 +0000 Subject: [PATCH] fix: prevent auto-upgrade recursion by disabling auto-upgrade during upgrade execution When auto-upgrade triggered 'sf upgrade', the nested process could trigger another auto-upgrade check, causing process management issues. Now we set SF_CLI_DISABLE_AUTO_UPGRADE=1 when calling 'sf upgrade' and re-running the original command to prevent this recursion. Co-authored-by: Daniel Tao --- src/checkVersion.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/checkVersion.ts b/src/checkVersion.ts index 4a23fe7..3c54230 100644 --- a/src/checkVersion.ts +++ b/src/checkVersion.ts @@ -125,12 +125,18 @@ export async function checkVersion() { chalk.cyan(`Automatically upgrading ${version} → ${latestVersion}`), ); try { - execSync("sf upgrade", { stdio: "inherit" }); + execSync("sf upgrade", { + stdio: "inherit", + env: { ...process.env, SF_CLI_DISABLE_AUTO_UPGRADE: "1" }, + }); console.log(chalk.gray("\n☁️☁️☁️\n")); // Re-run the original command const args = process.argv.slice(2); - execSync(`sf ${args.join(" ")}`, { stdio: "inherit" }); + execSync(`sf ${args.join(" ")}`, { + stdio: "inherit", + env: { ...process.env, SF_CLI_DISABLE_AUTO_UPGRADE: "1" }, + }); process.exit(0); } catch { // Silent error, just run the command the user wanted to run