Skip to content

AI Assistant For Workflow Edit #3319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Conversation

stuartc
Copy link
Member

@stuartc stuartc commented Jun 18, 2025

Description

This PR extends the AI Assistant functionality to support workflow editing, building upon its existing workflow creation capabilities. Users can now access the AI Assistant at any stage of their workflow development process, from initial creation through ongoing modifications.

Closes #3247

Validation Steps

1. Basic AI Panel Functionality

  • Navigate to an existing workflow in edit mode
  • Click the floating AI Assistant button (top-left corner with chat icon)
  • Verify the AI panel slides in smoothly from the left side
  • Confirm the workflow adjust it's placement in the canvas to avoid being hidden by the AI panel
  • Click the close button (chevron icon) on the panel and verify it slides out smoothly

2. AI-Assisted Workflow Modifications

  • With the AI panel open, type a workflow modification request (e.g., "Add a new job that transforms data after Step-1")
  • Submit the request and verify the AI generates appropriate modifications
  • Confirm the workflow canvas updates in real-time with the suggested changes
  • Verify the new elements appear correctly on the canvas with proper connections
  • Verify that new changes are not directly saved
  • Verify that you can hit CTRL+S to save the modifications
  • Verify that you can undo the AI changes using the UNDO / REDO buttons
  • Add manually changes to the workflow and confirm that the AI modifications integrates well with your changes

3. URL Parameter Persistence

  • Open the AI panel and note the URL changes to include ?method=ai
  • Refresh the page and verify the AI panel remains open
  • Copy the URL, open in a new tab, and confirm the AI panel state is preserved
  • Close the panel and verify the method=ai parameter is removed from the URL
  • Open the other panels, see that they can coexist with the AI Assistant panel
  • Open the inspector, close it, note that the AI assistant panel's state hasn't changed
  • Open a session in the AI assistant, close the AI Assistant panel, reopen and see that your session is loaded by default
  • Try as many combinations of panels open / closed

4. Workflow Creation with AI

  • Click "New Workflow" from the workflows list
  • Pick a template and save to see that you can still create workflows using templates
  • Do the same with importing workflow YAMLs
  • Click the Build With AI ✨ button and ask the AI to create a workflow for you
  • Save your workflow and note that the AI Assistant stays loaded for your modifications
  • Note that sessions are now associated to workflows.

5. Error Handling

  • In the AI panel, request an invalid workflow modification (e.g., "Create a job with invalid syntax")
  • Verify error messages appear in the AI chat with helpful feedback
  • Confirm the workflow canvas doesn't update with invalid changes
  • Check that the workflow remains in a valid state

6. Multi-User Scenarios

  • Open the same workflow in two different browser sessions
  • Make AI-assisted changes in one session
  • Verify the presence indicators update correctly
  • Confirm read-only mode activates appropriately when another user is editing

7. Integration with Existing Features

  • With AI panel open, try manual workflow editing on the canvas
  • Add a job manually and verify the AI assistant remains functional
  • Test switching between job inspector and AI panel
  • Verify save functionality works correctly with AI-generated changes

8. Edge Cases

  • Test AI panel with workflows in snapshot (read-only) mode
  • Verify AI panel is disabled appropriately for users without edit permissions
  • Test behavior when switching between different workflows with AI panel open
  • Confirm proper cleanup when navigating away from the workflow editor

Additional notes for the reviewer

AI Usage

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

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

Pre-submission checklist

  • I have performed a self-review of my 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

stuartc added 2 commits June 18, 2025 15:47
Replace handle_response_generated/3 with extract_generated_code/1 to remove
unused parameters and UI side effects. Move callback logic to component for
better separation of concerns and add proper type specs.
@github-project-automation github-project-automation bot moved this to New Issues in v2 Jun 18, 2025
@elias-ba elias-ba changed the title Always Available Workflow AI Chat AI Assistant For Workflow Edit Jul 14, 2025
Copy link
Contributor

@doc-han doc-han left a comment

Choose a reason for hiding this comment

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

Just a few things that got changed during the merge conflict resolution.
Please request a review from me once it's done. I'll like to take a closer look later on.

Quickly tested undo/redo when building with the AI. there seems to be issues with it when clicking undo after the AI has painted its workflow on the canvas. edges disappear and some new nodes show up at times.

@github-project-automation github-project-automation bot moved this from New Issues to In review in v2 Jul 15, 2025
@elias-ba
Copy link
Contributor

@doc-han thanks a lot for this review. This is super helpful, and I would love you to continue dissecting this (if you have time).

Could you help me understand what you mean here:

Quickly tested undo/redo when building with the AI. there seems to be issues with it when clicking undo after the AI has painted its workflow on the canvas. edges disappear and some new nodes show up at times.

Ain't these nodes appearing / disappearing because the AI added / removed them so Undo / Redo would do the inverse ? Isn't this how it should work ?

elias-ba added 3 commits July 15, 2025 22:34
- When workflow is nil, query returns sessions where workflow_id is nil
- When workflow is provided, query filters by that specific workflow_id
@elias-ba elias-ba requested review from doc-han and midigofrank July 16, 2025 08:36
@elias-ba elias-ba marked this pull request as ready for review July 19, 2025 02:14
@elias-ba elias-ba self-assigned this Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

Edit existing workflows via AI chat
3 participants