Skip to content

feat(tui): ctrl+c quit confirmation and /new fresh-session command - #59

Merged
jkyberneees merged 2 commits into
mainfrom
feat/session-lifecycle
Sep 1, 2026
Merged

feat(tui): ctrl+c quit confirmation and /new fresh-session command#59
jkyberneees merged 2 commits into
mainfrom
feat/session-lifecycle

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

Two session-lifecycle features:

1. Ctrl+C quit confirmation

The first ^C arms the standard two-step confirm gate — y or a second ^C fires, any other key disarms (and is consumed, never typed). All 11 quit sites now route through armConfirm(confirmQuit) instead of quitting outright; the gate renders at the top of footer() so it is visible from every context that can arm it. /quit stays immediate (explicit typed intent).

2. /new — start a fresh session

/clear only wipes the local view; the session kept accumulating history and context server-side. Verified against odek's protocol: sessions bind per WebSocket connection, and a sessionless connection's first prompt mints a brand-new session. So /new drops the session identity and closes the socket — the standard reconnect lands sessionless and the next prompt starts a genuinely new session (new ID, empty history/buffer). The old session stays resumable via /sessions.

Guards: idle-only (like /clear), plus pending approvals and queued prompts — both would be destroyed by the forced redial.

Test plan

  • RED-first: quit_confirm_test.go (5 tests + 8-context matrix) and new_session_test.go (guards, reset, reconnect-lands-fresh)
  • Existing immediate-quit tests flipped to gate semantics
  • /new e2e case added to TestE2EAllCommands (registry completeness guard)
  • make fmt vet lint test — lint 0 issues, all packages green under -race

The first ^C arms the standard confirm gate (y or a second ^C fires,
any other key disarms and is consumed); all 11 quit sites now route
through armConfirm(confirmQuit) instead of quitting outright, and the
gate renders from the top of footer() so it is visible from every
context that can arm it — panels, overlays, approvals, composer.
/clear only wipes the local view — the session kept accumulating
history and context server-side. odek binds sessions per connection
and mints a new one on a sessionless connection's first prompt, so
/new drops the session identity and closes the socket: the standard
reconnect lands sessionless and the next prompt starts a genuinely
new session. The old one stays resumable via /sessions.

Idle-only like /clear, plus guards for pending approvals and queued
prompts — both would be destroyed by the forced redial.
@jkyberneees
jkyberneees merged commit 6e8487e into main Sep 1, 2026
7 checks passed
@jkyberneees
jkyberneees deleted the feat/session-lifecycle branch September 1, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant