PR #9707 review: cloud environment onboarding, per-environment machine size, environment page in Settings

PR #9707 Review workspace Author: harshithmullapudi Reviewed at 5c365540 · base superset/environment-machine-size-migration (#9706)

Summary

The PR adds three pieces of cloud-environment work. First, a project with no cloud environment can create one from the new-workspace screen: a "Set up Environment" chip or Send creates a personal environment and starts a cloud workspace with an agent to set it up. Second, environments now carry a machine_size: cloudWorkspace.create uses it when the caller names no size, and the per-workspace size pickers are removed. Third, the environment page moves to /settings/environments/$environmentId and takes over the variables editor, with "Manage environment" and "Save checkpoint" entry points. The goal is to stop new users getting stuck when they pick Cloud for a repository that has no environment.

Verdict

Minor issues

The design is sound. The API changes are additive and match trpc-compat, and every surface I could reach worked at the PR head. One behaviour gap needs a decision before merge: the "Set up Environment" chip sends a setup prompt with no environment URL and no superset:environment skill, so a chip-started agent has no instruction to configure or checkpoint the environment it was made for.

Findings

Medium · behaviour

apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/NewWorkspaceScreen.tsx:1026 and …/ChatSession/components/Composer/Composer.tsx:620

The chip sends ENVIRONMENT_SETUP_PROMPT alone, and the in-chat chip inserts the same text. Send (:937) and the Create environment dialog both wrap the prompt with withEnvironmentSetupSkill(…, environmentUrl). The chip does not. Nothing on the server or in the box handles that text in a special way (I searched packages/trpc and the sandbox code). So an agent started from the chip installs things in its own box, but it has no instruction to write the setup config or save a checkpoint to the new environment. The environment stays sourceKind: "image", the next workspace boots from a bare image, and the in-chat chip stays visible.

Captured request for a chip click at the PR head:

cloudWorkspace.create { environmentId: "c0336452-…", agent: "claude",
  prompt: "Please set up the development environment for this codebase. Run the application(s) and demonstrate that the environment is working." }

Send on the same screen sent the typed text plus "Use the superset:environment skill to set up the cloud environment http://localhost:3000/environments/c0336452-… You are already in a box on that environment…".

Fix: in the chip handler, use cloudPrompt: (_typed, url) => withEnvironmentSetupSkill(ENVIRONMENT_SETUP_PROMPT, url). In Composer, build the inserted text the same way from the workspace's environmentId (the notice already looks it up). If the bare prompt is intentional, please say why in the PR, because the description's "Key decisions" table says the skill is named explicitly.

Low · correctness

apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace/useSubmitWorkspace.ts:196

typedPrompt and the seeded pending chat (:224) use userPrompt, which already includes the cloudPrompt override. The server stores typedPrompt as the row's prompt (start.ts:215), and CloudWorkspaceRecordView shows that as what the user asked. A user who typed "Add a health check endpoint" sees the internal skill sentence and URL as their own message.

Fix: send typedPrompt: prompt.trim() (the raw draft) and seed the chat with the raw draft. Keep the full text only in prompt.

Low · cleanup

apps/desktop/src/renderer/routes/_authenticated/utils/resolveCloudChoices/resolveCloudChoices.ts:67, …/NewWorkspaceScreen.tsx:369, apps/desktop/src/renderer/stores/v2-workspace-create-defaults.ts:20

Now that the size pickers are gone, nothing reads cloudSelection.machineSize. But resolveCloudChoices still computes it, the new-workspace screen still calls useMachineSizeOptions() only to feed it, and the remembered-choices store still has a machineSize field.

Fix: remove the field from resolveCloudChoices, from its input and from the store type. Then drop the useMachineSizeOptions call from the screen.

Low · duplication

…/Composer/components/EnvironmentSetupNotice/EnvironmentSetupNotice.tsx:16-27

This file repeats the logic of the new useWorkspaceEnvironment hook: it finds the workspace's environmentId, runs the list query and finds the row.

Fix: have useWorkspaceEnvironment also return sourceKind and use it here.

Low · structure (AGENTS.md co-location)

apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/DashboardSidebarWorkspaceItem.tsx:30

ManageEnvironmentItem is nested under DashboardSidebarWorkspaceContextMenu/components/, but its parent DashboardSidebarWorkspaceItem imports and builds it, then passes it in as environmentItem. The rule is to nest a component under the component that uses it.

Fix: render it inside DashboardSidebarWorkspaceContextMenu from a workspaceId / isCloudWorkspace prop. Or move it to DashboardSidebarWorkspaceItem/components/.

Checked and fine: start.ts falls back from the environment's size to the org default only when the caller named no size, and refuses an explicit size the plan does not offer. environment.update accepts machineSize: null for "default" and leaves the size alone when the field is omitted. cloudDispatch.ts now gives way to the environment's size. The beforeLoad redirect keeps restored routes working. The i18n enforced-dir additions are clean.

Evidence

Desktop dev build (Electron, DESKTOP_VITE_PORT=3005, CDP on 9333) against the local API on :3001. It used this workspace's own Neon branch, with the base PR's one-column migration 0193_environment_machine_size.sql applied. I drove it with CDP mouse and keyboard input and captured request bodies with an in-renderer fetch hook. All screenshots are at 5c365540.

New-workspace screen: Set up Environment

Cloud with project towns, which has no environment: the green "Set up Environment" chip shows. There is no machine-size pill in the footer.
After the chip click: environment.create made a personal environment named towns linked to the project, and the picker now shows it. cloudWorkspace.create failed with "Unsupported state or unable to authenticate data", the sandbox token-decrypt limit the author also hit. The chip stays, ready to retry. The request had the bare prompt (Finding 1).

Retry: I typed "Add a health check endpoint" and pressed Enter. One cloudWorkspace.create went out on the same environment c0336452-…, with no second environment.create. Its prompt was the typed text plus the superset:environment sentence with the environment URL. Works as described.

Environment picker

Each environment lists its repositories, and an "Edit towns" item sits above "Manage environments".

Environment page in Settings and machine size

"Edit towns" opens #/settings/environments/c0336452-… inside Settings, with the Machine size row set to "Organization default (Medium)".
The size options are "Organization default (Medium)" and Small / Medium / Large (this plan's sizes).
Taken right after choosing Large: the select is disabled while environment.update runs, so it still shows the old value. The database then read machine_size = large. Choosing the default again saved NULL, also read back from the database.
With 2xlarge stored, which this plan does not offer, the select shows "2xlarge (not on your plan)" as disabled. The API refused environment.update({machineSize: "xlarge"}) with BAD_REQUEST: Machine size "xlarge" is not available for this organization, and the stored value did not change.
Settings → Environments list. Rows open the environment page (the separate variables screen is gone).

Old route redirect

Boot with /environments/c0336452-… as the persisted route: the app lands on #/settings/environments/c0336452-…. In-app navigation to the old path redirects the same way.

Sidebar: Manage environment

Right-click on a cloud workspace shows "Manage environment".
…which opens that workspace's environment (Paradev, checkpointed) in Settings.

Create environment dialog

Last step: the copy now says the agent runs in a cloud workspace, the setup note shows, and the buttons are Cancel / Skip & save / Start agent.
After "Start agent": the environment was created (now 10 of 10) and the dialog closed. The API log shows environment.create 200 and then the same sandbox decrypt error on cloudWorkspace.create. The failure toast had already expired when I took this screenshot, so the toast text is not captured.

Could not verify

An existing cloud workspace stays on "Starting cloud workspace" in this sandbox.

Questions for the author

Test / CI notes

CheckResult (at 5c365540)
bun test packages/trpc/src/router/{cloud-workspace,environment,automation}108 pass, 0 fail
bun test desktop: environmentSetupPrompt, CreateEnvironmentFlow, DashboardNewWorkspaceModal44 pass, 0 fail
tsc --noEmit apps/desktop, packages/trpcclean
bun run check:i18nexit 0; catalogs unchanged after regenerating
GitHub CILint, Typecheck, Test, Sherif and the deploy checks were still in progress when I read them. CLA, Vale and Neon create passed. CodeRabbit skipped (non-default base).

Local setup note: the workspace database is a per-workspace Neon branch. I applied ALTER TABLE "environments" ADD COLUMN "machine_size" text; from #9706 to it so the API could read the column. I archived the two towns environments made during testing.