feat(sessions): opt-in renaming of sessions after their pull requests - #172
Conversation
A new "Rename sessions after their pull requests" switch (default off) in the Session list preferences group. When on, a session is retitled to the newest PR detected in it — from a tab's PR poll, the sidebar row's PR menu refresh, and a one-time sweep over saved PR lists when the setting is switched on. The title lands in the generated-name slot, so a manual rename always wins and the auto-title paths keep skipping the session. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01REtnD8HVyX4PBz1cNYDpmk
|
@claude review |
|
Claude finished @ghackett's task in 2m 50s —— View job Claude finished reviewing
SummaryThis is a clean, well-scoped feature. I traced all three write paths (
Minor observations (non-blocking)
I was unable to execute No bugs found; nothing here I'd block on. |
Review follow-up: _apply_preferences fires on every preferences save, so apply_pr_titles walked all sessions when e.g. only the font changed. The store now remembers the last-seen pr_title_sessions value and sweeps only on the off-to-on flip; steady-state saves return immediately, and the per-detection apply_pr_title hooks keep names current while the setting stays on. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01REtnD8HVyX4PBz1cNYDpmk
|
Addressed the review's two observations in a8638dc:
|
Summary
Adds a "Rename sessions after their pull requests" switch (default off) to the Session list preferences group. When on, a session is retitled to match the newest pull request detected in it, so the sidebar reads as a list of the PRs being worked on.
MainWindow._on_tab_prs_changed), the sidebar row's PR-menu refresh for sessions with no open tab (SessionRow._pr_menu_refreshed), and a one-time sweep over all saved PR lists when the setting is switched on (SessionStore.apply_pr_titlesfrom_apply_preferences) — so existing sessions with saved PRs retitle immediately.display_name's precedence keeps an explicit rename on top, and the auto-title paths already know to skip a session that has a generated name.pr-linktranscript record carries no title until aghreply enriches it; the newprstatus.newest_titlehelper skips untitled records, so nothing is renamed until the title is actually known (and a titled predecessor is never blanked by a newer bare link).The core logic lives in GTK-free modules (
prstatus.newest_title,SessionStore.apply_pr_title), with tests intest_prstatus.py,test_store.py, andtest_state.py.Screenshots
The new switch in Preferences → Session list:
A session renamed to its PR's title in the sidebar:
🤖 Generated with Claude Code
https://claude.ai/code/session_01REtnD8HVyX4PBz1cNYDpmk