fix(stop): the exit-4 refusal names where the holder may be (Issue #31, Mac review)
The refusal pointed at ~/.claude/sessions/ for every agent, whatever CLAUDE_CONFIG_DIR said, and never mentioned a non-agent process naming the uuid on its command line. The in-use CLI now prints, on stderr while the conversation is in use, the adapter's in_use_hints: for every adapter `ps -axww | grep <uuid>`, and for claude its real sessions/ dir first. stop prints them under its refusal, and says "records preserved" instead of "no state was modified": the gate runs after the kill chain, so the session itself may already be down. SKILL.md's exit 4 row says the same; it is not a code block, so no inventory hash moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
af8ed397f6
commit
e156179822
6 files changed
+25
-6
No files matched your search
@@ -533,6 +533,7 @@ def test_claude_config_dir_moves_the_config_root(home, tmp_path, monkeypatch, co
|
||||
ctx = _ctx(ws, home)
|
||||
|
||||
assert adapter.conversation_in_use(conv, ctx) is True
|
||||
assert adapter.in_use_hints(conv, ctx)[0] == f"a claude process whose session file under {cfg / 'sessions'}/ names it"
|
||||
res = _agents_cli(["purge", "claude", conv, str(ws)], ws)
|
||||
assert res.returncode == 4, res.stdout + res.stderr
|
||||
assert all(p.exists() for p in t.values())
|
||||
@@ -649,6 +650,8 @@ def test_in_use_cli_waits_then_answers(home, tmp_path, conv, live):
|
||||
assert res.returncode == 4, res.stdout + res.stderr
|
||||
assert json.loads(res.stdout)["in_use"] is True
|
||||
assert time.monotonic() - t0 >= 1
|
||||
assert f"session file under {home / '.claude' / 'sessions'}/ names it" in res.stderr
|
||||
assert f"ps -axww | grep {conv}" in res.stderr
|
||||
|
||||
assert _agents_cli(["in-use", "nosuchagent", conv, str(ws)], ws).returncode == 1
|
||||
assert _agents_cli(["in-use", "claude"], ws).returncode == 1
|
||||
@@ -732,6 +735,8 @@ def test_stop_purge_refuses_while_the_claude_process_lives(stop_box, conv):
|
||||
assert res.returncode == 4, res.stdout + res.stderr
|
||||
assert "herdr already dead" in res.stdout
|
||||
assert "records preserved" in res.stderr
|
||||
assert f"session file under {stop_box / '.claude' / 'sessions'}/ names it" in res.stderr
|
||||
assert f"ps -axww | grep {conv}" in res.stderr
|
||||
assert "purged: " not in res.stdout
|
||||
assert all(p.exists() for p in t.values())
|
||||
assert _row_left(stop_box, name) == (True, True)
|
||||
|
||||
Reference in new issue
Block a user