Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion apps/code/scripts/download-binaries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DEST_DIR = join(__dirname, "..", "resources", "codex-acp");
const BINARIES = [
{
name: "codex",
version: "0.140.0",
version: "0.144.0",
getUrl: (version, target) => {
if (target.includes("windows")) {
return `https://github.com/openai/codex/releases/download/rust-v${version}/codex-${target}.exe.zip`;
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"@anthropic-ai/claude-agent-sdk": "0.3.197",
"@anthropic-ai/sdk": "0.109.0",
"@hono/node-server": "^1.19.9",
"@openai/codex": "0.140.0",
"@openai/codex": "0.144.0",
"@opentelemetry/api-logs": "^0.208.0",
"@opentelemetry/exporter-logs-otlp-http": "^0.208.0",
"@opentelemetry/resources": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,32 @@ describe("CodexAppServerAgent", () => {
);
});

it("rejects the prompt with guidance when the gateway request is too large", async () => {
const stub = makeStubRpc({ "thread/start": { thread: { id: "t" } } });
const { client } = makeFakeClient();
const agent = new CodexAppServerAgent(client, {
processOptions: { binaryPath: "/x/codex" },
rpcFactory: stub.factory,
});

await agent.newSession({ cwd: "/r" } as unknown as NewSessionRequest);
const done = agent.prompt({
sessionId: "t",
prompt: [{ type: "text", text: "continue" }],
} as unknown as PromptRequest);
stub.emit("error", {
willRetry: false,
error: {
message:
"unexpected status 413 Payload Too Large: Request body too large",
},
});

await expect(done).rejects.toThrow(
"This conversation is too large to continue",
);
});

it("ends the turn without turn/start when no prompt block is usable", async () => {
const stub = makeStubRpc({ "thread/start": { thread: { id: "t" } } });
const { client } = makeFakeClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,18 @@ export class CodexAppServerAgent extends BaseAcpAgent {
this.turns.fail(RequestError.internalError(undefined, message));
return;
}
if (
message.includes("413") ||
message.toLowerCase().includes("request body too large")
) {
this.turns.fail(
RequestError.internalError(
undefined,
"This conversation is too large to continue. Start a new task and carry over a text summary instead of image or tool output.",
),
);
return;
}
void this.finalizeTurn("refusal");
}
}
Expand Down
58 changes: 29 additions & 29 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading