Skip to content

start tasks and top bar#81

Merged
Kitenite merged 6 commits intomainfrom
new-tasks
Nov 14, 2025
Merged

start tasks and top bar#81
Kitenite merged 6 commits intomainfrom
new-tasks

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Nov 14, 2025

Summary by CodeRabbit

  • New Features

    • Task tabs now reflect real worktrees and correctly select newly created worktrees.
    • Add Task modal refreshes the task list after creation to show new tasks immediately.
  • UI

    • Hidden scrollbars for workspace/tabs and refreshed tab visuals including a clear selected indicator and spacing tweaks.
  • Bug Fixes

    • Added null-safe handling in terminal output and improved cleanup to prevent race conditions.
  • Refactor

    • Simplified task status determination for more consistent behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 14, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Centralizes status mapping in CreatingView, migrates task fetching from API to IPC with workspace scoping and refetch support, replaces MOCK_TASKS with worktree-derived tasks, hardens IPC listener cleanup with deferred removal, and applies various UI/layout and minor safety fixes across task/tab components and terminal output.

Changes

Cohort / File(s) Summary
AddTaskModal & task data
apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal.tsx, .../AddTaskModal/types.ts, .../AddTaskModal/useTaskData.ts, .../AddTaskModal/utils.ts, .../AddTaskModal/CreatingView.tsx
Replaces apiBaseUrl with currentWorkspaceId prop; useTaskData now fetches via IPC, exposes refetch, and accepts workspaceId + worktrees; adds transformWorktreeToTask to convert Worktree→Task; extracts getStatusType in CreatingView to centralize status logic.
Task tabs & tab layout
apps/desktop/src/renderer/screens/main/components/Layout/TaskTabs/TaskTabs.tsx, .../WorktreeTabButton.tsx
Introduces useTabWidth hook for tab sizing, layout/styling adjustments (hidden scrollbar, bottom border, non-shrinking add button), refactors removal confirmation handlers, and tweaks selected-tab visuals.
Task/worktree hooks & utils
apps/desktop/src/renderer/screens/main/hooks/useTasks.ts, .../hooks/useWorktrees.ts, apps/desktop/src/renderer/screens/main/utils.ts
Replaces MOCK_TASKS with dynamic tasks derived from worktrees; updates useTasks to map worktrees→tasks, uses cleanupTimeoutRef for 100ms deferred IPC listener removal, adjusts creation flow to fetch latest workspace before selecting new worktree; useWorktrees delays workspace refresh/update to avoid races; enrichWorktreesWithTasks signature changed to accept pending worktrees.
Terminal output safety
apps/desktop/src/renderer/screens/main/components/Sidebar/components/CreateWorktreeModal/TerminalOutput.tsx
Uses null-safe ref access fitAddonRef.current?.fit() inside ResizeObserver to avoid calling fit on missing ref.
Workspace ops
apps/desktop/src/main/lib/workspace/worktree-operations.ts
Ensures created Worktree always has a description by using input.description ?? input.title.
Global styles
apps/desktop/src/renderer/globals.css
Adds .hide-scrollbar utility covering carousel and tabs; hides scrollbars across browsers.
Main screen prop wiring
apps/desktop/src/renderer/screens/main/MainScreen.tsx
Passes currentWorkspaceId={currentWorkspace?.id ?? null} into AddTaskModal.
Superset setup manifest
.superset/setup.json, package.json
Broadens env copy glob to **/.env* and clears setup commands array; manifest update noted.

Sequence Diagram(s)

sequenceDiagram
  participant UI as MainScreen / AddTaskModal
  participant Hook as useTaskData
  participant IPC as ipcRenderer
  participant Store as Workspace State

  rect rgb(235,245,255)
  UI->>Hook: open modal (workspaceId)
  Hook->>IPC: fetch-workspace (workspaceId)
  IPC-->>Hook: workspace data (worktrees)
  Hook->>UI: tasks (transformWorktreeToTask)
  end

  rect rgb(245,255,235)
  UI->>Hook: create task (createWorktree)
  Hook->>IPC: create-worktree (payload)
  IPC-->>Hook: create-worktree-progress events...
  Hook->>Hook: schedule deferred cleanup (100ms)
  IPC-->>Hook: create-worktree-complete
  Hook->>IPC: fetch-workspace (after small delay)
  IPC-->>Hook: refreshed workspace
  Hook->>UI: select new task (from refreshed workspace)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing extra attention:
    • useTaskData / useTasks — verify IPC error handling, refetch semantics, and that deferred listener removal (timeout) cannot leak listeners or miss removal during rapid remounts.
    • transformWorktreeToTask and status mapping — ensure status rules match domain expectations and all Worktree cases handled.
    • TaskTabs / useTabWidth — confirm ResizeObserver lifecycle and layout edge cases (overflow, scrolling, hidden scrollbar).
    • Cross-file prop change: AddTaskModal prop signature updated — verify all call sites compile and types align.

Possibly related PRs

  • Tabs creation and management #78 — overlaps on useTasks and listener logic, directly related to IPC listener/cleanup changes.
  • new terminal #79 — modifies AddTaskModal and task-creation flow; likely to overlap with workspace-scoped refetch and prop changes.
  • workspace #71 — touches worktree→task transformation and hooks; related to transformWorktreeToTask and enrich/enrichment changes.

Poem

"I hopped through code with whiskers twitching bright,
Moved statuses and listeners into the right light.
I tucked timeouts in burrows, fit refs with care,
Tabs sized and trimmed with a soft rabbit stare.
New tasks now arrive — hop on, take flight!" 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided; all required template sections are missing or empty. Complete the PR description template with sections describing changes, related issues, type of change, testing, and any additional context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'clean up' is vague and generic, failing to convey meaningful information about the specific changes made to the three files. Use a more descriptive title that captures the primary change, such as 'Refactor task setup status handling and improve cleanup logic' or similar.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ef1e92 and 8dc3b38.

📒 Files selected for processing (13)
  • .superset/setup.json (1 hunks)
  • apps/desktop/src/main/lib/workspace/worktree-operations.ts (1 hunks)
  • apps/desktop/src/renderer/globals.css (1 hunks)
  • apps/desktop/src/renderer/screens/main/MainScreen.tsx (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal.tsx (2 hunks)
  • apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/types.ts (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/useTaskData.ts (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/utils.ts (2 hunks)
  • apps/desktop/src/renderer/screens/main/components/Layout/TaskTabs/TaskTabs.tsx (6 hunks)
  • apps/desktop/src/renderer/screens/main/components/Layout/TaskTabs/WorktreeTabButton.tsx (3 hunks)
  • apps/desktop/src/renderer/screens/main/hooks/useTasks.ts (6 hunks)
  • apps/desktop/src/renderer/screens/main/hooks/useWorktrees.ts (1 hunks)
  • apps/desktop/src/renderer/screens/main/utils.ts (3 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

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

🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/CreatingView.tsx (1)

14-25: LGTM! Clean extraction of status logic.

Centralizing the status determination into a dedicated helper function improves maintainability and makes the logic testable and reusable. The case-insensitive keyword matching is appropriate for flexible status string handling.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4dbad17 and 0ef1e92.

📒 Files selected for processing (3)
  • apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/CreatingView.tsx (1 hunks)
  • apps/desktop/src/renderer/screens/main/components/Sidebar/components/CreateWorktreeModal/TerminalOutput.tsx (1 hunks)
  • apps/desktop/src/renderer/screens/main/hooks/useTasks.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/CreatingView.tsx (1)
apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/index.ts (1)
  • CreatingView (3-3)
🔇 Additional comments (5)
apps/desktop/src/renderer/screens/main/components/Sidebar/components/CreateWorktreeModal/TerminalOutput.tsx (1)

45-45: LGTM! Defensive null-safe access.

The optional chaining prevents potential runtime errors if the ResizeObserver callback fires after the ref has been cleared during cleanup (line 53).

apps/desktop/src/renderer/screens/main/components/Layout/AddTaskModal/CreatingView.tsx (1)

33-35: LGTM! Simplified status handling.

Deriving isError and isSuccess from the centralized statusType eliminates duplicate string checks and keeps the logic DRY.

apps/desktop/src/renderer/screens/main/hooks/useTasks.ts (3)

34-34: LGTM! Proper timeout tracking.

Adding cleanupTimeoutRef enables proper cancellation and prevents race conditions from overlapping cleanup attempts.


39-42: LGTM! Cleanup on unmount.

Clearing the timeout during unmount prevents the callback from firing after the component is destroyed, avoiding potential memory leaks and stale listener references.


258-270: LGTM! Race condition prevention.

Clearing any existing cleanup timeout before scheduling a new one ensures only one delayed cleanup is active at a time. This prevents multiple concurrent attempts to remove the IPC listener, which could occur if handleCreateTask completes multiple times in quick succession.

@Kitenite Kitenite changed the title clean up start tasks and top bar Nov 14, 2025
@Kitenite Kitenite merged commit 9fd128c into main Nov 14, 2025
1 of 5 checks passed
@Kitenite Kitenite deleted the new-tasks branch November 14, 2025 22:40
@coderabbitai coderabbitai Bot mentioned this pull request Nov 24, 2025
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