Skip to content

feat(dashboard): workflow optional steps — authoring, full-modal parity, stepwise seam - #1703

Merged
gsxdsm merged 10 commits into
mainfrom
gsxdsm/workflow-optional-steps
Jun 21, 2026
Merged

feat(dashboard): workflow optional steps — authoring, full-modal parity, stepwise seam#1703
gsxdsm merged 10 commits into
mainfrom
gsxdsm/workflow-optional-steps

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Workflow optional steps

Workflows can declare optional steps — workflow-step templates (e.g. Browser Verification) that a task may toggle on/off per task, with a workflow-level defaultOn seeding the initial state.

Implements the plan at docs/plans/2026-06-20-001-feat-workflow-optional-steps-node-editor-modal-plan.md (units U1–U5).

What's in this PR

  • U1 — stepwise builtin parity + seam (core/engine): the stepwise-coding workflow gains a workflow-step seam node (placed once after the foreach, with rework-hold → workflow-step and workflow-step → {review,end} edges) plus a browser-verification optional-step declaration (default OFF) so enabled steps actually run.
  • U2 — node-editor round-trip (dashboard): flowToIr/serializeGraph now thread optionalSteps, and a new optionalStepsOf reader hydrates editor state — fixing a data-loss bug where saving a workflow in the visual editor dropped its optional-step declaration. Empty/absent optionalSteps is omitted entirely to preserve legacy v1 byte-identity.
  • U3 — authoring panel (dashboard): an Optional Steps panel in the node editor to add/remove declarations and set each one's defaultOn, with a shared workflow-phase-badge extraction and graceful handling of unknown/stale template ids.
  • U4 — full New Task modal (dashboard): TaskForm/NewTaskModal load the selected workflow's optional steps, seed from defaultOn, and submit enabledWorkflowSteps (omitted when empty).
  • U5 — shared steps dropdown (dashboard): a reusable WorkflowOptionalStepsDropdown (portal-positioned, keyboard/aria-complete) adopted by both the quick-add card and the full modal, replacing the inline chip toggles.

Test plan

  • @fusion/core suite: 6218 passed.
  • @fusion/engine suite: 7983 passed (incl. stepwise seam parity/execution tests).
  • @fusion/dashboard optional-steps suites: flow-mapping, node editor, dropdown, inline card, modal, form — all green (629 in the focused run; 1229 across the broader component set).

Review (ce-code-review autofix) — applied

  • Dropdown active-option focus() was called on every render while open → moved to a useEffect keyed on [isOpen, position, activeIndex] (3-reviewer corroboration).
  • NewTaskModal post-create/close reset omitted setEnabledWorkflowSteps([]) → added to both reset blocks.

Residual Review Findings

These were surfaced by the autofix review and are intentionally not addressed in this PR (out-of-diff scope, behavioral decisions, or test-hardening). Recorded here verbatim as the durable handoff:

  • [P2] Agent-native parity gap — fn_task_create cannot set enabledWorkflowSteps (packages/engine/src/agent-tools.ts). The store (TaskCreateInput) and HTTP route both accept enabledWorkflowSteps, but the agent tool schema/execute path do not expose it, so an agent cannot opt into/out of optional steps at create time. Fix: add an optional enabled_workflow_steps array param and forward it to createAgentTask.
  • [P2] U1 execution test under-proves R1 (packages/engine/src/__tests__/stepwise-workflow-parity.test.ts:583). The seam test uses a spy but never sets enabledWorkflowSteps on the task, so it proves graph routing but not that the seam reads enabledWorkflowSteps → writes workflowStepResults. Harden: set enabledWorkflowSteps:["browser-verification"], assert workflowStepResults populated, and add an OFF-sibling asserting none.
  • [P2] Creation-surface divergence (InlineCreateCard vs TaskForm). InlineCreateCard resolves the effective workflow to 'builtin:coding' when no default is configured; TaskForm shows no steps. Canonicalize the fetch/seed/toggle wiring (e.g. a shared useWorkflowOptionalSteps hook) — behavioral decision, needs intent.
  • [P2] Template→workflow creation may drop optionalSteps (copyIrWithFreshIds path, not in this diff). Verify and add coverage that declarations survive create-from-template.
  • [P3] Untested stepwise edges: the new rework-hold → workflow-step edge and the three workflow-step → end outcome edges have no execution-level test.
  • [P3] TaskForm re-seed double-trigger on async settings load (benign today; flagged by 2 reviewers) — clears then re-seeds enabledWorkflowSteps once the default workflow id resolves.

Advisory (verify before acting): FNXC_LOG comments + FN-XXXX commit-prefix conventions; mobile portal / iOS-keyboard drift and offscreen-toggle horizontal-scroll require real-browser verification (plan R-3).

🤖 Generated with Claude Code


Open in Stage

Summary by CodeRabbit

Release Notes

  • New Features

    • Workflows can now define optional steps that tasks can enable or disable (with workflow-level defaults).
    • Browser verification is available as an optional step in built-in workflows.
    • Workflow editor now lets you author, save, and manage optional steps.
  • UI Enhancements

    • Task creation now uses a shared multi-select dropdown for optional step selection (quick-add and the full modal).
  • Bug Fixes

    • Optional step configurations are preserved correctly across workflow editor save/load, and enabled optional steps run properly in stepwise workflows.

gsxdsm added 6 commits June 21, 2026 00:02
…ep to stepwise workflow

The stepwise-coding IR had no workflow-step seam node, so a per-task
enabledWorkflowSteps entry (e.g. browser verification) would never execute.
Add the seam node on the success path (steps -> workflow-step -> review,
once post-foreach) and declare browser-verification as an optional step,
matching the coding workflow. Covers the dead-toggle gap with resolver and
engine execution-divergence tests.
Thread an optionalSteps param through flowToIr (counts as a v2 signal,
re-attached like fields/settings, omitted entirely when empty for byte
identity) and add an optionalStepsOf reader mirroring fieldsOf/settingsOf.
Without this, saving a workflow through the node editor silently dropped
its optional-step declaration.
New WorkflowOptionalStepsPanel (sibling to Fields/Settings) lets authors
add/remove optional steps and set each one's defaultOn, with unknown ids
shown as muted removable rows. Wire optionalSteps state through both load
paths (incl. the fragment path, which also dropped settings), every
flowToIr/serializeGraph call site, and the save handler deps — fixing a
stale-closure that dropped defaultOn edits on save. Extract the shared
phaseBadge helper. Mobile gets an Optional steps tab too.
Add WorkflowOptionalStepsDropdown — a controlled, portal-rendered multi-select
(listbox a11y, keyboard nav, committed 'Steps: N selected' label matrix,
render-nothing empty state) shared by the quick-add card and (next) the full
modal. Swap InlineCreateCard's inline chip toggles for it; the fetch/seed/submit
wiring is unchanged. Remove the now-unused chip CSS.
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@gsxdsm, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 5 minutes and 2 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b3566f0-1bde-46cd-bbf4-e2c5ab1b30e9

📥 Commits

Reviewing files that changed from the base of the PR and between e16d489 and 7c8eba3.

📒 Files selected for processing (10)
  • docs/solutions/build-errors/eslint-exhaustive-deps-rule-not-registered-fails-ci-lint.md
  • packages/core/src/builtin-stepwise-coding-workflow-ir.ts
  • packages/dashboard/app/components/InlineCreateCard.tsx
  • packages/dashboard/app/components/NewTaskModal.tsx
  • packages/dashboard/app/components/TaskForm.tsx
  • packages/dashboard/app/components/WorkflowNodeEditor.tsx
  • packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx
  • packages/dashboard/app/components/WorkflowOptionalStepsPanel.tsx
  • packages/dashboard/app/components/workflow-flow-mapping.ts
  • packages/dashboard/app/components/workflow-phase-badge.tsx
📝 Walkthrough

Walkthrough

Adds optional workflow steps end-to-end: the stepwise-coding built-in IR gains a workflow-step seam node and browser-verification optional step declaration; flowToIr and a new optionalStepsOf helper handle serialization round-trips; WorkflowNodeEditor threads optional steps through all load/save/dirty paths; new WorkflowOptionalStepsDropdown and WorkflowOptionalStepsPanel components handle selection and authoring; NewTaskModal/TaskForm/InlineCreateCard wire optional step selection into task creation.

Changes

Workflow Optional Steps

Layer / File(s) Summary
Stepwise IR: workflow-step seam node and optionalSteps declaration
packages/core/src/builtin-stepwise-coding-workflow-ir.ts, packages/core/src/__tests__/workflow-optional-steps.test.ts, packages/engine/src/__tests__/stepwise-workflow-parity.test.ts
Adds workflow-step seam node to stepwise IR, rewires both the normal-success and rework-hold-release edges through it before review, and declares browser-verification as defaultOn: false. Core tests assert browser-verification resolves from the stepwise IR and that the seam node and edges exist; engine parity tests verify the seam runs exactly once and is a transparent pass-through when no callback is supplied.
flowToIr / optionalStepsOf serialization round-trip
packages/dashboard/app/components/workflow-flow-mapping.ts, packages/dashboard/app/components/__tests__/workflow-flow-mapping.test.ts
Extends flowToIr with an optionalSteps parameter, treats non-empty optionalSteps as a v2 signal, serializes the array into the v2 IR and omits the property when empty for byte-identity. Adds exported optionalStepsOf extractor. Round-trip tests cover extraction semantics, v2 promotion, and key-absence behavior.
Shared UI: WorkflowOptionalStepsDropdown, WorkflowOptionalStepsPanel, phaseBadge
packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx, packages/dashboard/app/components/WorkflowOptionalStepsDropdown.css, packages/dashboard/app/components/WorkflowOptionalStepsPanel.tsx, packages/dashboard/app/components/WorkflowOptionalStepsPanel.css, packages/dashboard/app/components/workflow-phase-badge.tsx, packages/dashboard/app/components/WorkflowResultsTab.tsx, packages/dashboard/app/components/__tests__/WorkflowOptionalSteps*.test.tsx
WorkflowOptionalStepsDropdown is a portal-backed, keyboard-navigable multi-select listbox with ARIA wiring; WorkflowOptionalStepsPanel is an authoring list with add/remove/defaultOn controls and unknown-template handling; phaseBadge is extracted to a shared helper. Full test suites cover accessibility, keyboard navigation, editing behaviors, and read-only mode.
WorkflowNodeEditor: optionalSteps authoring, load/save/dirty wiring
packages/dashboard/app/components/WorkflowNodeEditor.tsx, packages/dashboard/app/components/__tests__/WorkflowNodeEditor.test.tsx
Threads optionalSteps state through load (optionalStepsOf), reset, dirty-tracking (serializeGraph), save (flowToIr), AI-replace, and post-save snapshot re-baseline. Adds a collapsible desktop sidebar "Optional steps" section and a mobile tab, both rendering WorkflowOptionalStepsPanel. Test verifies defaultOn toggle persists through save.
Task creation: NewTaskModal, TaskForm, InlineCreateCard
packages/dashboard/app/components/NewTaskModal.tsx, packages/dashboard/app/components/TaskForm.tsx, packages/dashboard/app/components/InlineCreateCard.tsx, packages/dashboard/app/components/InlineCreateCard.css, packages/dashboard/app/components/__tests__/NewTaskModal.test.tsx, packages/dashboard/app/components/__tests__/InlineCreateCard.test.tsx, packages/dashboard/app/components/__tests__/TaskForm.test.tsx
NewTaskModal tracks enabledWorkflowSteps state, resets on close/post-create, and conditionally includes it in the create payload. TaskForm fetches resolved optional steps per workflow selection, seeds the enabled set from defaultOn, and renders WorkflowOptionalStepsDropdown. InlineCreateCard replaces per-step toggle buttons with the shared dropdown and removes associated CSS. Tests cover payload inclusion, defaultOn pre-seeding, and "No workflow" omission.
Feature plan and changeset
docs/plans/2026-06-20-001-feat-workflow-optional-steps-node-editor-modal-plan.md, .changeset/workflow-optional-steps.md
Adds the feature plan document (requirements R1–R7, implementation units U1–U5, scope boundaries, deferred work, risks) and changeset marking a minor version bump.

Sequence Diagrams

sequenceDiagram
  rect rgba(100, 149, 237, 0.5)
    Note over NewTaskModal,fetchWorkflowOptionalSteps: Task creation optional-step selection
  end
  participant NewTaskModal
  participant TaskForm
  participant fetchWorkflowOptionalSteps
  participant WorkflowOptionalStepsDropdown
  NewTaskModal->>TaskForm: enabledWorkflowSteps, onEnabledWorkflowStepsChange
  TaskForm->>fetchWorkflowOptionalSteps: fetch(workflowId, projectId)
  fetchWorkflowOptionalSteps-->>TaskForm: ResolvedWorkflowOptionalStep[]
  TaskForm->>TaskForm: seed enabledIds from defaultOn
  TaskForm->>WorkflowOptionalStepsDropdown: steps, enabledIds, onToggle
  WorkflowOptionalStepsDropdown-->>TaskForm: onToggle(templateId)
  TaskForm-->>NewTaskModal: onEnabledWorkflowStepsChange(ids)
  NewTaskModal->>NewTaskModal: create payload includes enabledWorkflowSteps
Loading
sequenceDiagram
  rect rgba(144, 238, 144, 0.5)
    Note over WorkflowNodeEditor,WorkflowOptionalStepsPanel: Node editor authoring
  end
  participant WorkflowNodeEditor
  participant optionalStepsOf
  participant WorkflowOptionalStepsPanel
  participant flowToIr
  WorkflowNodeEditor->>optionalStepsOf: optionalStepsOf(activeWorkflow)
  optionalStepsOf-->>WorkflowNodeEditor: WorkflowOptionalStep[]
  WorkflowNodeEditor->>WorkflowOptionalStepsPanel: optionalSteps, onChange, readOnly
  WorkflowOptionalStepsPanel-->>WorkflowNodeEditor: onChange(updatedSteps)
  WorkflowNodeEditor->>flowToIr: flowToIr(..., optionalSteps)
  flowToIr-->>WorkflowNodeEditor: WorkflowIrV2 with optionalSteps
  WorkflowNodeEditor->>WorkflowNodeEditor: updateWorkflow(ir)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Runfusion/Fusion#1536: Establishes the workflow-step seam execution pipeline that this PR depends on for optional-step execution in the stepwise workflow.

Poem

🐇 Hop, hop, a new step appears,
Optional branches, the rabbit cheers!
With dropdowns and panels, the editor gleams,
defaultOn: false — unless the user dreams.
Save, load, round-trip, the seam node runs neat,
Browser-verification: toggle complete! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and specifically summarizes the main changes: workflow optional steps implementation across authoring (node editor), full modal parity (New Task Modal), and stepwise seam (builtin workflow).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gsxdsm/workflow-optional-steps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ghost

ghost commented Jun 21, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai 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.

Actionable comments posted: 5

🧹 Nitpick comments (6)
packages/core/src/builtin-stepwise-coding-workflow-ir.ts (1)

126-131: ⚡ Quick win

Add an FNXC-formatted requirement trace comment for the new seam/optional-step behavior.

This is a major behavior seam change (steps → workflow-step → review plus optional-step declaration) and should carry one FNXC:<Area> yyyy-MM-dd-hh:mm: trace comment near the introduced logic for requirement/date traceability.

As per coding guidelines, **/*.{ts,tsx,js,jsx} changes should include FNXC-formatted requirement/date comments; based on learnings, use the FNXC:<Area> yyyy-MM-dd-hh:mm: convention (without requiring a literal FNXC_LOG token).

Also applies to: 162-172, 192-194

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/builtin-stepwise-coding-workflow-ir.ts` around lines 126 -
131, Add FNXC-formatted requirement trace comments for requirement and date
traceability near the major behavior seam changes in this file. Specifically,
add comments with the format FNXC:<Area> yyyy-MM-dd-hh:mm: near the
workflow-step node definition (the prompt kind node with id "workflow-step"),
and near any optional-step declarations (such as browser-verification step).
These trace comments should be placed as inline comments just before or after
the logic that introduces this new workflow-step seam behavior to maintain
compliance with the TypeScript file coding guidelines for requirement
traceability.

Sources: Coding guidelines, Learnings

packages/dashboard/app/components/workflow-flow-mapping.ts (1)

458-463: ⚡ Quick win

Add an FNXC-formatted comment for the optionalSteps v2-signal/round-trip contract.

The new v2 signaling + key-omission behavior is contract-level logic; adding a nearby FNXC:<Area> yyyy-MM-dd-hh:mm: comment would keep requirement provenance explicit.

As per coding guidelines, important TS behavior decisions should be captured with FNXC-formatted requirement/date comments; based on learnings, follow the FNXC:<Area> yyyy-MM-dd-hh:mm: convention.

Also applies to: 564-569, 981-989

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/app/components/workflow-flow-mapping.ts` around lines 458
- 463, Add FNXC-formatted comments to document the contract-level logic related
to v2 signaling and key-omission behavior. Specifically, add a comment in the
format FNXC:<Area> yyyy-MM-dd-hh:mm: near the v2 variable assignment (around the
hasOptionalSteps check) to capture the requirement that optionalSteps
contributes to v2-signal detection and impacts round-trip serialization. Apply
the same FNXC comment pattern to the other related v2-signal logic locations
mentioned (at lines 564-569 and 981-989) to maintain consistent documentation of
this contract-level behavior throughout the workflow-flow-mapping.ts file.

Sources: Coding guidelines, Learnings

packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx (1)

1-18: ⚡ Quick win

Add an FNXC-formatted provenance comment for this new dropdown.

Please include a brief FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: comment that captures the requirement/decision behind this shared optional-steps control.

As per coding guidelines **/*.{ts,tsx,js,jsx} requires FNXC-formatted requirement/change comments, and based on learnings this should use the FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: convention.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx` around
lines 1 - 18, The WorkflowOptionalStepsDropdown component is missing the
required FNXC-formatted provenance comment. Add a brief FNXC comment following
the convention FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: that documents the
requirement or decision behind this shared optional-steps control. This comment
should be placed after the existing JSDoc block and before the component
implementation to comply with coding guidelines for all TypeScript/TSX files.

Sources: Coding guidelines, Learnings

packages/dashboard/app/components/WorkflowOptionalStepsPanel.tsx (1)

1-13: ⚡ Quick win

Add an FNXC-formatted provenance comment for this panel.

Please add a concise FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: comment documenting the requirement/decision for this optional-steps authoring surface.

As per coding guidelines **/*.{ts,tsx,js,jsx} requires FNXC-formatted requirement/change comments, and based on learnings this should follow FNXC:<Area-of-product> yyyy-MM-dd-hh:mm:.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/app/components/WorkflowOptionalStepsPanel.tsx` around
lines 1 - 13, The WorkflowOptionalStepsPanel.tsx file is missing the required
FNXC-formatted provenance comment. Add a new line at the beginning of the JSDoc
block (before the existing documentation comment) that follows the format
FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: where Area-of-product should be a
descriptive label for the workflow editor functionality and the timestamp should
reflect when this requirement/decision was made. This comment documents the
rationale for the optional-steps authoring surface and is required for all
TypeScript and TypeScript React files per coding guidelines.

Sources: Coding guidelines, Learnings

packages/dashboard/app/components/workflow-phase-badge.tsx (1)

1-5: ⚡ Quick win

Add an FNXC-formatted provenance comment for this helper.

Please add a short FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: comment capturing the requirement/decision that introduced this shared badge extraction.

As per coding guidelines **/*.{ts,tsx,js,jsx} requires FNXC-formatted requirement/change comments, and based on learnings this should use the FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: convention (not a literal FNXC_LOG token).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/app/components/workflow-phase-badge.tsx` around lines 1 -
5, The workflow-phase-badge.tsx file is missing an FNXC-formatted provenance
comment as required by the coding guidelines for TypeScript/JavaScript files.
Add a short FNXC-formatted comment using the convention FNXC:<Area-of-product>
yyyy-MM-dd-hh:mm: that captures the requirement or decision that introduced this
shared badge extraction. This comment should be placed near the existing JSDoc
comment at the top of the file and should follow the FNXC format convention (not
a literal FNXC_LOG token).

Sources: Coding guidelines, Learnings

packages/dashboard/app/components/TaskForm.tsx (1)

298-304: ⚡ Quick win

Use FNXC-format for this new requirement comment block.

The new optional-steps behavior notes are requirement-driven and should use the repo’s FNXC comment convention.

As per coding guidelines, **/*.{ts,tsx,js,jsx} should use comments in FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: format for requirement/UX/technical-decision traces. Based on learnings, this means using FNXC heading format rather than adding a literal FNXC_LOG token.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/app/components/TaskForm.tsx` around lines 298 - 304, The
comment block preceding the effectiveOptionalWorkflowId variable declaration
does not follow the FNXC format convention required for requirement-driven
comments in TypeScript files. Replace the existing comment that describes the
optional workflow steps behavior with a properly formatted FNXC comment using
the format FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: followed by the requirement
details, ensuring the comment captures the null selection and undefined behavior
documentation in the standardized FNXC format.

Sources: Coding guidelines, Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/dashboard/app/components/InlineCreateCard.tsx`:
- Around line 1083-1091: Add a FNXC-formatted requirement comment to document
the design decision for the user-facing selection path introduced by the
WorkflowOptionalStepsDropdown component. Insert an FNXC comment with the format
FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: followed by the rationale for enabling
users to toggle optional workflow steps through this dropdown. This comment
should be placed directly above or inline with the WorkflowOptionalStepsDropdown
component to document the product requirement and decision behind this UX
interaction.

In `@packages/dashboard/app/components/NewTaskModal.tsx`:
- Around line 64-66: The enabledWorkflowSteps state is now user-editable but the
hasDirtyState tracking does not include it in its comparison logic. Update the
hasDirtyState calculation to also compare the current enabledWorkflowSteps
against its initial value, ensuring that any changes to optional workflow steps
are properly detected as dirty state and trigger the discard confirmation prompt
when users attempt to close the modal.

In `@packages/dashboard/app/components/TaskForm.tsx`:
- Around line 307-310: The early return when effectiveOptionalWorkflowId is
falsy does not reset the optionalStepsLoading state, which can leave the loading
UI stuck even after switching to "No workflow". Add a call to set
optionalStepsLoading to false in the conditional block around line 307-310
before the early return statement. Apply the same fix to the similar code block
mentioned at lines 325-327 to ensure the loading state is cleared in all cases
where the workflow selection changes or is cleared.

In `@packages/dashboard/app/components/WorkflowNodeEditor.tsx`:
- Around line 2501-2505: The WorkflowOptionalStepsPanel component accepts a
pluginTemplates prop that allows it to merge and display plugin-contributed step
templates, but both instances of this component (one in the desktop layout
around line 2501-2505 and one in the mobile layout around line 2811-2815) are
missing this prop. Add the pluginTemplates prop to both
WorkflowOptionalStepsPanel component instances and pass the appropriate plugin
templates data so that the "Add optional step" picker can display
plugin-contributed step templates.

In `@packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx`:
- Around line 163-166: The listbox element with role="listbox" in
WorkflowOptionalStepsDropdown.tsx is missing the aria-multiselectable="true"
attribute. Add this attribute to the same element that has aria-label and
aria-labelledby to properly expose the multi-select semantics to assistive
technologies, ensuring they interpret this as a multi-select control rather than
a single-select one.

---

Nitpick comments:
In `@packages/core/src/builtin-stepwise-coding-workflow-ir.ts`:
- Around line 126-131: Add FNXC-formatted requirement trace comments for
requirement and date traceability near the major behavior seam changes in this
file. Specifically, add comments with the format FNXC:<Area> yyyy-MM-dd-hh:mm:
near the workflow-step node definition (the prompt kind node with id
"workflow-step"), and near any optional-step declarations (such as
browser-verification step). These trace comments should be placed as inline
comments just before or after the logic that introduces this new workflow-step
seam behavior to maintain compliance with the TypeScript file coding guidelines
for requirement traceability.

In `@packages/dashboard/app/components/TaskForm.tsx`:
- Around line 298-304: The comment block preceding the
effectiveOptionalWorkflowId variable declaration does not follow the FNXC format
convention required for requirement-driven comments in TypeScript files. Replace
the existing comment that describes the optional workflow steps behavior with a
properly formatted FNXC comment using the format FNXC:<Area-of-product>
yyyy-MM-dd-hh:mm: followed by the requirement details, ensuring the comment
captures the null selection and undefined behavior documentation in the
standardized FNXC format.

In `@packages/dashboard/app/components/workflow-flow-mapping.ts`:
- Around line 458-463: Add FNXC-formatted comments to document the
contract-level logic related to v2 signaling and key-omission behavior.
Specifically, add a comment in the format FNXC:<Area> yyyy-MM-dd-hh:mm: near the
v2 variable assignment (around the hasOptionalSteps check) to capture the
requirement that optionalSteps contributes to v2-signal detection and impacts
round-trip serialization. Apply the same FNXC comment pattern to the other
related v2-signal logic locations mentioned (at lines 564-569 and 981-989) to
maintain consistent documentation of this contract-level behavior throughout the
workflow-flow-mapping.ts file.

In `@packages/dashboard/app/components/workflow-phase-badge.tsx`:
- Around line 1-5: The workflow-phase-badge.tsx file is missing an
FNXC-formatted provenance comment as required by the coding guidelines for
TypeScript/JavaScript files. Add a short FNXC-formatted comment using the
convention FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: that captures the
requirement or decision that introduced this shared badge extraction. This
comment should be placed near the existing JSDoc comment at the top of the file
and should follow the FNXC format convention (not a literal FNXC_LOG token).

In `@packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx`:
- Around line 1-18: The WorkflowOptionalStepsDropdown component is missing the
required FNXC-formatted provenance comment. Add a brief FNXC comment following
the convention FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: that documents the
requirement or decision behind this shared optional-steps control. This comment
should be placed after the existing JSDoc block and before the component
implementation to comply with coding guidelines for all TypeScript/TSX files.

In `@packages/dashboard/app/components/WorkflowOptionalStepsPanel.tsx`:
- Around line 1-13: The WorkflowOptionalStepsPanel.tsx file is missing the
required FNXC-formatted provenance comment. Add a new line at the beginning of
the JSDoc block (before the existing documentation comment) that follows the
format FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: where Area-of-product should be
a descriptive label for the workflow editor functionality and the timestamp
should reflect when this requirement/decision was made. This comment documents
the rationale for the optional-steps authoring surface and is required for all
TypeScript and TypeScript React files per coding guidelines.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 426eb16b-293f-4481-a3ff-2eb2bb95517d

📥 Commits

Reviewing files that changed from the base of the PR and between 4f9c4cf and 481e38d.

📒 Files selected for processing (24)
  • .changeset/workflow-optional-steps.md
  • docs/plans/2026-06-20-001-feat-workflow-optional-steps-node-editor-modal-plan.md
  • packages/core/src/__tests__/workflow-optional-steps.test.ts
  • packages/core/src/builtin-stepwise-coding-workflow-ir.ts
  • packages/dashboard/app/components/InlineCreateCard.css
  • packages/dashboard/app/components/InlineCreateCard.tsx
  • packages/dashboard/app/components/NewTaskModal.tsx
  • packages/dashboard/app/components/TaskForm.tsx
  • packages/dashboard/app/components/WorkflowNodeEditor.tsx
  • packages/dashboard/app/components/WorkflowOptionalStepsDropdown.css
  • packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx
  • packages/dashboard/app/components/WorkflowOptionalStepsPanel.css
  • packages/dashboard/app/components/WorkflowOptionalStepsPanel.tsx
  • packages/dashboard/app/components/WorkflowResultsTab.tsx
  • packages/dashboard/app/components/__tests__/InlineCreateCard.test.tsx
  • packages/dashboard/app/components/__tests__/NewTaskModal.test.tsx
  • packages/dashboard/app/components/__tests__/TaskForm.test.tsx
  • packages/dashboard/app/components/__tests__/WorkflowNodeEditor.test.tsx
  • packages/dashboard/app/components/__tests__/WorkflowOptionalStepsDropdown.test.tsx
  • packages/dashboard/app/components/__tests__/WorkflowOptionalStepsPanel.test.tsx
  • packages/dashboard/app/components/__tests__/workflow-flow-mapping.test.ts
  • packages/dashboard/app/components/workflow-flow-mapping.ts
  • packages/dashboard/app/components/workflow-phase-badge.tsx
  • packages/engine/src/__tests__/stepwise-workflow-parity.test.ts
💤 Files with no reviewable changes (1)
  • packages/dashboard/app/components/InlineCreateCard.css

Comment thread packages/dashboard/app/components/InlineCreateCard.tsx
Comment thread packages/dashboard/app/components/NewTaskModal.tsx
Comment thread packages/dashboard/app/components/TaskForm.tsx
Comment thread packages/dashboard/app/components/WorkflowNodeEditor.tsx
Comment thread packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx
@greptile-apps

greptile-apps Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces workflow optional steps end-to-end: workflow-level declarations, node-editor authoring, round-trip persistence through flowToIr/serializeGraph, and a shared WorkflowOptionalStepsDropdown consumed by both the quick-add card and the full New Task modal. It also fixes a pre-existing data-loss bug where saving a workflow in the visual editor silently dropped optionalSteps (and settings on the fragment/generate path).

  • U1/core+engine: Stepwise builtin gains a workflow-step seam node and browser-verification optional step (default OFF); routing corrected for both the normal and rework-exhausted paths.
  • U2/flow-mapping: optionalStepsOf reader added; flowToIr threads optionalSteps and omits the key entirely when empty for v1 byte-identity preservation.
  • U3/authoring panel: WorkflowOptionalStepsPanel lets workflow authors add/remove step declarations and set defaultOn, with graceful handling of unknown template IDs.
  • U4+U5/task creation: TaskForm fetches and seeds optional steps from defaultOn in create mode, lifting the enabled set to NewTaskModal; WorkflowOptionalStepsDropdown is adopted by both creation surfaces, replacing the previous chip-toggle buttons in InlineCreateCard.

Confidence Score: 5/5

Safe to merge; all changed paths are covered by tests and the known residual gaps are transparently documented in the PR description.

The feature is well-scoped and thoroughly tested (flow-mapping round-trip, dropdown, panel, modal, inline card, engine seam execution). The data-loss fix for the fragment/generate path is correct. The two flagged items are non-blocking style and accessibility concerns with no impact on runtime correctness or data integrity.

WorkflowOptionalStepsDropdown.tsx (Tab-away accessibility) and TaskForm.tsx (effect deps comment) are worth a quick look but have no effect on functional correctness.

Important Files Changed

Filename Overview
packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx New shared multi-select dropdown for optional workflow steps; portal-positioned, keyboard+ARIA-annotated. Tab-away does not close the popup listbox.
packages/dashboard/app/components/TaskForm.tsx Adds optional-step fetch, seed, and toggle in create mode; lifts enabled set to NewTaskModal. Effect deps comment omits stability requirement for onWorkflowIdChange.
packages/dashboard/app/components/WorkflowOptionalStepsPanel.tsx New authoring panel for optional-step declarations in the node editor; renders resolved templates and handles unknown/stale IDs gracefully.
packages/dashboard/app/components/WorkflowNodeEditor.tsx Threads optionalSteps through serializeGraph/flowToIr and hydrates on load and fragment/generate paths; also fixes settings data-loss on the generate path.
packages/dashboard/app/components/workflow-flow-mapping.ts Adds optionalStepsOf reader and threads optionalSteps through flowToIr; omits the key entirely when empty to preserve legacy v1 byte-identity (R6).
packages/dashboard/app/components/NewTaskModal.tsx Adds enabledWorkflowSteps state, dirty-check, and both reset paths; threads the enabled set to TaskForm and into the create payload. Clean implementation.
packages/core/src/builtin-stepwise-coding-workflow-ir.ts Adds workflow-step seam node and browser-verification optional step to the stepwise builtin, with corrected rework-hold → workflow-step → review edge routing.
packages/engine/src/tests/stepwise-workflow-parity.test.ts Adds seam execution tests: verifies the workflow-step node fires exactly once post-foreach and routes correctly before review; no-op pass-through is also covered.
packages/dashboard/app/components/InlineCreateCard.tsx Replaces individual chip-toggle buttons with the shared WorkflowOptionalStepsDropdown, keeping the same toggle callback and enabled-id semantics.
packages/dashboard/app/components/workflow-phase-badge.tsx Extracts phaseBadge from WorkflowResultsTab into a shared utility; identical signature, no behavior change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Workflow IR\noptionalSteps declaration] -->|optionalStepsOf| B[WorkflowNodeEditor\noptionalSteps state]
    B -->|WorkflowOptionalStepsPanel| C[Author: add/remove/defaultOn]
    B -->|serializeGraph / flowToIr| D[Saved IR\noptionalSteps preserved]

    A -->|fetchWorkflowOptionalSteps| E[TaskForm\noptionalSteps + seed from defaultOn]
    E -->|lift enabledWorkflowSteps| F[NewTaskModal\ncreate payload]
    E -->|WorkflowOptionalStepsDropdown| G[User toggles steps]
    G --> F

    H[InlineCreateCard\nfetches optional steps] -->|WorkflowOptionalStepsDropdown| G

    F -->|enabledWorkflowSteps| I[Task created]
    I -->|workflow-step seam node| J[runWorkflowSteps\ne.g. browser-verification]
    J --> K[review node]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Workflow IR\noptionalSteps declaration] -->|optionalStepsOf| B[WorkflowNodeEditor\noptionalSteps state]
    B -->|WorkflowOptionalStepsPanel| C[Author: add/remove/defaultOn]
    B -->|serializeGraph / flowToIr| D[Saved IR\noptionalSteps preserved]

    A -->|fetchWorkflowOptionalSteps| E[TaskForm\noptionalSteps + seed from defaultOn]
    E -->|lift enabledWorkflowSteps| F[NewTaskModal\ncreate payload]
    E -->|WorkflowOptionalStepsDropdown| G[User toggles steps]
    G --> F

    H[InlineCreateCard\nfetches optional steps] -->|WorkflowOptionalStepsDropdown| G

    F -->|enabledWorkflowSteps| I[Task created]
    I -->|workflow-step seam node| J[runWorkflowSteps\ne.g. browser-verification]
    J --> K[review node]
Loading

Reviews (2): Last reviewed commit: "Address PR review feedback (#1703)" | Re-trigger Greptile

Comment thread packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx
Comment thread packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx
Comment thread packages/dashboard/app/components/WorkflowOptionalStepsDropdown.tsx
gsxdsm added 3 commits June 21, 2026 03:00
- Dropdown: aria-multiselectable, drop dead aria-labelledby, ArrowUp opens panel
- Dirty-state: NewTaskModal tracks enabledWorkflowSteps so toggles trigger discard prompt
- TaskForm: reset optionalStepsLoading on the no-workflow early return
- Node editor: pass plugin step templates into the optional-steps panel (both layouts)
- FNXC requirement comments on the new optional-steps components
- FNXC requirement-trace comments on the stepwise workflow-step seam,
  the flowToIr v2-signal/byte-identity contract, and TaskForm's
  optional-steps create-mode behavior
@gsxdsm

gsxdsm commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

Re: CodeRabbit "Nitpick comments (6)" — FNXC requirement-trace comments

All six FNXC nitpicks are now addressed:

  • Three were already added in commit 45dc1795e: WorkflowOptionalStepsDropdown.tsx, WorkflowOptionalStepsPanel.tsx, workflow-phase-badge.tsx.
  • The remaining three are addressed in commit 7c8eba38b:
    • builtin-stepwise-coding-workflow-ir.ts — FNXC trace on the pre-merge workflow-step seam (the node that makes enabledWorkflowSteps actually run).
    • workflow-flow-mapping.ts — FNXC trace on the optionalSteps v2-signal / byte-identity contract.
    • TaskForm.tsx — converted the optional-steps create-mode comment block to FNXC format.

All follow the FNXC:<Area-of-product> yyyy-MM-dd-hh:mm: convention from AGENTS.md.

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