Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(codex): retain manual-only updates in saved engine status

Afloat8eb6a526efdd
diff --git a/server/harness/engine-status-file.ts b/server/harness/engine-status-file.ts
index e59ff1f69e..85cbefc42f 100644
--- a/server/harness/engine-status-file.ts
+++ b/server/harness/engine-status-file.ts
@@ -37,6 +37,7 @@ export function snapshotFrom(value: unknown): ProviderSnapshot | null {
const raw = value as Record<string, unknown>;
if (raw.state !== "available" && raw.state !== "unavailable") return null;
const update = strings(raw.update, ["title", "message", "command"] as const);
+ const skipServerInstall = (raw.update as { serverInstall?: unknown } | null | undefined)?.serverInstall === false;
const warning = strings(raw.warning, ["title", "message"] as const);
const signedInAs = account(raw.account);
return {
@@ -49,7 +50,7 @@ export function snapshotFrom(value: unknown): ProviderSnapshot | null {
...(text(raw.authenticationUnavailableReason) ? { authenticationUnavailableReason: raw.authenticationUnavailableReason } : {}),
...(signedInAs ? { account: signedInAs } : {}),
...(text(raw.version) || raw.version === null ? { version: raw.version } : {}),
- ...(update ? { update } : {}),
+ ...(update ? { update: { ...update, ...(skipServerInstall ? { serverInstall: false as const } : {}) } } : {}),
...(raw.billing === "metered" || raw.billing === "subscription" ? { billing: raw.billing } : {}),
...(warning ? { warning } : {}),
};
diff --git a/server/harness/registry-start-read.test.ts b/server/harness/registry-start-read.test.ts
index 9501677057..3c2c4df802 100644
--- a/server/harness/registry-start-read.test.ts
+++ b/server/harness/registry-start-read.test.ts
@@ -179,6 +179,27 @@ describe("the start-up read", () => {
expect(changed).toBe(false);
});
+ it("keeps a terminal-only update in the saved status before the live read completes", async () => {
+ const file = statusFile();
+ const update = { title: "Update Codex", message: "Use the terminal for the newer release.", command: "codex update", serverInstall: false as const };
+ const answer = { ...AVAILABLE, update };
+ timersForTheFile();
+ await (await engines({ fake: { answer } }, { statusFile: file })).registry.describe();
+ await saved();
+ const probe = gate();
+ const { registry, probes } = await engines({ fake: { answer, holdSnapshot: probe.promise } }, { statusFile: file });
+ const read = registry.readAtStart();
+ try {
+ const [listed] = await registry.describe({ known: true });
+ expect(listed.snapshot).toMatchObject({ update });
+ expect(registry.lastSnapshot("fake")).toBeUndefined();
+ expect(probes()).toEqual({ fake: 1 });
+ } finally {
+ probe.open();
+ await read;
+ }
+ });
+
it("reports no change when the probe agrees with the last run", async () => {
const file = statusFile();
timersForTheFile();