Skip to content

fix(claude-ls,claude-rm): find sessions under underscore paths and after a late rename - #420

Merged
ycpss91255 merged 2 commits into
mainfrom
fix/claude-ls-rm-session-lookup
Nov 13, 2026
Merged

ycpss91255 merged 2 commits into
mainfrom
fix/claude-ls-rm-session-lookup

Conversation

@ycpss91255

Copy link
Copy Markdown
Owner

Summary

Fix two independent ways claude-ls / claude-rm fail to find a Claude Code session: directories with an underscore (or other non-alphanumeric characters) in their path, and sessions whose title was written or changed late in the transcript. Closes #419.

Changes

  • module/config/fish/functions/claude-ls.fish: derive the project name by replacing every non-alphanumeric character with -, matching how Claude Code names ~/.claude/projects/<dir> (~/Desktop/arch_drawio is stored as ...-arch-drawio).
  • module/config/fish/_claude_sessions.py: the title is the last customTitle in the transcript instead of the first one within the first 50 lines.
  • module/config/fish/functions/claude-rm.fish: match titles through _claude_sessions.py instead of its own head -50 scan, so both tools share one rule. The sessionId-prefix fallback is unchanged.
  • test/unit/module/claude-ls_spec.bats: project-name fixture now uses the non-alphanumeric rule; new spec for an underscore directory.
  • test/unit/module/claude-sessions_spec.bats (new): helper title cases and the claude-rm title match (a declined prompt must not call gio).
  • doc/changelog/CHANGELOG.md: [Unreleased] / Fixed entry.

Decision

  • A /branched session that is then renamed gets its custom-title records far past the header (line 538 and later in a 2271-line transcript), and /rename appends a new record each time. The last record is the current name, so "last one wins" is the correct rule and the first-50-lines window from fix(claude-rm): customTitle match only reads first line, misses fork/resumed sessions #33 is dropped.
  • claude-rm delegates to the helper rather than keeping a second scan, so the two commands cannot drift apart again. The helper already scans each file fully for message counts and claude-rm already invoked it for the fork-dependents check, so there is no new cost class.
  • The project name is still computed from $PWD rather than from each session's recorded cwd; only the character mapping changed.

Tests

  • just -f justfile.ci test-unit claude-sessions: 5/5 pass.
  • just -f justfile.ci test-unit claude-ls: all pass, including the new underscore-path spec.
  • Reverted the three source files to origin/main and re-ran both specs: the new specs fail (claude-ls 1, 2, 3, 4, 7, 9; claude-sessions 1-4), then pass again with the fix restored.
  • just -f justfile.ci lint did not finish locally within 5 minutes (timed out, result unknown); relying on CI (ci-passed).

…ter a late rename (#419)

claude-ls derived the project name by replacing only `/`, but Claude Code
replaces every non-alphanumeric char with `-`, so a cwd such as
~/Desktop/arch_drawio (stored as ...-arch-drawio) was never matched in the
current-folder view.

_claude_sessions.py only scanned the first 50 lines for customTitle, and
claude-rm.fish did the same with `head -50`. A /branch'd and renamed session
carries its custom-title records far past that window, so claude-ls showed
the wrong title and claude-rm <title> found nothing. Take the last
customTitle in the file (the current name) and make claude-rm resolve titles
through the helper so both tools share one rule.

Add a claude-ls spec for the underscore path and a new claude-sessions spec
covering the late/last title and the claude-rm title match; add a CHANGELOG
entry.
@ycpss91255
ycpss91255 enabled auto-merge (squash) November 13, 2026 11:50
…ule (#419)

fish_spec still pinned the old fixed 50-line window (`head -50` in
claude-rm.fish, `i > 50` in _claude_sessions.py), so the fix for #419
failed test-unit (fish). Assert the new shape instead: claude-rm resolves
titles through _claude_sessions.py with no head-N scan, and the helper
overwrites the title with each customTitle record so the last one wins.
@ycpss91255
ycpss91255 merged commit 8968b60 into main Nov 13, 2026
12 checks passed
@ycpss91255
ycpss91255 deleted the fix/claude-ls-rm-session-lookup branch November 13, 2026 13:03
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.

fix: claude-ls and claude-rm miss sessions with underscore paths or a late rename

1 participant