Keep Codex request identity vanilla (#1377)

This commit is contained in:
Mohamed Boudra
2026-06-06 21:00:25 +08:00
committed by GitHub
parent db4376d17a
commit 2822c02543
2 changed files with 51 additions and 6 deletions
@@ -534,6 +534,37 @@ describe("Codex app-server provider", () => {
await session.close();
});
test("initializes Codex app-server without making Paseo the request originator", async () => {
let initializeParams: unknown;
const appServer = createFakeCodexAppServer({
initialize: (params) => {
initializeParams = params;
return {};
},
"collaborationMode/list": () => ({ data: [] }),
"skills/list": () => ({ data: [] }),
});
const session = new CodexAppServerAgentSession(
createConfig({ cwd: "/workspace/project" }),
null,
createTestLogger(),
async () => appServer.child,
);
await session.connect();
expect(initializeParams).toEqual({
clientInfo: {
name: "codex_app_server_daemon",
title: "Codex App Server Daemon",
version: "0.0.0",
},
capabilities: { experimentalApi: true },
});
appServer.assertNoErrors();
await session.close();
});
test("rewinds the conversation to a freshly emitted Codex user message id", async () => {
const appServer = createFakeCodexAppServer();
const session = new CodexAppServerAgentSession(
@@ -2703,7 +2734,17 @@ describe("Codex persisted sessions", () => {
}),
);
expect(calls).toEqual([
{ method: "initialize", params: expect.any(Object) },
{
method: "initialize",
params: {
clientInfo: {
name: "codex_app_server_daemon",
title: "Codex App Server Daemon",
version: "0.0.0",
},
capabilities: { experimentalApi: true },
},
},
{ method: "thread/list", params: { limit: 50, cwd: "/workspace/project-a" } },
]);
});
@@ -103,6 +103,14 @@ const TURN_START_TIMEOUT_MS = 90 * 1000;
const INTERRUPT_TIMEOUT_MS = 2_000;
const CODEX_PROVIDER = "codex" as const;
const CODEX_IMAGE_ATTACHMENT_DIR = "paseo-attachments";
// Codex treats most app-server client names as the model-request originator.
// This reserved Codex name is non-originating, so requests keep Codex's default
// CLI identity instead of showing up as Paseo in provider usage logs.
const CODEX_NON_ORIGINATING_APP_SERVER_CLIENT_INFO = {
name: "codex_app_server_daemon",
title: "Codex App Server Daemon",
version: "0.0.0",
} as const;
const ASSISTANT_MESSAGE_BOUNDARY_MARKDOWN = "\n\n---\n\n";
const CODEX_TOOL_THREAD_ITEM_TYPES = new Set([
"commandExecution",
@@ -2818,11 +2826,7 @@ function buildCodexAppServerInitializeParams(): {
capabilities: { experimentalApi: true };
} {
return {
clientInfo: {
name: "paseo",
title: "Paseo",
version: "0.0.0",
},
clientInfo: CODEX_NON_ORIGINATING_APP_SERVER_CLIENT_INFO,
capabilities: {
experimentalApi: true,
},