Skip to content

[BUG] #69806

Description

@AwanSaqqaf

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When selecting a named custom cloud environment (lovable-uat) from the environment switcher before starting a new Claude Code on the web session, the session does not actually run inside that environment's configuration. It runs on the default environment instead, and the selected environment's name is dropped entirely. Specifically, CLAUDE_CODE_ENVIRONMENT_NAME is not set at all inside the session, even though lovable-uat was visibly checkmarked as selected in the environment switcher UI immediately before the session was created. As a direct result, the custom environment's setup script never ran and its custom network allowlist (which included *.lovable.dev, not in the default Trusted list) was never applied — outbound requests to that domain were blocked with "Host not in allowlist," and Playwright/dependencies that should have been installed by the custom setup script were missing. No error or warning was surfaced anywhere indicating the selected environment wasn't actually applied; the only way to detect this was to manually query environment variables from inside the running session.

Image Image Image

What Should Happen?

CLAUDE_CODE_ENVIRONMENT_NAME should be set to lovable-uat inside the session. The session should run using lovable-uat's configured setup script and custom network allowlist (specifically allowing *.lovable.dev), since that environment was the one explicitly selected via checkmark in the environment switcher before the session was started.

Error Messages/Logs

Steps to Reproduce

  1. In Claude Code on the web, open the environment switcher and select "Add cloud environment."

  2. Create a new custom environment with these settings:

  • Name: lovable-uat

  • Network access: Custom

  • Allowed domains:
    *.lovable.app`` *.lovable.dev lovable.dev

  • Check the box: "Also include default list of common package managers"

  • Setup script:
    #!/bin/bash set -e npm install npx playwright install chromium

  1. Save and create the environment.

  2. Start a brand-new session (not a resumed one) from claude.ai/code.

  3. Before sending the first message, open the environment switcher (the cloud icon dropdown) and explicitly click lovable-uat. Confirm it shows a checkmark next to it, indicating it is selected.

  4. Send the first message in the session:
    "What environment is this session running in? Show me
    CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE and CLAUDE_CODE_ENVIRONMENT_NAME."

  5. Observe the output. CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE returns cloud_default (expected, per documentation, since this value is always cloud_default for named cloud environments). However, CLAUDE_CODE_ENVIRONMENT_NAME returns not set, instead of lovable-uat.

  6. As confirmation that the wrong environment was actually applied, ask Claude Code to attempt the custom-allowlisted domain, e.g.:
    "Try to reach https://[any-host-under-your-custom-allowed-domain]"

This fails with a "Host not in allowlist" error, confirming the session is running under the default Trusted-tier network policy, not the custom environment's policy that was selected.

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

2.1.185

Platform

Other

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:claude-code-webClaude Code on the web. claude.com/codebugSomething isn't workinghas reproHas detailed reproduction stepsplatform:webIssue specifically occurs on the webstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions