The best way to control Claude Code, Codex and more from any computer or phone
fix(server): show recovery commands for stale Homebrew metadata (#21452)
Julius Marminge committed
Oct 19, 2026 at 13:22 UTC
462fa32c1d86eb664fe187c64010a0fd671538d1
2 files changed
+64
apps/server/src/provider/providerCompatibility.test.ts
+55
@@ -53,6 +53,61 @@ const provider: ServerProvider = {
53
const V2_RELEASE = "0.0.46";
54
55
describe("provider compatibility", () => {
56
+ it("offers Homebrew metadata recovery only while installed and latest versions are incompatible", () => {
57
+ const versionAdvisory = {
58
+ status: "current",
59
+ currentVersion: "1.0.0",
60
+ latestVersion: "1.0.0",
61
+ canUpdate: true,
62
+ updateCommand: "brew upgrade --cask codex",
63
+ checkedAt: provider.checkedAt,
64
+ message: null,
65
+ } as const;
66
+ for (const [version, command] of [
67
+ ["1.0.0", "brew upgrade --cask codex"],
68
+ ["0.9.0", "brew upgrade codex"],
69
+ ] as const) {
70
+ const stale = {
71
+ ...provider,
72
+ version,
73
+ versionAdvisory: {
74
+ ...versionAdvisory,
75
+ currentVersion: version,
76
+ latestVersion: version,
77
+ updateCommand: command,
78
+ },
79
+ };
80
+ const result = applyProviderCompatibility(stale, [policy], []);
81
+ assert.include(result.compatibilityAdvisory?.message ?? "", `brew update && ${command}`);
82
+ assert.include(result.compatibilityAdvisory?.message ?? "", "environment's host");
83
+ assert.include(result.compatibilityAdvisory?.message ?? "", "refresh provider status");
84
+ assert.strictEqual(result.message, provider.message);
85
+ assert.deepStrictEqual(result.versionAdvisory, stale.versionAdvisory);
86
+
87
+ const refreshed = applyProviderCompatibility(
88
+ { ...result, versionAdvisory: { ...stale.versionAdvisory, latestVersion: "2.0.0" } },
89
+ [policy],
90
+ [],
91
+ );
92
+ assert.strictEqual(refreshed.compatibilityAdvisory?.latestVersionStatus, "supported");
93
+ assert.notInclude(refreshed.compatibilityAdvisory?.message ?? "", "brew update");
94
+ }
95
+
96
+ for (const advisory of [
97
+ { ...versionAdvisory, updateCommand: "npm install -g @openai/codex@latest" },
98
+ { ...versionAdvisory, updateCommand: null, canUpdate: false },
99
+ { ...versionAdvisory, latestVersion: null },
100
+ { ...versionAdvisory, latestVersion: "9.0.0" },
101
+ ]) {
102
+ const result = applyProviderCompatibility(
103
+ { ...provider, versionAdvisory: advisory },
104
+ [policy],
105
+ [],
106
+ );
107
+ assert.notInclude(result.compatibilityAdvisory?.message ?? "", "brew update");
108
+ }
109
+ });
110
+
111
it("bundles a compatibility policy for every built-in harness", () => {
112
for (const builtIn of BUILT_IN_DRIVERS) {
113
if (builtIn.driverKind === "acpRegistry") continue;
apps/server/src/provider/providerCompatibility.ts
+9
@@ -115,11 +115,20 @@ export function applyProviderCompatibility(
115
? (resolveProviderCompatibility(policies, snapshot.driver, latestVersion) ??
116
resolveProviderCompatibility(fallback, snapshot.driver, latestVersion))
117
: undefined;
118
+ const updateCommand = snapshot.versionAdvisory?.updateCommand;
119
+ // The maintenance resolver emits this command only for confirmed Homebrew installs.
120
+ const needsHomebrewRefresh =
121
+ updateCommand?.startsWith("brew upgrade ") &&
122
+ (advisory?.status === "unsupported" || advisory?.status === "broken") &&
123
+ (latestAdvisory?.status === "unsupported" || latestAdvisory?.status === "broken");
124
return advisory
125
? {
126
...base,
127
compatibilityAdvisory: {
128
...advisory,
129
+ message: needsHomebrewRefresh
130
+ ? `${advisory.message} Homebrew's local package metadata may be stale. Run brew update && ${updateCommand} on this environment's host, then refresh provider status.`
131
+ : advisory.message,
132
...(latestAdvisory ? { latestVersionStatus: latestAdvisory.status } : {}),
133
},
134
}