From 76870fa306830bcea470326781ec4ec4eca514a2 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Tue, 31 Mar 2026 22:55:16 -0700 Subject: [PATCH] feat(claudbg-mfpd): Esc/Backspace returns to session transcript from agent transcript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When on SubagentTranscript, Esc or Backspace now goes back to the parent session's Transcript view (lazy-reloads entries) instead of jumping all the way to the session list. Transcript → session list path unchanged. Co-Authored-By: Claude Sonnet 4.6 --- ...te-back-to-main-session-transcript-from.md | 11 ++++++++-- src/tui/screens/transcript.rs | 14 ++++++++++--- src/tui/state.rs | 21 +++++++++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.beans/claudbg-mfpd--tui-navigate-back-to-main-session-transcript-from.md b/.beans/claudbg-mfpd--tui-navigate-back-to-main-session-transcript-from.md index fd749a8..bf7519b 100644 --- a/.beans/claudbg-mfpd--tui-navigate-back-to-main-session-transcript-from.md +++ b/.beans/claudbg-mfpd--tui-navigate-back-to-main-session-transcript-from.md @@ -1,10 +1,17 @@ --- # claudbg-mfpd title: 'TUI: navigate back to main session transcript from agent transcript' -status: todo +status: completed type: feature +priority: normal created_at: 2026-03-31T23:45:12Z -updated_at: 2026-03-31T23:45:12Z +updated_at: 2026-04-01T05:55:11Z --- There is currently no way to navigate back to the main session transcript after drilling into an agent transcript. Add a keybinding (e.g. Backspace or Escape) to return to the parent session view. + +## Summary of Changes + +Added `go_back_to_transcript(parent_session_id)` to `AppState` in `state.rs`: transitions to `Screen::Transcript { session_id: parent_session_id }`, clears transcript entries (to trigger lazy-reload), and leaves `subagents` intact (they belong to the parent session). + +Changed the Esc/Backspace arm in `handle_transcript_event` (`transcript.rs`) to be context-aware: when on `SubagentTranscript`, calls `go_back_to_transcript` to return to the parent session view; when on `Transcript`, calls `go_back` to return to the session list. Backspace is added as a second binding alongside Escape. diff --git a/src/tui/screens/transcript.rs b/src/tui/screens/transcript.rs index 49eb324..3a93979 100644 --- a/src/tui/screens/transcript.rs +++ b/src/tui/screens/transcript.rs @@ -551,9 +551,17 @@ pub fn handle_transcript_event(event: Event, state: &mut AppState) -> bool { }; true } - // Navigate back to the session list. - KeyCode::Esc => { - state.go_back(); + // Navigate back: from SubagentTranscript → parent session transcript; + // from Transcript → session list. + KeyCode::Esc | KeyCode::Backspace => { + if let crate::tui::state::Screen::SubagentTranscript { + parent_session_id, .. + } = state.screen.clone() + { + state.go_back_to_transcript(&parent_session_id); + } else { + state.go_back(); + } true } // Show quit dialog (don't exit immediately on transcript screen). diff --git a/src/tui/state.rs b/src/tui/state.rs index 770ba98..a2302fb 100644 --- a/src/tui/state.rs +++ b/src/tui/state.rs @@ -300,6 +300,27 @@ impl AppState { self.focus = Focus::ChatLog; } + /// Return to the parent session's transcript from a sub-agent transcript. + /// + /// Clears transcript entries so the lazy-loader will reload the parent + /// session's content. The sub-agents list is left intact because it + /// belongs to the parent session and will still be accurate. + pub fn go_back_to_transcript(&mut self, parent_session_id: &str) { + self.screen = Screen::Transcript { + session_id: parent_session_id.to_string(), + }; + self.transcript_entries.clear(); + self.transcript_scroll = 0; + self.transcript_h_scroll = 0; + self.search_input.clear(); + self.search_active.clear(); + self.search_match_lines.clear(); + self.search_current_match = 0; + self.pending_g = false; + self.focus = Focus::ChatLog; + // Leave subagents intact — they belong to the parent session. + } + /// Return to the session-list screen. /// /// Clears transcript and sub-agent data. The session list and the