{"version":"2.1.321","anchor":"new-env-var-claude-code-user-delegated-session-direct-api-in","canonical_anchor":"new-env-var-claude-code-user-delegated-session-direct-api-in","heading":"New environment variable for user-delegated sessions with its own failure type","tier":"use","area":"Delegated Sessions","scope":"org","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.321\/e\/new-env-var-claude-code-user-delegated-session-direct-api-in","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.321","markdown":"### New environment variable for user-delegated sessions with its own failure type\n\nSetting CLAUDE_CODE_USER_DELEGATED_SESSION_DIRECT_API gives remote sessions a separate failure type when their route is refused\n\n**What**\n\nClaude Code now reads a new environment variable, `CLAUDE_CODE_USER_DELEGATED_SESSION_DIRECT_API`. An environment variable is a named value set outside Claude Code that changes how it behaves.\n\nWhen it is set in a session's environment variables:\n\n- If the session's process exits with code 1 and its error output matches a known pattern, Claude Code records that the user-delegated session route was refused, and reports it as a session configuration error.\n\n- If the result is unavailable or the conversation is too long, the session is treated as blocked.\n\n**Why**\n\nThis is a new mode for remote sessions with its own way of reporting failures. Only setups that set this variable see it.\n\n- Area: Delegated Sessions\n- Names: `CLAUDE_CODE_USER_DELEGATED_SESSION_DIRECT_API`\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 4\/5\n- Scope: org\n- Heads-up: no"}