feat(frontend): workflow picker in create modal + fix refresh bug#902
feat(frontend): workflow picker in create modal + fix refresh bug#902Gkrumbach07 merged 3 commits intomainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughCentralizes 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
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 | 🔴 CriticalFix CI blocker: unused
userHasInteractedstate value.Lint is currently failing (
no-unused-vars) becauseuserHasInteractedis 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
📒 Files selected for processing (6)
components/frontend/src/app/projects/[name]/sessions/[sessionName]/lib/types.tscomponents/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsxcomponents/frontend/src/components/create-session-dialog.tsxcomponents/frontend/src/components/workflow-picker.tsxcomponents/frontend/src/types/agentic-session.tscomponents/frontend/src/types/workflow.ts
| if (workflowSelection) { | ||
| request.activeWorkflow = workflowSelection; | ||
| } |
There was a problem hiding this comment.
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).
| activeWorkflow?: { | ||
| gitUrl: string; | ||
| branch: string; | ||
| path?: string; | ||
| }; |
There was a problem hiding this comment.
🛠️ 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.
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
components/frontend/src/app/projects/[name]/sessions/[sessionName]/page.tsx
| if (hasRealMessages) { | ||
| setUserHasInteracted(true); | ||
|
|
||
| } |
There was a problem hiding this comment.
🧹 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.
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>
a25d528 to
76f35a8
Compare
Summary
Changes
types/workflow.ts— shared workflow types (WorkflowConfig,WorkflowSelection, etc.)components/workflow-picker.tsx— reusable searchable workflow picker componentcreate-session-dialog.tsx— integrated WorkflowPicker + CustomWorkflowDialogtypes/agentic-session.ts— addedactiveWorkflowtoCreateAgenticSessionRequestpage.tsx— fixed custom workflow restoration on refresh viasetCustomWorkflow()lib/types.ts— re-exports workflow types from shared locationTest plan
Fixes: RHOAIENG-52973