Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(server): parse CLI version in update preflight (#4389)
Theo Browne88c69ffff6ca
diff --git a/apps/server/src/cloud/selfUpdate.test.ts b/apps/server/src/cloud/selfUpdate.test.tsindex 28bcc0ffe..9d6e38017 100644--- a/apps/server/src/cloud/selfUpdate.test.ts+++ b/apps/server/src/cloud/selfUpdate.test.ts@@ -54,7 +54,7 @@ const makeRecordingRunnerLayer = (return {stdout:options?.stdoutFor?.(input.command, input.args) ??- (versionFromPath === undefined ? "" : `${versionFromPath}\n`),+ (versionFromPath === undefined ? "" : `t3 v${versionFromPath}\n`),stderr: failed ? `${input.command} exploded` : "",code: ChildProcessSpawner.ExitCode(failed ? 1 : 0),timedOut: false,@@ -427,7 +427,7 @@ it.layer(NodeServices.layer)("ServerSelfUpdate.update", (it) => {Effect.gen(function* () {const context = yield* makeContext({stdoutFor: (command, args) =>- command === NODE_PATH && args[1] === "--version" ? "0.0.28\n" : undefined,+ command === NODE_PATH && args[1] === "--version" ? "t3 v0.0.28\n" : undefined,});const versionDir = context.path.join(context.baseDir, "runtime", "versions", "0.0.29");diff --git a/apps/server/src/cloud/selfUpdate.ts b/apps/server/src/cloud/selfUpdate.tsindex 2df49910b..62bd07fbb 100644--- a/apps/server/src/cloud/selfUpdate.ts+++ b/apps/server/src/cloud/selfUpdate.ts@@ -273,8 +273,10 @@ export const make = Effect.fn("cloud.server_self_update.make")(function* (optionfailWith(`Could not verify the installed t3@${targetVersion}.`, cause),),);- const preflightVersion = preflight.stdout.trim();- if (preflight.code !== 0 || preflightVersion !== targetVersion) {+ // Effect CLI's unstable formatVersion currently emits `${name} v${version}`.+ // Extract the version token so surrounding presentation changes do not break updates.+ const reportedVersion = /\bv(\S+)\s*$/.exec(preflight.stdout)?.[1];+ if (preflight.code !== 0 || reportedVersion !== targetVersion) {// A completed npm install can still be unusable under this Node or on// this machine. Remove its sentinel and tree so a retry of the same// version performs a clean install instead of reusing a known-bad one.