[BUG]
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] 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.
<img width="1037" height="347" alt="Image" src="https://github.com/user-attachments/assets/e14b8faf-646a-41cd-8296-a193c964f114" />
<img width="962" height="287" alt="Image" src="https://github.com/user-attachments/assets/11814555-edec-4061-9c61-2acdb58c0ccb" />
<img width="973" height="407" alt="Image" src="https://github.com/user-attachments/assets/0a536de6-9016-43e0-8ac1-37f2cbd11e2d" />
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
- In Claude Code on the web, open the environment switcher and select "Add cloud environment."
- 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
- Save and create the environment.
- Start a brand-new session (not a resumed one) from claude.ai/code.
- 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.
- 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."
- 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.
- 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_