Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

test(e2e): capture binding after model setup

vastsa84e3c50e02eb
diff --git a/apps/desktop/test/e2e/trusted-extensions/drive.mjs b/apps/desktop/test/e2e/trusted-extensions/drive.mjs
index ca9acb404..d6b33a208 100644
--- a/apps/desktop/test/e2e/trusted-extensions/drive.mjs
+++ b/apps/desktop/test/e2e/trusted-extensions/drive.mjs
@@ -99,12 +99,6 @@ await tool("pi_project_open", { path: project });
const created = await tool("pi_session_create", { title: "ext e2e", projectPath: project, mode: "agent" });
const sessionId = created?.session?.id ?? created?.id;
check("session created", !!sessionId, sessionId);
-const initialSession = await tool("pi_session_get", { id: sessionId });
-const initialProviderId = initialSession?.session?.providerId;
-const initialModelId = initialSession?.session?.modelId;
-if (typeof initialProviderId !== "string" || typeof initialModelId !== "string") {
- throw new Error("E2E session did not have an initial model binding");
-}
// 1) tool + hooks (E2E-242)
const firstPrompt = await tool("pi_agent_prompt", { sessionId, content: "please add 20 and 22" });
@@ -209,6 +203,13 @@ const rendererLeaksCredential = await ui.run(() =>
);
check("renderer does not display access or refresh tokens", rendererLeaksCredential === false);
+const initialSession = await tool("pi_session_get", { id: sessionId });
+const initialProviderId = initialSession?.session?.providerId;
+const initialModelId = initialSession?.session?.modelId;
+if (typeof initialProviderId !== "string" || typeof initialModelId !== "string") {
+ throw new Error("E2E session did not have an initial model binding");
+}
+
// Cancel a second login while its Host prompt is open; the plugin signal must
// abort without disturbing the credential from the completed login.
await ui.click("button.model-provider-add");