Skip to content

Feature/rename sessions#7

Merged
nahime0 merged 11 commits intomainfrom
feature/rename-sessions
Mar 9, 2026
Merged

Feature/rename sessions#7
nahime0 merged 11 commits intomainfrom
feature/rename-sessions

Conversation

@nahime0
Copy link
Copy Markdown
Member

@nahime0 nahime0 commented Mar 9, 2026

Rename sessions from TUI / Tray and API


Note

Medium Risk
Adds new state persistence and write-capable endpoints plus UI keybinding changes, so regressions could affect session listing/search and live updates across interfaces.

Overview
Adds persistent custom session names stored in ~/.config/lazyagent/session-names.json and surfaced across the TUI, macOS tray UI, and HTTP API.

Implements rename flows in the UIs (r key / double-click / Rename button) and introduces API support via PUT/DELETE /api/sessions/{id}/name, including propagating changes through SSE updates and returning custom_name in session payloads.

Updates core session filtering to match on custom names as well as CWD, auto-reloads names if the file changes externally, and fixes ShortName/PadRight to be rune-aware (better Unicode truncation/padding).

Written by Cursor Bugbot for commit a61bb12. This will update automatically on new commits. Configure here.

nahime0 added 4 commits March 9, 2026 14:32
Add SessionNames store (~/.config/lazyagent/session-names.json) for
user-defined session aliases. Names sync across processes via modtime
check on the 1s activity tick. Search also matches custom names.

Fix rune-aware truncation in ShortName and PadRight to prevent layout
corruption with multi-byte characters.
Replace 'r' keybinding from manual refresh (redundant with auto-refresh)
to session rename with inline modal input. Display custom names in list
and detail panels. Add custom_name field to API SessionItem.
Add rename via 'r' key, double-click on list item, or Rename button in
detail panel. Expose SetSessionName/GetSessionName bindings to Svelte
frontend. Replace 'r refresh' with 'r rename' in footer.
PUT /api/sessions/{id}/name sets a custom name (JSON body: {"name": "..."}).
DELETE /api/sessions/{id}/name resets to default path. Both trigger an
SSE push so connected clients update immediately. Playground updated
with interactive controls for the new endpoints.
- Fix ShortName off-by-one: "…/" prefix is 2 runes, use +2 not +1
- Remove dead code refreshIfChanged (superseded by Refresh method)
- Store session ID on rename start to prevent wrong-session rename
  if the list reorders during input
- Use rune-aware backspace in rename input to handle multi-byte chars
nahime0 added 2 commits March 9, 2026 15:13
- stopPropagation in rename input handlers so /, f, +, - can be typed
- Skip SessionList key handler when an input/textarea is focused
- Add 'r' keydown handler to SessionDetail for rename in detail panel
- SessionList defers 'r' to SessionDetail when detail panel is open
- TrimSpace rename input so whitespace-only names reset like empty string
- Remove unreachable fallthrough branch in ShortName (maxLen > 2 always true)
nahime0 added 2 commits March 9, 2026 15:19
In the tray app, selecting a session always opens the detail panel,
so $selectedId is always non-null and the 'r' handler in SessionList
could never trigger. Rename via 'r' is handled by SessionDetail.
@nahime0 nahime0 merged commit 8887718 into main Mar 9, 2026
1 check passed
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

if detailTitle == "" {
detailTitle = core.ShortName(s.CWD, width-2)
}
add(lipgloss.NewStyle().Foreground(colorText).Bold(true).Render(detailTitle))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detail panel title missing truncation for custom names

Low Severity

In buildDetailLines, the custom name from m.manager.SessionName() is used as the detail title without any length truncation, while the fallback path-based name is explicitly truncated via core.ShortName(s.CWD, width-2). In contrast, renderListRow correctly truncates custom names to nameW-1 plus an ellipsis. A long custom name in the detail panel could wrap unexpectedly and push content down.

Additional Locations (1)

Fix in Cursor Fix in Web

@nahime0 nahime0 deleted the feature/rename-sessions branch March 12, 2026 19:58
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