feat(agent-dialog): require default folder for provider CLI agents - #543
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — two minor suggestions.
Reviewed changes
create-agent-dialog.tsx— provider_clistep2Validnow also requiresdefaultFolderId, and the Default folder field is marked*and passesrequiredto the select.environment-folder-select.tsx—DefaultFolderSelectgains an optionalrequiredprop (defaultfalse) that hides the "No default folder" item and skips theNO_FOLDER→""mapping; mirrors the existingDefaultEnvironmentSelect.required.
ℹ️ Required-folder gate is UI-only
The dialog now blocks the broken case, but the server still accepts a provider_cli agent created without default_folder_id through any non-dialog client (direct API, MCP, older frontends), so the "conversation never starts" failure remains reachable outside this form. The PR body explicitly scopes server enforcement out — worth confirming whether a follow-up is planned, since the failure mode is what motivated the change.
Technical details
# Server-side enforcement for provider_cli default folder
## Affected sites
- `apps/web/src/components/projects/agents/create-agent-dialog.tsx:516` — UI gate added here
- server agent-create path — no equivalent requirement for `agentType == provider_cli` + missing `default_folder_id`
## Required outcome
- Decide whether provider_cli agents must reject creation without a default folder server-side (the dialog already surfaces `ApiErrorCode.AgentDefaultFolderInvalid`).
## Open questions for the human
- Is a server-side validation follow-up planned, or is dialog-only enforcement the intended long-term boundary?deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
| <> | ||
| <Select | ||
| value={value || NO_FOLDER} | ||
| value={required ? value : value || NO_FOLDER} |
There was a problem hiding this comment.
When required and no folder is picked yet, value is "", which matches no item — and unlike DefaultEnvironmentSelect (which passes a placeholder), this <SelectValue /> has none, so the trigger renders blank. This is reachable for a freshly created environment whose folders is null/empty. environments.picker.folderPlaceholder already exists in every locale.
Technical details
# Missing placeholder on required folder select
## Affected sites
- `apps/web/src/components/projects/environments/environment-folder-select.tsx:168` — `value={required ? value : value || NO_FOLDER}`
- `apps/web/src/components/projects/environments/environment-folder-select.tsx:198` — `<SelectValue />` lacks a `placeholder`
- `apps/web/src/components/projects/environments/environment-folder-select.tsx:96-102` — `DefaultEnvironmentSelect` sets one for its required case
## Required outcome
- The required folder trigger shows a prompt before a folder is chosen, consistent with the required environment select.
## Suggested approach (optional)
- `<SelectValue placeholder={required ? t("environments.picker.folderPlaceholder") : undefined} />`
Summary
Provider CLI agents created without a default folder never start their conversation when assigned a task. The create-agent dialog now requires a default folder for provider CLI agents:
*) and the "No default folder" option is hidden, so a folder must be picked or created.DefaultFolderSelectgains an optionalrequiredprop (defaultfalse), so the agent detail page behaves as before.Not included: server-side enforcement. A direct API call can still create a provider CLI agent without
default_folder_id, and existing agents without a folder are unaffected.Type of Change
Checklist
🤖 Generated with Claude Code