Skip to content

Commit 3283236

Browse files
fix(grok): a Nix store Grok install stays manual-only
Grok resolves maintenance on its own, so the shared Nix store guard did not reach it and `grok update` would install a second copy beside the store one. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent eb0192c commit 3283236

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎packages/provider-core/src/server/maintenanceResolver.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ function isMiseExecutablePath(commandPath: string): boolean {
270270
}
271271

272272
/** The Nix store is read-only, so no updater can replace a CLI that lives there. */
273-
function isNixStoreCommandPath(commandPath: string): boolean {
273+
export function isNixStoreCommandPath(commandPath: string): boolean {
274274
return normalizeCommandPath(commandPath).startsWith("/nix/store/");
275275
}
276276

‎packages/provider-grok/src/server/driver.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/
3232
import { discoverGrokSkills } from "./skills.ts";
3333
import {
3434
homebrewOwnershipFromCommandPath,
35+
isNixStoreCommandPath,
3536
makeCachedProviderMaintenanceResolution,
3637
makeManualOnlyProviderMaintenanceCapabilities,
3738
makeProviderMaintenanceCapabilities,
@@ -53,7 +54,7 @@ const GROK_NPM_PACKAGE = "@xai-official/grok";
5354
// `grok update` installs under `GROK_HOME` from the resolved executable and instance environment.
5455
// npm 12 blocks the postinstall that moves the new binary in, yet exits 0, so allow it by env.
5556
// Mise and Homebrew casks upgrade through their manager; `grok update` would install a second
56-
// copy, so a cask its brew cannot vouch for stays manual.
57+
// copy, so a cask its brew cannot vouch for stays manual, as does a Nix store install.
5758
const UPDATE: ProviderMaintenanceCapabilitiesResolver = {
5859
resolve: Effect.fn("resolveGrokMaintenance")(function* (context) {
5960
if (!context) {
@@ -62,6 +63,13 @@ const UPDATE: ProviderMaintenanceCapabilitiesResolver = {
6263
packageName: GROK_NPM_PACKAGE,
6364
});
6465
}
66+
if ([context.resolvedCommandPath, context.realCommandPath].some(isNixStoreCommandPath)) {
67+
return makeManualOnlyProviderMaintenanceCapabilities({
68+
provider: DRIVER_KIND,
69+
packageName: GROK_NPM_PACKAGE,
70+
installPath: context.realCommandPath,
71+
});
72+
}
6573
const mise = yield* resolveMiseProviderMaintenance(
6674
{ provider: DRIVER_KIND, packageName: GROK_NPM_PACKAGE },
6775
{ tool: "grok" },

0 commit comments

Comments
 (0)