Skip to content

feat: add auto-assign section option to prompt workspace creation - #796

Merged
leynier merged 8 commits into
mainfrom
feat/auto-assign-section-checkbox
Sep 17, 2026
Merged

leynier merged 8 commits into
mainfrom
feat/auto-assign-section-checkbox

Conversation

@leynier

@leynier leynier commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Adds best-effort automatic workspace section assignment to From Prompt workspace creation.

What changed

  • Forwards a new autoAssignSection flag from the prompt workspace request through identity generation to the runtime host. The flag is additive, older hosts ignore it and omit sectionId.
  • Parses optional sectionId from the identity response and assigns the section after workspace creation. Assignment failures are swallowed so they never fail the creation flow.
  • Adds dialog state for the option, defaulting to on and gated by hasWorkspaceSections, with an assignSection callback for applying the result.
  • Updates the Rust identity generation to list workspace sections best-effort when requested, extend the AI prompt with the section names plus an Others fallback, and resolve the returned section name case-insensitively to sectionId. Missing, unknown, or Others answers leave the workspace unassigned.
  • Covers the new prompt and parsing behavior with unit tests for empty sections, section listing, case-insensitive resolution, and unassigned fallbacks.

Why

  • Lets the AI identity step pick the matching workspace section from the user's existing sections, so prompt-created workspaces land in the right section without an extra manual move.

- 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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 autoAssignSection on aiText.workspaceIdentity.generate, with optional sectionId on 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 to sectionId. Missing, unknown, or Others answers leave the workspace unassigned.
  • Pipeline hook After create, the pipeline can assign identity.sectionId and 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.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Grok𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 setWorkspaceSection after 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.

Pullfrog  | View workflow run | Using Grok𝕏

@leynier
leynier merged commit f64fb90 into main Sep 17, 2026
23 checks passed
@leynier
leynier deleted the feat/auto-assign-section-checkbox branch September 17, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant