Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

test(e2e): create Alice's Another Me in the real-service harness

jeffrey78bbd2c48d88
diff --git a/apps/node-services/tests/document/realtime-e2e-environment.ts b/apps/node-services/tests/document/realtime-e2e-environment.ts
index 22b99bb0..03bc260e 100644
--- a/apps/node-services/tests/document/realtime-e2e-environment.ts
+++ b/apps/node-services/tests/document/realtime-e2e-environment.ts
@@ -45,6 +45,9 @@ const secretSeed = "e2e-document-runtime-secret-seed-0123456789";
const teamHubToRuntimeToken = serviceCredential("node-services-internal", {
LINGER_SECRET_SEED: secretSeed,
})!;
+const teamHubInternalToken = serviceCredential("teamhub-internal", {
+ LINGER_SECRET_SEED: secretSeed,
+})!;
const connectionTokenKey = serviceCredential("document-connection-token", {
LINGER_SECRET_SEED: secretSeed,
})!;
@@ -132,6 +135,7 @@ export class RealRealtimeE2EEnvironment implements RealtimeE2EControl {
`${this.#teamHubBaseUrl}/healthz`,
this.#config.teamHubStartupTimeoutMs,
);
+ await this.#fixtureManager.ensureAnotherMe(teamHubInternalToken);
if (process.env.VERIFY_ROOM_STARTUP_PRODUCTION === "1") {
await this.#fixtureManager.seedStartupDirectory();
}
diff --git a/apps/node-services/tests/document/realtime-e2e-fixture.ts b/apps/node-services/tests/document/realtime-e2e-fixture.ts
index 5bd33c05..7fc9d87f 100644
--- a/apps/node-services/tests/document/realtime-e2e-fixture.ts
+++ b/apps/node-services/tests/document/realtime-e2e-fixture.ts
@@ -173,6 +173,46 @@ export class RealTeamHubFixtureManager {
ON CONFLICT (computer_id) DO UPDATE SET status='online',last_seen_at=now()`;
}
+ // The Web covers the product until the Human's Another Me exists, and
+ // TeamHub creates it only when it observes her Computer online. Send the
+ // Runner heartbeat once, then remove the Computer again so every test still
+ // starts without a connected one.
+ async ensureAnotherMe(teamHubInternalToken: string): Promise<void> {
+ await this.connectOwnerComputer();
+ const [computer] = await this.#sql<{ computer_id: string }[]>`
+ SELECT computer_id FROM agent_registrations WHERE actor_id='actor_acme_official'`;
+ if (computer === undefined) {
+ throw new Error("The seeded @official Agent has no Computer");
+ }
+ const response = await fetchTeamHub(
+ `${this.#baseUrl}/v0/agent-runtime/local-computers/touch`,
+ {
+ body: JSON.stringify({
+ computer_id: computer.computer_id,
+ // TeamHub ignores a heartbeat no newer than the stored one.
+ seen_at: new Date(Date.now() + 1_000).toISOString(),
+ status: "online",
+ }),
+ headers: {
+ authorization: `Bearer ${teamHubInternalToken}`,
+ connection: "close",
+ "content-type": "application/json",
+ },
+ method: "POST",
+ },
+ "POST /v0/agent-runtime/local-computers/touch",
+ );
+ await assertStatus(response, 200);
+ const [anotherMe] = await this.#sql`
+ SELECT 1 FROM agent_registrations
+ WHERE tenant_id='tenant_acme' AND agent_type='anotherme' AND status='active'`;
+ await this
+ .#sql`DELETE FROM local_computers WHERE computer_id=${computer.computer_id}`;
+ if (anotherMe === undefined) {
+ throw new Error("TeamHub did not create Alice's Another Me");
+ }
+ }
+
async cleanup(fixture: RoomDocumentE2EFixture): Promise<void> {
await this.#sql`DELETE FROM local_computers WHERE computer_id=(
SELECT computer_id FROM agent_registrations WHERE actor_id='actor_acme_official')`;
diff --git a/apps/web/e2e/room-document-office-preview-entry.spec.ts b/apps/web/e2e/room-document-office-preview-entry.spec.ts
index f7319c20..26ba97ac 100644
--- a/apps/web/e2e/room-document-office-preview-entry.spec.ts
+++ b/apps/web/e2e/room-document-office-preview-entry.spec.ts
@@ -149,7 +149,10 @@ test("ordinary Office entry and direct link load only preview dependencies", asy
await cardVersion;
clickedAt = performance.now();
await reader
- .getByRole("button", { name: `Open ${entryFilename}`, exact: true })
+ .getByRole("button", {
+ name: `Preview ${entryFilename}`,
+ exact: true,
+ })
.click();
} else {
const pinned = await page.request.post(
@@ -177,7 +180,7 @@ test("ordinary Office entry and direct link load only preview dependencies", asy
await reader
.getByRole("article")
.filter({ hasText: "Pinned Version" })
- .getByRole("button", { name: `Open ${filename}`, exact: true })
+ .getByRole("button", { name: `Preview ${filename}`, exact: true })
.click();
}
const frame = reader.frameLocator(
diff --git a/apps/web/e2e/room-startup-production.spec.ts b/apps/web/e2e/room-startup-production.spec.ts
index 66a4060c..8c4d2cc6 100644
--- a/apps/web/e2e/room-startup-production.spec.ts
+++ b/apps/web/e2e/room-startup-production.spec.ts
@@ -68,9 +68,14 @@ test("production Room startup records cold and warm document loads", async ({
const directoryPath = `/v0/tenants/${fixture.tenant_id}/agents`;
const directory = await page.request.get(directoryPath + "?limit=200");
expect(directory.ok()).toBe(true);
- const agents = (await directory.json()).items;
- // The single Human sees all eight seeded Agents, including the one that
- // used to be outside the directory's former multi-Human scope.
+ // The directory also lists the Another Me and starter Agents that TeamHub
+ // creates for Alice; the assertions cover the SQL-seeded Agents.
+ const agents = (await directory.json()).items.filter(
+ (agent: { actor: { id: string } }) =>
+ agent.actor.id === "actor_acme_official" ||
+ agent.actor.id.startsWith("actor_directory_"),
+ );
+ // The single Human sees all eight seeded Agents.
expect(agents).toHaveLength(8);
expect(
agents.reduce(
@@ -78,7 +83,7 @@ test("production Room startup records cold and warm document loads", async ({
sum + agent.skill_bindings.length,
0,
),
- ).toBe(8 * 13 + 6); // Thirteen defaults each; three explicit bindings on two Agents.
+ ).toBe(8 * 13 + 8); // Thirteen defaults each; four explicit bindings on two Agents.
const target = agents.find(
(agent: { actor: { display_name: string } }) =>
agent.actor.display_name === "Directory Agent 1",