You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run the Nested-Session ID Probe Behind Requirement 9 #4312
#2598's approved option asked for a nested claude -p run to check whether a nested Claude Code session inherits the parent's CLAUDE_CODE_SESSION_ID. The requirement 9 text #4311 landed in host-setup/agent-safety/README.md holds either way. But if the id is inherited, the Claude kit falls short of it: it names a nested session's command scopes for the parent, and the nested SessionEnd sweep stops the parent's own scopes.
A nested agent session is a live run outside an agent's own workspace, so no agent runs this probe. The maintainer runs it.
The probe
The exact command and the expected observations for both cases are in #4311's body, under "For the Maintainer to Run". Run it as one Bash tool call in a fresh, idle Claude Code session on a Linux host where the kit's containment prefix is registered.
Done looks like
The result is recorded here: whether tool= and env= print the nested session's own id or the parent's.
Own id: this issue closes with the result as its evidence.
Inherited id: this issue becomes the kit-defect fix, an edit under host-setup/agent-safety/claude/ that needs the maintainer's approval.
Probe result, 2026-11-22: a nested session gets its own id. The maintainer had the probe run as a Bash tool call in an idle Claude Code session on a Linux host with the kit's containment prefix registered. Ids below are placeholders: <parent> is the outer session and <nested> is the claude -p session.
tool=<nested> and the SessionEnd hook's env=<nested> match each other and differ from parent=<parent>.
The hook's stdin payload carries "session_id":"<nested>".
root=<parent> in both the tool call and the hook.
The cgroup line names claude-tree-<parent>.slice/claude-tool-<nested>-<pid>-<token>.scope.
The outer command ran to its last cat, and claude -p exited 0.
So requirement 9 holds as implemented, and there is no kit defect to fix.
The probe text in #4311 is itself broken.--allowedTools takes more than one value, so the prompt after --allowedTools Bash is read as a second tool name. claude -p then exits with "Input must be provided either through stdin or as a prompt argument". The SessionEnd hook still fires, which is why the first run showed only the env= half. Putting -- before the prompt fixes it, and the result above is from that rerun.
Activity
Promote Develop to Main: Standup Ordering, Signal Handling, Merge Hol…
ptr727 commentedon Nov 22, 2026
Probe result, 2026-11-22: a nested session gets its own id. The maintainer had the probe run as a Bash tool call in an idle Claude Code session on a Linux host with the kit's containment prefix registered. Ids below are placeholders:
<parent>is the outer session and<nested>is theclaude -psession.tool=<nested>and the SessionEnd hook'senv=<nested>match each other and differ fromparent=<parent>."session_id":"<nested>".root=<parent>in both the tool call and the hook.claude-tree-<parent>.slice/claude-tool-<nested>-<pid>-<token>.scope.cat, andclaude -pexited 0.So requirement 9 holds as implemented, and there is no kit defect to fix.
The probe text in #4311 is itself broken.
--allowedToolstakes more than one value, so the prompt after--allowedTools Bashis read as a second tool name.claude -pthen exits with "Input must be provided either through stdin or as a prompt argument". The SessionEnd hook still fires, which is why the first run showed only theenv=half. Putting--before the prompt fixes it, and the result above is from that rerun.