From df64534045fff266aa8f4a4c17c6d2173f3eda86 Mon Sep 17 00:00:00 2001 From: Long Luong Date: Wed, 4 Nov 2026 22:29:03 +1000 Subject: [PATCH] test(server): bring two selective-timeline e2e cases up to the current contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both failed on main before #66 (abc404083) and after it (45b773e7d); the server source did not change between those commits. CI does not run this file, so neither failure showed. - "a background timeline listener…" called `DaemonClient.setAgentTimelineSubscription`, which was removed in 6f2195904 (2026-09-11) before this case was added (b424206ac). The viewer now sends the same legacy set_subscription frame through the file's existing `setLegacyTimelineMembership`. The case still asserts that a viewer keeps the agent resident and a background listener does not. - "plugin items are gated…": since 6d1329e9b an older client's subagent timeline fetch replaces each item it cannot render with an upgrade line, so the rows and window still match. The case now expects that line and asserts that none of the plugin's data is sent. Mutations: forcing keepsAgentsResident off, or leaking the item into the upgrade line, makes these cases fail. --- .../server/selective-timeline-delivery.e2e.test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/server/src/server/selective-timeline-delivery.e2e.test.ts b/packages/server/src/server/selective-timeline-delivery.e2e.test.ts index c3217f765..492fbb96c 100644 --- a/packages/server/src/server/selective-timeline-delivery.e2e.test.ts +++ b/packages/server/src/server/selective-timeline-delivery.e2e.test.ts @@ -471,9 +471,10 @@ test("a background timeline listener does not keep an agent resident and still f await setBackgroundTimelineSubscription(listener, [agent.id]); expect(manager.isAgentTimelineViewed(agent.id)).toBe(false); - await viewer.client.setAgentTimelineSubscription([agent.id]); + // A viewer's set keeps the agent resident; clearing it lets the agent go. + await viewer.setLegacyTimelineMembership([agent.id]); expect(manager.isAgentTimelineViewed(agent.id)).toBe(true); - await viewer.client.setAgentTimelineSubscription([]); + await viewer.setLegacyTimelineMembership([]); expect(manager.isAgentTimelineViewed(agent.id)).toBe(false); await daemon.daemon.agentManager.closeAgent(agent.id); @@ -804,9 +805,16 @@ test("plugin items are gated in provider child streams, child fetches, and rewin const oldChild = await legacy.client.fetchProviderSubagentTimeline(agent.id, "child"); const newChild = await capable.client.fetchProviderSubagentTimeline(agent.id, "child"); expect(newChild.rows.map((row) => row.item)).toContainEqual(plugin); + // A fetch keeps every row, so the window matches: an item an older client + // cannot render becomes an upgrade line, and none of its data is sent. expect(oldChild.rows.map((row) => row.item)).toEqual([ + { + type: "assistant_message", + text: "Please upgrade Clisbot to view this subagent conversation.", + }, { type: "assistant_message", text: "Child result" }, ]); + expect(JSON.stringify(oldChild.rows)).not.toContain("Provider notice"); expect(oldChild.window).toEqual(newChild.window); await capable.client.sendMessage(agent.id, "Rewind target");