{"version":"2.1.334","anchor":"bg-pty-host-refuses-to-start-from-inside-a-claude-session","canonical_anchor":"bg-pty-host-refuses-to-start-from-inside-a-claude-session","heading":"Background service handles nested-session markers more strictly","tier":"notice","area":"Background Agents","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.334\/e\/bg-pty-host-refuses-to-start-from-inside-a-claude-session","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.334","markdown":"### Background service handles nested-session markers more strictly\n\n`--bg-pty-host` refuses to start inside a Claude Code session, and the macOS re-launch no longer looks like a nested child session\n\n**What**\n\nClaude Code marks programs it starts with `CLAUDE_CODE_CHILD_SESSION` and `CLAUDECODE`, environment variables (named settings passed to programs) that show a process is running inside a Claude Code session. Background sessions are run by a background service, which now treats these markers more carefully:\n\n- `--bg-pty-host`, an internal option of the background service, now exits with an error when either variable is set, unless the `tengu_swift_sunset` gate is false. The error says it cannot be started from a Claude Code session or a process it launched, and tells you to run `claude --bg` instead. Before, it always started. Nothing has been read about the `tengu_swift_sunset` gate.\n\n- On macOS, when Claude Code re-launches itself with `macDisclaimResponsibility`, it now also removes `CLAUDE_CODE_CHILD_SESSION` and `CLAUDECODE` from the new process's environment. Before, it removed only `CLAUDE_PTY_HOST_NO_STABLE_PATH`.\n\n**Why**\n\nThe background host cannot be started by accident from inside a session, and a background session re-launched on macOS is no longer treated as a nested child session, which would have hidden it from things like `--resume`.\n\n- Area: Background Agents\n- Names: `claude --bg`, `CLAUDE_CODE_CHILD_SESSION`\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: yes"}