Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions src/server/responses/agent-task-recovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const CODEX_ORIGINATORS = new Set([
"Codex Desktop",
"codex_app",
"codex_work_desktop",
"codexless_agent",
]);
const CODEX_OAUTH_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
const OPENAI_TOKEN_ISSUERS = new Set(["https://auth.openai.com", "https://auth.openai.com/"]);
Expand Down
23 changes: 23 additions & 0 deletions tests/agent-task-recovery-security.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,4 +413,27 @@ describe("agent task recovery security", () => {
expect(response.status).toBe(200);
expect(recoveryOriginator).toBe("codex_work_desktop");
});

test("accepts the Codexless originator", async () => {
let recoveryOriginator = "";
globalThis.fetch = (async (input, init) => {
if (String(input).includes("chatgpt.com")) {
recoveryOriginator = new Headers(init?.headers).get("originator") ?? "";
return new Response(recoverySse("Recover the Codexless child task."), { status: 200 });
}
return providerResponse();
}) as typeof fetch;
const headers = codexHeaders();
headers.set("originator", "codexless_agent");

const response = await post(
routedConfig(),
"xai/grok-4.5",
encryptedInput(),
headers,
);

expect(response.status).toBe(200);
expect(recoveryOriginator).toBe("codexless_agent");
});
});
Loading