feat: add auto-assign section option to prompt workspace creation - #796
Conversation
- classify new workspace prompt into existing sections during AI identity generation - return sectionId additively so older hosts and clients keep working - assign section best-effort after creation without failing the flow
There was a problem hiding this comment.
Important
From Prompt never actually auto-assigns a section, and the Dart changes will not analyze.
Reviewed changes This run reviewed automatic section assignment on From Prompt workspace creation.
- Identity RPC Additive
autoAssignSectiononaiText.workspaceIdentity.generate, with optionalsectionIdon the parsed response. Older hosts ignore the flag. - Host prompt and parse When requested, the identity prompt lists existing section names plus
Others, then resolves a case-insensitive name tosectionId. Missing, unknown, orOthersanswers leave the workspace unassigned. - Pipeline hook After create, the pipeline can assign
identity.sectionIdand swallows assignment failures so they cannot fail the flow. - Dialog state Adds a default-on flag gated by
hasWorkspaceSections, but the form never renders it and submit never forwards it.
⚠️ Create never turns the option on
showCreateWorkspaceFlow does not pass hasWorkspaceSections or assignSection. BackgroundSetupJobs builds PromptWorkspacePipeline without assignSection. PromptWorkspaceCreateRequest.autoAssignSection defaults to false, and the dialog enqueue path never sets it, so a completed checkbox still would not reach the host.
Existing generateIdentity closures in test/unit/prompt_workspace_pipeline_test.dart and the prompt-dialog widget tests still use the old three-parameter shape, so analysis fails there as well.
Technical details
# Wire auto-assign through create, jobs, and tests
## Affected sites
- `lib/src/features/workbench/presentation/prompt_workspace_dialog_form.dart` — no checkbox; follow the `Create Another` `AleraCheckbox` pattern, shown only when `hasWorkspaceSections` is true.
- `lib/src/features/workbench/presentation/prompt_workspace_dialog.dart` — `_submit` enqueue omits `autoAssignSection`; the inline `generateIdentity` call at line 360 omits the new required argument.
- `lib/src/features/workbench/presentation/workbench_dialog_launchers_create_workspace.dart` — does not pass `hasWorkspaceSections` or `assignSection`.
- `lib/src/features/workbench/application/background_setup_jobs.dart` — pipeline constructed without `assignSection`.
- `test/unit/prompt_workspace_pipeline_test.dart` and `test/widget/prompt_workspace_dialog_*.dart` — `generateIdentity` closures missing `autoAssignSection`.
## Required outcome
- Checkbox visible only when sections exist, default on, restored on retry.
- Enqueue and inline generate both send `_autoAssignSectionEffective`.
- After create, jobs assign via `WorkbenchController.saveWorkspaceSection` / `setSection`, still best-effort.
- Tests compile and cover assign-on-success plus swallow-on-failure.
## Suggested approach
Pass `hasWorkspaceSections: ref.read(workbenchControllerProvider).sections.isNotEmpty` from the launcher, and `assignSection: (workspaceId, sectionId) => controller.saveWorkspaceSection(workspaceId, sectionId: sectionId)` into both the dialog and the pipeline.
## Open questions for the human
Mobile From Prompt still omits the flag (host keeps the old two-field prompt). That is valid additive behavior; include the phone option only if this is meant to be a parity feature in this PR.Grok | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes This run reviewed the wiring commit since 87695928, which connects the host identity path to desktop and mobile From Prompt create.
- Desktop create path The dialog now shows Auto Assign Section when sections exist, enqueue and inline generate both send the flag, and background jobs assign via
saveWorkspaceSection. - Mobile parity From Prompt on the phone got the same option, identity flag, and best-effort
setWorkspaceSectionafter create, including retry restore. - Tests Pipeline, dialog, and mobile suites now cover assign-on-success, swallow-on-failure, hide-without-sections, and uncheck-skips-assignment.
Grok | 𝕏

Adds best-effort automatic workspace section assignment to From Prompt workspace creation.
What changed
autoAssignSectionflag from the prompt workspace request through identity generation to the runtime host. The flag is additive, older hosts ignore it and omitsectionId.sectionIdfrom the identity response and assigns the section after workspace creation. Assignment failures are swallowed so they never fail the creation flow.hasWorkspaceSections, with anassignSectioncallback for applying the result.Othersfallback, and resolve the returned section name case-insensitively tosectionId. Missing, unknown, orOthersanswers leave the workspace unassigned.Why