From 2658ec02c848ce7e5bd618ee2e18256c5c0992db Mon Sep 17 00:00:00 2001 From: Sanghyuk Lee <49530170+ricky9408@users.noreply.github.com> Date: Fri, 6 Nov 2026 12:11:19 +0900 Subject: [PATCH] fix(tui): enable transcript jumps in subagent sessions (#60817) Co-authored-by: DS <78942835+Tarquinen@users.noreply.github.com> --- packages/tui/src/routes/session/index.tsx | 1 + .../test/session-subagent-navigation.test.tsx | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 packages/tui/test/session-subagent-navigation.test.tsx diff --git a/packages/tui/src/routes/session/index.tsx b/packages/tui/src/routes/session/index.tsx index 5b22bc813e6..bda05149e1d 100644 --- a/packages/tui/src/routes/session/index.tsx +++ b/packages/tui/src/routes/session/index.tsx @@ -1450,6 +1450,7 @@ export function Session(props: { })) Keymap.createLayer(() => ({ + mode: "composer", enabled: () => renderer.currentFocusedEditor === null, bindings: baseAndUnfocusedCommands.map((command) => command.id), })) diff --git a/packages/tui/test/session-subagent-navigation.test.tsx b/packages/tui/test/session-subagent-navigation.test.tsx new file mode 100644 index 00000000000..46267a78fe9 --- /dev/null +++ b/packages/tui/test/session-subagent-navigation.test.tsx @@ -0,0 +1,44 @@ +import { expect, test } from "bun:test" +import { createAppFixture } from "./fixture/app" +import { directory, json } from "./fixture/tui-client" + +test("Home and End navigate a subagent transcript", async () => { + const session = { + id: "ses_subagent_navigation", + parentID: "ses_parent", + title: "Subagent", + agent: "build", + projectID: "proj_test", + location: { directory }, + cost: 0, + tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } }, + time: { created: 0, updated: 0 }, + } + const messages = Array.from({ length: 20 }, (_, index) => ({ + id: `message-${index}`, + type: "user", + text: `Message ${index}`, + time: { created: index }, + })) + await using setup = await createAppFixture({ + width: 100, + height: 30, + config: { animations: false, tabs: { mode: "off" } }, + args: { sessionID: session.id }, + fetch: (url) => { + if (url.pathname === "/api/session") return json({ data: [session], cursor: {} }) + if (url.pathname === `/api/session/${session.id}`) return json({ data: session }) + if (url.pathname === `/api/session/${session.id}/message`) + return json({ data: messages.toReversed(), cursor: {} }) + if (url.pathname === `/api/session/${session.id}/inbox`) return json({ data: [] }) + }, + }) + await setup.ready + expect( + await setup.waitForFrame((frame) => frame.includes("Message 19") && frame.includes("Subagents")), + ).not.toContain("Message 0") + setup.mockInput.pressKey("HOME") + expect(await setup.waitForFrame((frame) => frame.includes("Message 0"))).not.toContain("Message 19") + setup.mockInput.pressKey("END") + expect(await setup.waitForFrame((frame) => frame.includes("Message 19"))).not.toContain("Message 0") +})