Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/server/src/provider/Drivers/ClaudeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv, Path.
} satisfies ClaudeSettings;
const resolveMaintenance = yield* makeClaudeMaintenanceResolution({
binaryPath: effectiveConfig.binaryPath,
maintenanceBinaryPath: config.maintenanceBinaryPath
? expandHomePath(config.maintenanceBinaryPath, yield* HostProcess.HomeDirectory)
: null,
env: processEnv,
}).pipe(
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
Expand Down Expand Up @@ -322,6 +325,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv, Path.
Effect.flatMap((maintenanceCapabilities) =>
enrichProviderSnapshotWithVersionAdvisory(snapshot, maintenanceCapabilities, {
enableProviderUpdateChecks: settings.enableProviderUpdateChecks,
useMaintenanceVersion: true,
}),
),
Effect.provideService(HttpClient.HttpClient, httpClient),
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/provider/Drivers/CodexDriver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ it.layer(layerTest)("CodexDriver", (it) => {

for (const update of updates) {
expect(update).toMatchObject({
command: `${binaryPath} update`,
command: `env CODEX_HOME='${installHome}' ${binaryPath} update`,
args: ["update"],
lockKey: "codex-native",
env: { CODEX_HOME: installHome },
Expand Down
6 changes: 5 additions & 1 deletion apps/server/src/provider/Drivers/CodexDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function makeCodexMaintenanceResolver(sharedHomePath: string) {
args: ["update"],
isCommandPath: (commandPath) => codexStandaloneHome(commandPath) !== null,
requiresCommandPath: true,
env: (context) => ({
installationEnv: (context) => ({
CODEX_HOME:
codexStandaloneHome(context.realCommandPath) ??
codexStandaloneHome(context.resolvedCommandPath) ??
Expand Down Expand Up @@ -225,6 +225,9 @@ export const CodexDriver: ProviderDriver<
makeCodexMaintenanceResolver(homeLayout.sharedHomePath),
{
binaryPath: effectiveConfig.binaryPath,
maintenanceBinaryPath: config.maintenanceBinaryPath
? expandHomePath(config.maintenanceBinaryPath, yield* HostProcess.HomeDirectory)
: null,
env: processEnv,
},
).pipe(
Expand Down Expand Up @@ -299,6 +302,7 @@ export const CodexDriver: ProviderDriver<
Effect.flatMap((maintenanceCapabilities) =>
enrichProviderSnapshotWithVersionAdvisory(snapshot, maintenanceCapabilities, {
enableProviderUpdateChecks: settings.enableProviderUpdateChecks,
useMaintenanceVersion: true,
}),
),
Effect.provideService(HttpClient.HttpClient, httpClient),
Expand Down
33 changes: 29 additions & 4 deletions apps/server/src/provider/providerMaintenanceRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,22 @@ describe("providerMaintenanceRunner", () => {
},
{ name: "installed behind", probe: { installedVersion: "2.1.309" }, skip: false },
{ name: "installed unknown", probe: { installedVersion: null }, skip: false },
] as const)("only skips a successful fresh current probe: $name", ({ probe, skip }) => {
{ name: "maintenance behind", probe: {}, maintenanceVersion: "2.1.309", skip: false },
{
name: "maintenance current",
probe: { version: "2.1.309" },
maintenanceVersion: "2.1.310",
skip: true,
},
{
name: "maintenance updated but session behind",
probe: { version: "2.1.309" },
maintenanceVersion: "2.1.309",
skip: false,
},
] as const)("only skips a successful fresh current probe: $name", (fixture) => {
const { probe, skip } = fixture;
let maintenanceVersion = "maintenanceVersion" in fixture ? fixture.maintenanceVersion : null;
const calls: Array<{ command: string; args: ReadonlyArray<string> }> = [];
const refreshedInstanceIds: Array<ProviderInstanceId> = [];
return Effect.gen(function* () {
Expand Down Expand Up @@ -375,20 +390,29 @@ describe("providerMaintenanceRunner", () => {
);
},
getProviderMaintenanceCapabilitiesForInstance: () =>
Effect.succeed(
makeProviderMaintenanceCapabilities({
Effect.succeed({
...makeProviderMaintenanceCapabilities({
provider: CODEX_DRIVER,
packageName: "@anthropic-ai/claude-code",
updateExecutable: "claude",
updateArgs: ["update"],
updateLockKey: "claudeAgent-native",
}),
),
...("maintenanceVersion" in fixture
? { lookupMaintenanceVersion: Effect.sync(() => maintenanceVersion) }
: {}),
}),
});

const result = yield* updater.updateProvider(CODEX_DRIVER);
assert.deepStrictEqual(refreshedInstanceIds, [CODEX_INSTANCE_ID]);
assert.deepStrictEqual(calls, skip ? [] : [{ command: "claude", args: ["update"] }]);
if ("maintenanceVersion" in fixture && !skip) {
assert.strictEqual(
result.providers[0]?.updateState?.status,
fixture.name === "maintenance updated but session behind" ? "unchanged" : "succeeded",
);
}
if (!skip) return;
assert.strictEqual(result.providers[0]?.updateState?.status, "succeeded");
assert.strictEqual(result.providers[0]?.updateState?.message, "Already up to date.");
Expand All @@ -407,6 +431,7 @@ describe("providerMaintenanceRunner", () => {
layerLatestVersionHttpClient("2.1.310"),
layerMockSpawner((command, args) => {
calls.push({ command, args });
maintenanceVersion = "2.1.310";
return { stdout: "updated" };
}),
),
Expand Down
3 changes: 3 additions & 0 deletions apps/server/src/provider/providerMaintenanceRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ export const make = Effect.fn("ProviderMaintenanceRunner.make")(function* () {
enrichProviderSnapshotWithVersionAdvisory(
refreshedProvider,
maintenanceCapabilities,
phase === "pre-update"
? { enableProviderUpdateChecks: undefined, useMaintenanceVersion: true }
: undefined,
).pipe(
Effect.provideService(HttpClient.HttpClient, httpClient),
Effect.provideService(ProviderLatestVersions.ProviderLatestVersions, latestVersions),
Expand Down
7 changes: 7 additions & 0 deletions docs/user/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ The managed runtimes for Antigravity and for Codex connected through ChatGPT
first install the release T3 Code tested. When T3 Code finds a newer compatible
release, their setup in **Settings → Providers** offers an update.

If Codex or Claude uses a launcher as its **Binary path**, set **Maintenance binary path**
to the underlying CLI installation in web or desktop Settings. Sessions keep using the
launcher; Update now uses the maintenance installation and still verifies the session
binary's version afterward. Clear the maintenance path to update the session binary again.
When T3 can determine the installer, the copyable command also targets that installation.
Run it in a terminal on the environment where the provider is installed.

Add another provider instance for a separate account or configuration. Each
instance can have its own environment variables, such as API keys or a custom
base URL. Mark secret values as sensitive; after saving, T3 Code does not display
Expand Down
22 changes: 20 additions & 2 deletions packages/contracts/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,15 @@ export function makeProviderSettingsSchema<const Fields extends Schema.Struct.Fi
);
}

const MaintenanceBinaryPath = Schema.optionalKey(TrimmedString).pipe(
Schema.annotateKey({
title: "Maintenance binary path",
description:
"Underlying CLI to update when Binary path is a launcher. Leave empty to update the session binary.",
providerSettingsForm: { clearWhenEmpty: "omit" },
}),
);

export const CodexSettings = makeProviderSettingsSchema(
{
setupMode: Schema.optionalKey(Schema.Literals(["managed", "existing"])).pipe(
Expand All @@ -718,6 +727,7 @@ export const CodexSettings = makeProviderSettingsSchema(
providerSettingsForm: { placeholder: "codex", clearWhenEmpty: "omit" },
}),
),
maintenanceBinaryPath: MaintenanceBinaryPath,
homePath: TrimmedString.pipe(
Schema.withDecodingDefault(Effect.succeed("")),
Schema.annotateKey({
Expand Down Expand Up @@ -754,7 +764,7 @@ export const CodexSettings = makeProviderSettingsSchema(
),
},
{
order: ["binaryPath", "homePath", "shadowHomePath", "launchArgs"],
order: ["binaryPath", "maintenanceBinaryPath", "homePath", "shadowHomePath", "launchArgs"],
},
);
export type CodexSettings = typeof CodexSettings.Type;
Expand Down Expand Up @@ -794,6 +804,7 @@ export const ClaudeSettings = makeProviderSettingsSchema(
providerSettingsForm: { placeholder: "claude", clearWhenEmpty: "omit" },
}),
),
maintenanceBinaryPath: MaintenanceBinaryPath,
homePath: TrimmedString.pipe(
Schema.withDecodingDefault(Effect.succeed("")),
Schema.annotateKey({
Expand Down Expand Up @@ -847,7 +858,14 @@ export const ClaudeSettings = makeProviderSettingsSchema(
),
},
{
order: ["binaryPath", "homePath", "autoCompactWindow", "idleCompaction", "launchArgs"],
order: [
"binaryPath",
"maintenanceBinaryPath",
"homePath",
"autoCompactWindow",
"idleCompaction",
"launchArgs",
],
},
);
export type ClaudeSettings = typeof ClaudeSettings.Type;
Expand Down
2 changes: 2 additions & 0 deletions packages/provider-core/src/server/maintenance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export interface ProviderMaintenanceCapabilities {
readonly provider: ProviderDriverKind;
readonly packageName: string | null;
readonly update: ProviderMaintenanceCommandAction | null;
/** Selected maintenance CLI version; never replaces the session snapshot version. */
readonly lookupMaintenanceVersion?: Effect.Effect<string | null>;
/** undefined defers to npm; null means the installer could not determine the latest version. */
readonly latestVersion?: string | null;
/**
Expand Down
Loading
Loading