Repository navigation
fix(sleep): expand ~ in the configured Claude and Codex homes - #395
Open
Muhammad Abdullah Butt (1AbdullahButt) wants to merge 1 commit into
Open
Muhammad Abdullah Butt (1AbdullahButt) wants to merge 1 commit into
Muhammad Abdullah Butt (1AbdullahButt) wants to merge 1 commit into
Conversation
Config files are not shell-expanded, so "claude_home": "~/.claude-work" reached SleepConfig as a relative path named "~". transcripts_dir, history_path and skills_dir then pointed under ./~ (nothing harvested, the adopted skill written where Claude Code never loads it), and state_dir moved to ./~/.skillopt-sleep even for "~/.claude". codex_archived_sessions_dir had the same problem, and --claude-home / --codex-home skipped expanduser. Expand both homes the way pi_home and cursor_home already are. Fixes microsoft#394 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #394
SleepConfigjoinedclaude_homeandcodex_homeinto paths as given. Config files are not shell-expanded, so"claude_home": "~/.claude-work"was a relative path named~:transcripts_dir/history_pathpointed at a directory that does not exist, so nothing was harvested.skills_dir/managed_skill_path()put the adopted skill under./~/..., where Claude Code never loads it.state_dirmoved to./~/.skillopt-sleep, even for"~/.claude"(the default home).codex_archived_sessions_dirhad the same problem forcodex_home.--claude-homeand--codex-homealso calledos.path.abspathwithoutexpanduser.The fix adds a small
_home_dir()helper that expands and absolutizes the home, and uses it in those properties. That is whatpi_sessions_dirandcursor_projects_diralready do. The two CLI flags now callexpanduserlike--pi-homeand--cursor-home. Absolute homes behave the same as before.Tests
tests/test_sleep_home_tilde.pycovers~homes from aconfig.json,"~/.claude"keeping the default state dir, and the two CLI flags. All 3 tests fail onmainand pass with this change.python -m pytest -q tests -k "sleep or harvest or config or pi_ or cursor or codex"on Windows: 801 passed here and 798 onmain. The same 18 tests fail on both; they are Windows-only failures that already occur onmain.This change was written with Claude Code.
🤖 Generated with Claude Code