Keep Codex request identity vanilla (#1377)
This commit is contained in:
@@ -534,6 +534,37 @@ describe("Codex app-server provider", () => {
|
|||||||
await session.close();
|
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 () => {
|
test("rewinds the conversation to a freshly emitted Codex user message id", async () => {
|
||||||
const appServer = createFakeCodexAppServer();
|
const appServer = createFakeCodexAppServer();
|
||||||
const session = new CodexAppServerAgentSession(
|
const session = new CodexAppServerAgentSession(
|
||||||
@@ -2703,7 +2734,17 @@ describe("Codex persisted sessions", () => {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
expect(calls).toEqual([
|
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" } },
|
{ 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 INTERRUPT_TIMEOUT_MS = 2_000;
|
||||||
const CODEX_PROVIDER = "codex" as const;
|
const CODEX_PROVIDER = "codex" as const;
|
||||||
const CODEX_IMAGE_ATTACHMENT_DIR = "paseo-attachments";
|
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 ASSISTANT_MESSAGE_BOUNDARY_MARKDOWN = "\n\n---\n\n";
|
||||||
const CODEX_TOOL_THREAD_ITEM_TYPES = new Set([
|
const CODEX_TOOL_THREAD_ITEM_TYPES = new Set([
|
||||||
"commandExecution",
|
"commandExecution",
|
||||||
@@ -2818,11 +2826,7 @@ function buildCodexAppServerInitializeParams(): {
|
|||||||
capabilities: { experimentalApi: true };
|
capabilities: { experimentalApi: true };
|
||||||
} {
|
} {
|
||||||
return {
|
return {
|
||||||
clientInfo: {
|
clientInfo: CODEX_NON_ORIGINATING_APP_SERVER_CLIENT_INFO,
|
||||||
name: "paseo",
|
|
||||||
title: "Paseo",
|
|
||||||
version: "0.0.0",
|
|
||||||
},
|
|
||||||
capabilities: {
|
capabilities: {
|
||||||
experimentalApi: true,
|
experimentalApi: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user