Repository navigation
✨ feat: 🚸 claude asks before starting a second session in the same directory - #99
Merged
Merged
Conversation
On a machine where python3 is an asdf shim, the shim resolves its tool version relative to $HOME and exits 126 the moment a test overrides it. The deny-guard doctor test looked the interpreter up after setup() had already sandboxed HOME, so it failed at the lookup itself — locally only, which is why CI never showed it. setup() now resolves the interpreter first and re-exposes it under a stub on PATH, the way tests/denyguard.bats does, so every test in the file can use python3. The next commit's pseudo-terminal helper needs the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rectory Typing `claude` where a session is already running starts a second writer on the same tree, and a fresh prompt gives no sign the first is there. The wrapper now lists the live sessions in the directory and asks `Start another here anyway? [y/N]` — a warning with a way past it, never a refusal. claude_sessions_here reads the registry each profile keeps in <config dir>/sessions/<pid>.json (the files postbox already reads), across every mapped profile plus the directory this launch resolved to, since a literal CLAUDE_PROFILE or per-repo pin can sit outside every mapping. A match is the same real directory with a live pid. Only a launch somebody is sitting at is asked: no terminal, print mode, a help or version flag, or a first argument shaped like a subcommand all pass untouched, so hooks, the postbox courier and pipes never block. It fails open. `git config claude.second-session-check false` turns it off for anyone who runs several sessions in one checkout on purpose, and claude-doctor's new `running:` line shows what the wrapper would ask about. Testing the prompt needs a pseudo-terminal. zsh's zpty returns short reads on macOS and pty.spawn before Python 3.10 never returns there once the child exits, so the test helper forks one by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Typing
claudein a directory where a session is already running starts a second writer on the same tree, with no sign the first is there. Theclaude()wrapper now lists the live sessions in that directory and asksStart another here anyway? [y/N]— a warning with a way past it, never a refusal.How
claude_sessions_herereads the registry each profile keeps in<config dir>/sessions/<pid>.json(the files postbox already reads), across every mapped profile plus the directory this launch resolved to. A match is the same real directory with a live pid.-p/--print, a help or version flag, or a first argument shaped like a subcommand all pass untouched, so hooks, the postbox courier and pipes never block.git config claude.second-session-check falseturns it off.claude-doctorgains arunning:line and covers the new helper indefined:.Known limits
claude fix) has the shape of a subcommand and is not asked.Also in this PR
tests/claude-profiles.batsnow resolves the realpython3beforeHOMEis sandboxed. Wherepython3is an asdf shim, the existing deny-guard doctor test failed locally at the interpreter lookup (exit 126); CI never showed it.Verified
bats tests— 607 tests, no failures (run with a realpython3first onPATH; several other test files hit the same asdf-shim failure in a shell where it is not)bats tests/claude-profiles.bats— 66 tests pass after the review fixesnlaunches nothing and returns 1,ylaunchespublic-clone-advocateand/code-reviewon the diff; findings applied or listed under Known limits🤖 Generated with Claude Code