Skip to content

fix: stabilize task creation UI warnings and clean up temporary diagnostics#1013

Merged
rabanspiegel merged 13 commits intomainfrom
emdash/ui-opt-9ie
Feb 21, 2026
Merged

fix: stabilize task creation UI warnings and clean up temporary diagnostics#1013
rabanspiegel merged 13 commits intomainfrom
emdash/ui-opt-9ie

Conversation

@rabanspiegel
Copy link
Contributor

@rabanspiegel rabanspiegel commented Feb 21, 2026

Summary\n- keep reserve claims fast by keying reserves by base ref and prewarming on branch/default-base changes\n- collapse reserve claim + task persistence into one IPC path and add coverage in worktree IPC tests\n- unify task creation loading UX across single and multi-agent task flows\n- fix Task modal warnings by stabilizing controlled Select values and adding dialog description metadata\n- clean up PTY started listener lifecycle to prevent listener buildup over repeated terminal starts\n- remove temporary task-creation trace instrumentation after investigation\n\n## Validation\n- pnpm run format\n- pnpm run type-check\n- manual verification of create-task UX for single-worktree flows (modal close -> loading -> chat mount)

closes #972


Note

Medium Risk
Touches the task creation and git worktree pooling paths (including ref fetching and persistence timing), so regressions could impact task/worktree creation or base-branch correctness despite being scoped and covered by new IPC tests.

Overview
Task creation now shows a single, consistent “Creating task…” overlay across both single- and multi-agent flows, and clears it when the task interface mounts (with a 30s safety timeout) instead of relying on per-view spinners.

Worktree reserve pooling is updated to be base-ref aware (keyed by projectId::baseRef) with prewarming on base-branch selection changes, plus an additional IPC path worktree:claimReserveAndSaveTask to claim a reserve and persist the task in one round-trip (with new tests). Reserve creation behavior is adjusted to refresh git refs during reserve creation and the previous claim-time base-ref switching/reset logic is removed.

Fixes several UI stability issues by ensuring controlled Select components always have a defined value (branch/issue selectors, titlebar task selector) and adds DialogDescription metadata to the new-task modal. Also tightens PTY start listener cleanup to avoid accumulating onPtyStarted handlers, and updates .gitignore to ignore .notes in both file/dir forms.

Written by Cursor Bugbot for commit 34238bc. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 21, 2026 3:00am

Request Review

@rabanspiegel rabanspiegel changed the title Improve task creation responsiveness and cleanup task creation diagnostics fix: stabilize task creation UI warnings and clean up temporary diagnostics Feb 21, 2026
@greptile-apps
Copy link

greptile-apps bot commented Feb 21, 2026

Greptile Summary

This PR improves task creation responsiveness by optimizing the worktree pooling system and unifying the loading UX:

Key improvements:

  • Reserve worktrees now keyed by ${projectId}::${baseRef} for per-branch pooling, with automatic prewarming when base ref changes
  • Collapsed reserve claim + task persistence into single IPC call (worktreeClaimReserveAndSaveTask) to reduce round-trips
  • Moved git fetch from claim path (blocking) to reserve creation path (background) to keep claims instant
  • Unified task creation loading overlay across single and multi-agent flows for consistent UX
  • Fixed React Select controlled component warnings by using stable placeholder values instead of undefined
  • Added DialogDescription to TaskModal for accessibility compliance
  • Fixed PTY started listener cleanup to prevent listener buildup on repeated terminal starts
  • Removed temporary task creation trace instrumentation after investigation

Test coverage:

  • Added comprehensive worktree IPC tests covering claim+save success, reserve miss, database errors, and remote project rejection

Confidence Score: 4/5

  • Safe to merge with minor attention to worktree pooling edge cases
  • Well-tested refactoring with comprehensive test coverage for the new IPC flow. The reserve keying change is well-architected but introduces complexity in reserve lookup logic. PTY listener cleanup is correct. All Select component fixes follow the same safe pattern.
  • Pay close attention to src/main/services/WorktreePoolService.ts for reserve lookup behavior with multiple base refs per project

Important Files Changed

Filename Overview
src/main/services/WorktreePoolService.ts Refactored reserve keying to include base ref for per-branch pooling, moved git fetch to reserve creation instead of claim path for faster claims
src/main/services/worktreeIpc.ts Added new IPC handler to claim reserve and persist task in single round-trip
src/renderer/lib/taskCreationService.ts Unified task creation flow to use combined claim+save IPC, added return value to signal creation start
src/renderer/App.tsx Added isCreatingTask state management with 30s timeout and callback propagation
src/renderer/components/MainContentArea.tsx Added TaskCreationLoading overlay during task creation
src/renderer/terminal/TerminalSessionManager.ts Fixed PTY started listener cleanup to prevent listener buildup
src/test/main/worktreeIpc.test.ts Added comprehensive tests for claim-and-save flow covering success, miss, error, and remote rejection cases

Sequence Diagram

sequenceDiagram
    participant User
    participant TaskModal
    participant App
    participant taskCreationService
    participant IPC
    participant WorktreePool
    participant Database
    participant ChatInterface

    User->>TaskModal: Click "Create Task"
    TaskModal->>taskCreationService: createTask()
    TaskModal->>App: onClose() (modal closes immediately)
    
    App->>App: setIsCreatingTask(true)
    App->>MainContentArea: Show TaskCreationLoading overlay
    
    taskCreationService->>IPC: worktreeClaimReserveAndSaveTask()
    IPC->>WorktreePool: claimReserve(projectId, baseRef)
    
    alt Reserve available
        WorktreePool-->>IPC: {worktree, needsBaseRefSwitch: false}
        IPC->>Database: saveTask(worktree + metadata)
        Database-->>IPC: success
        IPC-->>taskCreationService: {success: true, worktree, task}
        taskCreationService->>App: Update UI state (setActiveTask)
        App->>ChatInterface: Mount with task
        ChatInterface->>App: onTaskInterfaceReady()
        App->>App: setIsCreatingTask(false)
        App->>MainContentArea: Hide loading overlay
    else Reserve miss
        WorktreePool-->>IPC: null
        IPC-->>taskCreationService: {success: false}
        taskCreationService->>IPC: worktreeCreate() (fallback)
        Note over IPC: Regular sync worktree creation
        taskCreationService->>IPC: saveTask() (separate call)
        taskCreationService->>App: Update UI state
    end
    
    Note over WorktreePool: Background: replenishReserve(projectId, baseRef)
Loading

Last reviewed commit: b901512

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

21 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 699 to 705
}, [
selectedProject?.id,
selectedProject?.path,
selectedProject?.gitInfo?.isGitRepo,
projectDefaultBranch,
prewarmReserveForBaseRef,
]);
Copy link

Choose a reason for hiding this comment

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

dependency array includes selectedProject?.id but guards with if (!selectedProject) - effect will run when selectedProject object reference changes even if the id/path haven't changed

Suggested change
}, [
selectedProject?.id,
selectedProject?.path,
selectedProject?.gitInfo?.isGitRepo,
projectDefaultBranch,
prewarmReserveForBaseRef,
]);
}, [
selectedProject,
projectDefaultBranch,
prewarmReserveForBaseRef,
]);

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@rabanspiegel rabanspiegel merged commit 7ff1d0f into main Feb 21, 2026
5 checks passed
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.

Bug: No UI feedback after clicking Create Task while worktree is being created

1 participant