Skip to content

feat: improve create task modal#2194

Draft
Davidknp wants to merge 7 commits into
mainfrom
new-create-task-modal
Draft

feat: improve create task modal#2194
Davidknp wants to merge 7 commits into
mainfrom
new-create-task-modal

Conversation

@Davidknp
Copy link
Copy Markdown
Collaborator

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 22, 2026

Greptile Summary

This PR refactors the create-task modal into a single unified layout — replacing the three-tab strategy switcher (From Branch / From Issue / From Pull Request) with a compact "Based on" toggle (Issue | Pull Request) and a separate Workspace Settings tab for branch/checkout configuration. Three separate mode hooks (useFromBranchMode, useFromIssueMode, useFromPullRequestMode) are consolidated into a single useCreateTaskState, and the inline selectors are promoted to popover-based comboboxes.

  • The new useCreateTaskState hook unifies task-name generation, branch selection, and linked-entity state; issue/PR selection is now optional enrichment rather than a hard requirement for creation.
  • use-task-name is reworked to use a placeholder/effectiveTaskName pattern, keeping user-typed input separate from the AI-generated name and merging only at submission.
  • initial-conversation-section.tsx ships two placeholder buttons (PlusIcon, CheckCheckIcon) with onClick={() => {}} no-ops, and the auto-approve Switch plus ModalContextBar were removed without replacement in this PR.

Confidence Score: 3/5

The modal restructure and hook consolidation are logically sound, but the initial-conversation toolbar ships two buttons that do nothing on click — a visible regression that reaches users directly.

The core task-creation path (state management, strategy dispatch, isValid gating) looks correct after the refactor. The problem is in initial-conversation-section.tsx: two toolbar buttons with empty onClick handlers are rendered as fully interactive UI elements with no action, and the auto-approve Switch was dropped with no replacement. These are observable regressions in the conversation tab that users will encounter on every task creation.

src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx — the no-op buttons and dead hook/import cleanup both need attention before merge.

Important Files Changed

Filename Overview
src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx Redesigned toolbar area ships two no-op buttons (onClick={() => {}}) and retains dead code from the removed ModalContextBar and auto-approve Switch.
src/renderer/features/tasks/create-task-modal/use-create-task-state.ts New unified hook replaces three separate mode hooks; consolidates branch/issue/PR selection and task name generation with correct per-project reset and isValid derivation.
src/renderer/features/tasks/create-task-modal/create-task-modal.tsx Significant restructure removes the three-tab strategy switcher in favour of a "Based on" toggle (issue/PR) plus a separate Workspace Settings section; handleCreateTask correctly dispatches PR vs. branch-based creation.
src/renderer/features/tasks/create-task-modal/use-task-name.ts Reworked to use placeholder/effectiveTaskName pattern; user input is kept separate from the generated name and merged only at submission time.
src/renderer/features/tasks/create-task-modal/workspace-settings-section.tsx New component that surfaces branch picker or checkout-mode group depending on linked type; "Select existing workspace" radio item is permanently disabled.
src/renderer/features/tasks/create-task-modal/issue-combobox-field.tsx New popover-based issue combobox replacing the inline selector; auto-closes on selection.
src/renderer/features/tasks/create-task-modal/pr-combobox-field.tsx New popover-based PR combobox replacing the inline selector + selected-PR-card pattern; auto-closes on selection.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([Open CreateTaskModal]) --> B[useCreateTaskState\ninitialPR? → linkedType='pr' : 'issue']
    B --> C{initialStrategy?}
    C -- from-issue --> D[setLinkedType 'issue']
    C -- from-pull-request --> E[setLinkedType 'pr']
    C -- from-branch --> F[default: linkedType='issue']

    subgraph Modal UI
        G[TaskNameField\nplaceholder = generatedName]
        H{Based-on toggle}
        H -- Issue --> I[IssueComboboxField\noptional]
        H -- Pull Request --> J[PrComboboxField\ndisabled when no repositoryUrl]
        K{Section tab}
        K -- conversation --> L[InitialConversationField\nAgentSelector + Textarea]
        K -- workspace --> M[WorkspaceSettingsSection]
        M --> N{linkedType=pr && linkedPR?}
        N -- yes --> O[CheckoutModeGroup]
        N -- no --> P[BranchPickerField]
    end

    B --> G
    G --> H

    subgraph handleCreateTask
        Q{linkedType=pr && linkedPR?}
        Q -- yes --> R[resolvePullRequestTaskStrategy\ncreateTask PR-based]
        Q -- no --> S[resolveBranchLikeTaskStrategy\ncreateTask branch-based\nlinkedIssue if type=issue]
    end

    H --> K
    K --> Q
Loading

Comments Outside Diff (2)

  1. src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx, line 49-60 (link)

    P2 Dead code left over from removed UI elements

    autoApproveDefaults, contextActions, and handleActionClick are computed on every render but none of them are referenced in the JSX anymore — the Switch and ModalContextBar that consumed them were removed in this PR. The associated imports (Switch, ModalContextBar, buildContextActionText, buildTaskContextActions, ContextAction, useAgentAutoApproveDefaults) are similarly unused. This also causes unnecessary hook calls (useAgentAutoApproveDefaults, useMemo for context actions) on each render.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx
    Line: 49-60
    
    Comment:
    **Dead code left over from removed UI elements**
    
    `autoApproveDefaults`, `contextActions`, and `handleActionClick` are computed on every render but none of them are referenced in the JSX anymore — the `Switch` and `ModalContextBar` that consumed them were removed in this PR. The associated imports (`Switch`, `ModalContextBar`, `buildContextActionText`, `buildTaskContextActions`, `ContextAction`, `useAgentAutoApproveDefaults`) are similarly unused. This also causes unnecessary hook calls (`useAgentAutoApproveDefaults`, `useMemo` for context actions) on each render.
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx, line 62-92 (link)

    P2 Auto-approve switch silently removed

    The Switch for "Auto-approve permissions" was removed from InitialConversationField with no replacement. In the previous UI it was the only surface where users could toggle per-agent auto-approve defaults from the create task modal. The autoApproveDefaults hook is still called and the setting is still read in handleCreateTask when building builtInitialConversation, so the last-saved default continues to apply — but users can no longer change it from here. Was removing the auto-approve switch intentional? If so, is there another surface where users can update their auto-approve preference?

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx
    Line: 62-92
    
    Comment:
    **Auto-approve switch silently removed**
    
    The `Switch` for "Auto-approve permissions" was removed from `InitialConversationField` with no replacement. In the previous UI it was the only surface where users could toggle per-agent auto-approve defaults from the create task modal. The `autoApproveDefaults` hook is still called and the setting is still read in `handleCreateTask` when building `builtInitialConversation`, so the last-saved default continues to apply — but users can no longer change it from here. Was removing the auto-approve switch intentional? If so, is there another surface where users can update their auto-approve preference?
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx:80-85
**No-op button handlers ship non-functional UI**

Both the `PlusIcon` and `CheckCheckIcon` buttons use `onClick={() => {}}`, so clicking them produces no effect. Because the old `ModalContextBar` was removed from this component in this PR, these buttons appear to be intended replacements for it — but they are unimplemented. A user who clicks either button will see no response, with no indication that the action is pending.

### Issue 2 of 3
src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx:49-60
**Dead code left over from removed UI elements**

`autoApproveDefaults`, `contextActions`, and `handleActionClick` are computed on every render but none of them are referenced in the JSX anymore — the `Switch` and `ModalContextBar` that consumed them were removed in this PR. The associated imports (`Switch`, `ModalContextBar`, `buildContextActionText`, `buildTaskContextActions`, `ContextAction`, `useAgentAutoApproveDefaults`) are similarly unused. This also causes unnecessary hook calls (`useAgentAutoApproveDefaults`, `useMemo` for context actions) on each render.

### Issue 3 of 3
src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx:62-92
**Auto-approve switch silently removed**

The `Switch` for "Auto-approve permissions" was removed from `InitialConversationField` with no replacement. In the previous UI it was the only surface where users could toggle per-agent auto-approve defaults from the create task modal. The `autoApproveDefaults` hook is still called and the setting is still read in `handleCreateTask` when building `builtInitialConversation`, so the last-saved default continues to apply — but users can no longer change it from here.

Reviews (1): Last reviewed commit: "feat: task modal improvmeents" | Re-trigger Greptile

Comment on lines +80 to +85
<Button variant="ghost" size="icon-xs" onClick={() => {}}>
<PlusIcon className="size-4" />
</Button>
<Button variant="ghost" size="icon-xs" onClick={() => {}}>
<CheckCheckIcon className="size-4" />
</Button>
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.

P1 No-op button handlers ship non-functional UI

Both the PlusIcon and CheckCheckIcon buttons use onClick={() => {}}, so clicking them produces no effect. Because the old ModalContextBar was removed from this component in this PR, these buttons appear to be intended replacements for it — but they are unimplemented. A user who clicks either button will see no response, with no indication that the action is pending.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/renderer/features/tasks/create-task-modal/initial-conversation-section.tsx
Line: 80-85

Comment:
**No-op button handlers ship non-functional UI**

Both the `PlusIcon` and `CheckCheckIcon` buttons use `onClick={() => {}}`, so clicking them produces no effect. Because the old `ModalContextBar` was removed from this component in this PR, these buttons appear to be intended replacements for it — but they are unimplemented. A user who clicks either button will see no response, with no indication that the action is pending.

How can I resolve this? If you propose a fix, please make it concise.

@Davidknp Davidknp marked this pull request as draft May 22, 2026 14:17
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