



























@@ -322,6 +322,9 @@ describe("runEmbeddedPiAgent overflow compaction trigger routing", () => {
322322expect(pluginParams.runtimePlan).toBe(runtimePlan);
323323const authProfileStore = expectRecordFields(pluginParams.authProfileStore, {});
324324expect(authProfileStore.profiles).toEqual({});
325+expect(
326+(pluginParams as { toolAuthProfileStore?: unknown }).toolAuthProfileStore,
327+).toBeUndefined();
325328});
326329327330it("forwards optional attempt params and the runtime plan into one attempt call", async () => {
@@ -441,6 +444,13 @@ describe("runEmbeddedPiAgent overflow compaction trigger routing", () => {
441444provider: "anthropic",
442445key: "sk-ant",
443446},
447+"xai:work": {
448+type: "oauth" as const,
449+provider: "xai",
450+access: "xai-access",
451+refresh: "xai-refresh",
452+expires: Date.now() + 60_000,
453+},
444454},
445455};
446456mockedEnsureAuthProfileStoreWithoutExternalProfiles.mockReturnValueOnce(codexAuthStore);
@@ -487,14 +497,16 @@ describe("runEmbeddedPiAgent overflow compaction trigger routing", () => {
487497const harnessParams = mockCallArg(pluginRunAttempt) as {
488498runtimePlan?: unknown;
489499authProfileStore?: { profiles?: Record<string, unknown> };
500+toolAuthProfileStore?: unknown;
490501};
491502expect(harnessParams?.runtimePlan).toBe(runtimePlan);
492-const authProfileStore = expectRecordFields(harnessParams.authProfileStore, {});
493-const authProfiles = expectRecordFields(authProfileStore.profiles, {});
503+const forwardedAuthStore = expectRecordFields(harnessParams.authProfileStore, {});
504+const authProfiles = expectRecordFields(forwardedAuthStore.profiles, {});
494505expect(Object.keys(authProfiles)).toEqual(["openai-codex:work"]);
495506expectRecordFields(authProfiles["openai-codex:work"], {
496507provider: "openai-codex",
497508});
509+expect(harnessParams.toolAuthProfileStore).toBe(codexAuthStore);
498510});
499511500512it("forwards OpenAI Codex auth profiles when openai/* is forced through codex", async () => {
@@ -713,6 +725,13 @@ describe("runEmbeddedPiAgent overflow compaction trigger routing", () => {
713725refresh: "refresh-token",
714726expires: Date.now() + 60_000,
715727},
728+"xai:work": {
729+type: "oauth" as const,
730+provider: "xai",
731+access: "xai-token",
732+refresh: "xai-refresh",
733+expires: Date.now() + 60_000,
734+},
716735},
717736};
718737clearAgentHarnesses();
@@ -825,6 +844,17 @@ describe("runEmbeddedPiAgent overflow compaction trigger routing", () => {
825844forwardedAuthProfileId: "openai-codex:default",
826845},
827846});
847+const harnessParams = mockCallArg(pluginRunAttempt) as {
848+authProfileStore?: { profiles?: Record<string, unknown> };
849+toolAuthProfileStore?: unknown;
850+};
851+const forwardedAuthStore = expectRecordFields(harnessParams.authProfileStore, {});
852+const authProfiles = expectRecordFields(forwardedAuthStore.profiles, {});
853+expect(Object.keys(authProfiles)).toEqual(["openai-codex:default"]);
854+expectRecordFields(authProfiles["openai-codex:default"], {
855+provider: "openai-codex",
856+});
857+expect(harnessParams.toolAuthProfileStore).toBe(codexAuthStore);
828858});
829859830860it("refreshes bootstrapped Codex OAuth credentials when rotating profiles", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。