Skip to content

feat(workflow-settings): simplify workflow model lanes#1502

Merged
gsxdsm merged 3 commits into
mainfrom
feature/workflow-settings
Jun 8, 2026
Merged

feat(workflow-settings): simplify workflow model lanes#1502
gsxdsm merged 3 commits into
mainfrom
feature/workflow-settings

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Project Models now gives users a direct place to set the default workflow's Plan/Triage, Executor, and Reviewer model lanes without digging through the full workflow policy editor. The workflow settings panel is also more usable for advanced policy editing: existing workflows open on grouped Values first, while declaration editing remains available for custom workflows.

The lane proxy persists through workflow setting values instead of resurrecting the old project-scoped model keys. It resolves stale default workflow IDs back to builtin:coding, keeps save rejections inline on the affected lane, and uses clearer inherited/default wording in the model dropdown.

Verification

  • pnpm --filter @fusion/dashboard typecheck
  • pnpm --filter @fusion/dashboard exec vitest run --project dashboard-app-quality-components-b app/components/__tests__/WorkflowSettingsPanel.test.tsx --silent=passed-only --reporter=dot
  • pnpm --filter @fusion/dashboard exec vitest run --project dashboard-app-quality-settings app/components/__tests__/SettingsModal.test.tsx --silent=passed-only --reporter=dot
  • pnpm --filter @fusion/dashboard test:browser-smoke
  • git diff --check

Browser Notes

agent-browser reached the local Vite server and the dashboard API health endpoint passed, but this linked-worktree HMR session did not mount the app because Vite returned 404s for existing app-root module paths such as /api/legacy.ts and /api-node.ts. The repository browser layout smoke passed in a real local browser.


Compound Engineering
GPT--5_Codex

Summary by CodeRabbit

  • New Features

    • Edit and save default workflow model lanes (Plan/Triage, Executor, Reviewer) per project with per-lane reset and batch save.
    • New grouped workflow settings display and grouping logic for clearer organization.
  • Improvements

    • Workflow settings reorganized into a value-first layout; Values tab defaults when settings exist.
    • Model selector adds customizable "use default" label; UI spacing and group headers improved.
  • Documentation & Tests

    • Updated docs, migration notes, and expanded tests covering workflow model-lane behavior.
  • Chores

    • Release notes/changeset and dev-server proxy adjustment.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3c569037-3a78-41c4-b154-7a86c65c68a4

📥 Commits

Reviewing files that changed from the base of the PR and between 4ac4764 and 7850b08.

📒 Files selected for processing (3)
  • .changeset/workflow-model-lanes-settings.md
  • packages/dashboard/app/components/settings/sections/ProjectModelsSection.tsx
  • packages/dashboard/vite.config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/dashboard/vite.config.ts
  • packages/dashboard/app/components/settings/sections/ProjectModelsSection.tsx

📝 Walkthrough

Walkthrough

This PR exposes default-workflow Plan/Triage, Executor, and Reviewer lanes in Project Models via workflow-scoped setting values, groups WorkflowSettingsPanel values by intent with display metadata, and updates tests, docs, and a changeset to reflect the split-authority storage and precedence changes.

Changes

Default Workflow Model Lanes Settings

Layer / File(s) Summary
Planning and documentation
.changeset/workflow-model-lanes-settings.md, docs/dashboard-guide.md, docs/plans/2026-06-08-001-feat-workflow-settings-simplification-plan.md, docs/settings-reference.md
Adds a changeset and updates docs/plans/reference to describe default workflow lane controls in Project Models, the proxy-edit approach, and the new model-resolution precedence that consults default workflow lane values.
Workflow setting display and grouping infrastructure
packages/dashboard/app/components/workflow-setting-display.ts
New types and DISPLAY mapping plus helpers getWorkflowSettingDisplay() and groupWorkflowSettings() to produce ordered groups and labels for workflow settings.
WorkflowSettingsPanel grouped values display and styling
packages/dashboard/app/components/WorkflowSettingsPanel.tsx, packages/dashboard/app/components/WorkflowSettingsPanel.css, packages/dashboard/app/components/__tests__/WorkflowSettingsPanel.test.tsx
Values tab now derives labels/helps from display helpers and renders grouped sections (Models, Review & Approval, Step Execution, Advanced); CSS adds group spacing/title styles; tests updated to assert grouping and tab defaults.
CustomModelDropdown default label support
packages/dashboard/app/components/CustomModelDropdown.tsx
Adds optional defaultOptionLabel prop, uses it for the default option row and when the selected value is empty.
ProjectModelsSection workflow model lanes feature
packages/dashboard/app/components/settings/sections/ProjectModelsSection.tsx, packages/dashboard/app/components/__tests__/SettingsModal.test.tsx
Replaces per-phase stub with "Default workflow model lanes" UI bound to workflow setting values; adds loading/pending/rejection state, per-lane reset, save that calls updateWorkflowSettingValues(), 404 fallback to builtin workflow, and surfaces per-lane validation messages. Tests cover edits, resets, stale workflow fallback, typed rejections, and no-project context.
SettingsModal integration & dev config
packages/dashboard/app/components/SettingsModal.tsx, packages/dashboard/vite.config.ts
Passes projectId and addToast into ProjectModelsSection; adjusts Vite dev-server proxy regex to avoid proxying .ts/.tsx/.js asset paths.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SettingsModal
  participant ProjectModelsSection
  participant WorkflowAPI as Workflow Settings API

  User->>SettingsModal: Open Project Models
  SettingsModal->>ProjectModelsSection: Render with projectId, addToast
  ProjectModelsSection->>WorkflowAPI: fetchWorkflowSettingValues(projectId, defaultWorkflowId)
  WorkflowAPI-->>ProjectModelsSection: { stored, effective, orphaned }
  ProjectModelsSection->>ProjectModelsSection: Derive lane values
  
  User->>ProjectModelsSection: Select new executor model
  ProjectModelsSection->>ProjectModelsSection: Update pending edits
  
  User->>ProjectModelsSection: Click Save workflow models
  ProjectModelsSection->>WorkflowAPI: updateWorkflowSettingValues({ settingId, patch })
  alt API Success
    WorkflowAPI-->>ProjectModelsSection: Updated values
    ProjectModelsSection->>ProjectModelsSection: Clear pending
    ProjectModelsSection->>SettingsModal: Toast success
  else API Validation Error
    WorkflowAPI-->>ProjectModelsSection: 400 with rejections
    ProjectModelsSection->>ProjectModelsSection: Map rejections to lanes
    ProjectModelsSection->>SettingsModal: Toast error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Runfusion/Fusion#1445: Introduces the underlying workflow settings mechanism and Settings UI redesign surfaces that this PR's default workflow model lane edits plug into.

Poem

🐰
I hopped through settings, lanes in hand,
Grouped each value, tidied the land,
Saved defaults without a fright,
Docs and tests now shine quite bright,
A carrot-toast for settings done!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% 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 title 'feat(workflow-settings): simplify workflow model lanes' directly and specifically describes the main change—simplifying workflow model lane configuration—which aligns with the PR's core objective of adding a dedicated place in Project Models to set default workflow model lanes.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/workflow-settings

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.

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a first-class proxy surface in Project Models settings for the default workflow's Plan/Triage, Executor, and Reviewer model lanes, backed by workflow_settings (never tombstoned project keys). The workflow settings panel is also reorganised: settings are grouped into Models, Review & Approval, Step Execution, and Advanced sections, and built-in workflows now open to the Values tab by default.

  • ProjectModelsSection gains a full load/save/reject cycle using fetchWorkflowSettingValues / updateWorkflowSettingValues with stale-workflow fallback to builtin:coding, reqSeq concurrency guard, and per-lane inline rejection display.
  • workflow-setting-display.ts is a new display-metadata catalog that drives grouping in both WorkflowSettingsPanel and the new lane controls; CustomModelDropdown gains a configurable defaultOptionLabel prop to surface "Use workflow/global default" instead of the generic label.
  • vite.config.ts tightens the dev-server proxy to a negative-lookahead regex so Vite-source modules under app/api* are served locally instead of being forwarded to the backend.

Confidence Score: 5/5

Safe to merge; the core proxy-edit path is well-guarded and the persistence boundary between project settings and workflow setting values is correctly maintained throughout.

The load/save/reject cycle in ProjectModelsSection is covered by targeted tests for all key paths (stale workflow fallback, null-patch reset, inline rejection, no-project disabled state). The reqSeq concurrency guard prevents stale responses from landing. Workflow lane saves are deliberately separated from the regular settings save, and the MOVED_SETTINGS_KEYS tombstone boundary is not touched.

No files require special attention; the vite.config.ts proxy regex has a minor edge case with query-string-suffixed source module URLs in dev, but this has no production impact.

Important Files Changed

Filename Overview
packages/dashboard/app/components/settings/sections/ProjectModelsSection.tsx Replaced the moved-settings stub for per-phase model lanes with a live proxy editor; load/save/reject workflow setting values through dedicated API calls, preserving separation from project settings save; well-guarded race via reqSeq pattern.
packages/dashboard/app/components/workflow-setting-display.ts New file providing display metadata (group, label, description) for known workflow setting IDs; groupWorkflowSettings partitions declarations into Models, Review & Approval, Step Execution, and Advanced; unknown IDs fall to Advanced.
packages/dashboard/app/components/WorkflowSettingsPanel.tsx Settings groups rendered in named sections using new display metadata; default tab now values when settings are populated; existing Definitions tab tests updated with explicit openDefinitions() calls.
packages/dashboard/app/components/CustomModelDropdown.tsx Added defaultOptionLabel prop to allow callers to override the Use default option label; memoization deps updated correctly in both the options list and display-value memo.
packages/dashboard/app/components/tests/SettingsModal.test.tsx New test suite covers workflow model lane proxy edits, null-patch resets, stale-workflow 404 fallback to builtin:coding, inline rejection rendering, and no-project disabled state.
packages/dashboard/vite.config.ts Proxy key narrowed from the plain /api prefix to a negative-lookahead regex that excludes paths ending in .ts/.tsx/.js/.jsx; regex logic is sound but the query-string anchor edge case may miss HMR cache-busted source URLs.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant PMS as ProjectModelsSection
    participant API as Dashboard API
    participant DB as workflow_settings

    U->>PMS: Open Project Models (projectId set)
    PMS->>API: fetchWorkflowSettingValues(defaultWorkflowId, projectId)
    alt 404 – stale workflow
        API-->>PMS: 404
        PMS->>API: fetchWorkflowSettingValues("builtin:coding", projectId)
    end
    API-->>PMS: "{ stored, effective, orphaned }"
    PMS-->>U: Render Plan/Triage, Executor, Reviewer dropdowns

    U->>PMS: Change lane value
    PMS-->>PMS: updateWorkflowLane → workflowPending

    U->>PMS: Click Save workflow models
    PMS->>API: updateWorkflowSettingValues(resolvedWorkflowId, workflowPending, projectId)
    alt Success
        API-->>DB: persist lane values
        API-->>PMS: updated payload
        PMS-->>U: Toast Workflow model settings saved
    else 400 Rejection
        API-->>PMS: "{ rejections: [{settingId, message}] }"
        PMS-->>U: Inline error per lane, pending preserved
    end
Loading

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

Comment thread .changeset/workflow-model-lanes-settings.md Outdated
Comment thread packages/dashboard/app/components/WorkflowSettingsPanel.tsx

@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: 1

🤖 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/settings/sections/ProjectModelsSection.tsx`:
- Around line 167-173: The catch block resets workflow payload, rejections and
resolvedWorkflowId but leaves workflowPending intact, risking stale edits being
applied to a different workflow; inside the same conditional (when
reqSeq.current === seq) call the state reset for pending edits (use
setWorkflowPending to clear to the initial/empty shape you use elsewhere), so
that after a failed reload you clear workflowPending along with
setWorkflowPayload, setWorkflowRejections and setResolvedWorkflowId (referencing
workflowPending, setWorkflowPending, reqSeq.current, seq, setWorkflowPayload,
setWorkflowRejections, setResolvedWorkflowId, defaultWorkflowId).
🪄 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: 6577ab27-4fe2-4c7e-927b-6e9585256f9d

📥 Commits

Reviewing files that changed from the base of the PR and between cf80622 and 61ae1bf.

📒 Files selected for processing (12)
  • .changeset/workflow-model-lanes-settings.md
  • docs/dashboard-guide.md
  • docs/plans/2026-06-08-001-feat-workflow-settings-simplification-plan.md
  • docs/settings-reference.md
  • packages/dashboard/app/components/CustomModelDropdown.tsx
  • packages/dashboard/app/components/SettingsModal.tsx
  • packages/dashboard/app/components/WorkflowSettingsPanel.css
  • packages/dashboard/app/components/WorkflowSettingsPanel.tsx
  • packages/dashboard/app/components/__tests__/SettingsModal.test.tsx
  • packages/dashboard/app/components/__tests__/WorkflowSettingsPanel.test.tsx
  • packages/dashboard/app/components/settings/sections/ProjectModelsSection.tsx
  • packages/dashboard/app/components/workflow-setting-display.ts

@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: 1

🧹 Nitpick comments (2)
packages/dashboard/vite.config.ts (2)

202-202: ⚡ Quick win

Add an explanatory comment for the .ts exclusion pattern.

The regex pattern's negative lookahead is subtle and may confuse future maintainers. Please add a comment explaining that .ts files are excluded to allow Vite to serve source modules from the /api directory while still proxying actual API endpoints.

📝 Suggested comment
   server: {
     proxy: {
+      // Proxy API requests to the backend, but exclude .ts files so Vite can
+      // serve source modules from app/api/ during development (fixes HMR 404s)
       "^/api(?!/.*\\.ts$)(/|$)": {
🤖 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/vite.config.ts` at line 202, Add a brief inline comment
next to the proxy rule that uses the regex "^/api(?!/.*\\.ts$)(/|$)" in
vite.config.ts explaining that the negative lookahead excludes .ts files so Vite
can serve source modules under /api while still proxying actual API endpoints;
update the comment to mention why the exclusion is necessary and give a short
example (e.g., allowing /api/foo.ts to be served as a module but proxying
/api/foo and /api/foo/).

202-202: ⚡ Quick win

Consider excluding .tsx files as well.

The regex only excludes .ts files, but if there are React component files (.tsx) under the app/api directory, they would still be proxied to the backend and result in 404s. Consider extending the pattern to also exclude .tsx:

"^/api(?!/.*\\.tsx?$)(/|$)": {

This would match both .ts and .tsx files.

🤖 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/vite.config.ts` at line 202, The proxy rule key in
vite.config.ts currently uses the pattern "^/api(?!/.*\\.ts$)(/|$)" which only
excludes .ts files; update that proxy key to also exclude .tsx files so React
API route files aren't proxied (i.e., make the negative lookahead match both .ts
and .tsx). Locate the proxy entry whose key is the "^/api(?!/.*\\.ts$)(/|$)"
string and replace the pattern with one that excludes both extensions, keeping
the rest of the proxy config intact.
🤖 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/vite.config.ts`:
- Line 202: The proxy regex string "^/api(?!/.*\\.ts$)(/|$)" in vite.config.ts
fails to exclude requests like "/api/foo.ts?x=1"; update this negative lookahead
to also reject paths ending in .ts, .tsx (and optionally .jsx) even when
followed by query strings (i.e., extend the negative lookahead to match file
extensions optionally followed by a "?" and query), and add a short inline
comment next to the proxy entry explaining that these extensions are excluded so
Vite serves TS/TSX/JSX modules and HMR instead of proxying them to the backend.

---

Nitpick comments:
In `@packages/dashboard/vite.config.ts`:
- Line 202: Add a brief inline comment next to the proxy rule that uses the
regex "^/api(?!/.*\\.ts$)(/|$)" in vite.config.ts explaining that the negative
lookahead excludes .ts files so Vite can serve source modules under /api while
still proxying actual API endpoints; update the comment to mention why the
exclusion is necessary and give a short example (e.g., allowing /api/foo.ts to
be served as a module but proxying /api/foo and /api/foo/).
- Line 202: The proxy rule key in vite.config.ts currently uses the pattern
"^/api(?!/.*\\.ts$)(/|$)" which only excludes .ts files; update that proxy key
to also exclude .tsx files so React API route files aren't proxied (i.e., make
the negative lookahead match both .ts and .tsx). Locate the proxy entry whose
key is the "^/api(?!/.*\\.ts$)(/|$)" string and replace the pattern with one
that excludes both extensions, keeping the rest of the proxy config intact.
🪄 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: f1eb963e-dd83-4a0c-af9a-a5e3108778f7

📥 Commits

Reviewing files that changed from the base of the PR and between 61ae1bf and 4ac4764.

📒 Files selected for processing (1)
  • packages/dashboard/vite.config.ts

Comment thread packages/dashboard/vite.config.ts Outdated
- Bump workflow model lane changeset to minor

- Clear pending workflow model edits after value reload failures

- Exclude Vite source module requests with query strings from API proxy
@gsxdsm
gsxdsm merged commit 55a8e14 into main Jun 8, 2026
6 checks passed
@gsxdsm
gsxdsm deleted the feature/workflow-settings branch June 8, 2026 06:11
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