diff --git a/packages/tui/src/component/dialog-open.tsx b/packages/tui/src/component/dialog-open.tsx index 5b24d30057a..6406e245ffd 100644 --- a/packages/tui/src/component/dialog-open.tsx +++ b/packages/tui/src/component/dialog-open.tsx @@ -161,7 +161,7 @@ export function DialogOpen(props: { sessions: SessionInfo[]; onLoad: (sessions: const seen = new Set() const match = matched() const list = [...data.session.list(), ...props.sessions, ...(match ? [match] : [])].filter((session) => { - if (session.parentID || seen.has(session.id)) return false + if ((session.parentID && session.id !== match?.id) || seen.has(session.id)) return false if (session.time.archived !== undefined && session.id !== match?.id) return false seen.add(session.id) return true diff --git a/packages/tui/test/cli/tui/dialog-open.test.tsx b/packages/tui/test/cli/tui/dialog-open.test.tsx index 92b61763448..92dd20b60c9 100644 --- a/packages/tui/test/cli/tui/dialog-open.test.tsx +++ b/packages/tui/test/cli/tui/dialog-open.test.tsx @@ -59,7 +59,7 @@ test("selecting an unhydrated session preserves its location", async () => { } }) -test("finds and opens an exact session ID outside the recent list", async () => { +test("finds and opens an exact child session ID outside the recent list", async () => { const sessionID = "ses_04a7a3d82ffeIphUJgd3SnEqiv" const remote = { directory: "/tmp/opencode/archive", workspaceID: "ws_archive" } const fixture = await renderOpen((url) => { @@ -68,6 +68,7 @@ test("finds and opens an exact session ID outside the recent list", async () => return json({ data: { id: sessionID, + parentID: "ses_04a7a3d82ffeParentSessionID", projectID: "proj_archive", cost: 0, tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },