fix(codex): support GPT-6.2 context and Fast #21
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@eleith-pi/codex": patch
|
||||
---
|
||||
|
||||
Add GPT-6.2 Sol and Astra context controls and target the advertised 872K Codex maximum for all supported models, preserving larger Pi catalog windows. Declining the reduction from the older 922K extension window keeps the current window without asking again on every prompt. Update Fast eligibility discovery to a catalog version that includes both GPT-6.2 models.
|
||||
@@ -1,8 +1,9 @@
|
||||
# codex
|
||||
|
||||
context controls, account usage, and fast-mode requests using Pi's existing Codex login.
|
||||
verified extended-context profiles currently cover GPT-6 Sol, GPT-6.1 Sol, and GPT-6 Astra;
|
||||
unknown models are not guessed.
|
||||
extended context targets 872K, the advertised Codex catalog maximum for GPT-6 Sol,
|
||||
GPT-6 Astra, GPT-6.1 Sol, GPT-6.2 Sol, and GPT-6.2 Astra. larger Pi catalog windows
|
||||
are preserved.
|
||||
|
||||
## why
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ it("returns raw catalog JSON using only Pi's resolved routing credentials", asyn
|
||||
expect(f.registry.getProviderAuth).toHaveBeenCalledExactlyOnceWith("openai-codex");
|
||||
const requestOptions = expect.objectContaining({ method: "GET", redirect: "error" });
|
||||
expect(f.fetcher).toHaveBeenCalledExactlyOnceWith(
|
||||
`${BASE_URL}/codex/models?client_version=0.162.0`,
|
||||
`${BASE_URL}/codex/models?client_version=0.170.0`,
|
||||
requestOptions,
|
||||
);
|
||||
const headers = new Headers(f.fetcher.mock.calls[0][1]?.headers);
|
||||
|
||||
@@ -5,7 +5,7 @@ const PROVIDER = "openai-codex";
|
||||
const BASE_URL = "https://chatgpt.com/backend-api";
|
||||
const ACCOUNT_URLS = {
|
||||
usage: `${BASE_URL}/wham/usage`,
|
||||
catalog: `${BASE_URL}/codex/models?client_version=0.162.0`,
|
||||
catalog: `${BASE_URL}/codex/models?client_version=0.170.0`,
|
||||
} as const;
|
||||
type AccountResource = keyof typeof ACCOUNT_URLS;
|
||||
const TIMEOUT_MS = 10_000;
|
||||
|
||||
@@ -14,7 +14,7 @@ describe("ContextController", () => {
|
||||
async ({ saved, selectedExtended }) => {
|
||||
const f = fixture();
|
||||
f.state.branch = saved === undefined ? [] : [entry(preference(saved))];
|
||||
f.state.current = selectedExtended ? { ...f.catalog, contextWindow: 922_000 } : f.catalog;
|
||||
f.state.current = selectedExtended ? { ...f.catalog, contextWindow: 872_000 } : f.catalog;
|
||||
// Load the active branch without replay aligning metadata to its preference.
|
||||
f.state.idle = false;
|
||||
await f.controller.restore(f.ctx);
|
||||
@@ -23,7 +23,7 @@ describe("ContextController", () => {
|
||||
await f.controller.handle(" TOGGLE ", f.ctx);
|
||||
|
||||
const extended = saved !== true;
|
||||
expect(f.state.current?.contextWindow).toBe(extended ? 922_000 : 272_000);
|
||||
expect(f.state.current?.contextWindow).toBe(extended ? 872_000 : 272_000);
|
||||
expect(f.controller.getStatus(f.ctx)?.desiredExtended).toBe(extended);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledExactlyOnceWith(
|
||||
CONTEXT_ENTRY,
|
||||
@@ -94,7 +94,7 @@ describe("ContextController", () => {
|
||||
await request;
|
||||
|
||||
const extended = pending === "selection";
|
||||
expect(f.state.current?.contextWindow).toBe(extended ? 922_000 : 272_000);
|
||||
expect(f.state.current?.contextWindow).toBe(extended ? 872_000 : 272_000);
|
||||
expect(f.controller.getStatus(f.ctx)?.desiredExtended).toBe(extended);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(records + 1);
|
||||
expect(f.api.appendEntry).toHaveBeenLastCalledWith(CONTEXT_ENTRY, preference(extended));
|
||||
@@ -127,12 +127,12 @@ describe("ContextController", () => {
|
||||
await f.controller.handle(" ON ", f.ctx);
|
||||
|
||||
expect(f.state.current).not.toBe(f.catalog);
|
||||
expect(f.state.current).toEqual({ ...original, contextWindow: 922_000 });
|
||||
expect(f.state.current).toEqual({ ...original, contextWindow: 872_000 });
|
||||
expect(f.catalog).toEqual(original);
|
||||
expect(f.state.thinking).toBe("medium");
|
||||
expect(f.api.setThinkingLevel).toHaveBeenCalledWith("medium");
|
||||
expect(f.api.appendEntry).toHaveBeenCalledExactlyOnceWith(CONTEXT_ENTRY, preference(true));
|
||||
expect(f.notify).toHaveBeenLastCalledWith(expect.stringContaining("922,000 tokens"), "info");
|
||||
expect(f.notify).toHaveBeenLastCalledWith(expect.stringContaining("872,000 tokens"), "info");
|
||||
|
||||
await f.controller.handle("on", f.ctx);
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
@@ -170,7 +170,7 @@ describe("ContextController", () => {
|
||||
return true;
|
||||
});
|
||||
await f.controller.handle("on", f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.catalog.contextWindow).toBe(272_000);
|
||||
expect(f.state.thinking).toBe("medium");
|
||||
expect(f.api.appendEntry).toHaveBeenCalledExactlyOnceWith(CONTEXT_ENTRY, preference(true));
|
||||
@@ -185,13 +185,13 @@ describe("ContextController", () => {
|
||||
await f.controller.handle("off", f.ctx);
|
||||
|
||||
expect(f.confirm).toHaveBeenCalledWith(
|
||||
"Use standard context?",
|
||||
expect.stringContaining("922,000 → 272,000"),
|
||||
"Reduce context window?",
|
||||
expect.stringContaining("872,000 → 272,000"),
|
||||
{ signal: expect.any(AbortSignal) },
|
||||
);
|
||||
expect(f.state.current).not.toBe(extended);
|
||||
expect(f.state.current?.contextWindow).toBe(272_000);
|
||||
expect(extended.contextWindow).toBe(922_000);
|
||||
expect(extended.contextWindow).toBe(872_000);
|
||||
expect(f.catalog.contextWindow).toBe(272_000);
|
||||
expect(f.state.thinking).toBe("high");
|
||||
expect(f.api.appendEntry).toHaveBeenLastCalledWith(CONTEXT_ENTRY, preference(false));
|
||||
@@ -217,7 +217,7 @@ describe("ContextController", () => {
|
||||
await f.controller.reconcile(f.ctx);
|
||||
await f.controller.handle("on", f.ctx);
|
||||
|
||||
expect(owned.contextWindow).toBe(922_000);
|
||||
expect(owned.contextWindow).toBe(872_000);
|
||||
expect(f.catalog.contextWindow).toBe(272_000);
|
||||
expect(f.api.setModel).not.toHaveBeenCalled();
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
@@ -240,7 +240,7 @@ describe("ContextController", () => {
|
||||
|
||||
f.state.accepted = true;
|
||||
await f.controller.handle("on", f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -255,7 +255,7 @@ describe("ContextController", () => {
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
await f.controller.handle("on", f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.state.thinking).toBe("medium");
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(2);
|
||||
// The saved desired preference was already true; no redundant record.
|
||||
@@ -284,7 +284,7 @@ describe("ContextController", () => {
|
||||
f.confirm.mockResolvedValueOnce(false);
|
||||
await f.controller.handle("off", f.ctx);
|
||||
expect(f.state.current).toBe(owned);
|
||||
expect(owned?.contextWindow).toBe(922_000);
|
||||
expect(owned?.contextWindow).toBe(872_000);
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -295,12 +295,12 @@ describe("ContextController", () => {
|
||||
it("usage above the target requires compaction before a reduction dialog", async () => {
|
||||
const f = fixture();
|
||||
await f.controller.handle("on", f.ctx);
|
||||
f.state.usage = { tokens: 272_001, contextWindow: 922_000, percent: null };
|
||||
f.state.usage = { tokens: 272_001, contextWindow: 872_000, percent: null };
|
||||
await f.controller.handle("off", f.ctx);
|
||||
expect(f.confirm).not.toHaveBeenCalled();
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.notify).toHaveBeenLastCalledWith(expect.stringContaining("Run /compact"), "warning");
|
||||
});
|
||||
|
||||
@@ -313,7 +313,7 @@ describe("ContextController", () => {
|
||||
expect(f.confirm).not.toHaveBeenCalled();
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.notify).toHaveBeenLastCalledWith(
|
||||
expect.stringContaining("interactive confirmation"),
|
||||
"warning",
|
||||
@@ -340,7 +340,7 @@ describe("ContextController", () => {
|
||||
|
||||
f.state.branch.push(entry(preference(true)), entry(null));
|
||||
await f.controller.restore(f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
expect(f.catalog.contextWindow).toBe(272_000);
|
||||
});
|
||||
@@ -353,7 +353,7 @@ describe("ContextController", () => {
|
||||
await f.controller.restore(f.ctx);
|
||||
await f.controller.reconcile(f.ctx);
|
||||
expect(f.confirm).not.toHaveBeenCalled();
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
|
||||
const answer = deferred<boolean>();
|
||||
f.confirm.mockReturnValueOnce(answer.promise);
|
||||
@@ -383,7 +383,69 @@ describe("ContextController", () => {
|
||||
expect(f.notify).toHaveBeenLastCalledWith("Keeping extended context on this branch.", "info");
|
||||
await f.controller.reconcile(f.ctx);
|
||||
expect(f.confirm).toHaveBeenCalledTimes(1);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
});
|
||||
|
||||
it("applies the new extended window without rewriting a saved preference", async () => {
|
||||
const f = fixture();
|
||||
f.state.current = { ...f.catalog, contextWindow: 922_000 };
|
||||
f.state.branch = [entry(preference(true))];
|
||||
|
||||
await f.controller.restore(f.ctx);
|
||||
expect(f.confirm).toHaveBeenCalledExactlyOnceWith(
|
||||
"Reduce context window?",
|
||||
expect.stringContaining("922,000 → 872,000"),
|
||||
expect.anything(),
|
||||
);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each(["command", "branch change", "model selection"] as const)(
|
||||
"defers a declined extended-window reduction until %s",
|
||||
async (retry) => {
|
||||
const f = fixture();
|
||||
f.state.current = { ...f.catalog, contextWindow: 922_000 };
|
||||
f.state.branch = [entry(preference(true))];
|
||||
f.confirm.mockResolvedValueOnce(false);
|
||||
|
||||
await f.controller.restore(f.ctx);
|
||||
// Advancing the conversation does not count as switching branches.
|
||||
f.state.leafId = "next-message";
|
||||
await f.controller.reconcile(f.ctx);
|
||||
await f.controller.reconcile(f.ctx);
|
||||
expect(f.confirm).toHaveBeenCalledTimes(1);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.api.setModel).not.toHaveBeenCalled();
|
||||
expect(f.controller.getStatus(f.ctx)).toMatchObject({
|
||||
desiredExtended: true,
|
||||
replayPaused: true,
|
||||
});
|
||||
|
||||
if (retry === "command") await f.controller.handle("on", f.ctx);
|
||||
else if (retry === "branch change") await f.controller.restore(f.ctx);
|
||||
else await f.controller.modelSelected(f.ctx);
|
||||
expect(f.confirm).toHaveBeenCalledTimes(2);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.controller.getStatus(f.ctx)).toMatchObject({
|
||||
desiredExtended: true,
|
||||
replayPaused: false,
|
||||
});
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
},
|
||||
);
|
||||
|
||||
it("blocks reduction when current usage exceeds the new extended window", async () => {
|
||||
const f = fixture();
|
||||
f.state.current = { ...f.catalog, contextWindow: 922_000 };
|
||||
f.state.branch = [entry(preference(true))];
|
||||
f.state.usage = { tokens: 900_000, contextWindow: 922_000, percent: null };
|
||||
|
||||
await f.controller.restore(f.ctx);
|
||||
expect(f.notify).toHaveBeenLastCalledWith(expect.stringContaining("Run /compact"), "warning");
|
||||
expect(f.confirm).not.toHaveBeenCalled();
|
||||
expect(f.api.setModel).not.toHaveBeenCalled();
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("shutdown aborts the confirmation signal without accessing the expired root", async () => {
|
||||
@@ -403,7 +465,7 @@ describe("ContextController", () => {
|
||||
expect(signal?.aborted).toBe(true);
|
||||
expect(f.state.staleReads).toBe(0);
|
||||
expect(f.notify).not.toHaveBeenCalled();
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -439,7 +501,7 @@ describe("ContextController", () => {
|
||||
expect(f.state.staleReads).toBe(0);
|
||||
expect(f.notify).not.toHaveBeenCalled();
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
expect(extended.contextWindow).toBe(922_000);
|
||||
expect(extended.contextWindow).toBe(872_000);
|
||||
await f.controller.reconcile(f.ctx);
|
||||
expect(f.confirm).toHaveBeenCalledTimes(1);
|
||||
if (event !== "shutdown") {
|
||||
@@ -470,7 +532,7 @@ describe("ContextController", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each([undefined, { tokens: null, contextWindow: 922_000, percent: null }])(
|
||||
it.each([undefined, { tokens: null, contextWindow: 872_000, percent: null }])(
|
||||
"confirms reduction with unknown usage %j without inventing zero",
|
||||
async (usage) => {
|
||||
const f = fixture();
|
||||
@@ -478,7 +540,7 @@ describe("ContextController", () => {
|
||||
f.state.usage = usage;
|
||||
await f.controller.handle("off", f.ctx);
|
||||
expect(f.confirm).toHaveBeenCalledWith(
|
||||
"Use standard context?",
|
||||
"Reduce context window?",
|
||||
expect.stringContaining("usage: unknown"),
|
||||
expect.anything(),
|
||||
);
|
||||
@@ -502,11 +564,11 @@ describe("ContextController", () => {
|
||||
expect(extended.cost).toBe(f.catalog.cost);
|
||||
await f.controller.handle("off", f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(272_000);
|
||||
expect(extended.contextWindow).toBe(922_000);
|
||||
expect(extended.contextWindow).toBe(872_000);
|
||||
expect(f.catalog).toEqual(original);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(2);
|
||||
f.controller.shutdown();
|
||||
expect(extended.contextWindow).toBe(922_000);
|
||||
expect(extended.contextWindow).toBe(872_000);
|
||||
});
|
||||
|
||||
it("compares captured values even when another writer mutates a retained submitted object", async () => {
|
||||
@@ -552,7 +614,7 @@ describe("ContextController", () => {
|
||||
const f = fixture();
|
||||
await f.controller.handle("on", f.ctx);
|
||||
f.confirm.mockImplementationOnce(async () => {
|
||||
f.state.usage = { tokens: 300_000, contextWindow: 922_000, percent: null };
|
||||
f.state.usage = { tokens: 300_000, contextWindow: 872_000, percent: null };
|
||||
return true;
|
||||
});
|
||||
await f.controller.handle("off", f.ctx);
|
||||
@@ -568,7 +630,7 @@ describe("ContextController", () => {
|
||||
await f.controller.handle("on", f.ctx);
|
||||
f.state.branch = [];
|
||||
if (reason === "usage")
|
||||
f.state.usage = { tokens: 300_000, contextWindow: 922_000, percent: null };
|
||||
f.state.usage = { tokens: 300_000, contextWindow: 872_000, percent: null };
|
||||
else f.state.hasUI = false;
|
||||
await f.controller.restore(f.ctx);
|
||||
expect(f.confirm).not.toHaveBeenCalled();
|
||||
@@ -598,7 +660,7 @@ describe("ContextController", () => {
|
||||
else f.state[key] = "changed";
|
||||
finish.resolve(true);
|
||||
await request;
|
||||
expect(f.api.setModel.mock.calls[0][0].contextWindow).toBe(922_000);
|
||||
expect(f.api.setModel.mock.calls[0][0].contextWindow).toBe(872_000);
|
||||
expect(f.catalog.contextWindow).toBe(272_000);
|
||||
expect(f.state.thinking).toBe("off");
|
||||
expect(f.api.setThinkingLevel).not.toHaveBeenCalled();
|
||||
@@ -610,7 +672,7 @@ describe("ContextController", () => {
|
||||
await f.controller.restore(f.ctx);
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
await f.controller.handle("on", f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
},
|
||||
);
|
||||
@@ -644,7 +706,7 @@ describe("ContextController", () => {
|
||||
await request;
|
||||
expect(copy).toEqual(original);
|
||||
expect(f.state.staleReads).toBe(0);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
expect(f.api.setThinkingLevel).not.toHaveBeenCalled();
|
||||
expect(f.notify).not.toHaveBeenCalled();
|
||||
@@ -663,7 +725,7 @@ describe("ContextController", () => {
|
||||
throw new Error("model hook failed after assignment");
|
||||
});
|
||||
await f.controller.handle(action, f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(action === "on" ? 922_000 : 272_000);
|
||||
expect(f.state.current?.contextWindow).toBe(action === "on" ? 872_000 : 272_000);
|
||||
expect(previous).toEqual(original);
|
||||
expect(f.state.thinking).toBe("off");
|
||||
expect(f.api.setThinkingLevel).not.toHaveBeenCalled();
|
||||
@@ -697,7 +759,7 @@ describe("ContextController", () => {
|
||||
await request;
|
||||
expect(f.state.current).toEqual(originalPending);
|
||||
expect(external).toEqual(originalExternal);
|
||||
expect(oldCopy.contextWindow).toBe(922_000);
|
||||
expect(oldCopy.contextWindow).toBe(872_000);
|
||||
expect(f.state.thinking).toBe("off");
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
expect(f.notify).toHaveBeenCalledWith(
|
||||
@@ -717,7 +779,7 @@ describe("ContextController", () => {
|
||||
f.state.catalog = astra;
|
||||
await f.assign(astra);
|
||||
expect(f.state.current?.id).toBe("gpt-6-astra");
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(astra.contextWindow).toBe(272_000);
|
||||
expect(f.api.setModel).toHaveBeenCalledTimes(1);
|
||||
expect(f.api.appendEntry).not.toHaveBeenCalled();
|
||||
@@ -731,8 +793,8 @@ describe("ContextController", () => {
|
||||
await f.assign(f.catalog); // no model_select
|
||||
expect(f.state.current?.contextWindow).toBe(272_000);
|
||||
await f.controller.reconcile(f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(oldCopy.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
expect(oldCopy.contextWindow).toBe(872_000);
|
||||
expect(f.catalog.contextWindow).toBe(272_000);
|
||||
expect(f.api.appendEntry).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -743,20 +805,20 @@ describe("ContextController", () => {
|
||||
f.controller.shutdown();
|
||||
const controller = new ContextController(f.api, "personal:codex");
|
||||
await controller.restore(f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(922_000);
|
||||
expect(f.state.current?.contextWindow).toBe(872_000);
|
||||
await controller.handle("off", f.ctx);
|
||||
expect(f.api.setModel.mock.lastCall?.[0].contextWindow).toBe(272_000);
|
||||
expect(f.state.current?.contextWindow).toBe(272_000);
|
||||
expect(f.api.appendEntry).toHaveBeenLastCalledWith(CONTEXT_ENTRY, preference(false));
|
||||
});
|
||||
|
||||
it.each([300_000, 922_000, 1_000_000])(
|
||||
it.each([300_000, 872_000, 1_000_000])(
|
||||
"honors catalog override %s rather than a guessed default",
|
||||
async (window) => {
|
||||
const f = fixture({ ...model(), contextWindow: window });
|
||||
await f.controller.handle("on", f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(Math.max(window, 922_000));
|
||||
if (window >= 922_000) {
|
||||
expect(f.state.current?.contextWindow).toBe(Math.max(window, 872_000));
|
||||
if (window >= 872_000) {
|
||||
expect(f.api.setModel).not.toHaveBeenCalled();
|
||||
expect(f.notify).toHaveBeenLastCalledWith(
|
||||
`Using catalog context: ${window.toLocaleString("en-US")} tokens. No extension is needed.`,
|
||||
@@ -765,7 +827,7 @@ describe("ContextController", () => {
|
||||
}
|
||||
await f.controller.handle("off", f.ctx);
|
||||
expect(f.state.current?.contextWindow).toBe(window);
|
||||
if (window >= 922_000) {
|
||||
if (window >= 872_000) {
|
||||
expect(f.confirm).not.toHaveBeenCalled();
|
||||
expect(f.notify).toHaveBeenLastCalledWith(
|
||||
expect.stringContaining("no smaller default is known"),
|
||||
@@ -775,7 +837,7 @@ describe("ContextController", () => {
|
||||
},
|
||||
);
|
||||
|
||||
it.each(["gpt-6.2-sol", "gpt-6.1-astra", "gpt-7-sol"])(
|
||||
it.each(["gpt-6.3-sol", "gpt-6.1-astra", "gpt-7-sol"])(
|
||||
"does not guess an extended limit or replay saved preferences for %s",
|
||||
async (id) => {
|
||||
const f = fixture(model(id));
|
||||
@@ -819,7 +881,7 @@ describe("ContextController", () => {
|
||||
...[0, -1, NaN, Infinity].map((contextWindow) => ({ ...model(), contextWindow })),
|
||||
])("refuses missing/incompatible/invalid catalog baseline %j", async (catalog) => {
|
||||
const f = fixture();
|
||||
f.state.current = { ...f.catalog, contextWindow: 922_000 };
|
||||
f.state.current = { ...f.catalog, contextWindow: 872_000 };
|
||||
f.state.catalog = catalog;
|
||||
await f.controller.handle("off", f.ctx);
|
||||
await f.controller.handle("on", f.ctx);
|
||||
|
||||
@@ -57,6 +57,7 @@ export class ContextController {
|
||||
private changing: AbortController | undefined;
|
||||
private selecting = false;
|
||||
private replayPaused = false;
|
||||
private declinedExtendedReduction?: { model: Model<Api>; target: number };
|
||||
private revision = 0;
|
||||
private disposed = false;
|
||||
|
||||
@@ -105,6 +106,7 @@ export class ContextController {
|
||||
action === "on" ||
|
||||
(action === "toggle" && (!model || this.preferences.get(modelKey(model)) !== true));
|
||||
this.replayPaused = false;
|
||||
this.declinedExtendedReduction = undefined;
|
||||
await this.change(ctx, extended, true);
|
||||
}
|
||||
|
||||
@@ -125,13 +127,16 @@ export class ContextController {
|
||||
if (profile && standardWindow !== undefined) {
|
||||
extendedWindow = Math.max(standardWindow, profile.extendedWindow);
|
||||
}
|
||||
const desiredExtended = this.preferences.get(modelKey(model));
|
||||
return {
|
||||
model,
|
||||
usage: ctx.getContextUsage(),
|
||||
standardWindow,
|
||||
extendedWindow,
|
||||
desiredExtended: this.preferences.get(modelKey(model)),
|
||||
replayPaused: this.replayPaused,
|
||||
desiredExtended,
|
||||
replayPaused:
|
||||
this.replayPaused ||
|
||||
(desiredExtended === true && this.wasExtendedReductionDeclined(model, extendedWindow)),
|
||||
branch: ctx.sessionManager.getBranch(),
|
||||
};
|
||||
}
|
||||
@@ -157,9 +162,12 @@ export class ContextController {
|
||||
);
|
||||
return;
|
||||
}
|
||||
const model = { ...current };
|
||||
const target = extended ? Math.max(standardWindow, profile.extendedWindow) : standardWindow;
|
||||
if (!command && model.contextWindow === target) return;
|
||||
if (!command) {
|
||||
if (current.contextWindow === target) return;
|
||||
if (extended && this.wasExtendedReductionDeclined(current, target)) return;
|
||||
}
|
||||
const model = { ...current };
|
||||
const revision = this.revision;
|
||||
const operation = new AbortController();
|
||||
this.changing = operation;
|
||||
@@ -168,13 +176,17 @@ export class ContextController {
|
||||
const answer = await this.confirmReduction(ctx, model, target, operation.signal);
|
||||
if (!this.live(revision)) return;
|
||||
if (answer !== "confirmed") {
|
||||
if (
|
||||
!command &&
|
||||
answer === "declined" &&
|
||||
model.contextWindow === Math.max(standardWindow, profile.extendedWindow)
|
||||
) {
|
||||
this.remember(model, true);
|
||||
ctx.ui.notify("Keeping extended context on this branch.", "info");
|
||||
if (answer === "declined") {
|
||||
if (extended) {
|
||||
this.declinedExtendedReduction = { model, target };
|
||||
ctx.ui.notify("Keeping the current context window.", "info");
|
||||
} else if (
|
||||
!command &&
|
||||
model.contextWindow === Math.max(standardWindow, profile.extendedWindow)
|
||||
) {
|
||||
this.remember(model, true);
|
||||
ctx.ui.notify("Keeping extended context on this branch.", "info");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -202,6 +214,11 @@ export class ContextController {
|
||||
}
|
||||
}
|
||||
|
||||
private wasExtendedReductionDeclined(model: Model<Api>, target: number | undefined): boolean {
|
||||
const decline = this.declinedExtendedReduction;
|
||||
return decline !== undefined && decline.target === target && matches(model, decline.model);
|
||||
}
|
||||
|
||||
private remember(model: Model<Api>, extended: boolean): void {
|
||||
const key = modelKey(model);
|
||||
if (this.preferences.get(key) === extended) return;
|
||||
@@ -237,7 +254,7 @@ export class ContextController {
|
||||
const sessionId = ctx.sessionManager.getSessionId();
|
||||
const leafId = ctx.sessionManager.getLeafId();
|
||||
const confirmed = await ctx.ui.confirm(
|
||||
"Use standard context?",
|
||||
"Reduce context window?",
|
||||
`Window: ${tokens(model.contextWindow)} → ${tokens(target)} tokens. Current usage: ${tokens(ctx.getContextUsage()?.tokens)}. ` +
|
||||
"Pi may compact older history on the next request, depending on your compaction settings.",
|
||||
{ signal },
|
||||
@@ -340,6 +357,7 @@ export class ContextController {
|
||||
else this.replayPaused = true;
|
||||
}
|
||||
this.revision++;
|
||||
this.declinedExtendedReduction = undefined;
|
||||
this.changing?.abort();
|
||||
this.changing = undefined;
|
||||
}
|
||||
|
||||
@@ -28,11 +28,12 @@ const directory = await vi.hoisted(async () => {
|
||||
return directory;
|
||||
});
|
||||
|
||||
const CATALOG_URL = "https://chatgpt.com/backend-api/codex/models?client_version=0.162.0";
|
||||
const CATALOG_URL = "https://chatgpt.com/backend-api/codex/models?client_version=0.170.0";
|
||||
const RESPONSES_URL = "https://chatgpt.com/backend-api/codex/responses";
|
||||
const SOCKET_URL = "wss://chatgpt.com/backend-api/codex/responses";
|
||||
const FAST_ENTRY = "eleith-codex-fast";
|
||||
type Transport = "sse" | "websocket";
|
||||
const GPT_6_2_WINDOWS = { "gpt-6.2-sol": 500_000, "gpt-6.2-astra": 272_000 } as const;
|
||||
|
||||
beforeEach(blockUnexpectedNetwork);
|
||||
afterEach(() => {
|
||||
@@ -45,12 +46,19 @@ afterAll(() => {
|
||||
rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it.each(["sse", "websocket"] as const)(
|
||||
"SDK fast on reaches the native Codex %s wire, independently of the observed tier",
|
||||
async (transport) => {
|
||||
it.each([
|
||||
["sse", "gpt-6-sol"],
|
||||
["websocket", "gpt-6-sol"],
|
||||
["sse", "gpt-6.2-sol"],
|
||||
["websocket", "gpt-6.2-sol"],
|
||||
["sse", "gpt-6.2-astra"],
|
||||
["websocket", "gpt-6.2-astra"],
|
||||
] as const)(
|
||||
"SDK fast on reaches the native Codex %s wire for %s, independently of the observed tier",
|
||||
async (transport, modelId) => {
|
||||
const network = installResponseTransports(transport);
|
||||
const { runtime, model, accessToken, credentialWrites, resolveAuth, modelTurns } =
|
||||
await createOfflineModelRuntime(transport, network.fetch);
|
||||
await createOfflineModelRuntime(transport, network.fetch, modelId);
|
||||
const { session, manager, confirm, notify, input, beforeStart, errors, closeSession } =
|
||||
await openRealExtensionSession(runtime, model);
|
||||
try {
|
||||
@@ -96,6 +104,9 @@ it.each(["sse", "websocket"] as const)(
|
||||
"info",
|
||||
);
|
||||
|
||||
await session.prompt("/eleith:codex context on");
|
||||
expect(session.model?.contextWindow).toBe(872_000);
|
||||
expect(session.model?.maxTokens).toBe(model.maxTokens);
|
||||
const enabledBranch = structuredClone(manager.getBranch());
|
||||
resolveAuth.mockClear();
|
||||
// Already on is a local no-op, even if discovery has become unavailable.
|
||||
@@ -116,6 +127,7 @@ it.each(["sse", "websocket"] as const)(
|
||||
expectNativeAuthOnly(resolveAuth);
|
||||
expect(network.catalog).toHaveBeenCalledOnce();
|
||||
expect(modelTurns).toHaveBeenCalledOnce();
|
||||
expect(modelTurns.mock.lastCall?.[0].contextWindow).toBe(872_000);
|
||||
expect(network.payloads).toEqual([
|
||||
expect.objectContaining({ model: model.id, service_tier: "priority" }),
|
||||
]);
|
||||
@@ -165,6 +177,10 @@ it.each(["sse", "websocket"] as const)(
|
||||
expect(resolveAuth).not.toHaveBeenCalled();
|
||||
expect(modelTurns).toHaveBeenCalledOnce();
|
||||
expect(credentialWrites).not.toHaveBeenCalled();
|
||||
await session.prompt("/eleith:codex context off");
|
||||
expect(session.model?.contextWindow).toBe(model.contextWindow);
|
||||
expect(confirm).toHaveBeenCalledTimes(2);
|
||||
expect(modelTurns).toHaveBeenCalledOnce();
|
||||
expect(errors).toEqual([]);
|
||||
} finally {
|
||||
await closeSession();
|
||||
@@ -554,7 +570,22 @@ function installResponseTransports(transport: Transport) {
|
||||
|
||||
function createHttpResponses(transport: Transport, payloads: Record<string, unknown>[]) {
|
||||
const catalog = vi.fn<typeof fetch>(async () =>
|
||||
Response.json({ models: [{ slug: "gpt-6-sol", service_tiers: [{ id: "priority" }] }] }),
|
||||
Response.json({
|
||||
models: [
|
||||
{ slug: "gpt-6-sol", service_tiers: [{ id: "priority" }] },
|
||||
{
|
||||
slug: "gpt-6.2-sol",
|
||||
// Signed-in catalogs may also advertise Ultrafast; fast on still requests priority.
|
||||
service_tiers: [{ id: "priority" }, { id: "ultrafast" }],
|
||||
additional_speed_tiers: ["fast", "ultrafast"],
|
||||
},
|
||||
{
|
||||
slug: "gpt-6.2-astra",
|
||||
service_tiers: [{ id: "priority" }],
|
||||
additional_speed_tiers: ["fast"],
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
const sse = vi.fn<typeof fetch>(async (_url, init) => {
|
||||
if (transport !== "sse") throw new Error("Unexpected SSE fallback");
|
||||
@@ -609,22 +640,38 @@ function installSocketResponses(payloads: Record<string, unknown>[]) {
|
||||
}
|
||||
|
||||
// Offline ModelRuntime: real built-in provider and OAuth resolution, never persistence or refresh I/O.
|
||||
async function createOfflineModelRuntime(transport: Transport, fetcher: typeof fetch) {
|
||||
async function createOfflineModelRuntime(
|
||||
transport: Transport,
|
||||
fetcher: typeof fetch,
|
||||
modelId: "gpt-6-sol" | keyof typeof GPT_6_2_WINDOWS = "gpt-6-sol",
|
||||
) {
|
||||
const claim = { "https://api.openai.com/auth": { chatgpt_account_id: "fast-sdk-account" } };
|
||||
const accessToken = `e30.${Buffer.from(JSON.stringify(claim)).toString("base64url")}.fake-signature`;
|
||||
const { credentials, credentialWrites } = createReadOnlyCredentials(accessToken);
|
||||
const modelsStore = new InMemoryModelsStore();
|
||||
const runtime = await ModelRuntime.create({
|
||||
credentials,
|
||||
modelsPath: null,
|
||||
modelsStore: new InMemoryModelsStore(),
|
||||
modelsStore,
|
||||
allowModelNetwork: false,
|
||||
refreshOnCreate: false,
|
||||
});
|
||||
if (modelId !== "gpt-6-sol") {
|
||||
// Pi's bundled test SDK predates 6.2. Load it as a catalog overlay, not a provider override.
|
||||
const template = runtime.getModel("openai-codex", "gpt-6-sol");
|
||||
if (!template) throw new Error("Built-in Codex model missing");
|
||||
await modelsStore.write("openai-codex", {
|
||||
models: [
|
||||
{ ...template, id: modelId, name: modelId, contextWindow: GPT_6_2_WINDOWS[modelId] },
|
||||
],
|
||||
lastModified: Number.MAX_SAFE_INTEGER,
|
||||
});
|
||||
}
|
||||
const refresh = await runtime.refresh({ providers: ["openai-codex"], allowNetwork: false });
|
||||
expect(refresh.errors.size).toBe(0);
|
||||
expect(runtime.isUsingOAuth("openai-codex")).toBe(true);
|
||||
const model = runtime.getModel("openai-codex", "gpt-6-sol");
|
||||
if (!model) throw new Error("Built-in Codex model missing");
|
||||
const model = runtime.getModel("openai-codex", modelId);
|
||||
if (!model) throw new Error(`Codex model missing from test catalog: ${modelId}`);
|
||||
const resolveAuth = vi.spyOn(runtime, "getAuth");
|
||||
const nativeStream = runtime.streamSimple.bind(runtime);
|
||||
// Only select the transport at this public seam; retain native serialization and extension hooks.
|
||||
|
||||
@@ -26,25 +26,32 @@ describe("context profiles", () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
["gpt-6-sol", "https://developers.openai.com/api/docs/models/gpt-6-sol"],
|
||||
["gpt-6.1-sol", "https://developers.openai.com/api/docs/models/gpt-6-sol"],
|
||||
["gpt-6-astra", "https://developers.openai.com/api/docs/models/gpt-6-astra"],
|
||||
])("provides the 922000-token local window for %s", (id, source) => {
|
||||
const current = model(id);
|
||||
["gpt-6-sol", 272_000],
|
||||
["gpt-6.1-sol", 500_000],
|
||||
["gpt-6-astra", 272_000],
|
||||
["gpt-6.2-sol", 500_000],
|
||||
["gpt-6.2-astra", 272_000],
|
||||
] as const)("uses the Codex catalog maximum for %s", (id, contextWindow) => {
|
||||
const current = { ...model(id), contextWindow };
|
||||
const original = structuredClone(current);
|
||||
expect(contextProfile(current)).toEqual({ extendedWindow: 922_000, source });
|
||||
// The profile is metadata, not a mutation of the model's server/output limits.
|
||||
const profile = contextProfile(current);
|
||||
expect(profile).toEqual({
|
||||
extendedWindow: 872_000,
|
||||
source:
|
||||
"https://github.com/openai/codex/blob/rust-v0.170.0/codex-rs/models-manager/models.json",
|
||||
});
|
||||
expect(profile).toBe(contextProfile(model("gpt-6-sol")));
|
||||
expect(Object.isFrozen(profile)).toBe(true);
|
||||
expect(current).toEqual(original);
|
||||
expect(current.contextWindow).toBe(272_000);
|
||||
expect(current.maxTokens).toBe(128_000);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["gpt-6-sol", "openai"],
|
||||
["gpt-6-sol", "other"],
|
||||
["gpt-6", "openai-codex"],
|
||||
["gpt-6.2-sol", "openai-codex"],
|
||||
["gpt-6.2-sol", "openai"],
|
||||
["gpt-6.1-astra", "openai-codex"],
|
||||
["gpt-6.3-sol", "openai-codex"],
|
||||
["gpt-7-sol", "openai-codex"],
|
||||
["gpt-6-sol-2026-10-08", "openai-codex"],
|
||||
["GPT-6-SOL", "openai-codex"],
|
||||
@@ -52,14 +59,6 @@ describe("context profiles", () => {
|
||||
expect(contextProfile(model(id, provider))).toBeUndefined();
|
||||
});
|
||||
|
||||
it("shares immutable verified Sol metadata without matching future model names", () => {
|
||||
const profile = contextProfile(model("gpt-6-sol"));
|
||||
expect(profile).toBe(contextProfile(model("gpt-6.1-sol")));
|
||||
expect(Object.isFrozen(profile)).toBe(true);
|
||||
expect(Object.isFrozen(contextProfile(model("gpt-6-astra")))).toBe(true);
|
||||
expect(contextProfile(model("gpt-6.2-sol"))).toBeUndefined();
|
||||
});
|
||||
|
||||
it("requires the native Codex API even when the provider and ID match", () => {
|
||||
expect(contextProfile({ ...model("gpt-6-sol"), api: "openai-responses" })).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -5,22 +5,19 @@ export interface ContextProfile {
|
||||
readonly source: string;
|
||||
}
|
||||
|
||||
// Keep room for the full 128K output allowance within the documented 1.05M total.
|
||||
// These are local windows, not a claim about any account's Codex server limit.
|
||||
const SOL_PROFILE: ContextProfile = Object.freeze({
|
||||
extendedWindow: 922_000,
|
||||
source: "https://developers.openai.com/api/docs/models/gpt-6-sol",
|
||||
});
|
||||
const ASTRA_PROFILE: ContextProfile = Object.freeze({
|
||||
extendedWindow: 922_000,
|
||||
source: "https://developers.openai.com/api/docs/models/gpt-6-astra",
|
||||
// Match Codex's advertised maximum, not the direct OpenAI API input limit.
|
||||
const CODEX_PROFILE: ContextProfile = Object.freeze({
|
||||
extendedWindow: 872_000,
|
||||
source: "https://github.com/openai/codex/blob/rust-v0.170.0/codex-rs/models-manager/models.json",
|
||||
});
|
||||
|
||||
// Share verified metadata, not a naming rule: future versions need an explicit review.
|
||||
const PROFILES: Readonly<Record<string, ContextProfile>> = {
|
||||
"openai-codex/gpt-6-sol": SOL_PROFILE,
|
||||
"openai-codex/gpt-6.1-sol": SOL_PROFILE,
|
||||
"openai-codex/gpt-6-astra": ASTRA_PROFILE,
|
||||
"openai-codex/gpt-6-sol": CODEX_PROFILE,
|
||||
"openai-codex/gpt-6.1-sol": CODEX_PROFILE,
|
||||
"openai-codex/gpt-6-astra": CODEX_PROFILE,
|
||||
"openai-codex/gpt-6.2-sol": CODEX_PROFILE,
|
||||
"openai-codex/gpt-6.2-astra": CODEX_PROFILE,
|
||||
};
|
||||
|
||||
export function modelKey(model: Pick<Model<Api>, "provider" | "id">): string {
|
||||
|
||||
@@ -171,19 +171,25 @@ async function fixture(window = 272_000, modelId = "gpt-6-sol") {
|
||||
it.each([
|
||||
["gpt-6-sol", 272_000],
|
||||
["gpt-6-sol", 300_000],
|
||||
["gpt-6.1-sol", 500_000],
|
||||
["gpt-6-sol", 1_000_000],
|
||||
["gpt-6-astra", 272_000],
|
||||
["gpt-6.1-sol", 500_000],
|
||||
["gpt-6.2-sol", 500_000],
|
||||
["gpt-6.2-astra", 272_000],
|
||||
] as const)(
|
||||
"SDK catalog %s at %s stays independent through extend, reload, and confirmed restore",
|
||||
async (modelId, window) => {
|
||||
const profileWindow = 872_000;
|
||||
const f = await fixture(window, modelId);
|
||||
const original = structuredClone(f.catalog);
|
||||
try {
|
||||
const leaf = f.manager.getLeafId();
|
||||
await f.session.prompt("/eleith:codex context on");
|
||||
const extended = f.session.model!;
|
||||
expect(extended.contextWindow).toBe(Math.max(window, 922_000));
|
||||
if (window < 922_000) {
|
||||
const expectedWindow = Math.max(window, profileWindow);
|
||||
expect(extended.contextWindow).toBe(expectedWindow);
|
||||
expect(extended.maxTokens).toBe(original.maxTokens);
|
||||
if (window < profileWindow) {
|
||||
expect(extended).not.toBe(f.catalog);
|
||||
expect(f.manager.getLeafId()).not.toBe(leaf);
|
||||
expect(f.manager.getBranch().some((entry) => entry.type === "model_change")).toBe(true);
|
||||
@@ -191,21 +197,25 @@ it.each([
|
||||
expect(f.registry.find("openai-codex", modelId)).toEqual(original);
|
||||
expect(f.modelSelect).not.toHaveBeenCalled(); // actual same-ID suppression
|
||||
expect(f.session.thinkingLevel).toBe("high");
|
||||
// Reload from the baseline so this requires actual replay of the saved preference.
|
||||
await f.session.setModel(f.catalog);
|
||||
f.session.setThinkingLevel("high");
|
||||
expect(f.session.model?.contextWindow).toBe(window);
|
||||
await f.session.reload();
|
||||
expect(f.session.model?.contextWindow).toBe(Math.max(window, 922_000));
|
||||
expect(f.session.model?.contextWindow).toBe(expectedWindow);
|
||||
expect(f.registry.find("openai-codex", modelId)?.contextWindow).toBe(window);
|
||||
await f.session.prompt("/eleith:codex context off");
|
||||
expect(f.session.model?.contextWindow).toBe(window);
|
||||
expect(extended.contextWindow).toBe(Math.max(window, 922_000));
|
||||
expect(extended.contextWindow).toBe(expectedWindow);
|
||||
expect(f.catalog).toEqual(original);
|
||||
expect(f.confirm).toHaveBeenCalledTimes(window < 922_000 ? 1 : 0);
|
||||
expect(f.confirm).toHaveBeenCalledTimes(window < profileWindow ? 1 : 0);
|
||||
expect(f.session.thinkingLevel).toBe("high");
|
||||
expect(f.modelSelect).not.toHaveBeenCalled();
|
||||
expect(f.preferences()).toEqual([
|
||||
{ provider: "openai-codex", modelId, extended: true },
|
||||
{ provider: "openai-codex", modelId, extended: false },
|
||||
]);
|
||||
if (window >= 922_000)
|
||||
if (window >= profileWindow)
|
||||
expect(f.notify).toHaveBeenLastCalledWith(
|
||||
expect.stringContaining("no smaller default is known"),
|
||||
"info",
|
||||
@@ -222,7 +232,7 @@ it("SDK replays a saved context preference after the command rename", async () =
|
||||
try {
|
||||
f.manager.appendCustomEntry("eleith-context", saved);
|
||||
await f.session.reload();
|
||||
expect(f.session.model?.contextWindow).toBe(922_000);
|
||||
expect(f.session.model?.contextWindow).toBe(872_000);
|
||||
expect(f.preferences()).toEqual([saved]);
|
||||
|
||||
await f.session.prompt("/eleith:codex context off");
|
||||
@@ -268,7 +278,7 @@ it.each(["rename", "external"])(
|
||||
}
|
||||
resume();
|
||||
await request;
|
||||
expect(f.session.model?.contextWindow).toBe(922_000);
|
||||
expect(f.session.model?.contextWindow).toBe(872_000);
|
||||
expect(f.session.model?.id).toBe("gpt-6-sol"); // older call can replace external intent
|
||||
expect(submitted).toEqual(originalSubmitted);
|
||||
expect(f.catalog).toEqual(originalCatalog);
|
||||
@@ -313,7 +323,7 @@ it.each(["missing", "endpoint"])(
|
||||
const select = vi.spyOn(f.session, "setModel");
|
||||
await f.session.prompt("/eleith:codex context off");
|
||||
expect(select).not.toHaveBeenCalled();
|
||||
expect(f.session.model?.contextWindow).toBe(922_000);
|
||||
expect(f.session.model?.contextWindow).toBe(872_000);
|
||||
expect(f.confirm).not.toHaveBeenCalled();
|
||||
expect(f.preferences()).toHaveLength(1);
|
||||
expect(f.notify).toHaveBeenLastCalledWith(
|
||||
@@ -390,17 +400,17 @@ it.each(["user", "custom"] as const)(
|
||||
f.beforeStart.mockClear();
|
||||
}
|
||||
await f.session.prompt("Continue on the selected branch");
|
||||
expect(f.input).toHaveBeenCalledExactlyOnceWith({ idle: true, window: 922_000 });
|
||||
expect(f.input).toHaveBeenCalledExactlyOnceWith({ idle: true, window: 872_000 });
|
||||
expect(f.beforeStart).toHaveBeenCalledExactlyOnceWith({
|
||||
messageType: "user",
|
||||
idle: VERSION.startsWith("1.1."),
|
||||
window: 922_000,
|
||||
window: 872_000,
|
||||
});
|
||||
expect(f.stream.mock.lastCall?.[0].contextWindow).toBe(922_000);
|
||||
expect(f.stream.mock.lastCall?.[0].contextWindow).toBe(872_000);
|
||||
expect(select).toHaveBeenCalledTimes(1);
|
||||
expect(thinkingWrites.mock.calls).toEqual([["medium"], ["high"]]);
|
||||
expect(f.session.thinkingLevel).toBe("high");
|
||||
expect(f.session.model?.contextWindow).toBe(922_000);
|
||||
expect(f.session.model?.contextWindow).toBe(872_000);
|
||||
expect(f.confirm).toHaveBeenCalledTimes(1);
|
||||
expect(f.notify).not.toHaveBeenCalledWith(expect.anything(), "warning");
|
||||
expect(network).not.toHaveBeenCalled();
|
||||
|
||||
Reference in new issue
Block a user