Skip to content

fix: keep /rename session names across refreshes - #185

Open
tahmidul612 wants to merge 1 commit into
hiroppy:mainfrom
tahmidul612:fix/session-name-persist
Open

tahmidul612 wants to merge 1 commit into
hiroppy:mainfrom
tahmidul612:fix/session-name-persist

Conversation

@tahmidul612

@tahmidul612 tahmidul612 commented Nov 15, 2026 •

Copy link
Copy Markdown

Summary

Session names set with Claude Code's /rename only show up now and then in the sidebar. Most of the time the row shows the agent name.

apply_session_snapshot rebuilds repo_groups from tmux on every 1s refresh. The rebuilt PaneInfos start with an empty session_name (src/tmux/query.rs). refresh_session_names only runs when sessions.dirty is set, which happens after each 10s session_poll_loop tick or when a pane is new or its session_id changes. So a renamed session shows its label for about one tick after each poll, then the next refresh wipes it.

This fix keeps each pane's previous session_name in the pane_id map that apply_session_snapshot already builds. When a pane's session_id hasn't changed, the label is copied onto the rebuilt pane. New panes and changed session_ids still set the dirty flag and get a full refresh_session_names pass, so that optimization still works.

Test plan

  • Added apply_session_snapshot_keeps_session_name_when_session_id_unchanged (the regression) and apply_session_snapshot_drops_session_name_when_session_id_changes
  • cargo test: all tests pass
  • cargo fmt --check passes. cargo clippy --all-targets reports no new warnings (on Rust 1.97 it reports existing collapsible_if warnings in other files)
  • Manual check: with 5 renamed Claude sessions, all labels stay visible across several refresh ticks. Before the fix they disappeared within about a second of each poll.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DfNZyAtMAKWkHpRXBDmQBg

Summary by CodeRabbit

  • Bug Fixes
    • Pane labels are now retained when the session remains unchanged and cleared when a pane switches sessions.

apply_session_snapshot rebuilds every pane from tmux on each 1s refresh,
and the rebuilt panes start with an empty session_name. The cached names
were only re-applied when sessions.dirty was set (the 10s poll, or a
new/changed session_id), so a renamed session showed its label for one
tick after each poll and fell back to the agent name otherwise.

Carry the resolved label over for panes whose session_id is unchanged,
keeping the dirty-flag optimization for the cases that need a full
re-walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DfNZyAtMAKWkHpRXBDmQBg
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

apply_session_snapshot now preserves cached session names when a pane’s session ID is unchanged. It marks names dirty for new panes or changed session IDs. Tests cover both outcomes.

Changes: Session name refresh

Layer / File(s) Summary
Snapshot update and validation
src/state/refresh.rs
The snapshot update retains a pane’s cached session name when its session ID is unchanged. It marks names dirty for new panes or changed session IDs. Tests cover both cases.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: hiroppy

Merge Risk: Minimal · up to 82c02

This change keeps session names set with /rename visible across one-second refreshes. New or changed sessions still trigger a full name refresh. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: session names set with /rename are now kept across refreshes. It matches the summary and objectives, which describe carrying each pane's session_name forward when its …
Description check Passed The description follows the template. It has a Summary section that explains the cause (apply_session_snapshot rebuilds PaneInfo with an empty session_name each second, and refresh_session_names runs …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: session names set with /rename are now kept across refreshes. It matches the summary and objectives, which describe carrying each pane's session_name forward when its session_id is unchanged. The title uses the fix: prefix and is 48 characters long.

Full details: Description check

Explanation

The description follows the template. It has a Summary section that explains the cause (apply_session_snapshot rebuilds PaneInfo with an empty session_name each second, and refresh_session_names runs only when the dirty flag is set) and the fix (carry the label forward when session_id is unchanged). It has a Test plan section that lists the added regression and drop tests, cargo test, cargo fmt and clippy results, and a manual check with five renamed sessions.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 75b27964-b07c-47e1-891e-526d9cad0393
Commits

Reviewing files that changed from the base of the PR and between 1e72a39 and 82c0203.

Files selected for processing: 1

  • src/state/refresh.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

This branch has not been deployed

No deployments
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