Skip to content

AI-First Starting UX: Build with AI path#4902

Draft
lmac-1 wants to merge 6 commits into
4848-ai-first-starting-ux-parentfrom
4868-build-with-ai
Draft

AI-First Starting UX: Build with AI path#4902
lmac-1 wants to merge 6 commits into
4848-ai-first-starting-ux-parentfrom
4868-build-with-ai

Conversation

@lmac-1

@lmac-1 lmac-1 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR adds the "Build with AI path" of the #4848 AI-First Starting UX epic.

How it works:

  1. User goes to /new and types a prompt in the "Build with AI" textarea
  2. Pressing Enter or clicking "Build it →" dismisses the landing screen and opens the AI panel with the prompt pre
    sent
  3. The canvas stays blank while the AI processes
  4. When the AI returns YAML, it is auto-applied to the canvas and saved to the DB automatically — no "Create" button
  5. The URL transitions from /new to /projects/{id}/w/{id} without a page reload

Key decisions:

  • Auto-save is silent. No "Workflow saved" toast fires on first creation — it would be noise in a flow the user didn't manually trigger.
  • Panel lock while unsaved. The AI panel cannot be closed (⌘K disabled, close button hidden) while the workflow hasn't been saved yet. Closing it would leave the user on a blank canvas with no path forward.
  • Validation errors route to chat, not toasts. If the AI returns invalid YAML, the error is injected as a message into the chat panel so the user can ask the AI to fix it, rather than hitting a dead-end toast.
  • Save failure shows a Retry button. If the DB save fails, a toast fires with a Retry action that re-runs the full apply+save. Fit-view is skipped on failure so the canvas doesn't zoom into an unpersisted workflow.
  • Streaming dedup moved inline. The streaming streamingChanges event and the final new_message both carry the same YAML. The dedup logic (skip the second apply) was split across the wrapper and the hook — consolidated into the hook's auto-apply effect so it happens atomically in one place.

Decisions made:

  1. Removed AI disclaimer, instead the footer of text area and AI reference policy and warns against sharing personal information
  2. Workflow is saved while the message is streaming. The YAML returned during streaming is the final YAML.

Closes #4868

Validation steps

  1. Go to /new, type a prompt, press Enter — confirm landing screen dismisses, AI panel opens with prompt pre-sent
  2. Wait for AI to return YAML — confirm workflow appears on canvas and URL updates to /w/{id} without a reload
  3. While AI is processing, ⌘K — should do nothing
  4. After creation, confirm panel can be freely opened and closed
  5. Test with a prompt that produces invalid YAML (might be hard to do - might have to hack it with Claude) — confirm error appears in the chat panel, canvas stays blank, panel stays locked

Additional notes for the reviewer

  1. What do you think about the toolbar appearing? Is the effect very jumpy and jarring? What could be the alternative? A completely read-only toolbar before save?

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

lmac-1 added 5 commits June 26, 2026 13:51
…ew workflows

When YAML validation fails (syntax, ID format, schema) during handleApplyWorkflow
and the workflow is new, inject the error as an assistant message into the AI chat
thread instead of showing a toast. Save failures keep the existing toast behaviour.
Add tests for the six untested behaviours introduced in #4868:
- auto-save called after importWorkflow when isNewWorkflow
- validation errors routed to onValidationError callback, not toast
- save failures show toast and do not invoke onValidationError
- close button absent when onClose is undefined
- empty-canvas placeholder suppressed when AI panel is open

Also adds saveWorkflow to mockWorkflowActions and isNewWorkflow: false
to all existing handleApplyWorkflow renderHook calls to match the
updated hook interface.
…e fails

When saveWorkflow rejects on a new workflow, fit-view was incorrectly
dispatched after doneApplyingWorkflow, implying the workflow was
successfully persisted when it wasn't. Add a saveSucceeded flag and
skip fit-view when save fails.

Also wires up the Retry action on the save-failure toast so the user
can re-attempt the full apply+save without losing their canvas state.
@github-project-automation github-project-automation Bot moved this to New Issues in Core Jun 26, 2026
…ies workflow

The workflow was being applied twice — once via streaming and again when the
final new_message arrived — causing a transient dirty state (unsaved red dot)
between the second import and save.

Consolidate the deduplication flag into useAIWorkflowApplications so the
"mark as applied + skip" logic happens atomically in one place rather than
split across two separate useEffect passes in the wrapper.

Test changes: delete a duplicate test identical to an existing case, tighten
the streaming-skip assertion to also verify saveWorkflow is not called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New Issues

Development

Successfully merging this pull request may close these issues.

1 participant