Skip to content

feat(frontend): workflow picker in create modal + fix refresh bug#902

Merged
Gkrumbach07 merged 3 commits intomainfrom
feat/workflow-picker-create-modal-52973
Mar 13, 2026
Merged

feat(frontend): workflow picker in create modal + fix refresh bug#902
Gkrumbach07 merged 3 commits intomainfrom
feat/workflow-picker-create-modal-52973

Conversation

@Gkrumbach07
Copy link
Contributor

Summary

  • Add WorkflowPicker component to the create session dialog for selecting OOTB or custom workflows at session creation time
  • Fix custom workflow paths being lost on page refresh by restoring full git details (gitUrl, branch, path) from the session CR
  • Keep existing sidebar WorkflowsAccordion for mid-session workflow changes

Changes

  • New: types/workflow.ts — shared workflow types (WorkflowConfig, WorkflowSelection, etc.)
  • New: components/workflow-picker.tsx — reusable searchable workflow picker component
  • Modified: create-session-dialog.tsx — integrated WorkflowPicker + CustomWorkflowDialog
  • Modified: types/agentic-session.ts — added activeWorkflow to CreateAgenticSessionRequest
  • Modified: page.tsx — fixed custom workflow restoration on refresh via setCustomWorkflow()
  • Modified: lib/types.ts — re-exports workflow types from shared location

Test plan

  • Frontend unit tests pass (471 passed)
  • ESLint passes (0 errors, 0 warnings)
  • Build succeeds

Fixes: RHOAIENG-52973

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

Warning

Rate limit exceeded

@Gkrumbach07 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 213266bd-43bd-4d52-b0d8-a966c9ba79f3

📥 Commits

Reviewing files that changed from the base of the PR and between a25d528 and 76f35a8.

📒 Files selected for processing (6)
  • components/frontend/src/app/projects/[name]/sessions/[sessionName]/lib/types.ts
  • components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx
  • components/frontend/src/components/create-session-dialog.tsx
  • components/frontend/src/components/workflow-picker.tsx
  • components/frontend/src/types/agentic-session.ts
  • components/frontend/src/types/workflow.ts

Walkthrough

Centralizes workflow types into a new shared module, adds a WorkflowPicker UI and workflow selection to the Create Session dialog, and restores/apply custom workflows on session page load while removing the WelcomeExperience usage.

Changes

Cohort / File(s) Summary
Shared Types
components/frontend/src/types/workflow.ts, components/frontend/src/app/projects/[name]/sessions/[sessionName]/lib/types.ts
Introduce centralized workflow types (WorkflowConfig, WorkflowCommand, WorkflowAgent, WorkflowMetadata, WorkflowSelection) and re-export them from the local session types file.
API Type
components/frontend/src/types/agentic-session.ts
Extend CreateAgenticSessionRequest with optional activeWorkflow?: { gitUrl: string; branch: string; path?: string }.
Workflow Picker UI
components/frontend/src/components/workflow-picker.tsx
Add WorkflowPicker component: searchable popover, filtering, selection callbacks, supports "general" and "custom" entries, loading state and accessibility.
Create Session Dialog
components/frontend/src/components/create-session-dialog.tsx
Add workflow selection state and UI, fetch OOTB workflows, support custom workflow fields (gitUrl/branch/path), attach activeWorkflow on submit, reset on close.
Session Page Integration
components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx
Remove WelcomeExperience import and its props from MessagesTab. Add logic to restore/apply custom workflow from session.spec.activeWorkflow via workflowManagement.setCustomWorkflow and set active workflow to "custom" when no OOTB match exists.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CreateDialog as CreateSessionDialog
  participant Picker as WorkflowPicker
  participant Server
  participant SessionPage as SessionPage
  participant WorkflowMgmt as workflowManagement

  User->>CreateDialog: Open create session dialog
  CreateDialog->>Server: fetch OOTB workflows
  Server-->>CreateDialog: return ootbWorkflows
  CreateDialog->>Picker: render with ootbWorkflows
  User->>Picker: select workflow (ootb or custom)
  Picker-->>CreateDialog: onWorkflowChange(selected)
  alt custom selected
    CreateDialog->>CreateDialog: collect customGitUrl/branch/path
  end
  CreateDialog->>Server: submit create session (include activeWorkflow if present)
  Server-->>SessionPage: session created (spec.activeWorkflow set if provided)
  SessionPage->>SessionPage: on load, check session.spec.activeWorkflow
  alt no ootb match
    SessionPage->>WorkflowMgmt: setCustomWorkflow(gitUrl, branch="main"?, path)
    WorkflowMgmt-->>SessionPage: custom workflow applied
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: adding a workflow picker component to the create modal and fixing a custom workflow refresh bug.
Description check ✅ Passed The description provides comprehensive details about the changes, test results, and the issue being fixed, all directly related to the changeset.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/workflow-picker-create-modal-52973
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx (1)

169-170: ⚠️ Potential issue | 🔴 Critical

Fix CI blocker: unused userHasInteracted state value.

Lint is currently failing (no-unused-vars) because userHasInteracted is never read.

✅ Minimal unblock
-  const [userHasInteracted, setUserHasInteracted] = useState(false);
+  const [, setUserHasInteracted] = useState(false);

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/frontend/src/app/projects/`[name]/sessions/[sessionName]/page.tsx
around lines 169 - 170, The declared state const [userHasInteracted,
setUserHasInteracted] = useState(false) is unused and triggers a no-unused-vars
lint error; remove this state declaration (both userHasInteracted and
setUserHasInteracted) from the component so useState is no longer called for
this unused value, or alternatively, if the interaction flag is intended to be
used later, ensure you reference userHasInteracted (or call
setUserHasInteracted) where appropriate instead of leaving it unused.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/frontend/src/components/create-session-dialog.tsx`:
- Around line 196-198: The code that builds the session request currently skips
setting request.activeWorkflow when workflowSelection exists but the custom
workflow lacks a repository URL, causing sessions to be created without the
chosen workflow; update the submit handler (the place where request is
constructed and request.activeWorkflow is set) to either (A) always assign
request.activeWorkflow = workflowSelection when a workflow is selected and only
validate repository URL for later processing, or preferably (B) validate before
submitting: if workflowSelection indicates "Custom workflow" and the repository
URL/field is empty, prevent submission and surface a user-facing validation
error, otherwise set request.activeWorkflow = workflowSelection and continue;
apply the same validation/assignment logic to the other request-building sites
mentioned (where request.activeWorkflow is set).

In `@components/frontend/src/types/agentic-session.ts`:
- Around line 196-200: The activeWorkflow property currently duplicates the
WorkflowSelection shape; replace its inline type with a direct reference to the
existing WorkflowSelection type (i.e., change activeWorkflow?: { gitUrl: string;
branch: string; path?: string; } to activeWorkflow?: WorkflowSelection) so the
session type stays consistent as WorkflowSelection evolves; update the import or
type reference in components/frontend/src/types/agentic-session.ts to ensure
WorkflowSelection is available where activeWorkflow is declared.

---

Outside diff comments:
In `@components/frontend/src/app/projects/`[name]/sessions/[sessionName]/page.tsx:
- Around line 169-170: The declared state const [userHasInteracted,
setUserHasInteracted] = useState(false) is unused and triggers a no-unused-vars
lint error; remove this state declaration (both userHasInteracted and
setUserHasInteracted) from the component so useState is no longer called for
this unused value, or alternatively, if the interaction flag is intended to be
used later, ensure you reference userHasInteracted (or call
setUserHasInteracted) where appropriate instead of leaving it unused.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7607b8a-79e2-474d-9f97-fd662be3398a

📥 Commits

Reviewing files that changed from the base of the PR and between 373db39 and 927c54d.

📒 Files selected for processing (6)
  • components/frontend/src/app/projects/[name]/sessions/[sessionName]/lib/types.ts
  • components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx
  • components/frontend/src/components/create-session-dialog.tsx
  • components/frontend/src/components/workflow-picker.tsx
  • components/frontend/src/types/agentic-session.ts
  • components/frontend/src/types/workflow.ts

Comment on lines +196 to +198
if (workflowSelection) {
request.activeWorkflow = workflowSelection;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Prevent submitting when “Custom workflow” is selected without a repository URL.

Right now, users can select custom workflow and submit, but Lines 196-198 omit activeWorkflow when URL is empty, so the session is created without the selected workflow.

🐛 Proposed fix
+  const customWorkflowInvalid =
+    selectedWorkflow === "custom" && !customGitUrl.trim();

   const onSubmit = async (values: FormValues) => {
     if (!projectName) return;
+    if (customWorkflowInvalid) {
+      toast.error("Git Repository URL is required for custom workflow");
+      return;
+    }

     const request: CreateAgenticSessionRequest = {
@@
-    if (workflowSelection) {
+    if (workflowSelection) {
       request.activeWorkflow = workflowSelection;
     }
@@
-                <Button type="submit" data-testid="create-session-submit" disabled={createSessionMutation.isPending || runnerTypesLoading || runnerTypesError || modelsLoading || (modelsError && models.length === 0)}>
+                <Button type="submit" data-testid="create-session-submit" disabled={createSessionMutation.isPending || runnerTypesLoading || runnerTypesError || modelsLoading || (modelsError && models.length === 0) || customWorkflowInvalid}>

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

Also applies to: 301-331, 572-572

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/frontend/src/components/create-session-dialog.tsx` around lines
196 - 198, The code that builds the session request currently skips setting
request.activeWorkflow when workflowSelection exists but the custom workflow
lacks a repository URL, causing sessions to be created without the chosen
workflow; update the submit handler (the place where request is constructed and
request.activeWorkflow is set) to either (A) always assign
request.activeWorkflow = workflowSelection when a workflow is selected and only
validate repository URL for later processing, or preferably (B) validate before
submitting: if workflowSelection indicates "Custom workflow" and the repository
URL/field is empty, prevent submission and surface a user-facing validation
error, otherwise set request.activeWorkflow = workflowSelection and continue;
apply the same validation/assignment logic to the other request-building sites
mentioned (where request.activeWorkflow is set).

Comment on lines +196 to +200
activeWorkflow?: {
gitUrl: string;
branch: string;
path?: string;
};
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Reuse WorkflowSelection instead of duplicating the activeWorkflow shape.

Lines 196-200 duplicate WorkflowSelection and create drift risk as workflow typing evolves.

♻️ Proposed fix
+import type { WorkflowSelection } from "@/types/workflow";
+
 export type CreateAgenticSessionRequest = {
   initialPrompt?: string;
   llmSettings?: Partial<LLMSettings>;
@@
-  activeWorkflow?: {
-    gitUrl: string;
-    branch: string;
-    path?: string;
-  };
+  activeWorkflow?: WorkflowSelection;
   labels?: Record<string, string>;
   annotations?: Record<string, string>;
   runnerType?: string;
 };

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/frontend/src/types/agentic-session.ts` around lines 196 - 200, The
activeWorkflow property currently duplicates the WorkflowSelection shape;
replace its inline type with a direct reference to the existing
WorkflowSelection type (i.e., change activeWorkflow?: { gitUrl: string; branch:
string; path?: string; } to activeWorkflow?: WorkflowSelection) so the session
type stays consistent as WorkflowSelection evolves; update the import or type
reference in components/frontend/src/types/agentic-session.ts to ensure
WorkflowSelection is available where activeWorkflow is declared.

Copy link

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@components/frontend/src/app/projects/`[name]/sessions/[sessionName]/page.tsx:
- Around line 1211-1213: There are two empty conditional branches checking
hasRealMessages (the if blocks at/around the hasRealMessages checks) that do
nothing; remove these dead if (...) { } blocks (or, if there was intended
behavior, implement it) to eliminate no-op conditionals—search for the
hasRealMessages references in page.tsx and either delete the empty if blocks at
the reported locations or replace them with the correct side-effecting logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8216daeb-cf26-4bb9-b039-4001acc0cb95

📥 Commits

Reviewing files that changed from the base of the PR and between 927c54d and a25d528.

📒 Files selected for processing (1)
  • components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx

Comment on lines 1211 to 1213
if (hasRealMessages) {
setUserHasInteracted(true);

}
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Remove empty hasRealMessages branches (dead code).

These conditionals are no-ops and add confusion about missing side effects. Either remove them now or implement the intended behavior.

♻️ Proposed cleanup
       if (matchingWorkflow) {
         workflowManagement.setActiveWorkflow(matchingWorkflow.id);
         workflowManagement.setSelectedWorkflow(matchingWorkflow.id);
-        // Mark as interacted for existing sessions with messages
-        if (hasRealMessages) {
-
-        }
       } else {
         // No matching OOTB workflow found - treat as custom workflow.
         // Restore the full custom workflow details from the session CR
         // so they survive page refresh.
@@
         workflowManagement.setCustomWorkflow(
           aw.gitUrl,
           aw.branch || "main",
           aw.path || ""
         );
         workflowManagement.setActiveWorkflow("custom");
-        if (hasRealMessages) {
-
-        }
       }

As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."

Also applies to: 1225-1227

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/frontend/src/app/projects/`[name]/sessions/[sessionName]/page.tsx
around lines 1211 - 1213, There are two empty conditional branches checking
hasRealMessages (the if blocks at/around the hasRealMessages checks) that do
nothing; remove these dead if (...) { } blocks (or, if there was intended
behavior, implement it) to eliminate no-op conditionals—search for the
hasRealMessages references in page.tsx and either delete the empty if blocks at
the reported locations or replace them with the correct side-effecting logic.

Ambient Code Bot and others added 3 commits March 12, 2026 23:21
Add workflow selection to the create session dialog using the
WorkflowPicker component. Also fix custom workflow paths being
lost on page refresh by restoring them from session CR.

- Add shared workflow types in types/workflow.ts
- Add reusable WorkflowPicker component
- Integrate WorkflowPicker into CreateSessionDialog
- Add activeWorkflow field to CreateAgenticSessionRequest
- Fix custom workflow details lost on refresh by calling
  setCustomWorkflow with full git details from session spec

Fixes: RHOAIENG-52973

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three source files were accidentally committed with 755 permissions
instead of the standard 644. This restores them to non-executable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…come cards

Replace custom WorkflowPicker popover with standard shadcn Select
component. Show workflow description as helper text below dropdown.
Inline custom workflow fields (git URL, branch, path) directly in
the form instead of opening a second modal.

Remove WelcomeExperience workflow cards from chat message area —
workflow selection now happens only in the create session dialog
and the sidebar accordion.

Fixes: RHOAIENG-52973

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Gkrumbach07 Gkrumbach07 force-pushed the feat/workflow-picker-create-modal-52973 branch from a25d528 to 76f35a8 Compare March 13, 2026 04:22
@Gkrumbach07 Gkrumbach07 merged commit ecd3419 into main Mar 13, 2026
13 of 15 checks passed
@Gkrumbach07 Gkrumbach07 deleted the feat/workflow-picker-create-modal-52973 branch March 13, 2026 04:22
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