feat(workflow-generator): enhance the AI auto-creation flow end-to-end#38175
Open
crazywoola wants to merge 6 commits into
Open
feat(workflow-generator): enhance the AI auto-creation flow end-to-end#38175crazywoola wants to merge 6 commits into
crazywoola wants to merge 6 commits into
Conversation
Implements the stage 1–5 program from #38174 (3.1 dropped per request). Backend (api/) - New POST /workflow-generate/suggestions: short, workspace-grounded example instructions generated on the tenant default model; soft-fails to {suggestions: []}. - New POST /workflow-generate/stream: SSE plan-first generation that emits the planner result (plan) then the built graph (result), reusing the existing planner/builder/validate stages — the streamed result provably equals the blocking /workflow-generate return. - mode:"auto" on both generate endpoints; a lightweight classifier resolves the concrete mode before planning and it is echoed back as `mode`. Frontend (web/) - Remove the low-value "Ideal output" field from the modal. - Replace the static example chips with AI-generated, workspace-grounded suggestions (cached per session per mode, ↻ refresh, silent static fallback). - Plan-first streaming: show the planner outline as it lands, then the graph (replaces the guessed phase timer) via an isolated SSE consumer that reuses the existing cookie-auth/CSRF/abort setup without touching handleStream. - Review stage: planner metadata header (icon + name), an actionable error panel (Regenerate / Install tools / affected node), a /refine diff summary, and a post-apply nudge toward cmd+k /refine. - Entry & input: ⌘/Ctrl+Enter to generate, autofocus, palette inline capture (`/create workflow <text>`), an "Auto" submenu option, and last-instruction resume across opens. i18n keys added across all 23 locales. New tests cover the suggestions component (fetch → fallback → refresh), the graph diff util, and the updated /create command. Refs #38174 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Pyrefly Type Coverage
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-06-30 01:34:09.175636287 +0000
+++ /tmp/pyrefly_pr.txt 2026-06-30 01:33:53.273610741 +0000
@@ -5585,6 +5585,10 @@
--> tests/unit_tests/core/workflow/generator/test_runner.py:2438:16
ERROR Cannot index into `str` [bad-index]
--> tests/unit_tests/core/workflow/generator/test_runner.py:2439:16
+ERROR Argument `str` is not assignable to parameter `mode` with type `Literal['advanced-chat', 'workflow']` in function `core.workflow.generator.runner.WorkflowGenerator.generate_workflow_graph_stream` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/generator/test_runner.py:3064:111
+ERROR Argument `str` is not assignable to parameter `mode` with type `Literal['advanced-chat', 'workflow']` in function `core.workflow.generator.runner.WorkflowGenerator.generate_workflow_graph` [bad-argument-type]
+ --> tests/unit_tests/core/workflow/generator/test_runner.py:3066:103
ERROR Argument `None` is not assignable to parameter `plugin_id` with type `str` in function `_make_plugin_provider` [bad-argument-type]
--> tests/unit_tests/core/workflow/generator/test_tool_catalogue.py:344:55
ERROR Default `str` is not assignable to parameter `node_type` with type `BuiltinNodeTypes` [bad-function-definition]
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #38175 +/- ##
==========================================
- Coverage 85.32% 85.30% -0.03%
==========================================
Files 4967 4968 +1
Lines 258518 258819 +301
Branches 49059 49110 +51
==========================================
+ Hits 220593 220790 +197
- Misses 33632 33731 +99
- Partials 4293 4298 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pyrefly rejected flask.stream_with_context called with a generator (constrained AnyStr overload — "no-matching-overload"), failing the Python type-check CI. Switch the streaming endpoint to the repo's established SSE helper compact_generate_response (which wraps _stream_with_request_context), so it type-checks and still preserves request context during iteration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- jsonc/sort-keys (CI TS Common): the new i18n keys were appended at the end; re-sort them into ascending order across all locales via eslint --fix. - knip (CI Web Style): WorkflowGenPlanNode / WorkflowGenPlanInput are only used inside debug.ts, so stop exporting them. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a render test for GenerationPlan (planning state vs. plan outline + building state), covering the previously-untested new component and improving patch coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhances the AI auto-creation flow — the
⌘K→/createand/refineworkflow/chatflow generator (behindENABLE_FEATURE_PREVIEW) — end-to-end, implementing the stage 1–5 program tracked in #38174. Also folds in the two concrete refinements that started this work: dropping the low-value "Ideal output" field and replacing the static example chips with AI-generated, workspace-grounded suggestions.Closes #38174 (item 3.1 intentionally dropped; see Deferred below).
What changed
Backend (
api/)POST /workflow-generate/suggestions— returns a few short, buildable example instructions for the generator's "ideas" chips, grounded in the tenant's real knowledge bases + installed tools. Runs on the tenant default model (works before the user picks one) and soft-fails to{ "suggestions": [] }so the UI silently falls back.POST /workflow-generate/stream(SSE) — plan-first generation: emits aplanevent the moment the planner finishes, then aresultevent after the builder + validation. Reuses the existing planner/builder/validate stages through one shared generator, so the streamedresultprovably equals the blocking/workflow-generatereturn (parity test included).mode: "auto"on both generate endpoints — a tiny classifier resolves Workflow vs Chatflow before planning; the concrete mode is echoed back asmodeand never leaks"auto"./workflow-generateis unchanged except its response now also carriesmode.Frontend (
web/)Stage 1 — entry & input
/create workflow summarize a URLpre-fills the modal; "Auto" submenu option opens auto-mode.Stage 2 — generation
sseGeneratorPostconsumer that reuses the cookie-auth/CSRF/abort setup without touching the sharedhandleStream. Falls back to the single-shot endpoint if the stream can't start.Stage 3 — review (3.1 dropped)
UNKNOWN_TOOL) Install tools.Stage 4 — apply
/refinediff summary (added / removed / changed) computed client-side from the base vs. generated graph.⌘K → /refine.Stage 5 — history
i18n
New keys added across all 23 locales (
workflow.json+app.json); en-US authoritative, zh-Hans/zh-Hant translated, others English pending the translate bot.Tests
/createcommand (inline capture + auto option + threading).type-checkclean;eslint --quiet(CI posture) reports no new errors.Deferred (follow-ups, tracked in #38174)
ENABLE_FEATURE_PREVIEWthe cmd+k entry suffices; lands with GA.Notes
🤖 Generated with Claude Code