Skip to content

Commit 0cd0eaa

Browse files
chore(code): hide environment pickers until environments are set up (#1727)
1 parent cd0679a commit 0cd0eaa

5 files changed

Lines changed: 81 additions & 17 deletions

File tree

apps/code/src/renderer/features/environments/components/EnvironmentSelector.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export function EnvironmentSelector({
4848
const selectedEnvironment = environments.find((env) => env.id === value);
4949
const displayText = selectedEnvironment?.name ?? "No environment";
5050

51+
if (environments.length === 0) {
52+
return null;
53+
}
54+
5155
const handleChange = (newValue: string | null) => {
5256
onChange(newValue === NONE_VALUE ? null : newValue || null);
5357
setOpen(false);

apps/code/src/renderer/features/settings/components/sections/CloudEnvironmentsSettings.tsx

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,18 @@ export function CloudEnvironmentsSettings() {
298298
</Text>
299299
<Text size="1" color="gray">
300300
{editingEnv
301-
? "Changes to your environment will apply to new sessions."
302-
: "Configure a cloud environment for running tasks."}
301+
? "Changes take effect on the next session that uses this environment; running sessions are not affected."
302+
: "Once created, you can pick this environment in the Cloud section of the workspace picker when starting a task."}
303303
</Text>
304304

305305
<Flex direction="column" gap="1">
306306
<Text size="2" weight="medium">
307307
Name
308308
</Text>
309+
<Text size="1" color="gray">
310+
Shown in the workspace picker. Pick a name that describes the access
311+
profile, e.g. "Internal APIs" or "Read-only".
312+
</Text>
309313
<TextField.Root
310314
size="2"
311315
value={form.name}
@@ -318,6 +322,22 @@ export function CloudEnvironmentsSettings() {
318322
<Text size="2" weight="medium">
319323
Network access
320324
</Text>
325+
<Text size="1" color="gray">
326+
Controls which hosts the sandbox may reach.{" "}
327+
<Text size="1" color="gray" weight="medium">
328+
Full
329+
</Text>{" "}
330+
allows any outbound traffic.{" "}
331+
<Text size="1" color="gray" weight="medium">
332+
Trusted sources only
333+
</Text>{" "}
334+
restricts traffic to a curated list of common package registries and
335+
source hosts.{" "}
336+
<Text size="1" color="gray" weight="medium">
337+
Custom
338+
</Text>{" "}
339+
lets you define an explicit allowlist below.
340+
</Text>
321341
<NetworkAccessSelect
322342
value={form.network_access_level}
323343
onChange={(v) =>
@@ -333,7 +353,15 @@ export function CloudEnvironmentsSettings() {
333353
Allowed domains
334354
</Text>
335355
<Text size="1" color="gray">
336-
List of domains (not URLs). Use * for wildcards.
356+
One domain per line (not URLs — no scheme or path). Use{" "}
357+
<Text size="1" color="gray" weight="medium">
358+
*
359+
</Text>{" "}
360+
as a wildcard, e.g.{" "}
361+
<Text size="1" color="gray" weight="medium">
362+
*.example.com
363+
</Text>{" "}
364+
to cover all subdomains. Requests to any other host are blocked.
337365
</Text>
338366
<TextArea
339367
size="2"
@@ -375,7 +403,9 @@ export function CloudEnvironmentsSettings() {
375403
}
376404
/>
377405
<Text size="1" color="gray">
378-
Also include default list of common package managers
406+
Also include the built-in list of common package managers and
407+
source hosts — recommended unless you deliberately want to block
408+
them.
379409
</Text>
380410
</Flex>
381411
</>
@@ -386,7 +416,18 @@ export function CloudEnvironmentsSettings() {
386416
Environment variables
387417
</Text>
388418
<Text size="1" color="gray">
389-
In .env format. Leave blank to keep existing values unchanged.
419+
Injected into the sandbox shell before the agent runs — useful for
420+
API keys or service tokens the agent needs. Standard{" "}
421+
<Text size="1" color="gray" weight="medium">
422+
.env
423+
</Text>{" "}
424+
format: one{" "}
425+
<Text size="1" color="gray" weight="medium">
426+
KEY=value
427+
</Text>{" "}
428+
per line. Existing values aren't shown back once saved; leave the
429+
field blank to keep them unchanged, or enter new values to replace
430+
them.
390431
</Text>
391432
<TextArea
392433
size="2"
@@ -459,10 +500,14 @@ export function CloudEnvironmentsSettings() {
459500

460501
return (
461502
<Flex direction="column" gap="4">
462-
<Flex justify="between" align="center">
503+
<Flex justify="between" align="start" gap="4">
463504
<Text size="1" color="gray">
464-
Cloud environments define network access and configuration for sandbox
465-
sessions.
505+
A cloud environment is a reusable configuration applied to remote
506+
sandbox sessions — it controls which outbound network hosts the
507+
sandbox can reach and what environment variables (like API keys) are
508+
available to the agent. Pick an environment in the Cloud section of
509+
the workspace picker when starting a task; the Default option uses
510+
full network access.
466511
</Text>
467512
<Button size="1" variant="outline" onClick={openCreate}>
468513
<Plus size={12} />

apps/code/src/renderer/features/settings/components/sections/environments/EnvironmentForm.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ export function EnvironmentForm({
116116
<Text size="1" weight="medium">
117117
Name
118118
</Text>
119+
<Text size="1" color="gray" className="text-[12px]">
120+
Shown in the worktree picker. Use short names like "default" or
121+
"with-seed-data" so you can spot which setup will run.
122+
</Text>
119123
<TextField.Root
120124
size="1"
121125
value={name}
@@ -130,7 +134,9 @@ export function EnvironmentForm({
130134
Setup script
131135
</Text>
132136
<Text size="1" color="gray" className="text-[12px]">
133-
Runs in the project root on worktree creation.
137+
Runs in the worktree root right after it's created, before the agent
138+
starts. Use it to install dependencies, generate build artifacts, or
139+
seed a local database. Leave blank if no setup is needed.
134140
</Text>
135141
<TextArea
136142
size="1"

apps/code/src/renderer/features/settings/components/sections/environments/EnvironmentsSettings.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ export function EnvironmentsSettings() {
9191

9292
return (
9393
<Flex direction="column" gap="4">
94+
<Text size="1" color="gray">
95+
An environment defines how a fresh worktree of a project is prepared.
96+
The setup script runs once when the worktree is created, so the agent
97+
starts in a project that's already installed, built, and ready.
98+
Environments are stored as TOML files inside the project and can be
99+
committed so teammates share the same setup.
100+
</Text>
94101
<Text size="1" weight="medium">
95102
Projects
96103
</Text>

apps/code/src/renderer/features/task-detail/components/WorkspaceModeSelect.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,16 @@ export function WorkspaceModeSelect({
168168
<DropdownMenuSeparator />
169169
<div className="flex items-center justify-between px-2 py-1">
170170
<MenuLabel className="p-0">Cloud environments</MenuLabel>
171-
<button
172-
type="button"
173-
onClick={handleAddEnvironment}
174-
aria-label="Add cloud environment"
175-
className="flex cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0.5 text-muted-foreground transition-colors hover:bg-fill-hover hover:text-foreground"
176-
>
177-
<Plus size={12} />
178-
</button>
171+
{environments.length > 0 && (
172+
<button
173+
type="button"
174+
onClick={handleAddEnvironment}
175+
aria-label="Add cloud environment"
176+
className="flex cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0.5 text-muted-foreground transition-colors hover:bg-fill-hover hover:text-foreground"
177+
>
178+
<Plus size={12} />
179+
</button>
180+
)}
179181
</div>
180182

181183
<DropdownMenuGroup>

0 commit comments

Comments
 (0)