Commit Graph

696 Commits

Author SHA1 Message Date
Louis Knight-Webb
527febdc52 Workspaces FE (#1733) 2026-01-08 22:14:38 +00:00
GitHub Action
fe2215ba85 chore: bump version to 0.0.146 2026-01-08 19:40:01 +00:00
GitHub Action
ae852b297f chore: bump version to 0.0.145 2026-01-08 18:46:22 +00:00
Alex Netsch
67711e77f4 Show error when remote branch status is unavailable (Vibe Kanban) (#1825)
* I've completed the implementation. Here's a summary of the changes:

## Summary

### Changes Made

1. **`frontend/src/hooks/useBranchStatus.ts`**
   - Modified to return `{ data, error, isError, isLoading, refetch }` instead of just the query result
   - This exposes the error state to consuming components

2. **`frontend/src/components/tasks/Toolbar/GitOperations.tsx`**
   - Added `branchStatusError` prop to interface
   - Removed `hasConflictsCalculated` from the "Change target branch" button's disabled condition - now it stays enabled even during errors, allowing users to recover
   - Changed the actions section from hiding completely when `selectedRepoStatus` is null to showing an error message when there's a `branchStatusError`

3. **`frontend/src/components/dialogs/tasks/GitActionsDialog.tsx`**
   - Extracted `error` from `useBranchStatus` and passes it to `GitOperations` as `branchStatusError`

4. **`frontend/src/pages/ProjectTasks.tsx`**
   - Updated `DiffsPanelContainer` to accept and pass `branchStatusError`
   - Extracted `branchStatusError` from `useBranchStatus` hook
   - Passes the error through to `DiffsPanelContainer`

5. **i18n translation files** (all 6 locales: en, es, ja, ko, zh-Hans, zh-Hant)
   - Added `git.errors.branchStatusUnavailable` translation string

### Behavior Changes

- **Before**: When branch status API failed, git operations (Merge, PR/Push, Rebase buttons) were completely hidden
- **After**:
  - An error message is shown: "Unable to fetch branch status. You can still change the target branch."
  - The "Change target branch" button remains enabled, allowing users to recover from deadlock situations
  - Users can see something went wrong instead of the UI silently failing

* Cleanup script changes for workspace cdcbb9c6-fc9f-45bf-9c30-0e432d06cccf

* Simplify useBranchStatus hook return

Return useQuery result directly instead of manually constructing an object.
The useQuery hook already returns all needed properties (data, error, isError, isLoading, refetch).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Restore hasConflictsCalculated check for change target branch button

The conflict check wasn't needed for the branch status error fix.
Keeping it prevents changing target branch during active git conflicts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 13:42:15 +00:00
Alex Netsch
b63c90186e feat: Show timeout indicator for repository selector (Vibe Kanban) (#1510)
* Done. I've added a 5-second delay to the `list_git_repos` endpoint at `crates/server/src/routes/filesystem.rs:46`. This will let you see:

- "Searching for repositories..." for the first 2 seconds
- "Still searching... (2s)", "Still searching... (3s)", etc. after that
- The "This is taking longer than usual" message after 3 seconds

Remember to remove this delay (marked with `TODO`) once you're done testing!

* Done, the delay has been removed.

* All checks pass. The i18n script now passes with no new violations introduced.

* feat: Add timeout indicator to repository selector

- Shows progressive feedback when repo search takes longer than expected
- Displays "no repos found" message when search completes empty
- Added translations for all 6 locales (EN, ES, JA, KO, ZH-Hans, ZH-Hant)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 13:29:31 +00:00
Gabriel Gordon-Hall
76feaefdfe feat: add Exa and Chrome DevTools as one-click MCP server options (Vibe Kanban) (#1801)
* I've added the Exa Code MCP server as a one-click install option. Here's what was configured:

**Changes made to `crates/executors/default_mcp.json`:**

1. **Server configuration** (lines 23-33):
   - Command: `npx -y exa-mcp-server`
   - Tools enabled: `web_search_exa` and `get_code_context_exa` (as requested)
   - Environment variable: `EXA_API_KEY` (required for authentication)

2. **Metadata** (lines 53-58):
   - Name: "Exa"
   - Description: "Web search and code context retrieval powered by Exa AI"
   - URL: https://docs.exa.ai/reference/exa-mcp
   - Icon: `mcp/exa_logo.svg` (already exists)

The Exa MCP server icon was already present in the frontend public assets at `frontend/public/mcp/exa_logo.svg`.

* Done. I've added Chrome DevTools MCP as a one-click install option:

**Server configuration** (lines 34-39):
- Command: `npx chrome-devtools-mcp@latest`
- No environment variables required

**Metadata** (lines 65-70):
- Name: "Chrome DevTools"
- Description: "Browser automation, debugging and performance analysis with Chrome DevTools"
- URL: https://github.com/ChromeDevTools/chrome-devtools-mcp
- Icon: `mcp/chrome_devtools_logo.svg`

* The issue was that `justify-center` and `gap-3` were interfering with Embla Carousel's scroll calculations. Embla uses a specific margin/padding system (`-ml-4` on the content container and `pl-4` on items) to handle spacing and scroll positions. Adding `justify-center` shifts items in a way that breaks the scroll math, making it impossible to scroll to the leftmost items.

The fix removes these conflicting classes from `CarouselContent`.
2026-01-07 16:30:39 +00:00
GitHub Action
edef39c3fb chore: bump version to 0.0.144 2026-01-06 13:14:34 +00:00
Gabriel Gordon-Hall
cbfb637b73 fix i18n errors (#1796) 2026-01-06 10:24:33 +00:00
Alex Huang
875b1068a0 feat(i18n): add zh-Hant UI translations and locale mapping (#1777)
* feat(i18n): add zh-Hant UI translations and locale mapping

* chore(i18n): format config

* fix(i18n): add zh-Hant config enum

* chore(types): regenerate
2026-01-05 20:43:31 +00:00
Gabriel Gordon-Hall
7224376170 feat: override auto-detected preview url (#1573)
* override auto-detected preview url

* i18n

* remove redundant useMemo
2026-01-05 18:56:04 +00:00
GitHub Action
f99d2f06f2 chore: bump version to 0.0.143 2025-12-29 18:01:52 +00:00
gsxdsm
332bfbd965 feat: dynamically determine devserver hostname from browser location instead of hardcoding localhost (#1640)
Co-authored-by: Vibe Kanban <noreply@vibekanban.com>
2025-12-28 12:59:51 +00:00
Anastasiia Solop
36fbf7e12c Make file name in diffs sticky (vibe-kanban) (#1631)
* Perfect! I've successfully implemented sticky file name headers for the diffs view. Here's a summary of the changes:

## Summary

I've made the file name headers in the diffs view sticky by modifying the `DiffCard` component:

### Changes Made

**File**: `frontend/src/components/DiffCard.tsx:269`

Added the following CSS classes to the header div:
- `sticky` - Makes the header stick to the top when scrolling
- `top-0` - Positions it at the very top of the scroll container
- `z-[5]` - Sets appropriate z-index to ensure it stays above diff content but below the main panel header (which has z-10)
- `bg-background` - Adds background color so content scrolling underneath is covered
- `border-b` - Adds a bottom border for better visual separation

### How It Works

When users scroll down through the diffs in the DiffsPanel, each file header will now:
1. Stick to the top of the viewport as you scroll past it
2. Stay visible so users always know which file diff they're viewing
3. Get replaced by the next file's header when that file reaches the top
4. Maintain proper layering with the main panel header staying on top

The z-index hierarchy is:
- Main panel header (DiffsPanel): `z-10` (highest)
- Individual diff card headers: `z-[5]` (middle)
- Diff content: default (lowest)

This ensures a smooth scrolling experience where users can always see which file they're looking at, even when viewing large diffs.

* delete package-lock.json
2025-12-22 13:42:06 +00:00
Alex Netsch
3c35b92a97 Use session IDs for scratches and queued messages (Vibe Kanban) (#1613)
* All changes have been completed. Here's a summary of what was done:

## Summary

Changed both scratches and queued messages to use session IDs instead of workspace IDs:

### Files Modified

1. **`frontend/src/components/tasks/TaskFollowUpSection.tsx`**
   - Changed `useScratch(ScratchType.DRAFT_FOLLOW_UP, workspaceId ?? '')` → `useScratch(ScratchType.DRAFT_FOLLOW_UP, sessionId ?? '')`

2. **`crates/server/src/routes/sessions/queue.rs`**
   - Changed `session.workspace_id` → `session.id` in all three queue operations (queue, cancel, get status)

3. **`crates/services/src/services/queued_message.rs`**
   - Renamed `task_attempt_id` → `session_id` in `QueuedMessage` struct
   - Updated all method parameters and comments

4. **`crates/local-deployment/src/container.rs`**
   - Changed `ctx.workspace.id` → `ctx.session.id` for queue lookups and scratch deletion
   - Updated log messages to reference "session" instead of "workspace"

5. **`shared/types.ts`** (auto-generated)
   - `QueuedMessage.task_attempt_id` → `QueuedMessage.session_id`

* Cleanup script changes for task attempt 4df90bcd-f261-41ca-bac3-8f7c2fc576c5

* Build passes. The fix has been applied. Found and fixed one missed instance in `sessions/mod.rs` where `Scratch::delete` was using `workspace.id` instead of `session.id`.
2025-12-21 21:19:06 +00:00
GitHub Action
033ae2f1c6 chore: bump version to 0.0.142 2025-12-21 17:48:14 +00:00
GitHub Action
bcbe7aca69 chore: bump version to 0.0.141 2025-12-20 14:13:04 +00:00
GitHub Action
ca2b578231 chore: bump version to 0.0.140 2025-12-19 18:12:47 +00:00
Alex Netsch
2f5cef2dff Add agent working directory setting to run coding agents from repo directory (Vibe Kanban) (#1617)
* Done! The migration has been updated to copy `dev_script_working_dir` values to `agent_working_dir` for existing projects. The change:

**`vibe-kanban/crates/db/migrations/20251219000000_add_agent_working_dir_to_projects.sql`**:
```sql
-- Add column with empty default first
ALTER TABLE projects ADD COLUMN agent_working_dir TEXT DEFAULT '';

-- Copy existing dev_script_working_dir values to agent_working_dir
UPDATE projects SET agent_working_dir = dev_script_working_dir WHERE dev_script_working_dir IS NOT NULL AND dev_script_working_dir != '';
```

This ensures that when the migration runs, existing projects will have their `agent_working_dir` automatically populated from their existing `dev_script_working_dir` setting.

* Done! The migration has been updated to only copy `dev_script_working_dir` to `agent_working_dir` for single-repo projects. Multi-repo projects will keep `agent_working_dir` empty (None).

The key change in the migration:
```sql
UPDATE projects SET agent_working_dir = dev_script_working_dir
WHERE dev_script_working_dir IS NOT NULL
  AND dev_script_working_dir != ''
  AND (SELECT COUNT(*) FROM project_repos WHERE project_repos.project_id = projects.id) = 1;
```

The subquery `(SELECT COUNT(*) FROM project_repos WHERE project_repos.project_id = projects.id) = 1` ensures only projects with exactly one repository get the default value copied.

* Done! All tasks completed:

1. **Resolved the rebase conflict** in `task_attempts.rs` - removed the duplicate `follow_up` function since it was moved to `sessions/mod.rs` on main

2. **Updated `sessions/mod.rs`** with the `working_dir` changes - added the code to get `agent_working_dir` from project settings and pass it to both `CodingAgentFollowUpRequest` and `CodingAgentInitialRequest`

3. **Ran `npm run prepare-db`** - successfully prepared the database and updated sqlx cache

4. **Verified compilation** - all crates compile successfully

The migration now only copies `dev_script_working_dir` to `agent_working_dir` for single-repo projects (projects with exactly 1 repo in `project_repos` table). Multi-repo projects will keep `agent_working_dir` empty.

* Done. Removed all 6 comments as requested.

* Done! The implementation is now complete:

1. **Database migration** - Copies `dev_script_working_dir` to `agent_working_dir` for single-repo projects at migration time
2. **Runtime backfill** - `backfill_repo_names()` in `container.rs` sets `agent_working_dir` for existing single-repo projects where it's still empty
3. **Project creation** - New single-repo projects automatically get `agent_working_dir` set to the repo name

All three scenarios are now covered for setting `agent_working_dir` on single-repo projects.

* Done! The frontend UI for `agent_working_dir` has been added:

1. Added `agent_working_dir: string` to `ProjectFormState` interface
2. Added `agent_working_dir` to `projectToFormState` function
3. Added `agent_working_dir` to the `handleSave` payload
4. Added the input field after the dev server working directory input

* All tasks are complete. The implementation is finished:

**Summary of changes:**

1. **Project model**: Renamed `agent_working_dir` to `default_agent_working_dir` - this is now a default value for new workspaces

2. **Workspace model**: Added `agent_working_dir` field - this captures the project's default at workspace creation time

3. **Workspace creation**: Updated `create_task_attempt` to fetch the project's `default_agent_working_dir` and pass it to the workspace

4. **Execution sites**: Updated all 4 locations to use `workspace.agent_working_dir` instead of `project.default_agent_working_dir`:
   - `container.rs` (start_workspace)
   - `container.rs` (start_queued_follow_up)
   - `sessions/mod.rs` (follow_up)
   - `task_attempts/pr.rs` (trigger_pr_description_follow_up)

5. **Frontend**: Updated `ProjectSettings.tsx` to use `default_agent_working_dir`

6. **Migrations**: Two migrations added - one to rename the project column and one to add the workspace column

* Cleanup script changes for workspace a87cad74-ed7c-402b-b3f3-413a939a13a9

* Done. The migrations have been squashed into a single migration file `20251219000000_add_agent_working_dir_to_projects.sql` which now handles both the project and workspace table changes. The separate workspace migration file has been deleted and `npm run prepare-db` completes successfully.

* Done. The i18n check passes with all checks passing:
- No new literal strings introduced
- No duplicate keys found in JSON files
- Translation keys are consistent across locales (en, es, ja, ko, zh-Hans)

* All checks pass:
- `npm run check`  (frontend TypeScript and backend Rust)
- `npm run prepare-db`  (migrations and sqlx query cache)

* `npm run lint` passes now.

* Done. I've added the logic to `crates/services/src/services/project.rs` in the `add_repository()` function. When a second repository is added to a project (repo count becomes exactly 2), the `default_agent_working_dir` field is automatically cleared by setting it to an empty string.

* Cleanup script changes for workspace a87cad74-ed7c-402b-b3f3-413a939a13a9

* Both checks pass. The fix now correctly:
1. Counts repos **before** adding the new one
2. Only clears `default_agent_working_dir` if the previous count was exactly 1 (meaning we're going from 1 to 2 repos)

* Done. The fix now:

1. Added a dedicated `Project::clear_default_agent_working_dir()` method in `crates/db/src/models/project.rs` that only updates the `default_agent_working_dir` field without touching other fields
2. Updated `add_repository()` in `crates/services/src/services/project.rs` to use this new method when the repo count goes from 1 to 2
2025-12-19 17:58:01 +00:00
Alex Netsch
6a129d0fa8 Add session-scoped routes for follow-up and queue operations (Vibe Kanban) (#1606)
* Yup, I'll hold off and do nothing for now. Let me know when you're ready to proceed with the session routes task, and I'll start exploring the codebase and planning the implementation.

All cherry-pick conflicts resolved:

1. **`sessions/queue.rs`** - Fixed analytics to use `session.id` and `session.workspace_id` (2 locations)
2. **`task_attempts.rs`** - Removed the old `follow_up()` function that was already moved to `sessions/mod.rs`

No remaining conflict markers in the routes directory.

All fixes complete:

1. **`sessions/queue.rs`** ✓ - Fixed analytics to use `session.id` and `session.workspace_id`
2. **`task_attempts.rs`** ✓ - Removed old `follow_up` function (moved to sessions)
3. **`sessions/mod.rs`** ✓ - Fixed to use `find_latest_coding_agent_turn_session_id(pool, session.id)` instead of non-existent method

The session-based `follow_up` now correctly scopes the agent_session_id lookup to the current session rather than across all workspace sessions.

* All done:

1. ✓ `container.rs` - Changed to `find_latest_coding_agent_turn_session_id(pool, ctx.session.id)`
2. ✓ `pr.rs` - Changed to `find_latest_coding_agent_turn_session_id(pool, session.id)`
3. ✓ Deleted `find_latest_agent_session_id_by_workspace` from `execution_process.rs`

All workspace-scoped `agent_session_id` lookups have been converted to session-scoped lookups and the unused method has been removed.

Cleanup script changes for task attempt afc116fb-e639-4150-a299-b05c1f14f61e

Done. Removed the unnecessary `Session::create` call and now using `&ctx.session` directly.

Lint, db

* Done. Simplified the validation:
- Removed the extra `Session::find_by_id` DB call
- Now directly checks `process.session_id != session.id`
- Updated error message to "Process does not belong to this session"
2025-12-19 12:46:24 +00:00
GitHub Action
84ea4b71ee chore: bump version to 0.0.139 2025-12-19 09:32:22 +00:00
Gabriel Gordon-Hall
377941a90c make settings esc button navigate back to app rather than back page (#1607) 2025-12-18 18:00:28 +00:00
Alex Netsch
4188adc2a9 Refactor task_attempts to workspaces and sessions (Vibe Kanban) (#1569)
* All tasks are complete. Here's a summary of the refactoring that was done:

The `task_attempts` table has been refactored into `workspaces` and `sessions`:

- Created new migration `20251216142123_refactor_task_attempts_to_workspaces_sessions.sql`
- Renamed `task_attempts` table to `workspaces` (removed `executor` column)
- Created new `sessions` table with `(id, workspace_id, executor, created_at, updated_at)`
- Renamed `executor_sessions` to `coding_agent_turns` (dropped redundant `task_attempt_id`)
- Changed `execution_processes.task_attempt_id` to `session_id`
- Changed `merges.task_attempt_id` to `workspace_id`
- Changed `tasks.parent_task_attempt` to `parent_workspace_id`

- Renamed `crates/db/src/models/task_attempt.rs` → `workspace.rs`
- Created new `crates/db/src/models/session.rs`
- Renamed `executor_session.rs` → `coding_agent_turn.rs`
- Updated `execution_process.rs`:
  - Changed `task_attempt_id` field to `session_id`
  - Added workspace-level query methods (`find_latest_by_workspace_and_run_reason`, `latest_executor_profile_for_workspace`, `find_latest_external_session_id_by_workspace`, `find_running_dev_servers_by_workspace`, `has_running_non_dev_server_processes_for_workspace`)
- Updated `merge.rs`: Changed `task_attempt_id` to `workspace_id`
- Updated `task.rs`: Changed `parent_task_attempt` to `parent_workspace_id`

- Updated `container.rs`: Changed `start_execution` to take 4 parameters (workspace, session, action, reason)
- Updated `events/`: Changed event types from `TaskAttempt` to `Workspace`
- Updated `pr_monitor.rs`: Changed to use `Workspace` instead of `TaskAttempt`
- Updated `workspace_manager.rs`: Added support for `DbWorkspace` alias

- Updated `task_attempts.rs`: All handlers now create/use sessions for execution processes
- Updated `tasks.rs`: Removed `executor` from `CreateWorkspace`, fixed error type
- Updated setup helpers (codex, cursor, gh_cli) to create sessions
- Updated `error.rs`: Added `SessionError` handling

Cleanup script changes for task attempt 2f672d73-cb46-4515-b1c7-3da8f4402858

Done. All 3 `sqlx::query_scalar()` function calls have been converted to `sqlx::query_scalar!()` macros:

1. `has_running_non_dev_server_processes()` - lines 332-341
2. `has_running_non_dev_server_processes_for_workspace()` - lines 350-361
3. `find_prev_after_head_commit()` - lines 619-634

Key changes:
- Converted `?` placeholders to `$1, $2, $3` positional parameters (sqlx macro style)
- Added `as "count!: i64"` type annotation for COUNT queries
- Used `.flatten()` for the nullable `after_head_commit` column to avoid `Option<Option<String>>`

The one in `crates/remote/src/db/mod.rs` uses dynamic SQL for PostgreSQL's `ALTER ROLE` and cannot be converted to a macro.

Done. Removed the 4 unused functions from `execution_process.rs`:
- `find_running_dev_servers_by_session`
- `has_running_non_dev_server_processes` (the per-session version)
- `delete_by_session_id`
- `latest_executor_profile_for_session`

The workspace-level versions (`has_running_non_dev_server_processes_for_workspace`, `find_running_dev_servers_by_workspace`, `latest_executor_profile_for_workspace`) are still available. Everything builds successfully.

Rewbase

Revert event rename

* All done. Here's a summary of the changes:

Created a `TaskAttempt` helper struct in the backend that maintains backwards compatibility with the frontend:

1. **`crates/db/src/models/workspace.rs`**
   - Added `TaskAttempt` struct that combines `Workspace` fields + `executor` from the latest `Session`
   - Added `TaskAttempt::from_workspace()` to convert a `Workspace` by fetching its latest session's executor
   - Added `TaskAttempt::fetch_all()` for API responses

2. **`crates/db/src/models/task.rs`**
   - Changed `TaskRelationships.current_workspace` → `current_attempt: TaskAttempt`

3. **`crates/server/src/routes/task_attempts.rs`**
   - Updated `get_task_attempts` to return `Vec<TaskAttempt>`
   - Updated `get_task_attempt` to return `TaskAttempt`
   - Updated `create_task_attempt` to return `TaskAttempt`

4. **`crates/server/src/bin/generate_types.rs`**
   - Added `TaskAttempt::decl()` to the type generation list

Fixed references from `parent_task_attempt` to `parent_workspace_id` in:
- `TaskCard.tsx`
- `NoServerContent.tsx`
- `TaskPanel.tsx`
- `TaskFormDialog.tsx`
- `CreateAttemptDialog.tsx`
- `useTaskMutations.ts`
- `ProjectTasks.tsx`

- Frontend now gets `TaskAttempt` type with the `executor` field
- The `TaskRelationships.current_attempt` field provides `TaskAttempt` with executor
- Backend still uses `Workspace` + `Session` internally
- All type checks pass

Fixed. The issue was that the frontend was sending `task_attempt_id` as the query parameter, but the backend expected `workspace_id`. Now the execution processes WebSocket stream should work correctly and the "Loading History" should resolve.

* All done. Here's a summary of the changes:

1. **Added sessions endpoint** (`GET /api/sessions?workspace_id={uuid}`)
   - Created `crates/server/src/routes/sessions.rs`
   - Registered in `crates/server/src/routes/mod.rs`
   - Added `Session::decl()` to `generate_types.rs`

2. **Removed TaskAttempt from backend**
   - Removed `TaskAttempt` struct and methods from `crates/db/src/models/workspace.rs`
   - Changed `TaskRelationships.current_attempt` back to `current_workspace: Workspace` in `task.rs`
   - Updated route handlers to return `Workspace` instead of `TaskAttempt`

1. **Created `TaskAttempt` type** in `frontend/src/types/attempt.ts`
   - Defines `TaskAttempt = Workspace & { executor: string }`
   - Exports `createTaskAttempt()` helper function

2. **Updated `api.ts`**
   - Added `sessionsApi` for fetching sessions
   - Added `workspaceToTaskAttempt()` helper that fetches sessions and constructs TaskAttempt
   - Updated `attemptsApi.getAll()`, `get()`, and `create()` to internally convert Workspace → TaskAttempt

3. **Updated 20+ frontend files** to import `TaskAttempt` from `@/types/attempt` instead of `shared/types`

- Backend returns `Workspace` directly (no executor field)
- Backend has new `/api/sessions` endpoint to fetch sessions by workspace
- Frontend constructs `TaskAttempt` by combining `Workspace` + latest `Session.executor`
- All type checks pass

* The refactoring is complete. Here's a summary of what was done:

- `TaskAttempt` is now just a type alias for `Workspace` (no executor needed for most uses)
- Added `WorkspaceWithSession = Workspace & { executor: string }` for components that need executor
- Added `createWorkspaceWithSession()` helper function

- `attemptsApi.get()`, `getAll()`, `create()` now return `Workspace` directly (as `TaskAttempt`)
- Added `attemptsApi.getWithSession()` - fetches workspace + session to get executor
- Added `sessionsApi.getByWorkspace()` for fetching sessions

- Added `useTaskAttemptWithSession()` - for single attempt with executor
- Added `useTaskAttemptsWithSessions()` - for list of attempts with executor

Files that access `.executor` now use `WorkspaceWithSession`:
- `TaskPanel.tsx` - Uses `useTaskAttemptsWithSessions` and `useTaskAttemptWithSession`
- `NextActionCard.tsx` - Uses `attemptsApi.getWithSession()`
- `UserMessage.tsx` - Receives `WorkspaceWithSession` prop
- `RetryEditorInline.tsx` - Receives `WorkspaceWithSession` prop
- `DisplayConversationEntry.tsx` - Passes `WorkspaceWithSession` to children
- `VirtualizedList.tsx` - Receives `WorkspaceWithSession` prop
- `TaskAttemptPanel.tsx` - Receives `WorkspaceWithSession` prop
- `ProjectTasks.tsx` - Uses `useTaskAttemptWithSession`
- `FullAttemptLogs.tsx` - Uses `useTaskAttemptWithSession`
- `CreateAttemptDialog.tsx` - Uses `useTaskAttemptsWithSessions`

The 32 other files that only use Workspace fields continue to use `TaskAttempt` (which is just `Workspace`) without any changes needed.

Done! I've simplified the migration from 191 lines down to 106 lines by:

1. **Removed workspaces table rebuild** → simple `ALTER TABLE workspaces DROP COLUMN executor`
2. **Removed merges table rebuild** → simple `ALTER TABLE merges RENAME COLUMN task_attempt_id TO workspace_id`
3. **Removed tasks table rebuild** → simple `ALTER TABLE tasks RENAME COLUMN parent_task_attempt TO parent_workspace_id`
4. **Removed attempt_repos rebuild entirely** → FK auto-updates when `task_attempts` is renamed to `workspaces`

The only table rebuilds remaining are for:
- `execution_processes` - because the FK target changes from workspaces to sessions
- `executor_sessions` → `coding_agent_turns` - because we're dropping the `task_attempt_id` column

All done:

- **npm run lint** - passed (fixed 4 unused import errors)
- **cargo build** - passed
- **npm run build** - passed
- **tsc --noEmit** - passed

Prep db

* Done. I've renamed `TaskAttempt` to `Workspace` in all places where it was used as a type annotation. Here's the summary:

- `types/attempt.ts` - Removed `export type TaskAttempt = Workspace;`

**API Layer:**
- `lib/api.ts` - Changed return types from `TaskAttempt` to `Workspace`

**Hooks:**
- `hooks/useTaskAttempts.ts` - `TaskAttempt[]` → `Workspace[]`
- `hooks/useAttemptCreation.ts` - `TaskAttempt` → `Workspace`
- `hooks/useConversationHistory.ts` - `TaskAttempt` → `Workspace`
- `hooks/useAttempt.ts` - `TaskAttempt` → `Workspace`

**Components:**
- `contexts/ClickedElementsProvider.tsx`
- `components/DiffCard.tsx`
- `components/panels/AttemptHeaderActions.tsx`
- `components/panels/DiffsPanel.tsx`
- `components/tasks/Toolbar/GitOperations.tsx`
- `components/dialogs/tasks/GitActionsDialog.tsx`
- `components/dialogs/tasks/ViewRelatedTasksDialog.tsx`
- `components/dialogs/tasks/CreatePRDialog.tsx`
- `components/ui/actions-dropdown.tsx`

**Type Definitions:**
- `types/modal-args.d.ts`
- `types/modals.ts`

**Pages:**
- `pages/ProjectTasks.tsx`

TypeScript check passes with no errors.

Cleanup script changes for task attempt 2f672d73-cb46-4515-b1c7-3da8f4402858

* The Session type now has `executor: string | null`, which is correct. All changes are complete:

1. **Migration**: `executor TEXT` (no `NOT NULL`)
2. **Rust model**: `executor: Option<String>`
3. **sqlx queries**: Using just `executor` without type annotation (sqlx infers nullable correctly)
4. **All usages**: Wrapped string values in `Some()` where executor is set
5. **TypeScript types**: `executor: string | null`

Everything builds and lints successfully.

Done. Removed `Session::parent_workspace` and its unused `Workspace` import.

* Done. The migration has been updated with the sqlx workaround:

1. Added `COMMIT TRANSACTION;` after `PRAGMA foreign_keys = OFF;` to end sqlx's auto-transaction
2. Added `BEGIN TRANSACTION;` to start our own controlled transaction
3. Added `PRAGMA foreign_key_check;` before committing to verify FK integrity
4. Added `COMMIT;` to commit our transaction
5. Added final `BEGIN TRANSACTION;` for sqlx to close gracefully

This ensures the `PRAGMA foreign_keys = OFF` actually takes effect, preventing potential cascade deletes of `execution_process_logs` when `DROP TABLE execution_processes` runs on existing databases with data.

Fixed. The migration now has the correct order:

1. `COMMIT TRANSACTION;` - ends sqlx's auto-transaction
2. `PRAGMA foreign_keys = OFF;` - now takes effect (outside transaction)
3. `BEGIN TRANSACTION;` - starts our controlled transaction

This ensures foreign keys are actually disabled before the table operations, preventing potential cascade deletes of `execution_process_logs` when `DROP TABLE execution_processes` runs.

Done. The migration now only disables foreign keys for the section that needs it (steps 7-8, the table rebuilds with DROP TABLE). Steps 1-6 run in sqlx's normal auto-transaction with FK enforcement on.

Fix slow statement (vibe-kanban b695d0ad)

i think we are missing an index on something, seeing these logs:
2025-12-17T15:23:25.297852Z  WARN sqlx::query: slow statement: execution time exceeded alert threshold *summary*="SELECT t.id AS \\"id!: …" *db.statement*="\\n\\nSELECT\\n  t.id                            AS \\"id!: Uuid\\",\\n  t.project\_id                    AS \\"project\_id!: Uuid\\",\\n  t.title,\\n  t.description,\\n  t.status                        AS \\"status!: TaskStatus\\",\\n  t.parent\_workspace\_id           AS \\"parent\_workspace\_id: Uuid\\",\\n  t.shared\_task\_id                AS \\"shared\_task\_id: Uuid\\",\\n  t.created\_at                    AS \\"created\_at!: DateTime<Utc>\\",\\n  t.updated\_at                    AS \\"updated\_at!: DateTime<Utc>\\",\\n\\n  CASE WHEN EXISTS (\\n    SELECT 1\\n      FROM workspaces w\\n      JOIN sessions s ON s.workspace\_id = w.id\\n      JOIN execution\_processes ep ON ep.session\_id = s.id\\n     WHERE w.task\_id       = t.id\\n       AND ep.status        = 'running'\\n       AND ep.run\_reason IN ('setupscript','cleanupscript','codingagent')\\n     LIMIT 1\\n  ) THEN 1 ELSE 0 END            AS \\"has\_in\_progress\_attempt!: i64\\",\\n\\n  CASE WHEN (\\n    SELECT ep.status\\n      FROM workspaces w\\n      JOIN sessions s ON s.workspace\_id = w.id\\n      JOIN execution\_processes ep ON ep.session\_id = s.id\\n     WHERE w.task\_id       = t.id\\n     AND ep.run\_reason IN ('setupscript','cleanupscript','codingagent')\\n     ORDER BY ep.created\_at DESC\\n     LIMIT 1\\n  ) IN ('failed','killed') THEN 1 ELSE 0 END\\n                                 AS \\"last\_attempt\_failed!: i64\\",\\n\\n  ( SELECT s.executor\\n      FROM workspaces w\\n      JOIN sessions s ON s.workspace\_id = w.id\\n      WHERE w.task\_id = t.id\\n     ORDER BY s.created\_at DESC\\n      LIMIT 1\\n    )                               AS \\"executor!: String\\"\\n\\nFROM tasks t\\nWHERE t.project\_id = $1\\nORDER BY t.created\_at DESC\\n" *rows\_affected*=0 *rows\_returned*=202 *elapsed*=1.281210542s *elapsed\_secs*=1.281210542 *slow\_threshold*=1s

2025-12-17T15:23:25.350788Z  WARN sqlx::query: slow statement: execution time exceeded alert threshold *summary*="SELECT t.id AS \\"id!: …" *db.statement*="\\n\\nSELECT\\n  t.id                            AS \\"id!: Uuid\\",\\n  t.project\_id                    AS \\"project\_id!: Uuid\\",\\n  t.title,\\n  t.description,\\n  t.status                        AS \\"status!: TaskStatus\\",\\n  t.parent\_workspace\_id           AS \\"parent\_workspace\_id: Uuid\\",\\n  t.shared\_task\_id                AS \\"shared\_task\_id: Uuid\\",\\n  t.created\_at                    AS \\"created\_at!: DateTime<Utc>\\",\\n  t.updated\_at                    AS \\"updated\_at!: DateTime<Utc>\\",\\n\\n  CASE WHEN EXISTS (\\n    SELECT 1\\n      FROM workspaces w\\n      JOIN sessions s ON s.workspace\_id = w.id\\n      JOIN execution\_processes ep ON ep.session\_id = s.id\\n     WHERE w.task\_id       = t.id\\n       AND ep.status        = 'running'\\n       AND ep.run\_reason IN ('setupscript','cleanupscript','codingagent')\\n     LIMIT 1\\n  ) THEN 1 ELSE 0 END            AS \\"has\_in\_progress\_attempt!: i64\\",\\n\\n  CASE WHEN (\\n    SELECT ep.status\\n      FROM workspaces w\\n      JOIN sessions s ON s.workspace\_id = w.id\\n      JOIN execution\_processes ep ON ep.session\_id = s.id\\n     WHERE w.task\_id       = t.id\\n     AND ep.run\_reason IN ('setupscript','cleanupscript','codingagent')\\n     ORDER BY ep.created\_at DESC\\n     LIMIT 1\\n  ) IN ('failed','killed') THEN 1 ELSE 0 END\\n                                 AS \\"last\_attempt\_failed!: i64\\",\\n\\n  ( SELECT s.executor\\n      FROM workspaces w\\n      JOIN sessions s ON s.workspace\_id = w.id\\n      WHERE w.task\_id = t.id\\n     ORDER BY s.created\_at DESC\\n      LIMIT 1\\n    )                               AS \\"executor!: String\\"\\n\\nFROM tasks t\\nWHERE t.project\_id = $1\\nORDER BY t.created\_at DESC\\n" *rows\_affected*=0 *rows\_returned*=202 *elapsed*=1.333812833s *elapsed\_secs*=1.333812833 *slow\_threshold*=1s

2025-12-17T15:23:25.401326Z  WARN sqlx::query: slow statement: execution time exceeded alert threshold *summary*="INSERT INTO execution\_processes ( …" *db.statement*="\\n\\nINSERT INTO execution\_processes (\\n                    id, session\_id, run\_reason, executor\_action,\\n                    status, exit\_code, started\_at, completed\_at, created\_at, updated\_at\\n                ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\\n" *rows\_affected*=1 *rows\_returned*=0 *elapsed*=1.383690208s *elapsed\_secs*=1.383690208 *slow\_threshold*=1s

* Address feedback (vibe-kanban 81d8dbfa)

A PR opened by your colleague (https://github.com/BloopAI/vibe-kanban/pull/1569)
 got some feedback, let's address it.

```gh-comment
{
  "id": "2627479232",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "```suggestion\r\n-- 3. Migrate data: create one session per workspace\r\nINSERT INTO sessions (id, workspace_id, executor, created_at, updated_at)\r\nSELECT gen_random_uuid(), id, executor, created_at, updated_at FROM workspaces;\r\n```\r\n",
  "created_at": "2025-12-17T15:17:50Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627479232",
  "path": "crates/db/migrations/20251216142123_refactor_task_attempts_to_workspaces_sessions.sql",
  "line": 26,
  "diff_hunk": "@@ -0,0 +1,121 @@\n+-- Refactor task_attempts into workspaces and sessions\n+-- - Rename task_attempts -> workspaces (keeps workspace-related fields)\n+-- - Create sessions table (executor moves here)\n+-- - Update execution_processes.task_attempt_id -> session_id\n+-- - Rename executor_sessions -> coding_agent_turns (drop redundant task_attempt_id)\n+-- - Rename merges.task_attempt_id -> workspace_id\n+-- - Rename tasks.parent_task_attempt -> parent_workspace_id\n+\n+-- 1. Rename task_attempts to workspaces (FK refs auto-update in schema)\n+ALTER TABLE task_attempts RENAME TO workspaces;\n+\n+-- 2. Create sessions table\n+CREATE TABLE sessions (\n+    id              BLOB PRIMARY KEY,\n+    workspace_id    BLOB NOT NULL,\n+    executor        TEXT,\n+    created_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE\n+);\n+\n+CREATE INDEX idx_sessions_workspace_id ON sessions(workspace_id);\n+\n+-- 3. Migrate data: create one session per workspace (using workspace.id as session.id for simplicity)\n+INSERT INTO sessions (id, workspace_id, executor, created_at, updated_at)\n+SELECT id, id, executor, created_at, updated_at FROM workspaces;"
}
```

```gh-comment
{
  "id": "2627515578",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Why not rename `attempt_repos` to `workspace_repos` here now that `attempt` is a legacy concept?",
  "created_at": "2025-12-17T15:27:21Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627515578",
  "path": "crates/db/migrations/20251216142123_refactor_task_attempts_to_workspaces_sessions.sql",
  "line": 118,
  "diff_hunk": "@@ -0,0 +1,121 @@\n+-- Refactor task_attempts into workspaces and sessions\n+-- - Rename task_attempts -> workspaces (keeps workspace-related fields)\n+-- - Create sessions table (executor moves here)\n+-- - Update execution_processes.task_attempt_id -> session_id\n+-- - Rename executor_sessions -> coding_agent_turns (drop redundant task_attempt_id)\n+-- - Rename merges.task_attempt_id -> workspace_id\n+-- - Rename tasks.parent_task_attempt -> parent_workspace_id\n+\n+-- 1. Rename task_attempts to workspaces (FK refs auto-update in schema)\n+ALTER TABLE task_attempts RENAME TO workspaces;\n+\n+-- 2. Create sessions table\n+CREATE TABLE sessions (\n+    id              BLOB PRIMARY KEY,\n+    workspace_id    BLOB NOT NULL,\n+    executor        TEXT,\n+    created_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE\n+);\n+\n+CREATE INDEX idx_sessions_workspace_id ON sessions(workspace_id);\n+\n+-- 3. Migrate data: create one session per workspace (using workspace.id as session.id for simplicity)\n+INSERT INTO sessions (id, workspace_id, executor, created_at, updated_at)\n+SELECT id, id, executor, created_at, updated_at FROM workspaces;\n+\n+-- 4. Drop executor column from workspaces\n+ALTER TABLE workspaces DROP COLUMN executor;\n+\n+-- 5. Rename merges.task_attempt_id to workspace_id\n+DROP INDEX idx_merges_task_attempt_id;\n+DROP INDEX idx_merges_open_pr;\n+ALTER TABLE merges RENAME COLUMN task_attempt_id TO workspace_id;\n+CREATE INDEX idx_merges_workspace_id ON merges(workspace_id);\n+CREATE INDEX idx_merges_open_pr ON merges(workspace_id, pr_status)\n+WHERE merge_type = 'pr' AND pr_status = 'open';\n+\n+-- 6. Rename tasks.parent_task_attempt to parent_workspace_id\n+DROP INDEX IF EXISTS idx_tasks_parent_task_attempt;\n+ALTER TABLE tasks RENAME COLUMN parent_task_attempt TO parent_workspace_id;\n+CREATE INDEX idx_tasks_parent_workspace_id ON tasks(parent_workspace_id);\n+\n+-- Steps 7-8 need FK disabled to avoid cascade deletes during DROP TABLE\n+-- sqlx workaround: end auto-transaction to allow PRAGMA to take effect\n+-- https://github.com/launchbadge/sqlx/issues/2085#issuecomment-1499859906\n+COMMIT;\n+\n+PRAGMA foreign_keys = OFF;\n+\n+BEGIN TRANSACTION;\n+\n+-- 7. Update execution_processes to reference session_id instead of task_attempt_id\n+-- (needs rebuild because FK target changes from workspaces to sessions)\n+DROP INDEX IF EXISTS idx_execution_processes_task_attempt_created_at;\n+DROP INDEX IF EXISTS idx_execution_processes_task_attempt_type_created;\n+\n+CREATE TABLE execution_processes_new (\n+    id              BLOB PRIMARY KEY,\n+    session_id      BLOB NOT NULL,\n+    run_reason      TEXT NOT NULL DEFAULT 'setupscript'\n+                       CHECK (run_reason IN ('setupscript','codingagent','devserver','cleanupscript')),\n+    executor_action TEXT NOT NULL DEFAULT '{}',\n+    status          TEXT NOT NULL DEFAULT 'running'\n+                       CHECK (status IN ('running','completed','failed','killed')),\n+    exit_code       INTEGER,\n+    dropped         INTEGER NOT NULL DEFAULT 0,\n+    started_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    completed_at    TEXT,\n+    created_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE\n+);\n+\n+-- Since we used workspace.id as session.id, the task_attempt_id values map directly\n+INSERT INTO execution_processes_new (id, session_id, run_reason, executor_action, status, exit_code, dropped, started_at, completed_at, created_at, updated_at)\n+SELECT id, task_attempt_id, run_reason, executor_action, status, exit_code, dropped, started_at, completed_at, created_at, updated_at\n+FROM execution_processes;\n+\n+DROP TABLE execution_processes;\n+ALTER TABLE execution_processes_new RENAME TO execution_processes;\n+\n+-- Recreate execution_processes indexes\n+CREATE INDEX idx_execution_processes_session_id ON execution_processes(session_id);\n+CREATE INDEX idx_execution_processes_status ON execution_processes(status);\n+CREATE INDEX idx_execution_processes_run_reason ON execution_processes(run_reason);\n+\n+-- 8. Rename executor_sessions to coding_agent_turns and drop task_attempt_id\n+-- (needs rebuild to drop the redundant task_attempt_id column)\n+CREATE TABLE coding_agent_turns (\n+    id                    BLOB PRIMARY KEY,\n+    execution_process_id  BLOB NOT NULL,\n+    session_id            TEXT,\n+    prompt                TEXT,\n+    summary               TEXT,\n+    created_at            TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at            TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (execution_process_id) REFERENCES execution_processes(id) ON DELETE CASCADE\n+);\n+\n+INSERT INTO coding_agent_turns (id, execution_process_id, session_id, prompt, summary, created_at, updated_at)\n+SELECT id, execution_process_id, session_id, prompt, summary, created_at, updated_at\n+FROM executor_sessions;\n+\n+DROP TABLE executor_sessions;\n+\n+-- Recreate coding_agent_turns indexes\n+CREATE INDEX idx_coding_agent_turns_execution_process_id ON coding_agent_turns(execution_process_id);\n+CREATE INDEX idx_coding_agent_turns_session_id ON coding_agent_turns(session_id);\n+\n+-- 9. attempt_repos: no changes needed - FK auto-updated when task_attempts renamed to workspaces"
}
```

```gh-comment
{
  "id": "2627694792",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Maybe there's a better name than `external_session_id` here? `agent_session_id`? ",
  "created_at": "2025-12-17T16:16:24Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627694792",
  "path": "crates/db/src/models/execution_process.rs",
  "line": 685,
  "diff_hunk": "@@ -618,4 +680,34 @@ impl ExecutionProcess {\n             )),\n         }\n     }\n+\n+    /// Find latest coding_agent_turn session_id by workspace (across all sessions)\n+    pub async fn find_latest_external_session_id_by_workspace("
}
```

```gh-comment
{
  "id": "2627707446",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "```suggestion\r\n    pub async fn cleanup_workspace(db: &DBService, workspace: &Workspace) {\r\n```",
  "created_at": "2025-12-17T16:19:31Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627707446",
  "path": "crates/local-deployment/src/container.rs",
  "line": 146,
  "diff_hunk": "@@ -142,20 +143,20 @@ impl LocalContainerService {\n         map.remove(id)\n     }\n \n-    pub async fn cleanup_attempt_workspace(db: &DBService, attempt: &TaskAttempt) {\n-        let Some(container_ref) = &attempt.container_ref else {\n+    pub async fn cleanup_workspace_container(db: &DBService, workspace: &Workspace) {"
}
```

```gh-comment
{
  "id": "2627756192",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Update `mcp` nomenclature",
  "created_at": "2025-12-17T16:31:49Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627756192",
  "path": "crates/server/src/mcp/task_server.rs",
  "line": 352,
  "diff_hunk": "@@ -350,10 +349,9 @@ impl TaskServer {\n             project_id: ctx.project.id,\n             task_id: ctx.task.id,\n             task_title: ctx.task.title,\n-            attempt_id: ctx.task_attempt.id,\n-            attempt_branch: ctx.task_attempt.branch,\n+            attempt_id: ctx.workspace.id,"
}
```

```gh-comment
{
  "id": "2628161769",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "update, and similar in other events",
  "created_at": "2025-12-17T18:27:47Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2628161769",
  "path": "crates/server/src/routes/task_attempts.rs",
  "line": 1335,
  "diff_hunk": "@@ -1295,7 +1332,7 @@ pub async fn start_dev_server(\n             serde_json::json!({\n                 \"task_id\": task.id.to_string(),\n                 \"project_id\": project.id.to_string(),\n-                \"attempt_id\": task_attempt.id.to_string(),\n+                \"attempt_id\": workspace.id.to_string(),"
}
```

```gh-comment
{
  "id": "2628194289",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Ugly, but we should rename this struct to avoid confusion with the more general concept of a workspace. Ideas...\r\n\r\n- `WorktreeContainer`\r\n...\r\n...\r\n\r\nChatGPT?",
  "created_at": "2025-12-17T18:36:30Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2628194289",
  "path": "crates/services/src/services/workspace_manager.rs",
  "line": 3,
  "diff_hunk": "@@ -1,6 +1,6 @@\n use std::path::{Path, PathBuf};\n \n-use db::models::{repo::Repo, task_attempt::TaskAttempt};\n+use db::models::{repo::Repo, workspace::Workspace as DbWorkspace};"
}
```

```gh-comment
{
  "id": "2628198036",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "We could add a BE route for this, and similar hooks where we're aggregating this information on the fly",
  "created_at": "2025-12-17T18:37:46Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2628198036",
  "path": "frontend/src/hooks/useTaskAttempts.ts",
  "line": 43,
  "diff_hunk": "@@ -16,10 +20,36 @@ export function useTaskAttempts(taskId?: string, opts?: Options) {\n   const enabled = (opts?.enabled ?? true) && !!taskId;\n   const refetchInterval = opts?.refetchInterval ?? 5000;\n \n-  return useQuery<TaskAttempt[]>({\n+  return useQuery<Workspace[]>({\n     queryKey: taskAttemptKeys.byTask(taskId),\n     queryFn: () => attemptsApi.getAll(taskId!),\n     enabled,\n     refetchInterval,\n   });\n }\n+\n+/**\n+ * Hook for components that need executor field for all attempts.\n+ * Fetches all attempts and their sessions in parallel.\n+ */\n+export function useTaskAttemptsWithSessions(taskId?: string, opts?: Options) {\n+  const enabled = (opts?.enabled ?? true) && !!taskId;\n+  const refetchInterval = opts?.refetchInterval ?? 5000;\n+\n+  return useQuery<WorkspaceWithSession[]>({\n+    queryKey: taskAttemptKeys.byTaskWithSessions(taskId),\n+    queryFn: async () => {\n+      const attempts = await attemptsApi.getAll(taskId!);\n+      // Fetch sessions for all attempts in parallel"
}
```

* Address feedback (vibe-kanban 81d8dbfa)

A PR opened by your colleague (https://github.com/BloopAI/vibe-kanban/pull/1569)
 got some feedback, let's address it.

```gh-comment
{
  "id": "2627479232",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "```suggestion\r\n-- 3. Migrate data: create one session per workspace\r\nINSERT INTO sessions (id, workspace_id, executor, created_at, updated_at)\r\nSELECT gen_random_uuid(), id, executor, created_at, updated_at FROM workspaces;\r\n```\r\n",
  "created_at": "2025-12-17T15:17:50Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627479232",
  "path": "crates/db/migrations/20251216142123_refactor_task_attempts_to_workspaces_sessions.sql",
  "line": 26,
  "diff_hunk": "@@ -0,0 +1,121 @@\n+-- Refactor task_attempts into workspaces and sessions\n+-- - Rename task_attempts -> workspaces (keeps workspace-related fields)\n+-- - Create sessions table (executor moves here)\n+-- - Update execution_processes.task_attempt_id -> session_id\n+-- - Rename executor_sessions -> coding_agent_turns (drop redundant task_attempt_id)\n+-- - Rename merges.task_attempt_id -> workspace_id\n+-- - Rename tasks.parent_task_attempt -> parent_workspace_id\n+\n+-- 1. Rename task_attempts to workspaces (FK refs auto-update in schema)\n+ALTER TABLE task_attempts RENAME TO workspaces;\n+\n+-- 2. Create sessions table\n+CREATE TABLE sessions (\n+    id              BLOB PRIMARY KEY,\n+    workspace_id    BLOB NOT NULL,\n+    executor        TEXT,\n+    created_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE\n+);\n+\n+CREATE INDEX idx_sessions_workspace_id ON sessions(workspace_id);\n+\n+-- 3. Migrate data: create one session per workspace (using workspace.id as session.id for simplicity)\n+INSERT INTO sessions (id, workspace_id, executor, created_at, updated_at)\n+SELECT id, id, executor, created_at, updated_at FROM workspaces;"
}
```

```gh-comment
{
  "id": "2627515578",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Why not rename `attempt_repos` to `workspace_repos` here now that `attempt` is a legacy concept?",
  "created_at": "2025-12-17T15:27:21Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627515578",
  "path": "crates/db/migrations/20251216142123_refactor_task_attempts_to_workspaces_sessions.sql",
  "line": 118,
  "diff_hunk": "@@ -0,0 +1,121 @@\n+-- Refactor task_attempts into workspaces and sessions\n+-- - Rename task_attempts -> workspaces (keeps workspace-related fields)\n+-- - Create sessions table (executor moves here)\n+-- - Update execution_processes.task_attempt_id -> session_id\n+-- - Rename executor_sessions -> coding_agent_turns (drop redundant task_attempt_id)\n+-- - Rename merges.task_attempt_id -> workspace_id\n+-- - Rename tasks.parent_task_attempt -> parent_workspace_id\n+\n+-- 1. Rename task_attempts to workspaces (FK refs auto-update in schema)\n+ALTER TABLE task_attempts RENAME TO workspaces;\n+\n+-- 2. Create sessions table\n+CREATE TABLE sessions (\n+    id              BLOB PRIMARY KEY,\n+    workspace_id    BLOB NOT NULL,\n+    executor        TEXT,\n+    created_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE\n+);\n+\n+CREATE INDEX idx_sessions_workspace_id ON sessions(workspace_id);\n+\n+-- 3. Migrate data: create one session per workspace (using workspace.id as session.id for simplicity)\n+INSERT INTO sessions (id, workspace_id, executor, created_at, updated_at)\n+SELECT id, id, executor, created_at, updated_at FROM workspaces;\n+\n+-- 4. Drop executor column from workspaces\n+ALTER TABLE workspaces DROP COLUMN executor;\n+\n+-- 5. Rename merges.task_attempt_id to workspace_id\n+DROP INDEX idx_merges_task_attempt_id;\n+DROP INDEX idx_merges_open_pr;\n+ALTER TABLE merges RENAME COLUMN task_attempt_id TO workspace_id;\n+CREATE INDEX idx_merges_workspace_id ON merges(workspace_id);\n+CREATE INDEX idx_merges_open_pr ON merges(workspace_id, pr_status)\n+WHERE merge_type = 'pr' AND pr_status = 'open';\n+\n+-- 6. Rename tasks.parent_task_attempt to parent_workspace_id\n+DROP INDEX IF EXISTS idx_tasks_parent_task_attempt;\n+ALTER TABLE tasks RENAME COLUMN parent_task_attempt TO parent_workspace_id;\n+CREATE INDEX idx_tasks_parent_workspace_id ON tasks(parent_workspace_id);\n+\n+-- Steps 7-8 need FK disabled to avoid cascade deletes during DROP TABLE\n+-- sqlx workaround: end auto-transaction to allow PRAGMA to take effect\n+-- https://github.com/launchbadge/sqlx/issues/2085#issuecomment-1499859906\n+COMMIT;\n+\n+PRAGMA foreign_keys = OFF;\n+\n+BEGIN TRANSACTION;\n+\n+-- 7. Update execution_processes to reference session_id instead of task_attempt_id\n+-- (needs rebuild because FK target changes from workspaces to sessions)\n+DROP INDEX IF EXISTS idx_execution_processes_task_attempt_created_at;\n+DROP INDEX IF EXISTS idx_execution_processes_task_attempt_type_created;\n+\n+CREATE TABLE execution_processes_new (\n+    id              BLOB PRIMARY KEY,\n+    session_id      BLOB NOT NULL,\n+    run_reason      TEXT NOT NULL DEFAULT 'setupscript'\n+                       CHECK (run_reason IN ('setupscript','codingagent','devserver','cleanupscript')),\n+    executor_action TEXT NOT NULL DEFAULT '{}',\n+    status          TEXT NOT NULL DEFAULT 'running'\n+                       CHECK (status IN ('running','completed','failed','killed')),\n+    exit_code       INTEGER,\n+    dropped         INTEGER NOT NULL DEFAULT 0,\n+    started_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    completed_at    TEXT,\n+    created_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at      TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE\n+);\n+\n+-- Since we used workspace.id as session.id, the task_attempt_id values map directly\n+INSERT INTO execution_processes_new (id, session_id, run_reason, executor_action, status, exit_code, dropped, started_at, completed_at, created_at, updated_at)\n+SELECT id, task_attempt_id, run_reason, executor_action, status, exit_code, dropped, started_at, completed_at, created_at, updated_at\n+FROM execution_processes;\n+\n+DROP TABLE execution_processes;\n+ALTER TABLE execution_processes_new RENAME TO execution_processes;\n+\n+-- Recreate execution_processes indexes\n+CREATE INDEX idx_execution_processes_session_id ON execution_processes(session_id);\n+CREATE INDEX idx_execution_processes_status ON execution_processes(status);\n+CREATE INDEX idx_execution_processes_run_reason ON execution_processes(run_reason);\n+\n+-- 8. Rename executor_sessions to coding_agent_turns and drop task_attempt_id\n+-- (needs rebuild to drop the redundant task_attempt_id column)\n+CREATE TABLE coding_agent_turns (\n+    id                    BLOB PRIMARY KEY,\n+    execution_process_id  BLOB NOT NULL,\n+    session_id            TEXT,\n+    prompt                TEXT,\n+    summary               TEXT,\n+    created_at            TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    updated_at            TEXT NOT NULL DEFAULT (datetime('now', 'subsec')),\n+    FOREIGN KEY (execution_process_id) REFERENCES execution_processes(id) ON DELETE CASCADE\n+);\n+\n+INSERT INTO coding_agent_turns (id, execution_process_id, session_id, prompt, summary, created_at, updated_at)\n+SELECT id, execution_process_id, session_id, prompt, summary, created_at, updated_at\n+FROM executor_sessions;\n+\n+DROP TABLE executor_sessions;\n+\n+-- Recreate coding_agent_turns indexes\n+CREATE INDEX idx_coding_agent_turns_execution_process_id ON coding_agent_turns(execution_process_id);\n+CREATE INDEX idx_coding_agent_turns_session_id ON coding_agent_turns(session_id);\n+\n+-- 9. attempt_repos: no changes needed - FK auto-updated when task_attempts renamed to workspaces"
}
```

```gh-comment
{
  "id": "2627694792",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Maybe there's a better name than `external_session_id` here? `agent_session_id`? ",
  "created_at": "2025-12-17T16:16:24Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627694792",
  "path": "crates/db/src/models/execution_process.rs",
  "line": 685,
  "diff_hunk": "@@ -618,4 +680,34 @@ impl ExecutionProcess {\n             )),\n         }\n     }\n+\n+    /// Find latest coding_agent_turn session_id by workspace (across all sessions)\n+    pub async fn find_latest_external_session_id_by_workspace("
}
```

```gh-comment
{
  "id": "2627707446",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "```suggestion\r\n    pub async fn cleanup_workspace(db: &DBService, workspace: &Workspace) {\r\n```",
  "created_at": "2025-12-17T16:19:31Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627707446",
  "path": "crates/local-deployment/src/container.rs",
  "line": 146,
  "diff_hunk": "@@ -142,20 +143,20 @@ impl LocalContainerService {\n         map.remove(id)\n     }\n \n-    pub async fn cleanup_attempt_workspace(db: &DBService, attempt: &TaskAttempt) {\n-        let Some(container_ref) = &attempt.container_ref else {\n+    pub async fn cleanup_workspace_container(db: &DBService, workspace: &Workspace) {"
}
```

```gh-comment
{
  "id": "2627756192",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Update `mcp` nomenclature",
  "created_at": "2025-12-17T16:31:49Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2627756192",
  "path": "crates/server/src/mcp/task_server.rs",
  "line": 352,
  "diff_hunk": "@@ -350,10 +349,9 @@ impl TaskServer {\n             project_id: ctx.project.id,\n             task_id: ctx.task.id,\n             task_title: ctx.task.title,\n-            attempt_id: ctx.task_attempt.id,\n-            attempt_branch: ctx.task_attempt.branch,\n+            attempt_id: ctx.workspace.id,"
}
```

```gh-comment
{
  "id": "2628161769",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "update, and similar in other events",
  "created_at": "2025-12-17T18:27:47Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2628161769",
  "path": "crates/server/src/routes/task_attempts.rs",
  "line": 1335,
  "diff_hunk": "@@ -1295,7 +1332,7 @@ pub async fn start_dev_server(\n             serde_json::json!({\n                 \"task_id\": task.id.to_string(),\n                 \"project_id\": project.id.to_string(),\n-                \"attempt_id\": task_attempt.id.to_string(),\n+                \"attempt_id\": workspace.id.to_string(),"
}
```

```gh-comment
{
  "id": "2628194289",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "Ugly, but we should rename this struct to avoid confusion with the more general concept of a workspace. Ideas...\r\n\r\n- `WorktreeContainer`\r\n...\r\n...\r\n\r\nChatGPT?",
  "created_at": "2025-12-17T18:36:30Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2628194289",
  "path": "crates/services/src/services/workspace_manager.rs",
  "line": 3,
  "diff_hunk": "@@ -1,6 +1,6 @@\n use std::path::{Path, PathBuf};\n \n-use db::models::{repo::Repo, task_attempt::TaskAttempt};\n+use db::models::{repo::Repo, workspace::Workspace as DbWorkspace};"
}
```

```gh-comment
{
  "id": "2628198036",
  "comment_type": "review",
  "author": "ggordonhall",
  "body": "We could add a BE route for this, and similar hooks where we're aggregating this information on the fly",
  "created_at": "2025-12-17T18:37:46Z",
  "url": "https://github.com/BloopAI/vibe-kanban/pull/1569#discussion_r2628198036",
  "path": "frontend/src/hooks/useTaskAttempts.ts",
  "line": 43,
  "diff_hunk": "@@ -16,10 +20,36 @@ export function useTaskAttempts(taskId?: string, opts?: Options) {\n   const enabled = (opts?.enabled ?? true) && !!taskId;\n   const refetchInterval = opts?.refetchInterval ?? 5000;\n \n-  return useQuery<TaskAttempt[]>({\n+  return useQuery<Workspace[]>({\n     queryKey: taskAttemptKeys.byTask(taskId),\n     queryFn: () => attemptsApi.getAll(taskId!),\n     enabled,\n     refetchInterval,\n   });\n }\n+\n+/**\n+ * Hook for components that need executor field for all attempts.\n+ * Fetches all attempts and their sessions in parallel.\n+ */\n+export function useTaskAttemptsWithSessions(taskId?: string, opts?: Options) {\n+  const enabled = (opts?.enabled ?? true) && !!taskId;\n+  const refetchInterval = opts?.refetchInterval ?? 5000;\n+\n+  return useQuery<WorkspaceWithSession[]>({\n+    queryKey: taskAttemptKeys.byTaskWithSessions(taskId),\n+    queryFn: async () => {\n+      const attempts = await attemptsApi.getAll(taskId!);\n+      // Fetch sessions for all attempts in parallel"
}
```
2025-12-18 14:45:10 +00:00
Louis Knight-Webb
5810c7cccf All checks pass. Here's a summary of the changes made: (#1595)
## Summary

Fixed the regression where the Create PR dialog was defaulting to the repository's current checked-out branch (`is_current`) instead of the task attempt's configured target branch.

### Changes Made

1. **`frontend/src/components/dialogs/tasks/CreatePRDialog.tsx`**:
   - Added `targetBranch?: string` to the props interface
   - Destructured `targetBranch` in the component
   - Updated the default branch selection logic to prioritize `targetBranch` over `is_current`

2. **`frontend/src/components/tasks/Toolbar/GitOperations.tsx`**:
   - Pass `targetBranch: getSelectedRepoStatus()?.target_branch_name` when showing the dialog

### Behavior

- When opening the Create PR dialog, it now defaults to the attempt's target branch (from `RepoBranchStatus.target_branch_name`)
- Falls back to the current branch (`is_current`) only if the target branch is not set or not found in the branch list
- This restores the original intended behavior that was lost during the multi-repo refactor
2025-12-18 09:53:13 +00:00
Cal Courtney
adf759fbbe feat: add configurable auto-collapse for large diffs (#1587)
* perf: remove unecessary useEffects

* feat: add settings for default diff type collapsing

* feat: add setting for max line default collapse

* refactor: use object for default collapse config storage

* fix: use diff changes for max line count

* refactor: use consistent ids as fallback for id-less diffs

* chore: ran formatter

* chore: revert configurability and use fe defaults for auto-collapse

* Debug None additions/deletions for diff (vibe-kanban 72a2a541)

crates/utils/src/diff.rs

/api/task-attempts/.../diff/ws returns diffs with "additions": null", "deletions": null

* use backend additions/deletions

---------

Co-authored-by: Louis Knight-Webb <louis@bloop.ai>
2025-12-18 09:41:53 +00:00
Solomon
a282bbdae4 Real-time sync for Projects (#1512)
* Real-time sync for Projects

* Do not create project in a transaction

Update hooks trigger before the transaction is commited, which causes insert events to be dismissed because the row is isn't found
2025-12-17 18:25:34 +00:00
GitHub Action
fd210419cd chore: bump version to 0.0.138 2025-12-17 15:24:54 +00:00
Stephan Fitzpatrick
20352f2893 feat: enable diff and preview panels on smaller screens (#1524)
On screens < 1280px, users can now access Preview and Diffs views
via toggle buttons in the header, creating a tab-like experience.

Changes:
- Remove isXL check from AttemptHeaderActions toggle buttons
- Simplify mobile layout to switch between attempt/aux content based on mode
- Keyboard shortcuts (Cmd/Ctrl+Enter) now cycle through views on mobile

Closes #1523
2025-12-17 12:02:01 +00:00
Alex Netsch
7f09d25af8 Fix git actions modal overflow for multi-repo projects (Vibe Kanban) (#1566)
* The fix has been applied. The change adds `flex-wrap` to the container in the vertical layout, allowing the RepoSelector and branch chips to wrap to a new line when there isn't enough horizontal space in the modal. I also removed the `overflow-hidden` which was hiding content rather than allowing it to wrap properly.

* Done. The fix restructures the vertical layout so that:

1. **RepoSelector gets its own row** - only shown when there are multiple repos (`repos.length > 1`)
2. **Branch chips + status chips share a row** - with `flex-wrap` for graceful overflow if needed
3. **Action buttons remain on their own row** (unchanged)

This creates a cleaner visual hierarchy:
```
[RepoSelector]                          <-- only for multi-repo
[taskBranch] → [targetBranch] [status]  <-- branch flow + status
[Merge] [PR] [Rebase]                   <-- actions
```
2025-12-16 17:13:54 +00:00
Gabriel Gordon-Hall
8eb38ec476 fix: Preserve dev server working directory when editing script from preview (Vibe Kanban) (#1568) 2025-12-16 16:58:46 +00:00
GitHub Action
37af711712 chore: bump version to 0.0.137 2025-12-16 14:24:51 +00:00
Alex Netsch
f989b47470 Refactor branch fetching to use repo IDs instead of project IDs (Vibe Kanban) (#1560)
* All tasks are complete. Here's a summary of the changes made:

## Summary

Successfully refactored the project branches API to fetch branches using repo IDs instead of project IDs.

### Files Created
- `frontend/src/hooks/useRepoBranches.ts` - New hook that fetches branches for a single repository using `repoApi.getBranches(repoId)`

### Files Modified

1. **`frontend/src/hooks/index.ts`** - Added export for `useRepoBranches`

2. **`frontend/src/components/dialogs/tasks/GitActionsDialog.tsx`**
   - Removed `useState` for `repoBranches` and `loadingBranches`
   - Removed `useEffect` that called `projectsApi.getBranches(effectiveProjectId)`
   - Removed `useMemo` that filtered branches by `selectedRepoId`
   - Now uses `useRepoBranches(selectedRepoId)` to fetch branches directly for the selected repo from the task attempt

3. **`frontend/src/components/dialogs/tasks/CreatePRDialog.tsx`**
   - Removed `projectId` from props interface and component destructuring
   - Removed `useState` for `branches` and `branchesLoading`
   - Removed branch-fetching logic from useEffect
   - Now uses `useRepoBranches(repoId)` to fetch branches directly for the specified repo
   - Split useEffect into two: one for form initialization, one for setting default base branch

4. **`frontend/src/components/tasks/Toolbar/GitOperations.tsx`**
   - Removed `projectId` from `CreatePRDialog.show()` call

### Benefits
- More efficient - fetches only branches for the specific repo needed instead of all project repos
- Better caching - React Query caches branches per repo for efficient reuse
- Cleaner code - removed manual filtering logic from components
- Type safety - hooks return `GitBranch[]` directly instead of `RepositoryBranches[]`

* All tasks complete. Here's a summary of the changes made:

## Summary

Successfully decoupled the branches API from project IDs.

### Changes Made

**1. `frontend/src/hooks/useBranches.ts`** - Refactored to accept `repos: Array<{ id: string; name: string }>` instead of `projectId`
- Now uses `useQueries` to fetch branches for multiple repos in parallel
- Reuses the same query keys as `useRepoBranches` for cache consistency

**2. `frontend/src/hooks/useRepoBranchSelection.ts`** - Refactored to accept `repos: Repo[]` instead of `projectId`
- Removed internal fetch of project repos (caller now provides them)
- Removed `projectRepos` from return value
- Uses refactored `useBranches(repos)`

**3. `frontend/src/components/dialogs/tasks/CreateAttemptDialog.tsx`**
- Added `useQuery` to fetch project repos separately
- Passes `repos` to `useRepoBranchSelection`

**4. `frontend/src/components/dialogs/tasks/TaskFormDialog.tsx`**
- Already fetched `projectRepos`
- Updated to pass `projectRepos` to refactored `useBranches`

**5. `frontend/src/components/layout/Navbar.tsx`**
- Replaced `useBranches(projectId)` with `useQuery` for `projectsApi.getRepositories`
- Only needed repo count, not branches

**6. `frontend/src/components/projects/ProjectCard.tsx`**
- Replaced `useBranches(project.id)` with `useQuery` for `projectsApi.getRepositories`
- Only needed repo count, not branches

### Benefits
- Branch hooks no longer require a project ID
- Repos can come from any source (project, attempt, or future sources without projects)
- Better separation of concerns
- Enables future task attempts without projects attached

* Cleanup script changes for task attempt 6b5b9208-565d-4620-9fe3-20791db77d7a

* The fix is already applied. Type checks pass with `Repo[]` instead of the loose `Array<{ id: string; name: string }>` type.

This makes it explicit that `useBranches` expects actual `Repo` objects (with `Repo.id` being the repository's UUID), not project-repo junction records.

* All done. The refactor is complete:

**Summary of changes:**

1. **Created `useProjectRepos` hook** (`frontend/src/hooks/useProjectRepos.ts`) - A reusable hook that fetches project repositories with proper query key management

2. **Updated 5 files** to use the new hook instead of duplicating the `useQuery` pattern:
   - `CreateAttemptDialog.tsx`
   - `TaskFormDialog.tsx`
   - `Navbar.tsx`
   - `ProjectCard.tsx`
   - `NoServerContent.tsx`

3. **Earlier refactors** (from before the summary):
   - `useBranches.ts` - Now accepts `repos: Repo[]` instead of `projectId`
   - `useRepoBranchSelection.ts` - Now accepts `repos: Repo[]` instead of `projectId`

This enables future task attempts without projects attached, as branch fetching is now decoupled from project IDs.

* No more usages. The branches in `ProjectTasks.tsx` are used for the diffs panel - showing available branches for git operations when viewing an attempt's diffs.

* Cleanup script changes for task attempt 6b5b9208-565d-4620-9fe3-20791db77d7a

* All done. The refactor is complete:

**Summary of changes:**

`GitOperations` now fetches its own branches using `useRepoBranches(selectedRepoId)` instead of receiving them as a prop. This:

1. Removes prop drilling through `ProjectTasks` → `DiffsPanelContainer` → `DiffsPanel` → `GitOperations`
2. Removes the need for `ProjectTasks` to fetch all project repos just to get branches for the selected repo
3. Makes `GitOperations` self-contained - it already has `selectedRepoId` from `useAttemptRepo`, so it can fetch its own branches
4. Simplifies `GitActionsDialog` which no longer needs to fetch branches either

* All done. Here's a summary of the changes:

**Removed `projectId` from GitOperations flow:**

1. **`useRebase.ts`** - Changed param from `projectId` to `repoId`, updated invalidation to use `repoBranchKeys.byRepo(repoId)`

2. **`useChangeTargetBranch.ts`** - Changed param from `projectId` to `repoId`, updated invalidation to use `repoBranchKeys.byRepo(repoId)`

3. **`useMerge.ts`** - Updated invalidation to use `repoBranchKeys.all` instead of `['projectBranches']`

4. **`useGitOperations.ts`** - Changed param from `projectId` to `repoId`

5. **`GitOperations.tsx`** - Removed `projectId` prop, now passes `selectedRepoId` to `useGitOperations`

6. **`GitActionsDialog.tsx`** - Removed `projectId` from props and internal logic

7. **`DiffsPanelContainer`** (in ProjectTasks.tsx) - Removed `projectId` prop

8. **Callers of `GitActionsDialog.show`** - Removed `projectId` from `NextActionCard.tsx` and `actions-dropdown.tsx`

* The cleanup is complete. Here's a summary of what was done:

**Removed dead project branches code:**

1. **Backend** (`crates/server/src/routes/projects.rs`):
   - Removed `get_project_branches` handler and route
   - Removed `RepositoryBranches` and `ProjectBranchesResponse` structs
   - Fixed unused `Serialize` import warning

2. **Type Generation** (`crates/server/src/bin/generate_types.rs`):
   - Removed exports for `ProjectBranchesResponse` and `RepositoryBranches`

3. **Frontend Hooks** (`frontend/src/hooks/useBranches.ts`):
   - Defined local `RepositoryBranches` type instead of importing from shared/types

4. **Frontend API** (`frontend/src/lib/api.ts`):
   - Removed `projectsApi.getBranches` method
   - Removed `RepositoryBranches` and `ProjectBranchesResponse` imports

Both TypeScript and Rust compilation pass without errors.

* Done. Removed the `RepositoryBranches` type and simplified `useBranches` to return `Map<string, GitBranch[]>`. Changes:

1. **`useBranches.ts`** - Returns `Map<string, GitBranch[]>` instead of `RepositoryBranches[]`
2. **`useRepoBranchSelection.ts`** - Uses `branchMap.get(repo.id) ?? []` instead of `.find()`
3. **`TaskFormDialog.tsx`** - Uses `branchMap.get(repo.id) ?? []` instead of `.find()`

Type checks pass.

* Done. Deleted `useBranches` entirely and consolidated everything into `useRepoBranchSelection`. Summary:

1. **Deleted** `frontend/src/hooks/useBranches.ts`
2. **Updated** `useRepoBranchSelection.ts` - inlined the `useQueries` logic directly
3. **Updated** `hooks/index.ts` - removed `useBranches` export
4. **Updated** `TaskFormDialog.tsx` - now uses `useRepoBranchSelection` instead of duplicating the config-building logic

Type checks pass.

* types
2025-12-16 14:21:42 +00:00
Alex Netsch
ec8666da74 Add configurable working directory for dev server scripts (Vibe Kanban) (#1559)
* The implementation is complete. Here's a summary of all the changes made:

## Summary

Added the ability for users to specify a working directory for dev server scripts:

### Files Changed:

1. **Database migration** - `crates/db/migrations/20251216000000_add_dev_script_working_dir_to_projects.sql`
   - Added `dev_script_working_dir TEXT DEFAULT ''` column

2. **Rust model** - `crates/db/src/models/project.rs`
   - Added `dev_script_working_dir` field to `Project` and `UpdateProject` structs
   - Updated all SQL queries

3. **Dev server execution** - `crates/server/src/routes/task_attempts.rs`
   - `start_dev_server` now passes `project.dev_script_working_dir` to the script executor

4. **Backfill logic** - `crates/services/src/services/container.rs`
   - Changed `backfill_repo_names` to set `dev_script_working_dir` instead of prepending `cd ./repo &&`

5. **Frontend UI** - `frontend/src/pages/settings/ProjectSettings.tsx`
   - Added input field for "Dev Server Working Directory"

6. **Translations** - `frontend/src/i18n/locales/en/settings.json`
   - Added `devWorkingDir` label, placeholder, and helper text

7. **TypeScript types** - `shared/types.ts`
   - Regenerated with `dev_script_working_dir` field

* Cleanup script changes for task attempt 83423e2d-0d45-47fb-a6e4-dd91a2140f91

* Both packages compile successfully. The fix is complete:

1. **`project.rs`**: Removed `.or()` fallback for `dev_script` and `dev_script_working_dir` so `None` now clears the field
2. **`container.rs`**: Updated backfill to explicitly pass the existing project name instead of `None`

* Done. I've completed both review tasks:

1. Removed the comment from `container.rs` line 384
2. Added `devWorkingDir` translations to all four language files (es, ja, ko, zh-Hans) with:
   - `label`: The field label
   - `placeholder`: Example placeholder text
   - `helper`: Description of what the field does

I also updated the `dev.helper` text in each language to reference the new working directory option instead of suggesting users manually `cd` into the repo directory.

* Done. Removed both comments:
1. Removed the comment from the migration file
2. Removed the comment from `task_attempts.rs` line 1267

* Fixed. The TypeScript error in `NoServerContent.tsx` has been resolved by adding `dev_script_working_dir: null` to the `UpdateProject` data. All checks pass:

-  `npm run format` - completed
-  `npm run lint` - passed (frontend and backend)
-  `npx tsc --noEmit` - passed

* The Korean and Chinese translations already had the updated copy without the `cd` reference. The Spanish and Japanese were updated. All the translations now have the proper helper text that references the working directory field instead of telling users to manually `cd` into the repo.

* Done. I've removed the `cd my_website` line from both the Windows and Unix script placeholder examples in `scriptPlaceholders.ts`. Now the placeholder examples just show `npm run dev` without the `cd` command, since users can specify the working directory separately.
2025-12-16 12:19:15 +00:00
Gabriel Gordon-Hall
22ff27d8fd feat: multi repo projects (#1516)
* configure multiple repositories per project

* Move repo selection to frontend for create PR (#1436)

* Inline ensure worktree path (#1440)

* Inline ensure_worktree_path in task_attempts

* Inline ensure_worktree_path in images and setups, remove ensure_worktree_path

* chore: use `find_repos_for_attempt` where possible (#1442)

* use find_repos_for_attempt rather than find_repos_for_project where possible

* remove Repo::find_by_attempt_id

* change target branch backend (#1454)

* feat: multi repo branch rename (#1456)

* Rename branches

* Update crates/services/src/services/git.rs

Co-authored-by: Alex Netsch <alex@bloop.ai>

---------

Co-authored-by: Alex Netsch <alex@bloop.ai>

* Fix project display name being used as path (#1464)

* Multi repo merge (#1470)

* cleanup create PR

* Merge for multi repo projects

* Multi repo support for rebase (vibe-kanban) (#1472)

* All tasks completed successfully. Here's a summary of the changes made:

## Summary

Added multi-repo support for rebase, following the same pattern as merge (commit 483060e92).

### Files Modified

**Backend:**
1. `crates/server/src/routes/task_attempts.rs`:
   - Added `repo_id: Uuid` field to `RebaseTaskAttemptRequest` struct (line 92)
   - Updated `rebase_task_attempt` function to:
     - Fetch specific `AttemptRepo` using `find_by_attempt_and_repo_id()`
     - Fetch the `Repo` using `Repo::find_by_id()`
     - Build `worktree_path` as `workspace_path.join(&repo.name)`
     - Use the specific repo's target branch
     - Update only that repo's target branch via `AttemptRepo::update_target_branch()` instead of `update_all_target_branches()`
     - Pass `worktree_path` to `rebase_branch()` instead of `workspace_path`

**Frontend:**
2. `frontend/src/hooks/useRebase.ts`:
   - Added `repoId: string` to `RebaseMutationArgs` type
   - Pass `repo_id` in the request data

3. `frontend/src/components/tasks/Toolbar/GitOperations.tsx`:
   - Updated `handleRebaseWithNewBranchAndUpstream` to get `repoId` via `getSelectedRepoId()` and pass it to the rebase action

**Auto-generated:**
4. `shared/types.ts` - Regenerated with `repo_id: string` in `RebaseTaskAttemptRequest`

* All done. Both review comments have been addressed:

1. **Inlined `current_target_branch`** - Replaced the separate variable with `unwrap_or_else(|| attempt_repo.target_branch.clone())` calls directly

2. **Removed `update_all_target_branches`** - Deleted the unused function from `crates/db/src/models/attempt_repo.rs` since it's no longer needed after the multi-repo changes

All checks pass.

* Fix worktree name (#1483)

* Add multi-repo support for rebase conflict handling (Vibe Kanban) (#1487)

* All checks pass. Let me provide a summary of the changes made:

I've added multi-repo support for the conflict handling (auto fix rebase) functionality. Here's what was changed:

1. Added `AbortConflictsRequest` struct with `repo_id: Uuid` field
2. Updated `abort_conflicts_task_attempt()` handler to:
   - Accept `repo_id` in the request body
   - Look up the specific repo by ID
   - Build the correct worktree path: `workspace_path.join(&repo.name)`
   - Pass the repo-specific worktree path to `abort_conflicts()`

- Added `AbortConflictsRequest` to the list of exported types

1. **`frontend/src/lib/api.ts`**:
   - Updated `abortConflicts()` to accept `repoId` parameter and send it in the request body
   - Fixed `getBranchStatus()` return type from `BranchStatus[]` to `RepoBranchStatus[]`
   - Added `RepoBranchStatus` import, removed unused `BranchStatus` import

2. **`frontend/src/hooks/useAttemptConflicts.ts`**:
   - Added `repoId` parameter to the hook
   - Pass `repoId` to the API call

3. **`frontend/src/lib/conflicts.ts`**:
   - Added optional `repoName` parameter to `buildResolveConflictsInstructions()`
   - Added `repoName` parameter to `formatConflictHeader()`
   - Conflict resolution prompts now include repo context (e.g., "Rebase conflicts while rebasing 'branch' onto 'main' in repository 'my-repo'.")

4. **`frontend/src/components/tasks/follow-up/FollowUpConflictSection.tsx`**:
   - Updated `branchStatus` prop type from `BranchStatus[]` to `RepoBranchStatus[]`
   - Extract `repo_id` from first repo status and pass to `useAttemptConflicts()`

5. **`frontend/src/components/tasks/TaskFollowUpSection.tsx`**:
   - Pass `repo_name` to `buildResolveConflictsInstructions()` for multi-repo context in AI prompts

Cleanup script changes for task attempt b833fb22-7a04-4c56-b82d-1afaa1074e78

* The type check passes. Now the `abortConflicts` API uses the generated `AbortConflictsRequest` type, which will catch any type mismatches if the backend type changes.

* Done. Both components now find the first repo that actually has conflicts instead of just using the first repo in the array. The type check passes.

* Done. Removed both comments as requested.

* Multi-repo support for restoring commits (Vibe Kanban) (#1490)

* I've successfully implemented multi-repo support for restoring commits. Here's a summary of the changes made:

1. **`crates/server/src/routes/execution_processes.rs`**
   - Added import for `ExecutionProcessRepoState`
   - Added new endpoint `get_execution_process_repo_states` that returns the per-repo commit states for an execution process
   - Added route `/repo-states` to the router

2. **`crates/server/src/bin/generate_types.rs`**
   - Added `ExecutionProcessRepoState::decl()` to export the type to TypeScript

3. **`frontend/src/lib/api.ts`**
   - Added import for `ExecutionProcessRepoState`
   - Added `getRepoStates` method to `executionProcessesApi`

4. **`frontend/src/components/dialogs/tasks/RestoreLogsDialog.tsx`**
   - Updated the `useEffect` hook to fetch repo states via the new API instead of trying to access `before_head_commit` directly from the execution process
   - Uses the first repo's `before_head_commit` for display (consistent with how merge handles multi-repo)

5. **`shared/types.ts`**
   - Auto-generated to include `ExecutionProcessRepoState` type

The implementation follows the same pattern used for merge in commit 483060e92, where the first repo is selected for operations that need a single repo (like displaying commit information in the restore dialog).

Cleanup script changes for task attempt fefd6bd6-25e3-4775-b6af-c11ad3c06715

Let me provide a summary of the changes made:

I've implemented multi-repo support for the restore dialog. Here are the changes:

1. **`frontend/src/lib/api.ts`**
   - Changed `getBranchStatus` return type from `BranchStatus[]` to `RepoBranchStatus[]` (which includes `repo_id` and `repo_name` fields)
   - Removed unused `BranchStatus` import

2. **`frontend/src/hooks/useRetryProcess.ts`**
   - Changed `branchStatus` type in `RetryProcessParams` from `BranchStatus | undefined` to `RepoBranchStatus[] | undefined`
   - Updated caller to not pass `attemptId` (no longer needed)

3. **`frontend/src/components/NormalizedConversation/RetryEditorInline.tsx`**
   - Changed `branchStatus: branchStatus?.[0]` to `branchStatus: branchStatus` to pass the full array instead of just the first element

4. **`frontend/src/components/dialogs/tasks/RestoreLogsDialog.tsx`**
   - Changed `branchStatus` prop type from `BranchStatus | undefined` to `RepoBranchStatus[] | undefined`
   - Removed `attemptId` from props (no longer used)
   - Changed state from single `targetSha` to array `repoStates: ExecutionProcessRepoState[]`
   - Added `repoInfo` useMemo that joins repo states with branch status to get repo names
   - Added aggregated values: `anyDirty`, `totalUncommitted`, `totalUntracked`, `anyNeedsReset`, `repoCount`
   - Updated UI to display:
     - Title shows "(X repos)" when multiple repos
     - Lists each repo with its name and target commit SHA
     - Aggregated uncommitted/untracked counts across all repos

- For single-repo projects: Works exactly as before, shows one commit SHA
- For multi-repo projects: Shows all repos being restored with their respective target commits, e.g.:
  ```
  Reset worktree (2 repos)
  Your worktrees will be restored to these commits.
  🔀 repo-a: abc1234
  🔀 repo-b: def5678
  ```
- Uncommitted changes warnings aggregate across all repos

Revert "Let me provide a summary of the changes made:"

This reverts commit 14eea8717b422bdd913c9ef54def44e6297d2efe.

* I've completed all the changes. The rebase conflict is resolved and the multi-repo support is implemented. Here's a summary:

- Changed `getBranchStatus` return type from `BranchStatus[]` to `RepoBranchStatus[]`

- Changed import from `BranchStatus` to `RepoBranchStatus`
- Changed `branchStatus` in `RetryProcessParams` from `BranchStatus | undefined` to `RepoBranchStatus[] | undefined`
- Removed `attemptId` from the dialog call

- Changed `branchStatus: branchStatus?.[0]` to `branchStatus: branchStatus` to pass the full array

- Changed `branchStatus` prop from `BranchStatus | undefined` to `RepoBranchStatus[] | undefined`
- Removed `attemptId` from props (no longer needed)
- Changed state from single `targetSha` to array `repoStates: ExecutionProcessRepoState[]`
- Added `repoInfo` useMemo to join repo states with branch status by `repo_id`
- Added aggregated values: `anyDirty`, `totalUncommitted`, `totalUntracked`, `repoCount`
- Updated UI to show all repos with their target commits when `repoCount > 1`

The TypeScript check couldn't run in this worktree due to the pnpm workspace setup, but the implementation follows the same pattern that was working before. The main change is that the dialog now shows all repos being restored instead of just the first one.

* The frontend type check passes. All rebase conflicts have been resolved:

1. **`frontend/src/lib/api.ts`** - Resolved: Kept `AbortConflictsRequest` import and typed `abortConflicts` function; removed unused `BranchStatus` import
2. **`frontend/src/hooks/useAttemptConflicts.ts`** - Resolved: Uses `{ repo_id: repoId }` object parameter
3. **`frontend/src/components/tasks/TaskFollowUpSection.tsx`** - Resolved: Removed comment conflict marker, kept HEAD code
4. **`frontend/src/components/tasks/follow-up/FollowUpConflictSection.tsx`** - Resolved: Removed comment conflict marker, kept HEAD code

The rebase completed successfully and the frontend type check passes.

* All done! Here's a summary of the changes made to add multi-repo support for push and force push: (#1491)

1. **`crates/server/src/routes/task_attempts.rs`**:
   - Added `PushTaskAttemptRequest` struct with `repo_id: Uuid` field
   - Updated `push_task_attempt_branch` to accept `Json<PushTaskAttemptRequest>` and use the repo's worktree path
   - Updated `force_push_task_attempt_branch` to accept `Json<PushTaskAttemptRequest>` and use the repo's worktree path

2. **`crates/server/src/bin/generate_types.rs`**:
   - Added `PushTaskAttemptRequest::decl()` to export the type to TypeScript

3. **`frontend/src/lib/api.ts`**:
   - Updated `push()` and `forcePush()` to accept `PushTaskAttemptRequest` with `repo_id`

4. **`frontend/src/hooks/usePush.ts`**:
   - Added `PushParams` type with `repoId: string`
   - Updated mutation to accept params and pass `repo_id` to API
   - Added params to error callback for use in ForcePushDialog

5. **`frontend/src/hooks/useForcePush.ts`**:
   - Added `ForcePushParams` type with `repoId: string`
   - Updated mutation to accept params and pass `repo_id` to API

6. **`frontend/src/components/dialogs/git/ForcePushDialog.tsx`**:
   - Added `repoId` to props
   - Passes `repoId` to `forcePush.mutateAsync()`

7. **`frontend/src/hooks/useGitOperations.ts`**:
   - Updated push error handler to pass `repoId` to `ForcePushDialog.show()`

8. **`frontend/src/components/tasks/Toolbar/GitOperations.tsx`**:
   - Updated `handlePushClick` to get `repoId` and pass it to `git.actions.push()`

Cleanup script changes for task attempt 7fea7193-f072-4b7d-8650-e85ef88f0e9f

* Add multi-repo support for PR comments (Vibe Kanban) (#1500)

* All tasks are complete. Here's a summary of the changes made:

**`crates/server/src/routes/task_attempts/pr.rs`:**
- Added import for `Query` from axum
- Added new type `GetPrCommentsQuery { repo_id: Uuid }`
- Modified `get_pr_comments` function to:
  - Accept `Query(query): Query<GetPrCommentsQuery>` parameter
  - Use `AttemptRepo::find_by_attempt_and_repo_id()` to look up the specific repo
  - Use `Repo::find_by_id()` to get the repo path
  - Use `repo.path` instead of `get_first_repo_path()`

**`crates/server/src/bin/generate_types.rs`:**
- Added `GetPrCommentsQuery::decl()` to export the type to TypeScript

**`frontend/src/lib/api.ts`:**
- Updated `getPrComments` to accept `repoId: string` parameter
- Added query string `?repo_id=${encodeURIComponent(repoId)}`

**`frontend/src/hooks/usePrComments.ts`:**
- Added `repoId` parameter to hook and query key
- Updated enabled condition to require both `attemptId` and `repoId`

**`frontend/src/components/dialogs/tasks/GitHubCommentsDialog.tsx`:**
- Added `repoId: string` to `GitHubCommentsDialogProps`
- Pass `repoId` to `usePrComments` hook

**`frontend/src/components/tasks/TaskFollowUpSection.tsx`:**
- Extract `repoId` from `branchStatus?.[0]?.repo_id`
- Pass `repoId` to `GitHubCommentsDialog.show()`
- Added `branchStatus` to useCallback dependencies

Cleanup script changes for task attempt 1fc865dd-4297-4eb6-9265-09f102b92252

* Extend merges to handel repo ID (vibe-kanban 3dd2880f)

Incrates/db/src/models/merge.rs make sure mergerow and related structs have a repo\_id field to support multi repo projects. This is needed to support e.g. fetching PR comments correctly, see last few commits

* The backend compiles successfully. The fix is complete.

## Summary

Fixed the review comment by changing `get_pr_comments` to use `Merge::find_by_task_attempt_and_repo_id()` instead of `Merge::find_latest_by_task_attempt_id()`. This ensures the PR comments are fetched for the specific repo, not just the latest merge across all repos.

* All done. Here's a summary of the changes:

1. **`crates/server/src/routes/task_attempts.rs`** - Updated `rename_branch` to check ALL repos for open PRs using `find_by_task_attempt_id` instead of just the latest merge

2. **`crates/db/src/models/merge.rs`** - Removed the `find_latest_by_task_attempt_id` function entirely

* All done. The frontend now uses `useAttemptRepo` hook with `repos[0]?.id` for repo selection, matching the pattern used by merge, rebase, push, and other git operations in `GitOperations.tsx`.

* Done. The changes:

1. Removed `firstRepoStatus = branchStatus?.[0]` (line 82)
2. Updated the merged PR check to iterate over ALL repos using `branchStatus?.some()`
3. Updated the useMemo dependency from `firstRepoStatus?.merges` to `branchStatus`

* Done. Added the `getSelectedRepoId` helper function to `TaskFollowUpSection.tsx`, matching the pattern used in `GitOperations.tsx`. This makes it easier to add repo selection in the future - when that feature is added, only the helper function needs to be updated.

* Done. The lint errors are fixed. Both the frontend and backend linting pass now. The `getSelectedRepoId` helper function is now wrapped in `useCallback` with `[repos]` as its dependency, matching the pattern used in `GitOperations.tsx`.

* feat: override `ProjectRepos` (#1475)

* override repos at a task_attempt level

* simplify mcp

* refer to repoIds on frontend; separate api call to register a repo obj

* consolidate ProjectFormDialog

* Move repo path migration to rust backend (#1507)

* Add repo selection to git toolbar and fix project create loop (Vibe Kanban) (#1505)

* Conflicts are resolved in both files. I’m going to `git add` them and continue the rebase using a non‑interactive editor (`GIT_EDITOR=true`) so it won’t hang.

* **Rebase Complete**

- Resolved conflicts in `frontend/src/hooks/useAttemptRepo.ts` by keeping the new repo‑selection API (`repos`, `selectedRepoId`, `setSelectedRepoId`) and typing the query as `RepoWithTargetBranch[]`.
- Resolved conflicts in `frontend/src/lib/api.ts` by keeping both `RepoWithTargetBranch` and `RepositoryBranches` imports (no conflict markers left).
- Continued the rebase non‑interactively with `GIT_EDITOR=true`; rebase finished successfully.
- Ran `pnpm -C frontend run check`; fixed a post‑rebase TS error by re‑adding the missing `GitBranch` import used by `repoApi.getBranches` in `frontend/src/lib/api.ts`.
- Typecheck now passes and `git status` is clean.

If you want, I can run `pnpm -C frontend run lint` or a workspace test sweep next.

* Done. I made three small UI tweaks to improve readability.

**What Changed**
- Removed the dropdown caret/arrow in the repo selector button:
  - `frontend/src/components/tasks/RepoSelector.tsx`
  - Dropped the `ArrowDown` icon and its import so the selector is just folder icon + repo name.
- Removed the arrow separator that came right after the repo chip in the toolbar:
  - `frontend/src/components/tasks/Toolbar/GitOperations.tsx`
  - Deleted the first `ArrowRight` that was between the repo chip and task-branch chip.
- Replaced the gear icon with a clearer “switch” icon, and added spacing before branches:
  - `frontend/src/components/tasks/Toolbar/GitOperations.tsx`
  - Swapped `Settings` → `ArrowLeftRight` for both repo-change and target-branch-change buttons.
  - Added `ml-2` to the task branch chip so there’s visible separation from the repo selector area.

**Checks**
- `pnpm -C frontend run check` passes.

If you want a different icon (e.g., `ChevronsUpDown`, `Pencil`, `Repeat`), tell me which lucide icon you prefer and I’ll swap it.

* Cleanup script changes for task attempt 24ce3817-354c-48f7-a66c-3fb9e6fd019a

* That behavior lines up with a create‑loop in the project creation dialog. I found a likely culprit and patched it.

**Root Cause**
- `frontend/src/components/dialogs/projects/ProjectFormDialog.tsx` auto‑runs `handlePickRepo()` in a `useEffect` whenever `modal.visible` is true.
- After the multi‑repo changes, the `createProject` mutation object was causing `handlePickRepo` to be re‑created on rerenders while the modal stayed visible.
- Effect dependency `[modal.visible, handlePickRepo]` then retriggered repeatedly, spamming `createProject.mutate(...)` and creating tons of projects.

**Fix**
- Added a `hasStartedCreateRef` guard so we only call `handlePickRepo()` once per dialog open.
- Reset the guard when the modal closes.
- Narrowed the `handlePickRepo` deps to `createProject.mutate` (stable) instead of the whole mutation object.

Patch is in `frontend/src/components/dialogs/projects/ProjectFormDialog.tsx`.

**Status**
- `pnpm -C frontend run check` passes.

**What you should do now**
- Try creating a project again; you should see exactly one POST.
- If you want to clean up the 1500 accidental projects, tell me whether they’re local or remote and I can help script a safe bulk delete (with a dry‑run list first).

* Adjusted to match what you described.

**UI Tweaks**
- Kept the right‑side icon (target branch change) as the original gear:
  - In `frontend/src/components/tasks/Toolbar/GitOperations.tsx`, the target‑branch change button now uses `Settings` again.
- Changed only the icon after the project/repo chip to something more “selectable”:
  - Swapped that button to `ChevronsUpDown`, which reads more like a picker/change control.
- Increased spacing between the project/repo area and the task/branch chips:
  - Bumped the task branch chip margin from `ml-2` → `ml-3`.

**Checks**
- `pnpm -C frontend run check` passes.

If the spacing still feels tight on your screen size, tell me roughly how much more (e.g., “double it” / “a bit more”) and I’ll nudge to `ml-4` or add a `mr-*` on the repo group.

* Cleanup script changes for task attempt 24ce3817-354c-48f7-a66c-3fb9e6fd019a

* Ran lint and fixed the warning.

**Lint Fix**
- `pnpm -C frontend run lint` failed with a `react-hooks/exhaustive-deps` warning in `frontend/src/components/dialogs/projects/ProjectFormDialog.tsx:58`.
- Cause: the `useCallback` referenced `createProject.mutate` but ESLint wanted the full `createProject` object as a dep.
- Fix: pulled out a stable `createProjectMutate` variable and used that inside the callback/deps.

Patch is in `frontend/src/components/dialogs/projects/ProjectFormDialog.tsx`.

**Status**
- `pnpm -C frontend run lint` now passes with zero warnings.

* Done — task/branch group is now right‑aligned in horizontal layout.

**Change**
- In `frontend/src/components/tasks/Toolbar/GitOperations.tsx`, I split the left row into:
  - Left: repo chip + change button.
  - Right (horizontal only): task branch chip → arrow → target branch chip + gear.
- Implemented by wrapping the branch chips in a container that uses `ml-auto` when `layout !== 'vertical'`. Vertical layout keeps the old left‑flow behavior.

**Result**
- Maximizes spacing between project/repo and task/branch selectors without changing their contents.
- Icons remain: repo change uses `ChevronsUpDown`, target branch change keeps `Settings`.

**Checks**
- `pnpm -C frontend run check` passes.
- `pnpm -C frontend run lint` passes.

If you want the right group to wrap sooner/never wrap, I can tune the flex/whitespace classes.

* Cleanup script changes for task attempt 24ce3817-354c-48f7-a66c-3fb9e6fd019a

* Fixed — right‑alignment should now actually take effect.

**What I changed**
- In `frontend/src/components/tasks/Toolbar/GitOperations.tsx`, updated the horizontal grid template to give the left column flexible width:
  - `grid-cols-[auto_minmax(0,1fr)_auto]`
  - → `grid-cols-[minmax(0,1fr)_auto_auto]`
- With that, the left “branch flow” container stretches, so the inner branch group’s `ml-auto` can push it to the right.

**Checks**
- `pnpm -C frontend run check` passes.
- `pnpm -C frontend run lint` passes.

Take another look in the UI; you should see the repo chip left and the branch chips snapped to the right with maximum space between. If still tight on narrow widths, I can add a wrap breakpoint so branches drop to a second line sooner.

* Got it. I’ll make the branch group right‑align only in horizontal layout *and* when `repos.length > 1`. For a single repo, it’ll stay left‑flow with a small left margin.

I’ll patch `frontend/src/components/tasks/Toolbar/GitOperations.tsx` accordingly and re-run check/lint.

* Done.

**Behavior now**
- Horizontal layout:
  - If `repos.length > 1`: branch group uses `ml-auto` → right‑aligned.
  - If `repos.length <= 1`: branch group uses `ml-3` → stays left‑flow with a bit of spacing.
- Vertical layout unchanged.

Change is in `frontend/src/components/tasks/Toolbar/GitOperations.tsx`.

**Checks**
- `pnpm -C frontend run check` passes.
- `pnpm -C frontend run lint` passes.

* The `gh pr edit` call succeeded, but my body quoting was unsafe in bash (backticks triggered command substitution). I’m going to re‑apply the title/body using a `--body-file` heredoc so it’s exact.

Proposed final content:

**Title**
Add repo selection to git toolbar and fix project create loop (Vibe Kanban)

**Description**

This PR completes the frontend side of multi‑repo support by letting users choose which repository an attempt operates on, and by ensuring branch/status UI uses that selection. It also fixes a regression where the create‑project dialog could fire repeatedly.

- Added repo selection UX for git operations:
  - New `RepoSelectionContext` to share the selected repo across git‑related components.
  - New `RepoSelector` dropdown and `ChangeRepoDialog` modal for choosing a repo when an attempt has multiple repositories.
  - Updated `GitOperations`, `GitActionsDialog`, `TaskFollowUpSection`, and `ProjectTasks` to read/write the selected repo via the context and `useAttemptRepo`.
  - Disabled/enabled git buttons based on the selected repo’s branch status instead of aggregated status.

- Made project branches multi‑repo aware:
  - `projectsApi.getBranches` now returns `RepositoryBranches[]` (per‑repo branches) instead of flattening into a single list.
  - `useProjectBranches` and `ProjectTasks` now select the branch list for the currently selected repo.

- UI polish for clarity:
  - Simplified the repo picker chip, removed extra caret, and replaced the repo‑change icon with a clearer selector icon.
  - Tuned spacing and conditional right‑alignment of branch chips only when multiple repos exist.

- Fixed create‑project spam regression:
  - Guarded the auto‑launching repo picker in `ProjectFormDialog` so it runs once per modal open, preventing repeated `createProject` mutations.
  - Adjusted hook deps to satisfy `eslint-plugin-react-hooks`.

Multi‑repo attempts require users to choose which repo to rebase/merge/push against, and the UI must reflect branch/status information for that specific repo. Without a shared selection, components defaulted to the first repo or mixed aggregated data, causing incorrect button states and confusing branch display. The project‑creation guard addresses a rerender‑triggered loop introduced during this work.

- Selection defaults to the first repo, but persists across git dialogs through the context.
- The toolbar only shows repo selection controls when `repos.length > 1`.
- Branch/status lookups use `repo_id` matching to keep all operations scoped correctly.

This PR was written using [Vibe Kanban](https://vibekanban.com).

I’ll update the PR now with a safe heredoc.

* I switched the repo/project picker in the Git toolbar to an inline dropdown (no modal).

**What I changed**
- `frontend/src/components/tasks/Toolbar/GitOperations.tsx`
  - Removed the `ChangeRepoDialog` flow and its handler.
  - Rendered `RepoSelector` directly in the toolbar, so clicking the repo chip opens a dropdown.
  - Kept it visible for any attempt with repos, but the dropdown only matters when multiple repos exist; branch chips still right‑align only when `repos.length > 1`.
  - Disabled the selector while an attempt is running to match the old “can’t change mid‑run” behavior.
- `frontend/src/components/tasks/RepoSelector.tsx`
  - Added optional `disabled` prop and wired it to the trigger button.
- Cleaned up unused dialog:
  - Removed export in `frontend/src/components/dialogs/index.ts`.
  - Deleted `frontend/src/components/dialogs/tasks/ChangeRepoDialog.tsx`.

**Checks**
- `pnpm -C frontend run check` passes.
- `pnpm -C frontend run lint` passes.

**Note**
You currently have uncommitted changes from this tweak (`git status` shows 4 modified/deleted files). I didn’t commit because you haven’t asked me to; once you’re happy, you can `git add`/`git commit`/`git push` and the PR will update.

If you want me to also refactor `useAttemptRepo` into a shared selection (so picking a repo in the toolbar updates other panels), say so and I’ll tackle that next.

* Done — both tweaks are in.

**Repo selector icon**
- `frontend/src/components/tasks/RepoSelector.tsx`
  - Added the `ChevronsUpDown` indicator back.
  - It only renders when `repos.length > 1`, so single‑repo attempts just show the repo chip without a dropdown cue.

**Centered branch + status layout**
- `frontend/src/components/tasks/Toolbar/GitOperations.tsx`
  - Reworked the horizontal layout to match your sketch:
    - Left: repo selector.
    - Center (flex‑1, `justify-center`): `[task branch] → [target branch]` followed immediately by git status chips.
    - Right: git action buttons.
  - Vertical layout is unchanged.
  - Extracted `branchChips` and `statusChips` into reusable nodes so the markup stays consistent.

**Checks**
- `pnpm -C frontend run check` passes.
- `pnpm -C frontend run lint` passes.

Give it a quick look in the UI; spacing/centering should now line up with
`[repo]  [task branch] [target branch] [git status]  [git actions]`.

* Cleanup script changes for task attempt 24ce3817-354c-48f7-a66c-3fb9e6fd019a

* Fix branch selector repo state (vibe-kanban 0f20535c)

When selecting a repo, the branch selector needs to update accordingly and only show branches available on the selected repo. Check the latest commits for relevant files and changes.

* Fix branch selector repo state (vibe-kanban 0f20535c)

When selecting a repo, the branch selector needs to update accordingly and only show branches available on the selected repo. Check the latest commits for relevant files and changes.

* multi repo target selector (#1513)

* feat: per repo git state (#1514)

* multi repo target selector

* per-repo pr state

* query per iter

* Move per-repo scripts from Project to ProjectRepo (Vibe Kanban) (#1515)

* The implementation is complete. Here's a summary of all the changes made to move script fields from `Project` to `ProjectRepo`:

- Created `crates/db/migrations/20251212111429_move_scripts_to_project_repos.sql` - Migrates script columns from `projects` to `project_repos` table and removes them from `projects`

- **`crates/db/src/models/project_repo.rs`** - Added script fields (`setup_script`, `dev_script`, `cleanup_script`, `copy_files`, `parallel_setup_script`), `UpdateProjectRepo` struct, and `update()` method
- **`crates/db/src/models/project.rs`** - Removed all script fields from `Project`, `CreateProject`, and `UpdateProject`

- **`crates/services/src/services/container.rs`** - Updated `start_attempt()` to get scripts from project_repos and run them in parallel
- **`crates/local-deployment/src/container.rs`** - Updated copy_files execution to be per-repo

- **`crates/server/src/routes/projects.rs`** - Added `GET/PUT/DELETE` handlers for `/projects/{id}/repositories/{repo_id}`
- **`crates/server/src/routes/task_attempts.rs`** - Updated setup/cleanup/dev script handlers to use per-repo scripts

- **`crates/server/src/bin/generate_types.rs`** - Added `ProjectRepo` and `UpdateProjectRepo` type exports

- **`frontend/src/lib/api.ts`** - Added `getRepository()` and `updateRepository()` methods
- **`frontend/src/pages/settings/ProjectSettings.tsx`** - Completely updated to:
  - Separate project name editing from scripts editing
  - Add repo dropdown in Scripts card
  - Save scripts per-repository with dedicated save button
- **`frontend/src/components/tasks/TaskDetails/preview/NoServerContent.tsx`** - Updated to save dev scripts to first repository
- **`frontend/src/components/NormalizedConversation/NextActionCard.tsx`** - Updated to always show dev server button
- **`frontend/src/components/panels/PreviewPanel.tsx`** - Updated to always show dev server button
- **`frontend/src/components/tasks/TaskFollowUpSection.tsx`** - Updated to always allow running scripts
- **`frontend/src/components/dialogs/projects/ProjectFormDialog.tsx`** - Removed script fields from create project

* Cleanup script changes for task attempt ab6892e9-754c-4033-99e0-1bf13ea64df7

* Done! The fix is complete. The `cleanup_actions_for_repos` method now chains each cleanup script as a separate `ExecutorAction` using the `append_action()` method instead of combining them into one bash script with `join("\n\n")`. This ensures each script runs as its own distinct action in the execution chain.

* Cleanup script changes for task attempt ab6892e9-754c-4033-99e0-1bf13ea64df7

* Done! The migrations have been squashed:

1. Deleted `20251212111429_move_scripts_to_project_repos.sql`
2. Modified `20251209000000_add_project_repositories.sql` to:
   - Add script columns (`setup_script`, `dev_script`, `cleanup_script`, `copy_files`, `parallel_setup_script`) to `project_repos` table creation
   - Copy scripts from `projects` to `project_repos` during the migration INSERT
   - Remove script columns from `projects_new` table creation
3. Regenerated SQLx cache
4. Verified compilation passes

* Done! The `dev_script` has been successfully moved from `ProjectRepo` back to `Project`. All compilation passes. Here's a summary of the changes:

**Migration** (`20251209000000_add_project_repositories.sql`):
- `dev_script` stays on `projects` table (not moved to `project_repos`)

**Backend changes:**
- `Project` struct: Added `dev_script: Option<String>` field
- `UpdateProject`: Made fields optional with `#[ts(optional)]` for TypeScript
- `ProjectRepo`/`ProjectRepoWithName`/`UpdateProjectRepo`: Removed `dev_script` field
- `start_dev_server`: Now uses `project.dev_script` instead of `first_project_repo.dev_script`

**Frontend changes:**
- `ProjectSettings.tsx`: Dev script is now in the project-level form, not per-repo scripts
- `NoServerContent.tsx`: Saves dev script to project via `projectsApi.update()`

* Done! Both review comments have been addressed:

1. **Migration file** - Removed the note comment `-- Note: dev_script stays on projects table (project-level, not per-repo)`

2. **container.rs** - Removed the confusing/incorrect comment. The old comment said "For simplicity, we still run these in parallel but they complete before next_action" which was misleading. Changed the comment to simply say "Sequential setup script - starts before coding agent" which accurately describes what happens (it starts before the coding agent is started, but doesn't block it).

* Done! The fix is complete. Now sequential setup scripts properly use `next_action` chaining:

**How it works now:**

1. **Parallel setup scripts** (`parallel_setup_script = true`): Started immediately with `next_action: None`, run independently alongside the coding agent

2. **Sequential setup scripts** (`parallel_setup_script = false`): Collected and chained via `next_action`:
   - Chain: `setup1 → setup2 → ... → coding_agent → cleanup`
   - Only one `start_execution` call with the first setup as root
   - Each step triggers the next via `try_start_next_action()` when it completes

* Done! The refactoring is complete. Here's a summary of the changes:

**Changes made:**

1. **`cleanup_actions_for_repos`** - Updated signature to take `&[ProjectRepoWithName]` instead of `&[(String, String)]`. Filters repos with cleanup scripts internally.

2. **`setup_action_for_repo`** - New helper method that builds a setup script action for a single repo (used for parallel execution).

3. **`build_sequential_setup_chain`** - New helper method that chains sequential setup scripts → coding agent via `next_action`.

4. **`start_attempt`** - Refactored to use the new helpers:
   - If ALL repos have `parallel_setup_script = true`: Start each setup independently, then start coding agent
   - If ANY repo has `parallel_setup_script = false`: Chain ALL setups → coding agent via `next_action`

5. **Updated call sites** in `local-deployment/container.rs` and `server/task_attempts.rs` to pass `&project_repos` directly instead of extracting tuples.

* Done! The refactoring is complete. Here's a summary of the changes:

**Changes made:**

1. **`cleanup_actions_for_repos`** - Changed return type from `Option<Box<ExecutorAction>>` to `Option<ExecutorAction>`. Callers now box when needed.

2. **`setup_actions_for_repos`** - New helper method that mirrors `cleanup_actions_for_repos` but for setup scripts with `ScriptContext::SetupScript`.

3. **Updated all call sites** to use `.map(Box::new)` when the action is used as `next_action`:
   - `start_attempt` in `container.rs`
   - `run_with_message` in `local-deployment/container.rs`
   - `run_with_message` in `task_attempts.rs`

4. **Refactored handlers** to use the new helpers instead of manually building action chains:
   - `run_setup_script` handler - now uses `setup_actions_for_repos`
   - `run_cleanup_script` handler - now uses `cleanup_actions_for_repos`

This removes all the loosely-typed `Vec<(String, String)>` tuples and `(first_repo, first_script)` patterns in favor of using `ProjectRepoWithName` directly.

* Cleanup script changes for task attempt ab6892e9-754c-4033-99e0-1bf13ea64df7

* All review comments have been addressed:

1. **NextActionCard.tsx** - Reverted `projectHasDevScript` to `Boolean(project?.dev_script)`
2. **PreviewPanel.tsx** - Reverted `projectHasDevScript` to `Boolean(project?.dev_script)`
3. **NoServerContent.tsx** - Removed the comment about dev_script being saved at project level
4. **TaskFollowUpSection.tsx** - Removed the comments and inlined `hasSetupScript`/`hasCleanupScript` to just `true`, simplified the dropdown menu items by removing the disabled states and tooltips

* All 27 review comments have been addressed:

**Summary of changes:**

1. **Removed `#[ts(export)]` and `#[ts(optional)]` annotations** from `UpdateProject` struct in `project.rs`
2. **Removed `#[ts(export)]`** from `ProjectRepo` struct in `project_repo.rs`
3. **Removed unnecessary comments** from:
   - `project.rs` - "First get the existing project to use as defaults"
   - `project_repo.rs` - doc comment about finding project repos, "First check if the project_repo exists", "Use existing values as defaults"
   - `local-deployment/container.rs` - 3 comments about getting project repos
   - `task_attempts.rs` - 4 comments about getting project repos, dev server, setup/cleanup scripts
   - `services/container.rs` - All doc comments on helper methods, intermediate comments

4. **Refactored `NoServerContent.tsx`** to use `useProjectMutations` hook instead of direct `queryClient` usage:
   - Replaced `useQueryClient()` with `useProjectMutations()`
   - Updated `handleSaveDevScript` to use `updateProject.mutate()`
   - Replaced `isSaving` state with `updateProject.isPending`

5. **Fixed TypeScript type compatibility** after removing `#[ts(optional)]`:
   - `NoServerContent.tsx` - Pass `name: null` when only updating `dev_script`
   - `ProjectSettings.tsx` - Use `|| null` instead of `|| undefined`

* Done! The fix is complete. Now when you clear the `copy_files` field (or `setup_script` or `cleanup_script`) and save, it will properly clear to `null` instead of preserving the existing value.

* Done! The implementation is complete:

1. **Added `find_by_repo_id` method** to `crates/db/src/models/project_repo.rs` - a reusable method to find all project_repos by repo_id

2. **Updated `backfill_repo_names`** in `crates/services/src/services/container.rs` to also prepend `cd ./repo_name &&` to dev_script for single-repo projects when backfilling repo names

The backfill:
- Uses the existing `__NEEDS_BACKFILL__` sentinel to trigger
- Only updates single-repo projects (checks `all_repos.len() == 1`)
- Transforms `dev_script` from `"npm run dev"` to `"cd ./repo_name && npm run dev"`
- Works cross-platform (both bash and cmd.exe support `&&`)
- Uses existing `Project::update` method rather than raw SQL

* Cleanup script changes for task attempt ab6892e9-754c-4033-99e0-1bf13ea64df7

* Compiles cleanly. Fixed - now empty scripts are ignored and won't result in just `cd ./repo_name && ` being set.

* Compiles cleanly. Fixed - now using proper let chains for a cleaner flow.

* All 3 review comments have been addressed:

1. **Deleted `crates/db/bindings/` directory** - removed the generated ts-rs files that shouldn't be committed

2. **Used `#[sqlx(flatten)]` for `ProjectRepoWithName`** - refactored the struct to use flatten, which required:
   - Updating the struct definition
   - Updating all field accesses to use `project_repo.field` instead of `field` directly
   - Changing the query from `query_as!` macro to `query_as::<_, T>()` to work with flatten

3. **Added proper import for `ProjectRepoError`** - imported at the top of `error.rs` and simplified the `From` impl to use the imported type directly

* Reverted the flatten change. The `ProjectRepoWithName` struct is back to having all fields directly, and the query uses the type-checked `query_as!` macro.

* Cleanup script changes for task attempt ab6892e9-754c-4033-99e0-1bf13ea64df7

* Hide Open in IDE button for multi-repo projects (Vibe Kanban) (#1517)

* All checks pass. Let me summarize the changes:

## Summary

I've fixed the "Open project in IDE" button to:
- **Show and work for single-repo projects**
- **Hide for multi-repo projects**

### Changes made:

1. **`frontend/src/components/layout/Navbar.tsx`**:
   - Added `useQuery` import and `projectsApi` import
   - Added a query to fetch repositories when `projectId` is set
   - Added `isSingleRepoProject` check (`repos?.length === 1`)
   - Wrapped `OpenInIdeButton` in conditional rendering: only shows when `isSingleRepoProject` is true

2. **`frontend/src/components/projects/ProjectCard.tsx`**:
   - Added `useQuery` import
   - Added a query to fetch repositories for each project card
   - Added `isSingleRepoProject` check
   - Wrapped the "Open in IDE" dropdown menu item in conditional rendering: only shows when `isSingleRepoProject` is true

* The changes are complete. Here's a summary:

## Summary

Updated both files to use the existing `useBranches` hook instead of inline `useQuery` calls:

### `frontend/src/components/layout/Navbar.tsx`
- Replaced `useQuery` import with `useBranches` hook import
- Removed `projectsApi` import (no longer needed)
- Replaced inline query with `useBranches(projectId)`
- Button still only shows when `isSingleRepoProject` is true

### `frontend/src/components/projects/ProjectCard.tsx`
- Removed `useQuery` import
- Added `useBranches` hook import
- Replaced inline query with `useBranches(project.id)`
- Dropdown item still only shows when `isSingleRepoProject` is true

* Done! I've successfully removed the unused `compare_commit_to_head` endpoint. Here's a summary of the changes: (#1520)

## Changes Made

1. **`crates/server/src/routes/task_attempts.rs`**
   - Removed `CommitCompareResult` struct
   - Removed `compare_commit_to_head` handler function
   - Removed route registration for `/commit-compare`

2. **`crates/server/src/bin/generate_types.rs`**
   - Removed `CommitCompareResult::decl()` from type exports

3. **`frontend/src/lib/api.ts`**
   - Removed `CommitCompareResult` import
   - Removed the entire `commitsApi` object

4. **`shared/types.ts`** (auto-generated)
   - `CommitCompareResult` type was automatically removed after running `pnpm run generate-types`

All verification checks pass (`pnpm run check` including both frontend TypeScript and Rust cargo check).

* Fix WebSocket events lost when creating execution processes (Vibe Kanban) (#1518)

* The fix is complete. Here's a summary:

**File**: `crates/db/src/models/execution_process.rs`

**Problem**: When a follow-up was sent, the new `ExecutionProcess` was being created inside a transaction. The SQLite update hook would fire immediately after the INSERT (but before the transaction committed), spawning an async task that queried `find_by_rowid` on a **different database connection**. Since the transaction hadn't committed yet, this query couldn't see the row, causing it to return `None` and the WebSocket event to be lost.

**Solution**: Split the operation so that the `execution_process` INSERT is committed immediately (without a transaction wrapper), making it visible to the update hook's async task. The `execution_process_repo_states` are then inserted in a separate transaction afterward.

**Key changes**:
1. Removed the outer transaction that wrapped both inserts
2. Insert `execution_process` directly using `pool.execute()` - this auto-commits
3. Insert `execution_process_repo_states` in a separate transaction (only if there are any)
4. Added documentation explaining why this ordering is critical

This maintains data integrity because:
- The `execution_process_repo_states` table has a foreign key to `execution_processes`, so the parent must exist first anyway
- The repo states are still inserted atomically within their own transaction
- If the repo states insert fails, you have an execution process without repo states, which is a recoverable state (vs. the previous approach where a failed transaction would lose the execution process entirely)

* Done. Here's the summary of the fix:

**Changed files:**
1. `crates/db/src/models/execution_process.rs` - Removed transaction, added doc comment explaining why
2. `crates/db/src/models/execution_process_repo_state.rs` - Changed `create_many` to take `&SqlitePool` directly instead of a transaction

**The fix:**
- Removed the transaction wrapper around the execution_process + repo_states inserts
- Each INSERT now auto-commits immediately, so when the SQLite update hook fires and spawns an async task to query `find_by_rowid`, the row is already visible
- Added a doc comment explaining why transactions must be avoided here

**Trade-off:**
- If `create_many` fails partway through, you could have an execution_process with only some of its repo_states. This is a recoverable state (orphaned repo_states would just be ignored), vs. the previous bug where WebSocket events were silently lost.

* remove junk files (#1528)

* format, lint

* Version back to 10.13.0

* Fix i18n check script failures (Vibe Kanban) (#1530)

* The i18n check script now passes. Here's a summary of what I fixed:

**1. Added missing translation keys to tasks.json** (es, ja, ko, zh-Hans):
   - `repos.changeRepo.dialog.*` - Dialog for changing repository
   - `repos.selector.*` - Repository selector translations
   - `repoBranchSelector.label` - Base branch label
   - `attemptRepoSelector.*` - Attempt repository selector translations

**2. Internationalized FolderPickerDialog.tsx**:
   - Added `useTranslation` hook from react-i18next
   - Replaced 8 hardcoded strings with translation calls:
     - Legend text
     - "Enter path manually:" label
     - "Go" button
     - "Search current directory:" label
     - "Select Current" button
     - "git repo" badge
     - "Cancel" button
     - "Select Path" button

**3. Added folderPicker translations** to common.json for all locales (en, es, ja, ko, zh-Hans)

All three checks now pass:
-  No new literal strings introduced (134 violations in both base and PR)
-  No duplicate keys found in JSON files
-  Translation keys are consistent across locales

* Cleanup script changes for task attempt f9e7896e-d9a5-4030-a968-f1d976fbf83e

* Add analytics events for multi-repo projects (Vibe Kanban) (#1532)

* The code compiles successfully. Let me provide a summary of the changes made:

## Summary

I've implemented analytics tracking for multi-repo projects with the following changes:

### 1. Enhanced `task_attempt_started` event
**File:** `crates/server/src/routes/task_attempts.rs:185-196`
- Added `repository_count` property to track how many repos are involved when starting a task attempt

### 2. Added `project_repository_added` event
**File:** `crates/server/src/routes/projects.rs:443-465`
- New event fired when a repository is added to an existing project
- Properties: `project_id`, `repository_id`, `repository_count`, `is_multi_repo`

### 3. Added `project_repository_removed` event
**File:** `crates/server/src/routes/projects.rs:495-507`
- New event fired when a repository is removed from a project
- Properties: `project_id`, `repository_id`

All changes follow the existing analytics patterns and use `track_if_analytics_allowed` to respect user consent settings.

* Done. I've removed the `repo_count` and `is_multi_repo` properties from the `project_repository_added` event, and removed the comment from `delete_project_repository`.

* Add comprehensive logging for multi-repo add/remove operations (Vibe Kanban) (#1531)

* Done! I've added better logging for multi-repo actions. Here's a summary of the changes:

**`crates/services/src/services/project.rs`:**
- `add_repository()`: Added `debug!` at start and `info!` on success with project_id, repo_id, and path
- `delete_repository()`: Added `debug!` at start and `info!` on success with project_id and repo_id

**`crates/server/src/routes/projects.rs`:**
- `add_project_repository()`: Added `debug!` at start, plus `warn!` for each error case (path not found, not a directory, not a git repo, duplicate name, duplicate path)
- `delete_project_repository()`: Added `debug!` at start and `warn!` when repo not found

* Cleanup script changes for task attempt dccec713-4282-499e-af6d-670db5d54aba

* Let me provide a summary of the changes made: (#1529)

I've added proper multi-repo support to the MCP task server (`crates/server/src/mcp/task_server.rs`). Here are the changes:

1. **Added `RepoSummary` struct** (lines 43-61) - A new type to expose repository information in MCP responses:
   - `id`: Repository UUID
   - `name`: Repository name (directory name)
   - `display_name`: Human-readable display name

2. **Updated `ProjectSummary`** (lines 63-87) - Now includes a `repositories` field:
   - Changed `from_project()` to `from_project_with_repos()` to accept repos
   - Projects now expose their associated repositories

3. **Added `McpRepoContext` struct** (lines 255-265) - Per-repository context info:
   - `repo_id`: Repository UUID
   - `repo_name`: Repository name
   - `repo_display_name`: Repository display name
   - `target_branch`: Target branch for this repo in this attempt

4. **Updated `McpContext`** (lines 267-279) - Added multi-repo support:
   - Added `attempt_repos: Vec<McpRepoContext>` field for per-repo target branches
   - Kept `attempt_target_branch` for backward compatibility (first repo's branch)

5. **Updated `fetch_context_at_startup`** (lines 306-391) - Now fetches repo details:
   - Makes additional API call to `/api/task-attempts/{id}/repos`
   - Populates `attempt_repos` with full repo info (name, display_name, target_branch)

6. **Updated `list_projects`** (lines 559-587) - Now fetches repositories for each project:
   - For each project, calls `/api/projects/{id}/repositories`
   - Includes repos in the `ProjectSummary` response

7. **Added `Deserialize` to `RepoWithTargetBranch`** (line 29) - Required for JSON deserialization in the MCP server

- All changes are additive (new fields in responses)
- `attempt_target_branch` is still populated with the first repo's branch
- Existing MCP clients will continue to work

rm bindings

Cleanup script changes for task attempt 4f0c19cd-4d9c-42d6-a1fd-7d52063ff5d1

All done! Here's a summary of the final implementation based on your review feedback:

1. **Added `RepoSummary` struct** - Exposes repo `id`, `name`, `display_name` for MCP clients

2. **Updated `ProjectSummary`** - Added `repositories: Vec<RepoSummary>` field so `list_projects` returns repos

3. **Updated `McpContext`** - Replaced single `attempt_target_branch` with `attempt_target_branches: HashMap<Uuid, String>` mapping repo IDs to their target branches

4. **Simplified `fetch_context_at_startup`** - Builds the HashMap directly from `ctx.attempt_repos` (no additional API call needed)

5. **Updated `list_projects`** - Fetches repositories for each project

6. **Added `Deserialize` to `RepoWithTargetBranch`** - For consistency (though no longer used after simplification)

Cleanup script changes for task attempt 4f0c19cd-4d9c-42d6-a1fd-7d52063ff5d1

Done! The implementation is now focused on just the multi-repo context support:

1. **Updated `McpContext`** - Replaced `attempt_target_branch: String` with `attempt_target_branches: HashMap<Uuid, String>` mapping repo IDs to their target branches
2. **Simplified `fetch_context_at_startup`** - Builds the HashMap directly from `ctx.attempt_repos`
3. **Reverted `list_projects`** - Back to original simple implementation (no repo fetching)
4. **Reverted `ProjectSummary`** - Removed `repositories` field
5. **Removed `RepoSummary`** - No longer needed

6. **Added `Deserialize` to `RepoWithTargetBranch`** - For consistency

Done! The implementation now includes proper repo info alongside target branches. Here's what `McpContext.attempt_repos` will look like:

```json
{
  "attempt_repos": [
    {
      "repo_id": "uuid-1",
      "repo_name": "frontend",
      "target_branch": "main"
    },
    {
      "repo_id": "uuid-2",
      "repo_name": "backend",
      "target_branch": "develop"
    }
  ]
}
```

Done! The implementation now includes proper repo info alongside target branches. Here's what `McpContext.attempt_repos` will look like:

```json
{
  "attempt_repos": [
    {
      "repo_id": "uuid-1",
      "repo_name": "frontend",
      "target_branch": "main"
    },
    {
      "repo_id": "uuid-2",
      "repo_name": "backend",
      "target_branch": "develop"
    }
  ]
}
```

**Changes made:**
1. `crates/db/src/models/task_attempt.rs` - Changed `TaskAttemptContext.attempt_repos` from `Vec<AttemptRepo>` to `Vec<RepoWithTargetBranch>` and updated `load_context` to use `find_repos_with_target_branch_for_attempt`
2. `crates/server/src/mcp/task_server.rs` - Simplified `fetch_context_at_startup` to map directly from `ctx.attempt_repos` (no extra API call needed)

The multi-repo support implementation is complete. Here's a summary of what was done:

**Changes to `McpContext` (get_context tool):**
- Added `McpRepoContext` struct with `repo_id`, `repo_name`, and `target_branch`
- `McpContext.attempt_repos` is now `Vec<McpRepoContext>` providing full repo info for each repo in the attempt

**Changes to `start_task_attempt` tool:**
- Added `McpAttemptRepoInput` struct with `repo_id` and `base_branch`
- Changed `StartTaskAttemptRequest` from single `base_branch: String` to `repos: Vec<McpAttemptRepoInput>`
- Callers now specify the base branch per-repo

**Changes to db layer:**
- `TaskAttemptContext.attempt_repos` now uses `Vec<RepoWithTargetBranch>` to include repo info alongside target branches

Done. Added the new `list_repos` MCP tool:

- **New structs**: `McpRepoSummary`, `ListReposRequest`, `ListReposResponse`
- **New tool**: `list_repos(project_id)` - returns repos for a given project
- Uses the existing `/api/projects/{id}/repositories` endpoint

The tool follows the same pattern as `list_tasks` - takes a `project_id` and returns a list with count.

Done. Added `list_repos` to the server instructions.

* Allow follow-ups after PR merge (Vibe Kanban) (#1534)

* All checks pass. Let me summarize the changes made:

## Summary

I've implemented the changes to allow follow-ups after PR merge while still preventing duplicate PRs/merges from the same branch.

### Changes Made:

1. **`frontend/src/components/tasks/TaskFollowUpSection.tsx`**
   - Removed the `hasMergedPR` check from `canTypeFollowUp` function (lines 337-345)
   - Removed the unused `Merge` type import
   - Now users can type and send follow-ups even after a PR has been merged for the selected repo

2. **`frontend/src/components/tasks/Toolbar/GitOperations.tsx`**
   - Removed `mergeInfo.hasMergedPR` from the rebase button's disabled condition (line 520)
   - The merge and PR/Push buttons still have `hasMergedPR` checks to prevent duplicate operations on the same branch
   - Users can now rebase to get latest changes and continue working after merge

### What's now allowed after PR merge:
-  Typing and sending follow-up messages
-  Rebasing to get latest changes from target branch

### What's still blocked after PR merge (for the same repo/branch):
-  Direct merge (can't merge again)
-  Create PR / Push to PR (can't create/push to a merged PR)

* Cleanup script changes for task attempt 6f608351-a523-4137-a969-e717984fb7cc

* use git worktree move to move to temp dir; cleanup temp after successful migration (#1541)

* Refactor workspace cleanup and remove unused worktree_deleted field (Vibe Kanban) (#1537)

* All done! Here's a summary of the refactoring:

- Added `AttemptWithRef` struct with `attempt_id` and `container_ref` fields
- Added `ContainerInfo` struct with `attempt_id`, `task_id`, and `project_id` fields (with `Serialize` and `TS` derives)
- Renamed `find_by_worktree_deleted` → `find_by_workspace_deleted`, returns `Vec<AttemptWithRef>`
- Updated `find_expired_for_cleanup` to return `Vec<AttemptWithRef>` with a simplified query (removed JOINs to `attempt_repos`/`repos`)
- Updated `resolve_container_ref` to return `ContainerInfo` instead of tuple

- Renamed `check_externally_deleted_worktrees` → `check_externally_deleted_workspaces`
- Renamed `spawn_worktree_cleanup` → `spawn_workspace_cleanup`
- Updated `cleanup_expired_attempt` to:
  - Take `&AttemptWithRef` instead of individual parameters
  - Fetch repos via `AttemptRepo::find_repos_for_attempt` (like `delete_inner`)
  - Use `WorkspaceManager::cleanup_workspace` instead of `WorktreeManager::cleanup_worktree`
- Updated all log messages to use "workspace" terminology

- Removed local `ContainerInfo` definition
- Imported `ContainerInfo` from `db::models::task_attempt`
- Updated handlers to use the struct directly

The refactoring improves code clarity by:
- Using named structs instead of anonymous tuples
- Updating terminology from "worktree" to "workspace" where appropriate
- Making the cleanup flow consistent with `delete_inner` (using `WorkspaceManager::cleanup_workspace`)

Cleanup script changes for task attempt 28d13fd0-f4c3-4f33-9a9a-354f81d81d1a

* All done. Here's a summary of all the changes made:

1. **Added new structs** to `crates/db/src/models/task_attempt.rs`:
   - `AttemptWithRef` - holds `attempt_id` and `container_ref`
   - `ContainerInfo` - holds `attempt_id`, `task_id`, `project_id`

2. **Updated cleanup methods** to return named structs instead of tuples:
   - `find_expired_for_cleanup` now returns `Vec<AttemptWithRef>`
   - `resolve_container_ref` now returns `ContainerInfo`

3. **Updated `container.rs`** to use `WorkspaceManager::cleanup_workspace` (matching `delete_inner` pattern)

4. **Updated `containers.rs`** route to import `ContainerInfo` from db crate

5. **Created migration** `20251215145026_drop_worktree_deleted.sql` to drop the column

6. **Removed `worktree_deleted`** from:
   - `TaskAttempt` struct
   - All SELECT queries
   - INSERT query in `create()`

7. **Removed `mark_worktree_deleted` method** entirely

8. **Removed `check_externally_deleted_workspaces`** function (no longer needed)

9. **Renamed `find_by_workspace_deleted`** to `find_with_container_ref` (now just filters by `container_ref IS NOT NULL`)

10. **Updated `spawn_workspace_cleanup`** to no longer call the removed function

The `worktree_deleted` field was useless because workspaces get recreated on demand via `ensure_workspace_exists` when a user interacts with a task, but the flag was never reset to FALSE. Now cleanup just relies on `container_ref IS NOT NULL` and the 72-hour expiration logic.

Cleanup script changes for task attempt 28d13fd0-f4c3-4f33-9a9a-354f81d81d1a

Done. Removed the unused `find_with_container_ref` method.

Done. Fixed all three issues:
1. Simplified the migration to just `ALTER TABLE task_attempts DROP COLUMN worktree_deleted;`
2. Removed the `TS` derive from `ContainerInfo`
3. Removed the comment above `ContainerInfo`

* Everything compiles correctly. The refactoring is complete. Here's a summary of all the changes made:

**Summary of cleanup workspace refactor:**

1. **Removed `worktree_deleted` field and related functionality** - The field was never reset to false after workspace recreation, making it useless. Removed:
   - `worktree_deleted` column via migration `20251215145026_drop_worktree_deleted.sql`
   - `mark_worktree_deleted` method
   - `check_externally_deleted_workspaces` function

2. **Removed unused methods and endpoints:**
   - `find_with_container_ref` method (unused)
   - `/containers/info` endpoint (unused)

3. **Improved type clarity:**
   - Added `AttemptWithRef` struct with `attempt_id` and `container_ref` fields
   - Added `ContainerInfo` struct for `resolve_container_ref` return type
   - `find_expired_for_cleanup` now returns `Vec<AttemptWithRef>` with a simplified query

4. **Updated cleanup flow** to use `WorkspaceManager::cleanup_workspace` pattern (matching `delete_inner`)

* All done. Here's a summary of the changes made based on the review comments:

**Changes made:**

1. **Removed doc comment** (line 212) - Deleted `/// Clean up an expired workspace and all its worktrees`

2. **Dropped `AttemptWithRef`, now returns `TaskAttempt`** - Removed the custom struct and updated `find_expired_for_cleanup` to return `Vec<TaskAttempt>` directly

3. **Extracted shared cleanup logic** - Created `cleanup_attempt_workspace(db: &DBService, attempt: &TaskAttempt)` static function that both `delete_inner` and the cleanup loop use, eliminating code duplication

**Files modified:**
- `crates/db/src/models/task_attempt.rs` - Removed `AttemptWithRef`, updated `find_expired_for_cleanup` return type
- `crates/local-deployment/src/container.rs` - Added `cleanup_attempt_workspace`, simplified `delete_inner` to use it, updated `cleanup_expired_attempts` loop

Cleanup script changes for task attempt 28d13fd0-f4c3-4f33-9a9a-354f81d81d1a

Done. Added `clear_container_ref` method and call it after cleanup. Now cleanup will:
1. Clean up the workspace files
2. Set `container_ref = NULL` so the attempt won't be picked up again in future cleanup cycles

This gives the same performance benefit as the old `worktree_deleted` flag, but with correct semantics - if the workspace is recreated later via `ensure_workspace_exists`, it will set `container_ref` again and the attempt will become eligible for cleanup after 72 hours of inactivity.

Cleanup script changes for task attempt 28d13fd0-f4c3-4f33-9a9a-354f81d81d1a

Done. Now `ensure_container_exists` will call `create()` if `container_ref` is NULL, which regenerates the workspace using the stored `task_attempt.branch`. The branch is preserved in the database so it stays the same.

* All tasks are complete. The implementation now includes:

1. **`ensure_project_files_impl`** in `copy.rs` - Like `copy_project_files_impl` but skips files that already exist at target with same size
2. **`ensure_images_by_task`** in `image.rs` - Like `copy_images_by_task_to_worktree` but skips images that already exist
3. **`ensure_project_files`** wrapper in `container.rs` - Private async method with timeout that calls `ensure_project_files_impl`
4. **Updated `ensure_container_exists`** - Now calls the `ensure_*` methods after `WorkspaceManager::ensure_workspace_exists` to ensure project files and images are present (fast no-op if they already exist)

The key optimization is the fast path: when files/images already exist, the `ensure_*` methods only perform `stat()` calls to check file existence/size, avoiding any actual file copies. This keeps `ensure_container_exists` fast for the common case while fixing the bug where recreated workspaces (after cleanup set `container_ref = NULL`) wouldn't have their project files and images re-copied.

Done. Here's a summary of the refactoring:

**Changes made:**

1. **`crates/local-deployment/src/copy.rs`**:
   - Added `skip_existing: bool` parameter to `copy_project_files_impl`
   - Deleted `ensure_project_files_impl` (~55 lines)
   - Deleted `ensure_single_file` and `copy_single_file` wrappers (~16 lines)
   - Updated all tests to pass the new parameter

2. **`crates/services/src/services/image.rs`**:
   - Added `skip_existing: bool` parameter to `copy_images`
   - Deleted `ensure_images` (~40 lines)
   - Updated callers: `copy_images_by_task_to_worktree` passes `false`, `ensure_images_by_task` passes `true`

3. **`crates/local-deployment/src/container.rs`**:
   - Updated `copy_project_files` to pass `false`
   - Updated `ensure_project_files` to pass `true`

**Net result**: ~90 lines of duplicated code removed while keeping the fast path (stat check to skip existing files).

Cleanup script changes for task attempt 28d13fd0-f4c3-4f33-9a9a-354f81d81d1a

Done. Here's a summary of the refactoring:

**Changes made:**

1. **`crates/local-deployment/src/copy.rs`**
   - Removed `skip_existing` parameter - now always skips files that already exist with same size
   - Simpler function signature: `copy_project_files_impl(source_dir, target_dir, copy_files)`

2. **`crates/services/src/services/image.rs`**
   - Removed `skip_existing` parameter from `copy_images` - always skips existing
   - Deleted `ensure_images_by_task` - just use `copy_images_by_task_to_worktree`

3. **`crates/db/src/models/attempt_repo.rs`**
   - Added `RepoWithCopyFiles` struct
   - Added `find_repos_with_copy_files(attempt_id)` - gets repos with `copy_files` config in one query

4. **`crates/local-deployment/src/container.rs`**
   - Deleted `ensure_project_files` method
   - Added `copy_files_and_images` helper that handles both file and image copying
   - Simplified `create()`: now calls `copy_files_and_images` (~30 lines shorter)
   - Simplified `ensure_container_exists()`: uses `copy_files_and_images` instead of manual loops (~35 lines shorter)

**Result:**
- ~65 lines removed total
- Simpler API: no `skip_existing` flag, no `ensure_*` variants
- Fewer DB queries: `ensure_container_exists` went from 4 queries (task, project, project_repos, repos) to 2 (repos, repos_with_copy_files)
- Code deduplication: `create()` and `ensure_container_exists()` share the `copy_files_and_images` helper

Cleanup script changes for task attempt 28d13fd0-f4c3-4f33-9a9a-354f81d81d1a

* Done. The fix is cleaner:

1. **Removed the `create()` call** when `container_ref` is NULL
2. **Regenerate workspace path deterministically** using the same logic as `create()` - `dir_name_from_task_attempt(attempt_id, task_title)`
3. **Use `ensure_workspace_exists`** which handles existing branches properly (doesn't try to create them)
4. **Update `container_ref`** after ensuring the workspace exists

This is the proper solution because:
- `create()` is for NEW attempts with NEW branches
- `ensure_workspace_exists()` is for EXISTING attempts that just need their worktree recreated
- No hacky branch existence checks needed

* cleanup comments

* Update crates/services/src/services/image.rs

Co-authored-by: Gabriel Gordon-Hall <gabriel@bloop.ai>

* Update crates/services/src/services/image.rs

Co-authored-by: Gabriel Gordon-Hall <gabriel@bloop.ai>

* Revert rename

---------

Co-authored-by: Gabriel Gordon-Hall <gabriel@bloop.ai>

* Inline delete_inner into ContainerService delete method (Vibe Kanban) (#1544)

* Done. Here's a summary of the changes:

**Changes made:**

1. **`crates/services/src/services/container.rs`:**
   - Removed `delete_inner` trait method declaration
   - Added `cleanup_attempt_workspace` as a new trait method
   - Modified `delete` to call `self.cleanup_attempt_workspace(task_attempt).await` instead of `self.delete_inner(task_attempt).await`

2. **`crates/local-deployment/src/container.rs`:**
   - Removed `delete_inner` implementation (the old 4-line function)
   - Renamed `cleanup_attempt_workspace` → `cleanup_attempt_workspace_inner` (made private)
   - Added new trait method implementation `cleanup_attempt_workspace` that delegates to the inner function
   - Updated `cleanup_expired_attempts` to call the renamed `cleanup_attempt_workspace_inner`

The net effect is that `delete_inner` is inlined/removed, and the logic is now handled by `cleanup_attempt_workspace` as a trait method.

* Done. The refactor is now much cleaner:

**Before:** 3 methods (`delete` default impl → `delete_inner` abstract → `cleanup_attempt_workspace` impl)

**After:** 1 abstract method (`delete`) with direct implementation in `LocalContainerService`

The `delete` method now directly calls `try_stop` and `cleanup_attempt_workspace_inner` in one place.

* Done. Renamed `cleanup_attempt_workspace_inner` back to `cleanup_attempt_workspace` in all 3 places. Build passes.

* update copy for scripts (#1535)

* Fix orphan cleanup to properly handle workspaces containing multiple worktrees (Vibe Kanban) (#1545)

* All done. Here's a summary of the changes made:

Fixed the orphan cleanup bug by moving the logic from `LocalContainerService` to `WorkspaceManager` and properly handling workspaces (which contain multiple worktrees).

1. **`crates/services/src/services/workspace_manager.rs`**:
   - Added `cleanup_orphan_workspaces()` - public method that scans the workspace base directory for orphaned workspaces and cleans them up
   - Added `cleanup_workspace_without_repos()` - helper method that cleans up a workspace by discovering worktrees (subdirectories with `.git` files) and cleaning each one properly using `WorktreeManager::cleanup_worktree()`

2. **`crates/local-deployment/src/container.rs`**:
   - Removed the broken `cleanup_orphaned_worktrees()` method (was incorrectly treating workspaces as worktrees)
   - Updated `spawn_workspace_cleanup()` to call `WorkspaceManager::cleanup_orphan_workspaces()` instead
   - Removed unused imports (`WorktreeCleanup`, `WorktreeManager`)

The old code was passing workspace paths (e.g., `/worktrees/abc-task-title/`) directly to `WorktreeManager::cleanup_worktree()`, which expected individual worktree paths (e.g., `/worktrees/abc-task-title/repo-name/`). The new code correctly:
1. Identifies orphaned **workspaces** by checking if the workspace path exists in any task attempt's `container_ref`
2. For each orphaned workspace, scans its subdirectories for worktrees (directories with `.git` files)
3. Cleans up each worktree properly using `WorktreeManager::cleanup_worktree()`
4. Finally removes the workspace directory itself

* Done. I've added `cleanup_suspected_worktree()` to `WorktreeManager` and updated `cleanup_workspace_without_repos()` in `WorkspaceManager` to use it. This keeps the worktree detection and cleanup logic in the appropriate manager.

* Comments

* lint

* invalidate project queries on add or delete repo (#1557)

---------

Co-authored-by: Alex Netsch <alex@bloop.ai>
2025-12-16 10:55:27 +00:00
Louis Knight-Webb
7f9f1433af Store binaries in Cloudflare R2 instead of bundling in npm package (Vibe Kanban) (#1554)
* All changes are complete. Let me provide a summary of what was implemented:

## Summary

I've implemented the Cloudflare R2 binary storage feature. Here are the changes:

### Files Created
- **`npx-cli/bin/download.js`** - New module that handles downloading binaries from R2 with:
  - SHA-256 checksum verification
  - Progress reporting
  - Redirect handling
  - Local caching in `~/.vibe-kanban/bin/{version}/{platform}/`

### Files Modified

1. **`npx-cli/bin/cli.js`**
   - Converted to async for on-demand downloads
   - Downloads binaries from R2 instead of using bundled files
   - Non-blocking update check shows notice if newer version available
   - Caches binaries locally per version/platform

2. **`npx-cli/package.json`**
   - Removed `"dist"` from `files` array (package now ~15KB instead of ~150MB)

3. **`.github/workflows/pre-release.yml`**
   - Added new `upload-to-r2` job that:
     - Downloads all platform packages from artifacts
     - Generates manifest.json with SHA-256 checksums for each binary
     - Uploads binaries to R2 at `binaries/v{version}/{platform}/{binary}.zip`
     - Updates global manifest with latest version
   - Modified `create-prerelease` job to:
     - Depend on `upload-to-r2` instead of `package-npx-cli`
     - Inject R2 public URL into download.js via `sed`
     - No longer download/bundle binaries in the npm package

### Required GitHub Secrets

You'll need to add these secrets to your repository:
- `R2_BINARIES_ACCESS_KEY_ID`
- `R2_BINARIES_SECRET_ACCESS_KEY`
- `R2_BINARIES_ENDPOINT` (e.g., `https://<account_id>.r2.cloudflarestorage.com`)
- `R2_BINARIES_BUCKET`
- `R2_BINARIES_PUBLIC_URL` (the public URL for your R2 bucket, e.g., custom domain or public R2 URL)

### R2 Bucket Structure
```
binaries/
  manifest.json                    # {"latest": "0.0.135"}
  v0.0.135/
    manifest.json                  # Per-version manifest with checksums
    linux-x64/
      vibe-kanban.zip
      vibe-kanban-mcp.zip
      vibe-kanban-review.zip
    ...
```

* Done! I've updated the implementation to use full tags (with timestamps) instead of just version numbers. Here's a summary of what changed:

## Changes Made

1. **`npx-cli/bin/download.js`**:
   - Added `BINARY_TAG` constant (placeholder `__BINARY_TAG__`)
   - Changed `ensureBinary()` to use `BINARY_TAG` instead of accepting version as parameter
   - Cache paths now use the tag: `~/.vibe-kanban/bin/{tag}/{platform}/`

2. **`npx-cli/bin/cli.js`**:
   - Updated to import `BINARY_TAG` from download.js
   - Cache directory now uses `BINARY_TAG` instead of `CLI_VERSION`
   - Updated `ensureBinary()` call to not pass version

3. **`.github/workflows/pre-release.yml`**:
   - `upload-to-r2` job now uses `new_tag` instead of `new_version` for R2 paths
   - Binaries are stored at `binaries/{tag}/{platform}/{binary}.zip`
   - Global manifest stores the full tag: `{"latest": "v0.0.135-20251215122030"}`
   - `create-prerelease` job now injects both `__R2_PUBLIC_URL__` and `__BINARY_TAG__`

This allows multiple pre-releases to coexist in R2 (e.g., `v0.0.135-20251215122030` and `v0.0.135-20251215100000`), making rollbacks easy.

* chore: bump version to 0.0.136

---------

Co-authored-by: GitHub Action <action@github.com>
2025-12-15 23:48:27 +00:00
Louis Knight-Webb
e16602cc0f Downgrade version 2025-12-15 22:12:03 +00:00
Louis Knight-Webb
8a623ee924 Larger runner (#1552)
* Use a larger ubuntu runner

* chore: bump version to 0.0.136

---------

Co-authored-by: Solomon <abcpro11051@disroot.org>
Co-authored-by: GitHub Action <action@github.com>
2025-12-15 22:01:46 +00:00
GitHub Action
5710cc3371 chore: bump version to 0.0.135 2025-12-15 13:37:12 +00:00
Solomon
a07bebe333 Make the queue button in followup section not look disabled (#1533) 2025-12-15 12:42:38 +00:00
GitHub Action
dffa4d9621 chore: bump version to 0.0.134 2025-12-11 19:12:50 +00:00
Gabriel Gordon-Hall
2366e4ad23 chore: remove unused code and dependencies identified by knip (Vibe Kanban) (#1499)
* Here's a summary of what was cleaned up:

## Removed Unused Files (11 files)
- `frontend/src/components/layout/ResponsiveTwoPane.tsx`
- `frontend/src/components/OrgMemberAvatars.tsx`
- `frontend/src/components/tasks/FollowUpStatusRow.tsx`
- `frontend/src/components/tasks/TaskRelationshipCard.tsx`
- `frontend/src/components/tasks/TaskRelationshipViewer.tsx`
- `frontend/src/components/ui/image-upload-section.tsx`
- `frontend/src/components/ui/tabs.tsx`
- `frontend/src/components/ui/title-description-editor.tsx`
- `frontend/src/lib/caretPosition.ts`
- `frontend/src/utils/markdownImages.ts`
- `remote-frontend/src/App.tsx`

## Removed Unused Dependencies (10 packages from frontend/package.json)
- `@dnd-kit/modifiers`
- `@lexical/utils`
- `@radix-ui/react-tabs`
- `@tailwindcss/typography`
- `@tanstack/react-devtools`
- `@tanstack/react-form-devtools`
- `@types/react-window`
- `react-use-websocket`
- `react-window`
- `zod`

## Removed Unused Exports
- `useTabNavigation` hook from `TabNavigationContext.tsx`

## Not Removed (false positives or intentional)
- `shared/types.ts` - auto-generated file used throughout the project
- `@rjsf/shadcn` - used in tailwind.config.js content paths
- `wa-sqlite` - used in vite.config.ts optimizeDeps
- `eslint-plugin-prettier`, `vite` (root) - kept per user preference
- Barrel re-exports in index.ts files (dialogs, hooks, ui) - intentional public APIs
- Type exports - part of public API contracts

* Done. Restored `remote-frontend/src/App.tsx` as a placeholder.

* Update pnpm lockfile after removing unused dependencies

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-11 12:45:04 +00:00
GitHub Action
b37672a475 chore: bump version to 0.0.133 2025-12-11 11:28:42 +00:00
Louis Knight-Webb
07e1b34a21 add border around task form elements (#1492) 2025-12-11 11:26:54 +00:00
Louis Knight-Webb
b818f32b1e fix: preserve preceding space when inserting tag/file from typeahead (Vibe Kanban) (#1495)
* All type checks pass. The fix is complete.

**Summary:** Fixed the issue in `frontend/src/components/ui/wysiwyg/plugins/file-tag-typeahead-plugin.tsx:117-122`. When selecting a tag or file from the typeahead menu, the code now checks if the replaced text started with whitespace and preserves it by prepending a space to the inserted content.

* Done. The more elegant fix is now in place - a single line change in the `triggerFn`:

```typescript
replaceableString: match[0].slice(match[0].indexOf('@')),
```

This excludes the preceding space from `replaceableString` at the source, so the `onSelectOption` handler remains simple with no conditional logic.
2025-12-11 11:24:37 +00:00
Solomon
72c952626a Allow changing target branch when agent is running (#1474)
Changing the target branch is a no-op.
2025-12-09 16:28:54 +00:00
Gabriel Gordon-Hall
84d80659b3 normalize tool display; remove backticks (#1482) 2025-12-09 15:50:17 +00:00
GitHub Action
d0392e6d5e chore: bump version to 0.0.132 2025-12-09 12:32:34 +00:00
Louis Knight-Webb
55ca4d3655 Add auto-generate PR description feature (Vibe Kanban) (#1479)
* I've completed the implementation. Here's a summary of the changes made:

## Summary

### Backend (Rust)

1. **`crates/services/src/services/config/versions/v8.rs`**
   - Added two new config fields:
     - `pr_auto_description_enabled: bool` - defaults to `false`
     - `pr_auto_description_prompt: Option<String>` - defaults to `None`

2. **`crates/server/src/routes/task_attempts.rs`**
   - Added `auto_generate_description: bool` field to `CreateGitHubPrRequest`
   - Added `DEFAULT_PR_DESCRIPTION_PROMPT` constant with the default prompt
   - Added `trigger_pr_description_follow_up()` helper function that:
     - Gets the custom prompt from config or uses default
     - Replaces `{pr_number}` and `{pr_url}` placeholders
     - Triggers a follow-up (or initial if no session) coding agent execution
   - Modified `create_github_pr()` to call the follow-up trigger after successful PR creation

### Frontend (TypeScript/React)

3. **`frontend/src/components/dialogs/tasks/CreatePRDialog.tsx`**
   - Added `autoGenerateDescription` state, initialized from `config.pr_auto_description_enabled`
   - Added checkbox to toggle auto-generate PR description
   - Included `auto_generate_description` in the API call payload

4. **`frontend/src/pages/settings/GeneralSettings.tsx`**
   - Added "Pull Requests" Card section with:
     - Checkbox to enable/disable auto-generate by default
     - Textarea for custom prompt override

5. **Translation files**
   - Added `autoGenerateLabel` to `tasks.json`
   - Added `pullRequests` section to `settings.json`

6. **`shared/types.ts`** - Auto-generated with new types

### Key Features
- Toggle in PR creation dialog, defaulting to the global config setting
- Settings page for configuring default behavior and custom prompt
- Placeholders `{pr_number}` and `{pr_url}` for custom prompts
- Uses the same executor profile as the original task attempt
- Graceful error handling (warns but doesn't fail PR creation if follow-up fails)

* Cleanup script changes for task attempt 46e66dfc-f608-47a4-baca-e38399d2da15

* Done! I've updated the placeholder text in `settings.json` to show the actual default prompt. Now users can see exactly what prompt the AI agent will use by default, and they know what they're customizing when they enter a custom prompt.

The placeholder now shows:
```
Update the GitHub PR that was just created with a better title and description.
The PR number is #{pr_number} and the URL is {pr_url}.

Analyze the changes in this branch and write:
1. A concise, descriptive title that summarizes the changes
2. A detailed description that explains:
   - What changes were made
   - Why they were made (based on the task context)
   - Any important implementation details

Use `gh pr edit` to update the PR.
```

I also updated the helper text to mention the placeholder variables (`{pr_number}` and `{pr_url}`) so users know what variables they can use in their custom prompts.

* Cleanup script changes for task attempt 46e66dfc-f608-47a4-baca-e38399d2da15

* Done! Updated the label to "Ask AI agent to generate a better PR description" as requested.

* All done! The refactoring is complete:

**Summary of changes:**

1. **Created `crates/server/src/routes/task_attempts/pr.rs`** - New submodule containing all PR-related code:
   - Types: `CreateGitHubPrRequest`, `CreatePrError`, `AttachPrResponse`, `PrCommentsResponse`, `GetPrCommentsError`
   - Constants: `DEFAULT_PR_DESCRIPTION_PROMPT`
   - Functions: `trigger_pr_description_follow_up`, `create_github_pr`, `attach_existing_pr`, `get_pr_comments`

2. **Updated `crates/server/src/routes/task_attempts.rs`** - Added `pub mod pr;` and updated router to use `pr::` prefix for PR routes

3. **Updated `crates/server/src/bin/generate_types.rs`** - Fixed all paths to reference `pr::` submodule for the PR-related types

Both backend (cargo check) and frontend (TypeScript) compile successfully, and TypeScript types have been regenerated.

* Cleanup script changes for task attempt 46e66dfc-f608-47a4-baca-e38399d2da15

* Done! I've updated the default PR description prompt in both locations:

1. **`crates/server/src/routes/task_attempts/pr.rs`** - Updated `DEFAULT_PR_DESCRIPTION_PROMPT` constant
2. **`frontend/src/i18n/locales/en/settings.json`** - Updated `pullRequests.customPrompt.placeholder`

The changes are:
- Title should now be postfixed with "(Vibe Kanban)"
- Description should include a note at the end: "This PR was written using [Vibe Kanban](https://vibekanban.com)"

* Done! I've updated `pr_auto_description_enabled` to default to `true` in three places:

1. Added `default_pr_auto_description_enabled()` function that returns `true`
2. Updated the `#[serde(default)]` attribute to use this function
3. Updated the `from_v7_config` migration to set it to `true`
4. Updated the `Default` impl to set it to `true`

* All done! I've added i18n translations for the PR auto-description feature to all supported languages:

**settings.json** - Added `pullRequests` section with:
- `title`, `description`
- `autoDescription.label`, `autoDescription.helper`
- `customPrompt.label`, `customPrompt.placeholder`, `customPrompt.helper`

**tasks.json** - Added `autoGenerateLabel` key

Languages updated:
- Spanish (es)
- Japanese (ja)
- Korean (ko)
- Simplified Chinese (zh-Hans)

* Update frontend/src/i18n/locales/en/tasks.json

Co-authored-by: Gabriel Gordon-Hall <gabriel@bloop.ai>

* Done! I've implemented the UX improvement from the PR review:

1. **Moved the auto-generate checkbox** to the top of the form (above title and description)
2. **Added `disabled` prop** to both the title Input and description Textarea when `autoGenerateDescription` is true
3. **Added greyed-out styling** (`opacity-50 cursor-not-allowed`) to visually indicate the fields are disabled

The new field order is:
1. Auto-generate checkbox
2. Title input (disabled when checked)
3. Description textarea (disabled when checked)
4. Base branch selector
5. Draft checkbox

* All done! I've:

1. **Made `DEFAULT_PR_DESCRIPTION_PROMPT` public** in `pr.rs`

2. **Exported the constant to `shared/types.ts`** via `generate_types.rs`:
   - Imported the constant from the pr module
   - Added code to append `export const DEFAULT_PR_DESCRIPTION_PROMPT = \`...\`;` to the generated types

3. **Updated `GeneralSettings.tsx`** to import and use the constant directly as the placeholder

4. **Removed the duplicate `placeholder` key** from all i18n `settings.json` files (en, es, ja, ko, zh-Hans)

The default prompt is now defined in a single place (the Rust backend) and exported to TypeScript, eliminating duplication across all i18n files.

* Cleanup script changes for task attempt 46e66dfc-f608-47a4-baca-e38399d2da15

* Done! I've implemented the two-step UX for the custom prompt:

1. **Updated `GeneralSettings.tsx`**:
   - Replaced the always-visible textarea with a "Use custom prompt" checkbox
   - When checked, pre-fills the textarea with `DEFAULT_PR_DESCRIPTION_PROMPT`
   - When unchecked, sets `pr_auto_description_prompt` to `null` (reverts to default)
   - Textarea only visible when custom prompt is enabled

2. **Updated i18n files** (all 5 languages):
   - Replaced `label` with `useCustom` key
   - Updated `helper` text to remove "Leave empty to use the default" since that's now handled by the checkbox
   - Added translations:
     - **en**: "Use custom prompt"
     - **es**: "Usar prompt personalizado"
     - **ja**: "カスタムプロンプトを使用"
     - **ko**: "사용자 정의 프롬프트 사용"
     - **zh-Hans**: "使用自定义提示"

* Done! The custom prompt UX has been updated:

- **Textarea is now always visible** showing the current prompt (default or custom)
- **When "Use custom prompt" is unchecked**: textarea shows `DEFAULT_PR_DESCRIPTION_PROMPT` but is disabled/read-only with greyed-out styling
- **When "Use custom prompt" is checked**: textarea becomes editable, pre-filled with the default prompt for customization

This gives users visibility into what prompt will be used even when using the default, while still allowing them to customize it by checking the checkbox.

* Cleanup script changes for task attempt 46e66dfc-f608-47a4-baca-e38399d2da15

* Done! The fix has been applied. Now when the "Use custom prompt" checkbox is checked, users can:
- Clear all the text in the textarea to start from scratch
- The text no longer automatically reverts to the default prompt when emptied

---------

Co-authored-by: Gabriel Gordon-Hall <gabriel@bloop.ai>
2025-12-09 12:31:22 +00:00
Solomon
1ee05ea862 normalize cursor todo items (#1473) 2025-12-09 10:54:21 +00:00
Louis Knight-Webb
8846e6621c Improve reset dialog (vibe-kanban) (#1466)
* Excellent! All checks pass. Let me provide a summary of the changes made:

## Summary

I've successfully implemented all the requested changes to improve the Reset Dialog:

### 1. Safety Improvements
- **Default `worktreeResetOn` to `false`** (`RestoreLogsDialog.tsx:45`) - The "Reset worktree" toggle is now off by default, preventing accidental destructive actions.

- **Added `acknowledgeUncommitted` toggle** - When uncommitted changes are detected, a new amber-colored section appears with a toggle that users must enable before proceeding. This ensures users explicitly acknowledge that their uncommitted changes may be affected.

- **Updated `isConfirmDisabled` logic** (`RestoreLogsDialog.tsx:130-133`) - The confirm button is now disabled when there are uncommitted changes until the user toggles the acknowledgment.

### 2. i18n Migration
All hardcoded strings in the dialog have been migrated to use i18n with full support for 5 languages:
- English (`en/tasks.json`)
- Japanese (`ja/tasks.json`)
- Spanish (`es/tasks.json`)
- Korean (`ko/tasks.json`)
- Chinese Simplified (`zh-Hans/tasks.json`)

The translations include proper pluralization support using i18next's `_one`/`_other` suffixes for counts.

### Files Modified
- `frontend/src/components/dialogs/tasks/RestoreLogsDialog.tsx` - Main component changes
- `frontend/src/i18n/locales/en/tasks.json` - English translations
- `frontend/src/i18n/locales/ja/tasks.json` - Japanese translations
- `frontend/src/i18n/locales/es/tasks.json` - Spanish translations
- `frontend/src/i18n/locales/ko/tasks.json` - Korean translations
- `frontend/src/i18n/locales/zh-Hans/tasks.json` - Chinese translations

* Cleanup script changes for task attempt 0279d8b9-dcc8-4274-8da5-14b27672d604
2025-12-09 09:35:29 +00:00
Louis Knight-Webb
a82c7e37e7 GitHub comment dialog overflow issue (vibe-kanban) (#1465)
* All changes are complete and tests pass. Here's a summary of what was done:

## Summary

Fixed the GitHub Comments Dialog overflow issue with two files modified:

### 1. `frontend/src/components/ui/github-comment-card.tsx`
- Made the layout classes (`inline-block`, `align-bottom`, `max-w-md`) conditional
- They only apply when no custom layout className is provided (checked for `flex-`, `block`, or `w-` in className)
- This preserves the WYSIWYG editor behavior while allowing the dialog to override

### 2. `frontend/src/components/dialogs/tasks/GitHubCommentsDialog.tsx`
- Added `min-w-0` to the scrollable content container (line 108)
- Added `min-w-0` to each comment row flex container (line 145)
- Simplified the GitHubCommentCard className to `"flex-1 min-w-0"` (line 175)

The `min-w-0` classes are essential for proper flex containment - they override the default `min-width: auto` behavior that prevents flex items from shrinking below their content size.

Both TypeScript type checking and ESLint pass successfully.

* All changes are complete and tests pass. Here's a summary of what was fixed:

## Summary

**Root cause**: The Dialog component's API was being misused. Width classes (`max-w-2xl`) were being passed to `DialogContent` instead of `Dialog`. Since `DialogContent` is nested inside the Dialog's inner container (which has default `max-w-lg`), the width override was ineffective.

**Changes made**:

1. **`GitHubCommentsDialog.tsx`**: Moved sizing classes from `DialogContent` to `Dialog`:
   - `Dialog` now has `className="max-w-2xl p-0 max-h-[80vh] overflow-hidden"`
   - `DialogContent` now has `className="flex flex-col h-full"`

2. **`github-comment-card.tsx`**: Added `overflow-hidden` to the FullCard container so inner elements (DiffHunk `<pre>`) can scroll properly within the card boundaries.

The dialog should now:
- Be properly sized at `max-w-2xl` (672px) instead of being constrained to `max-w-lg` (512px)
- Properly contain content without horizontal overflow
- Allow diff hunks to scroll horizontally within the cards

* All changes are complete and tests pass. Summary of the fix for vertical scrolling:

1. **`dialog.tsx`**: Changed `grid` to `flex flex-col` in the Dialog inner container - this enables proper flex-based height constraints for child elements

2. **`GitHubCommentsDialog.tsx`**: Added `min-h-0` to the scrollable content div - this overrides the default `min-height: auto` which was preventing the flex item from shrinking below its content size

The dialog should now scroll vertically when there are many comments.

* All changes are complete and tests pass. Here's a summary of what was done:

**Changes to fix vertical scrolling:**

The dialog now follows the same pattern as `ViewProcessesDialog`:

1. **Dialog**: `className="max-w-2xl p-0 overflow-hidden"` - removed height constraints
2. **DialogContent**: `className="p-0"` - removed `h-full` and flex classes
3. **Added wrapper div**: `className="max-h-[70vh] flex flex-col min-h-0"` - explicit height constraint on inner wrapper
4. **Scrollable content**: `className="p-4 overflow-auto flex-1 min-h-0"` - scrolls within the constrained wrapper

The key insight was that putting the height constraint (`max-h-[70vh]`) on an **inner wrapper** rather than on the Dialog itself makes the flex-based scrolling work correctly. The header and footer remain outside this wrapper so they stay fixed.

* Cleanup script changes for task attempt a7065bc4-aa62-4dab-90c7-d15524acc50f

* Done! The hacky string matching has been replaced with an explicit `layout` prop:

**Changes:**

1. **`github-comment-card.tsx`**:
   - Added `layout?: 'inline' | 'block'` prop to `GitHubCommentCardProps`
   - Replaced the string matching logic with a simple `layout === 'inline'` check
   - Default is `'inline'` for backwards compatibility (WYSIWYG editor)

2. **`GitHubCommentsDialog.tsx`**:
   - Added `layout="block"` prop to `GitHubCommentCard`

The WYSIWYG editor (`github-comment-node.tsx`) doesn't need changes since it uses the default `layout="inline"`.

* Done! The hacky string matching has been replaced with an explicit `layout` prop:

**Summary of changes:**

1. **`github-comment-card.tsx`**:
   - Consolidated `variant` and `layout` into a single required `variant` prop
   - Three values: `'compact'` (inline chip), `'full'` (inline card with max-width), `'list'` (block card)
   - Removed the `layout` prop entirely
   - Made `variant` required (no default)

2. **`GitHubCommentsDialog.tsx`**:
   - Changed from `variant="full" layout="block"` to just `variant="list"`

3. **`github-comment-node.tsx`**:
   - Already had `variant="full"` explicitly set, no change needed
2025-12-08 17:34:12 +00:00