9dfa06ffee
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Signed-off-by: cls_宁波本机 <908705107@qq.com>
143 lines
4.6 KiB
TypeScript
143 lines
4.6 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
import { installMockBridge } from "../helpers/bridge";
|
|
|
|
// Mock agent pubkeys (distinct from the relay agents seeded by default).
|
|
const AGENT_PAUL = "aa".repeat(32);
|
|
const AGENT_DUNCAN = "bb".repeat(32);
|
|
|
|
// Mock channel IDs from the e2e bridge.
|
|
const CHANNEL_GENERAL = "9a1657ac-f7aa-5db0-b632-d8bbeb6dfb50";
|
|
const CHANNEL_ENGINEERING = "1c7e1c02-87bb-5e88-b2da-5a7a9432d0c9";
|
|
|
|
// A fixed epoch so the mocked clock is deterministic across runs.
|
|
const T0 = new Date("2026-06-18T12:00:00.000Z");
|
|
|
|
// Past both thresholds: FRAME_GAP_PAUSE_MS (20s) and REMOVE_AFTER_MS (25s).
|
|
// Several 5s prune ticks fire across this span, so shouldPausePrune is what
|
|
// keeps the badges alive — not the absence of a prune tick.
|
|
const FRAME_GAP_MS = 30_000;
|
|
|
|
type SeedInput = {
|
|
agentPubkey: string;
|
|
channelId: string;
|
|
turnId: string;
|
|
};
|
|
|
|
async function waitForBridge(page: import("@playwright/test").Page) {
|
|
await page.waitForFunction(
|
|
() =>
|
|
typeof (window as Window & { __BUZZ_E2E_SEED_ACTIVE_TURNS__?: unknown })
|
|
.__BUZZ_E2E_SEED_ACTIVE_TURNS__ === "function",
|
|
null,
|
|
{ timeout: 10_000 },
|
|
);
|
|
}
|
|
|
|
async function openAgentsView(page: import("@playwright/test").Page) {
|
|
await page.goto("/", { waitUntil: "domcontentloaded" });
|
|
await waitForBridge(page);
|
|
await page.getByTestId("open-agents-view").click();
|
|
await expect(page.getByTestId("unified-agents-groups")).toBeVisible({
|
|
timeout: 10_000,
|
|
});
|
|
}
|
|
|
|
async function seedTurns(
|
|
page: import("@playwright/test").Page,
|
|
turns: SeedInput[],
|
|
) {
|
|
await page.evaluate((seeds) => {
|
|
const win = window as Window & {
|
|
__BUZZ_E2E_SEED_ACTIVE_TURNS__?: (input: {
|
|
agentPubkey: string;
|
|
channelId: string;
|
|
turnId: string;
|
|
}) => void;
|
|
};
|
|
for (const seed of seeds) win.__BUZZ_E2E_SEED_ACTIVE_TURNS__?.(seed);
|
|
}, turns);
|
|
}
|
|
|
|
async function openAgentProfile(
|
|
page: import("@playwright/test").Page,
|
|
pubkey: string,
|
|
) {
|
|
await page.getByTestId(`managed-agent-${pubkey}`).click();
|
|
const panel = page.getByTestId("user-profile-panel");
|
|
await expect(panel).toBeVisible({ timeout: 5_000 });
|
|
return panel;
|
|
}
|
|
|
|
test.describe("active turn badge resilience", () => {
|
|
test.use({ viewport: { width: 1280, height: 720 } });
|
|
|
|
test("badges persist through an all-at-once liveness gap", async ({
|
|
page,
|
|
}) => {
|
|
// Install the mocked clock BEFORE navigation so the store's Date.now() /
|
|
// setInterval and the badge's useNow(1000) all run on the mocked clock from
|
|
// module init. Seeded turns then stamp lastActivityAt at T0.
|
|
await installMockBridge(page, {
|
|
managedAgents: [
|
|
{
|
|
pubkey: AGENT_PAUL,
|
|
name: "Paul",
|
|
status: "running",
|
|
channelNames: ["general", "engineering"],
|
|
},
|
|
{
|
|
pubkey: AGENT_DUNCAN,
|
|
name: "Duncan",
|
|
status: "running",
|
|
channelNames: ["general"],
|
|
},
|
|
],
|
|
});
|
|
await page.clock.install({ time: T0 });
|
|
|
|
await openAgentsView(page);
|
|
|
|
// Both agents working across channels — the healthy multi-agent state.
|
|
await seedTurns(page, [
|
|
{
|
|
agentPubkey: AGENT_PAUL,
|
|
channelId: CHANNEL_GENERAL,
|
|
turnId: "t-paul-g",
|
|
},
|
|
{
|
|
agentPubkey: AGENT_PAUL,
|
|
channelId: CHANNEL_ENGINEERING,
|
|
turnId: "t-paul-e",
|
|
},
|
|
{
|
|
agentPubkey: AGENT_DUNCAN,
|
|
channelId: CHANNEL_GENERAL,
|
|
turnId: "t-duncan-g",
|
|
},
|
|
]);
|
|
|
|
const paulPanel = await openAgentProfile(page, AGENT_PAUL);
|
|
await expect(paulPanel).toBeVisible();
|
|
|
|
// The profile panel surfaces active turns via the live-activity embed only
|
|
// where an agent session can open (channel surfaces). In the Agents view
|
|
// the store-driven working state shows as sidebar channel badges — the
|
|
// same activeAgentTurnsStore this test exercises.
|
|
const generalBadge = page.getByTestId("channel-working-general");
|
|
const engineeringBadge = page.getByTestId("channel-working-engineering");
|
|
await expect(generalBadge).toBeVisible({ timeout: 5_000 });
|
|
await expect(engineeringBadge).toBeVisible();
|
|
|
|
// Simulate the all-at-once relay drop: no further frames, advance the clock
|
|
// past both thresholds. This fires several real prune ticks; shouldPausePrune
|
|
// sees every turn's lastActivityAt stuck at T0 (gap > 20s) and pauses the
|
|
// prune, so the active-turn-driven working badges survive. Under the
|
|
// pre-fix code every badge would be gone after the first tick past 25s.
|
|
await page.clock.fastForward(FRAME_GAP_MS);
|
|
|
|
await expect(generalBadge).toBeVisible();
|
|
await expect(engineeringBadge).toBeVisible();
|
|
});
|
|
});
|