{"version":"2.1.321","anchor":"user-delegated-session-env-vars-forwarded-to-shellcommand-e","canonical_anchor":"user-delegated-session-env-vars-forwarded-to-shellcommand-e","heading":"Settings for user delegated sessions are passed on, and some commands refuse to run in them","tier":"use","area":"Delegated Sessions","scope":"org","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.321\/e\/user-delegated-session-env-vars-forwarded-to-shellcommand-e","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.321","markdown":"### Settings for user delegated sessions are passed on, and some commands refuse to run in them\n\nTwo user delegated session variables are passed to spawned processes, and `--bg` and `plugin eval` refuse to run when the direct API one is set\n\n**Unclear.** It is not clear what values `CLAUDE_CODE_USER_DELEGATED_SESSION_ALLOWED_CHECK_MODELS` accepts or which models it lets through.\n\n**What**\n\nClaude Code now recognises two environment variables (named settings passed to a program when it starts) for what it calls a user delegated session:\n\n- `CLAUDE_CODE_USER_DELEGATED_SESSION_DIRECT_API`\n\n- `CLAUDE_CODE_USER_DELEGATED_SESSION_ALLOWED_CHECK_MODELS`\n\nBoth are copied into the environment of the processes and sessions Claude Code starts. `CLAUDE_CODE_CCR_REQUESTS_BY_FETCH` is also on that list. For sessions on your own infrastructure, `CLAUDE_CODE_USER_DELEGATED_SESSION_DIRECT_API` is set to `1` when the matching option is on. `CLAUDE_CODE_USER_DELEGATED_SESSION_ALLOWED_CHECK_MODELS` is filled in for sessions that run the agent loop.\n\nWhen `CLAUDE_CODE_USER_DELEGATED_SESSION_DIRECT_API` is set:\n\n- `--bg`, which starts a background session, refuses to run and tells you to run the task in the current session instead.\n\n- `plugin eval` refuses to run and says nothing was run.\n\n- In auto mode, a model checks each action before it runs. When that check is unavailable, the message now reads \"No allowed model can check this action\". Without the variable, the message is still \"Claude Code no longer checks actions itself\".\n\n**Why**\n\nThis prepares for delegated sessions that call the API directly and limit which models may run the permission check on each action. If you see one of these refusals or the new auto mode message, a delegated session setting is in effect.\n\n- Area: Delegated Sessions\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 4\/5\n- Scope: org\n- Heads-up: no"}