





















@@ -55,7 +55,9 @@ import {
5555createResumeHarness,
5656createStartedThreadHarness,
5757fastWait,
58+getMockRuntimeIdentity,
5859mockCall,
60+mockClientRuntimeMethods,
5961queueActiveRunMessageForTest,
6062runCodexAppServerAttempt,
6163setCodexAppServerClientFactoryForTest,
@@ -577,7 +579,7 @@ describe("runCodexAppServerAttempt", () => {
577579throw new Error(`unexpected method: ${method}`);
578580});
579581const client = {
580-getServerVersion: () => "0.132.0",
582+...mockClientRuntimeMethods(),
581583 request,
582584};
583585try {
@@ -728,7 +730,7 @@ describe("runCodexAppServerAttempt", () => {
728730throw new Error(`unexpected method: ${method}`);
729731});
730732const client = {
731-getServerVersion: () => "0.132.0",
733+...mockClientRuntimeMethods(),
732734 request,
733735};
734736try {
@@ -805,7 +807,7 @@ describe("runCodexAppServerAttempt", () => {
805807throw new Error(`unexpected method: ${method}`);
806808});
807809const client = {
808-getServerVersion: () => "0.132.0",
810+...mockClientRuntimeMethods(),
809811 request,
810812};
811813try {
@@ -864,7 +866,7 @@ describe("runCodexAppServerAttempt", () => {
864866throw new Error(`unexpected method: ${method}`);
865867});
866868const client = {
867-getServerVersion: () => "0.132.0",
869+...mockClientRuntimeMethods(),
868870 request,
869871};
870872try {
@@ -1046,7 +1048,7 @@ describe("runCodexAppServerAttempt", () => {
1046104810471049await startOrResumeThread({
10481050client: {
1049-getServerVersion: () => "0.132.0",
1051+...mockClientRuntimeMethods(),
10501052request: async (method: string, requestParams?: unknown) => {
10511053requests.push({ method, params: requestParams });
10521054if (method === "thread/start") {
@@ -1901,6 +1903,7 @@ describe("runCodexAppServerAttempt", () => {
19011903let notify: ((notification: CodexServerNotification) => Promise<void>) | undefined;
19021904setCodexAppServerClientFactoryForTest(async () => {
19031905const client = {
1906+ ...mockClientRuntimeMethods(),
19041907request: vi.fn(async (method: string) => {
19051908events.push(`request:${method}`);
19061909if (method === "thread/start") {
@@ -1962,6 +1965,7 @@ describe("runCodexAppServerAttempt", () => {
19621965let startedClient: unknown;
19631966setCodexAppServerClientFactoryForTest(async () => {
19641967const client = {
1968+ ...mockClientRuntimeMethods(),
19651969request: vi.fn(async (method: string) => {
19661970events.push(`request:${method}`);
19671971if (method === "thread/start") {
@@ -2003,6 +2007,7 @@ describe("runCodexAppServerAttempt", () => {
20032007setCodexAppServerClientFactoryForTest(
20042008async () =>
20052009({
2010+ ...mockClientRuntimeMethods(),
20062011request: vi.fn(async (method: string) => {
20072012if (method === "thread/start") {
20082013return threadStartResult();
@@ -3925,6 +3930,7 @@ describe("runCodexAppServerAttempt", () => {
39253930setCodexAppServerClientFactoryForTest(
39263931async () =>
39273932({
3933+ ...mockClientRuntimeMethods(),
39283934 request,
39293935addNotificationHandler: (handler: typeof notify) => {
39303936notify = handler;
@@ -4026,6 +4032,7 @@ describe("runCodexAppServerAttempt", () => {
40264032key: buildCodexPluginAppCacheKey({
40274033 appServer,
40284034 agentDir,
4035+runtimeIdentity: getMockRuntimeIdentity(),
40294036}),
40304037request: async () => ({
40314038data: [
@@ -4128,6 +4135,7 @@ describe("runCodexAppServerAttempt", () => {
41284135setCodexAppServerClientFactoryForTest(
41294136async () =>
41304137({
4138+ ...mockClientRuntimeMethods(),
41314139 request,
41324140addNotificationHandler: (handler: typeof notify) => {
41334141notify = handler;
@@ -4230,6 +4238,7 @@ describe("runCodexAppServerAttempt", () => {
42304238 agentDir,
42314239 authProfileId,
42324240accountId: "account-work",
4241+runtimeIdentity: getMockRuntimeIdentity(),
42334242}),
42344243request: async () => ({
42354244data: [
@@ -4373,6 +4382,7 @@ describe("runCodexAppServerAttempt", () => {
43734382startOptions: appServer.start,
43744383baseEnv: { CODEX_API_KEY: "old-codex-env-key" },
43754384}),
4385+runtimeIdentity: getMockRuntimeIdentity(),
43764386}),
43774387request: async () => ({
43784388data: [
@@ -4564,6 +4574,7 @@ describe("runCodexAppServerAttempt", () => {
45644574setCodexAppServerClientFactoryForTest(
45654575async () =>
45664576({
4577+ ...mockClientRuntimeMethods(),
45674578 request,
45684579addNotificationHandler: () => () => undefined,
45694580addRequestHandler: () => () => undefined,
@@ -4609,6 +4620,7 @@ describe("runCodexAppServerAttempt", () => {
46094620setCodexAppServerClientFactoryForTest(
46104621async () =>
46114622({
4623+ ...mockClientRuntimeMethods(),
46124624 request,
46134625addNotificationHandler: () => () => undefined,
46144626addRequestHandler: () => () => undefined,
@@ -4911,6 +4923,7 @@ describe("runCodexAppServerAttempt", () => {
49114923const methods: string[] = [];
49124924requests.push(methods);
49134925return {
4926+ ...mockClientRuntimeMethods(),
49144927request: vi.fn(async (method: string) => {
49154928methods.push(method);
49164929if (method === "thread/resume" && startIndex === 0) {
@@ -4963,6 +4976,7 @@ describe("runCodexAppServerAttempt", () => {
49634976const methods: string[] = [];
49644977requests.push(methods);
49654978return {
4979+ ...mockClientRuntimeMethods(),
49664980request: vi.fn(async (method: string) => {
49674981methods.push(method);
49684982if (method === "thread/resume" && startIndex < 2) {
@@ -5010,6 +5024,7 @@ describe("runCodexAppServerAttempt", () => {
50105024let failedClient: unknown;
50115025setCodexAppServerClientFactoryForTest(async () => {
50125026const c = {
5027+ ...mockClientRuntimeMethods(),
50135028request: vi.fn(async (method: string) => {
50145029if (method === "thread/start") {
50155030throw new CodexAppServerRpcError(
@@ -5043,6 +5058,7 @@ describe("runCodexAppServerAttempt", () => {
50435058let failedClient: unknown;
50445059setCodexAppServerClientFactoryForTest(async () => {
50455060const c = {
5061+ ...mockClientRuntimeMethods(),
50465062request: vi.fn(async (method: string) => {
50475063if (method === "thread/start") {
50485064return await new Promise<never>(() => {});
@@ -5076,6 +5092,7 @@ describe("runCodexAppServerAttempt", () => {
50765092let failedClient: unknown;
50775093setCodexAppServerClientFactoryForTest(async () => {
50785094const c = {
5095+ ...mockClientRuntimeMethods(),
50795096request: vi.fn(async (method: string) => {
50805097if (method === "thread/start") {
50815098throw new Error("write EPIPE");
@@ -5106,6 +5123,7 @@ describe("runCodexAppServerAttempt", () => {
51065123let failedClient: unknown;
51075124setCodexAppServerClientFactoryForTest(async () => {
51085125const c = {
5126+ ...mockClientRuntimeMethods(),
51095127request: vi.fn(async (method: string) => {
51105128if (method === "thread/start") {
51115129throw new CodexAppServerRpcError(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。