Skip to content

The open source coding agent.

TypeScript

fix(tui): allow exit when viewing child session (#6898)

Rafi Khardalian7324b2260ab6
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
index a41f0ec0dd1..971f76e8df5 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
@@ -65,6 +65,7 @@ import { Editor } from "../../util/editor"
import stripAnsi from "strip-ansi"
import { Footer } from "./footer.tsx"
import { usePromptRef } from "../../context/prompt"
+import { useExit } from "../../context/exit"
import { Filesystem } from "@/util/filesystem"
import { PermissionPrompt } from "./permission"
import { DialogExportOptions } from "../../ui/dialog-export-options"
@@ -191,6 +192,15 @@ export function Session() {
let prompt: PromptRef
const keybind = useKeybind()
+ // Allow exit when in child session (prompt is hidden)
+ const exit = useExit()
+ useKeyboard((evt) => {
+ if (!session()?.parentID) return
+ if (keybind.match("app_exit", evt)) {
+ exit()
+ }
+ })
+
// Helper: Find next visible message boundary in direction
const findNextVisibleMessage = (direction: "next" | "prev"): string | null => {
const children = scroll.getChildren()