|
1 | | -import { EnvironmentId, ThreadId } from "@t3tools/contracts"; |
| 1 | +import { EnvironmentId, NodeId, ThreadId } from "@t3tools/contracts"; |
2 | 2 | import * as Cause from "effect/Cause"; |
3 | 3 | import { AsyncResult } from "effect/reactivity"; |
4 | 4 | import { expect, it, vi } from "vite-plus/test"; |
@@ -34,6 +34,7 @@ vi.mock(import("../../state/use-atom-command"), () => ({ |
34 | 34 | })); |
35 | 35 |
|
36 | 36 | import { render } from "../../../test/render"; |
| 37 | +import { makeThreadProjectionFixture } from "../../test-fixtures"; |
37 | 38 | import { ToastProvider } from "../ui/toast"; |
38 | 39 | import { ThreadRelationshipsPanel } from "./ThreadRelationshipsControl"; |
39 | 40 |
|
@@ -134,3 +135,51 @@ it.each([ |
134 | 135 | await expect.element(screen.getByRole("button", { name: "More thread actions" })).toBeEnabled(); |
135 | 136 | } |
136 | 137 | }); |
| 138 | + |
| 139 | +it("opens an idle child from Lineage when its shell has not been loaded", async () => { |
| 140 | + setup(); |
| 141 | + const projection = makeThreadProjectionFixture(); |
| 142 | + const childId = ThreadId.make("omitted-child"); |
| 143 | + const environmentId = EnvironmentId.make("local"); |
| 144 | + state.projection = { |
| 145 | + ...projection, |
| 146 | + subagents: [ |
| 147 | + { |
| 148 | + id: NodeId.make("agent"), |
| 149 | + threadId: projection.thread.id, |
| 150 | + runId: null, |
| 151 | + parentNodeId: NodeId.make("parent"), |
| 152 | + origin: "app_owned", |
| 153 | + createdBy: "agent", |
| 154 | + driver: "codex", |
| 155 | + providerInstanceId: projection.thread.providerInstanceId, |
| 156 | + providerThreadId: null, |
| 157 | + childThreadId: childId, |
| 158 | + nativeTaskRef: null, |
| 159 | + prompt: "Inspect the change", |
| 160 | + title: "Idle child", |
| 161 | + model: null, |
| 162 | + status: "completed", |
| 163 | + result: null, |
| 164 | + startedAt: null, |
| 165 | + completedAt: projection.thread.updatedAt, |
| 166 | + updatedAt: projection.thread.updatedAt, |
| 167 | + }, |
| 168 | + ], |
| 169 | + }; |
| 170 | + await using screen = await render( |
| 171 | + <ThreadRelationshipsPanel |
| 172 | + environmentId={environmentId} |
| 173 | + threadId={projection.thread.id} |
| 174 | + showLineage |
| 175 | + showSideChats |
| 176 | + />, |
| 177 | + ); |
| 178 | + await screen.getByRole("button", { name: /Previous agents/ }).click(); |
| 179 | + const child = screen.getByRole("button", { name: /Idle child/ }); |
| 180 | + await expect.element(child).toBeEnabled(); |
| 181 | + await child.click(); |
| 182 | + await vi.waitFor(() => |
| 183 | + expect(screen.router?.state.location.pathname).toBe("/local/omitted-child"), |
| 184 | + ); |
| 185 | +}); |
0 commit comments