From df3b701e4996e2c2fd306bc0d4ecd48821f2666b Mon Sep 17 00:00:00 2001 From: Rolando Santamaria Maso Date: Wed, 30 Sep 2026 09:38:26 +0200 Subject: [PATCH] fix(tui): warn when /copy-session-id runs before a session exists The id only exists after the first session frame lands, so calling the command before the first prompt produced a vague 'no active session yet'. The note now names the cause and the remedy: send a prompt first. --- internal/tui/clipboard.go | 2 +- internal/tui/copy_session_id_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/tui/clipboard.go b/internal/tui/clipboard.go index a5e6c03..a7ab2b2 100644 --- a/internal/tui/clipboard.go +++ b/internal/tui/clipboard.go @@ -242,7 +242,7 @@ func validSessionID(id string) bool { // for a later `bodek --session `. The ✓ Copied flash is the only ack. func (m *Model) copySessionID() tea.Cmd { if !validSessionID(m.sessionID) { - return m.transientNoteCmd("no active session yet") + return m.transientNoteCmd("no session yet — the id exists once a session is created; send a prompt first") } return m.copyText(m.sessionID) } diff --git a/internal/tui/copy_session_id_test.go b/internal/tui/copy_session_id_test.go index e6afa1b..29fa7bf 100644 --- a/internal/tui/copy_session_id_test.go +++ b/internal/tui/copy_session_id_test.go @@ -1,6 +1,7 @@ package tui import ( + "strings" "testing" "github.com/BackendStack21/bodek/internal/workspace" @@ -47,6 +48,13 @@ func TestCopySessionIDWithoutSession(t *testing.T) { if m.copyFlashing() { t.Error("nothing was copied — the flash must stay off") } + // The note must warn and teach: the id only exists once a session is + // created (first prompt), so the operator knows to send a prompt first. + if n := len(m.notices); n == 0 { + t.Fatal("no-session copy must record a visible note") + } else if got := m.notices[n-1]; !strings.Contains(got, "no session") || !strings.Contains(got, "prompt") { + t.Errorf("note = %q, want a warning naming the session and a prompt hint", got) + } } // A hostile id must never reach the clipboard — the payload is a