fix(sessions): keep ignored provider mutations inert

This commit is contained in:
Federico Jaramillo Martinez
2026-07-22 20:58:56 +02:00
parent ee8d9e5359
commit e70b3d6bb9
4 changed files with 48 additions and 7 deletions
+7 -1
View File
@@ -3,13 +3,19 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
import { InMemoryCredentialStore, type AuthPrompt, type Credential } from "@earendil-works/pi-ai";
import { afterEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { OAuthFlowState } from "../../shared/apiTypes.js";
import { AuthService, createModelRuntimeForAgentDir, type AuthChange, type AuthServiceLogger } from "./authService.js";
import { OAuthLoginFlowService } from "./oauthLoginFlowService.js";
const tempDirs: string[] = [];
beforeEach(() => {
// Pi 0.81 uses PI_OFFLINE for refreshes after runtime creation. Auth tests
// exercise local credential behavior and must never fetch provider catalogs.
vi.stubEnv("PI_OFFLINE", "1");
});
afterEach(async () => {
vi.unstubAllEnvs();
await Promise.all(tempDirs.splice(0).map((dir) => rm(dir, { recursive: true, force: true })));