Commit Graph

717 Commits

Author SHA1 Message Date
Gabriel Gordon-Hall
c5554610a9 feat: Repo level management (#1828)
* move dev server scripts onto project repos

* wip: move scripts onto Repo structs

* wip: repo settings page

* i18n and fixes

* fix refresh

* i18n

* nits

* clickable repo cards

* view logs for all dev servers

* updates to workspaces

* Let's make some changes to the way applications are tested: (vibe-kanban 4592de6c)

- When the user starts a dev server, we should automatically open the `PreviewPanel.tsx`
- In the preview panel, if no dev server script is set for any of the repos in the workspace show a message along these lines:

Vibe Kanban can run dev servers to help you test your changes. You can set this up in the repo settings area. You can learn more about testing applications here: https://www.vibekanban.com/docs/core-features/testing-your-application

- We should also not show the `PreviewControlsContainer.tsx` if none of the repos have a dev server script

`vibe-kanban/frontend/src/components/panels/PreviewPanel.tsx`

`vibe-kanban/frontend/src/components/ui-new/actions/index.ts`

`vibe-kanban/frontend/src/components/ui-new/containers/PreviewControlsContainer.tsx`

---------

Co-authored-by: Louis Knight-Webb <louis@bloop.ai>
2026-01-11 08:03:19 +00:00
Louis Knight-Webb
4e20df9823 Improve executor profile selection with save-as-default toggle and variant ordering (Vibe Kanban) (#1912)
* All implementations are complete. Here's a summary of the changes:

## Summary of Changes

### 1. `frontend/src/utils/executor.ts`
- Added `areProfilesEqual()` function to compare two `ExecutorProfileId` objects, treating `null`/`undefined` variant as equivalent to `"DEFAULT"`
- Updated `getVariantOptions()` to sort variants with DEFAULT first, then alphabetically

### 2. `frontend/src/components/ui-new/containers/CreateChatBoxContainer.tsx`
- Added `saveAsDefault` state (default: `false`)
- Added `hasChangedFromDefault` memo to detect when user has changed from their saved default
- Added `useEffect` to reset toggle when profile matches default again
- Updated `handleExecutorChange` to:
  - Use saved variant when switching TO the user's default executor
  - Fall back to DEFAULT variant otherwise
- Updated `handleSubmit` to save profile as default when toggle is checked
- Added `saveAsDefault` prop to `CreateChatBox`

### 3. `frontend/src/components/ui-new/primitives/CreateChatBox.tsx`
- Added `SaveAsDefaultProps` interface
- Added `saveAsDefault` prop to `CreateChatBoxProps`
- Rendered checkbox toggle in `headerLeft` (after executor dropdown) when `saveAsDefault.visible` is true

### 4. `frontend/src/i18n/locales/en/tasks.json`
- Added `"saveAsDefault": "Save as default"` translation key under `conversation`

* Cleanup script changes for workspace 143d0206-8a21-454b-96ad-ce53cbcfc24a

* All translations have been added:

| Language | Translation |
|----------|-------------|
| English (en) | "Save as default" |
| Spanish (es) | "Guardar como predeterminado" |
| Japanese (ja) | "デフォルトとして保存" |
| Korean (ko) | "기본값으로 저장" |
| Simplified Chinese (zh-Hans) | "设为默认" |
| Traditional Chinese (zh-Hant) | "設為預設" |
2026-01-10 12:26:17 +00:00
Louis Knight-Webb
d3dc1439cc Add PostHog analytics event for new UI access (Vibe Kanban) (#1895)
* Done. I've added PostHog analytics tracking to `NewDesignScope.tsx` that fires a `ui_new_accessed` event once per session when users visit any `/workspaces` route.

The implementation:
- Fires the event only once per session (using a `useRef` that resets on page refresh)
- Respects the user's analytics opt-in/opt-out preferences (handled by PostHog SDK)
- Located in `NewDesignScope` which wraps all new UI routes

* Use sessionStorage for true once-per-session tracking

The useRef approach only prevented duplicates within a single mount
lifecycle. If the user navigated away from /workspaces and back, the
component would remount and the ref would reset, firing the event again.

sessionStorage persists for the entire browser tab lifetime, ensuring
the event fires exactly once per session.

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

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

* Revert to useRef for tracking

🤖 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-10 12:02:09 +00:00
Louis Knight-Webb
4120678cf7 Done. The fix adds two lines to the GitCreatePR action in actions/index.ts: (#1911)
1. Fetches the workspace repos via `attemptsApi.getRepos(workspaceId)`
2. Finds the specific repo and passes its `target_branch` to `CreatePRDialog.show()`

This matches the pattern already used by the `GitRebase` action in the same file. Now when you create a PR from the workspaces (ui-new) layout, the base branch will correctly default to the workspace's target branch instead of the main repo's currently checked-out branch.
2026-01-10 12:01:49 +00:00
Louis Knight-Webb
e2fad0e10c The TypeScript check passed with no errors. The debounce pattern from VirtualizedProcessLogs.tsx has been successfully rolled out to ConversationList.tsx. (#1909)
## Summary

Added 100ms debounce to `ConversationList.tsx` matching the pattern in `VirtualizedProcessLogs.tsx`:

1. **Added refs** (lines 94-99): `pendingUpdateRef` to store pending updates and `debounceTimeoutRef` to track the timeout
2. **Modified `onEntriesUpdated`** (lines 115-149): Now stores updates in the ref and debounces state updates with a 100ms delay
3. **Added cleanup effect** (lines 107-113): Clears any pending timeout on unmount to prevent memory leaks
2026-01-10 11:18:44 +00:00
Louis Knight-Webb
a92c35d42e The TypeScript check passed with no errors. (#1910)
## Summary

I've implemented the fix for showing the left sidebar when entering `WorkspacesLayout.tsx` when no changes/preview/logs panel is open:

**Changes made to `vibe-kanban/frontend/src/components/ui-new/containers/WorkspacesLayout.tsx`:**

1. Added `setSidebarVisible` to the destructured values from `useLayoutStore()` (line 161)

2. Added a new `useEffect` (lines 333-338) that shows the sidebar whenever no panel is open:
   ```typescript
   useEffect(() => {
     if (!isChangesMode && !isLogsMode && !isPreviewMode) {
       setSidebarVisible(true);
     }
   }, [isChangesMode, isLogsMode, isPreviewMode, setSidebarVisible]);
   ```

This ensures that when the component mounts or when all panels are closed, the sidebar will automatically become visible.
2026-01-10 11:17:44 +00:00
Louis Knight-Webb
5ee40bf322 Improve diff viewer color styling for better theme support (Vibe Kanban) (#1894)
* improve diff styles

* diffs

* review comment styles
2026-01-10 11:10:02 +00:00
GitHub Action
bd09ba8bd0 chore: bump version to 0.0.148 2026-01-09 18:36:00 +00:00
Solomon
a9bc5f23e7 fix: empty process list regression (#1896)
* fix: empty process list regression

* tyecheck fix
2026-01-09 18:34:31 +00:00
Louis Knight-Webb
9aef10a1bb Done. I added min-w-0 to the URL bar container on line 68. This allows the flex container to shrink below its content size, enabling the truncate class on the URL text to work properly and prevent overflow. (#1892) 2026-01-09 17:20:13 +00:00
Louis Knight-Webb
6e3421c820 Fix CommandBar input and navigation issues with state machine refactor (Vibe Kanban) (#1885)
* Done! I've removed all 7 `shortcut` properties from the action definitions in `index.ts`:

- `NewWorkspace`: removed `shortcut: 'N'`
- `Settings`: removed `shortcut: ','`
- `ToggleSidebar`: removed `shortcut: '['`
- `ToggleGitPanel`: removed `shortcut: ']'`
- `ToggleChangesMode`: removed `shortcut: 'C'`
- `ToggleLogsMode`: removed `shortcut: 'L'`
- `TogglePreviewMode`: removed `shortcut: 'P'`

The `ActionDefinition` type (and its base `ActionBase` interface) were left unchanged as requested.

* fix tailwind nto auto creating styles

* I've successfully completed all the changes. Here's a summary of what was done:

## Summary of Changes

### 1. `ActionExecutorContext` (index.ts)
- Made all properties non-optional
- Removed `gitRepoId` from context (now passed as action parameter)
- Properties now use `| null` for values that may not exist

### 2. New `GitActionDefinition` Type (index.ts)
- Added new action type with `requiresTarget: 'git'`
- Git actions now explicitly require `repoId` as a parameter

### 3. Git Actions Updated (index.ts)
- `GitCreatePR`, `GitMerge`, `GitRebase`, `GitChangeTarget` now use `requiresTarget: 'git'`
- Each action's `execute` function takes `repoId` as third parameter
- Simplified implementations (no more fallback repo fetching logic)

### 4. `ActionsContext` Provider (ActionsContext.tsx)
- Now calls `useDevServer()` to get dev server state
- Provides all required context properties
- `executeAction` handles three action types: global, workspace, and git
- Removed `contextOverride` pattern

### 5. `ContextBarContainer` (ContextBarContainer.tsx)
- Simplified significantly - no longer builds extended context
- Uses executor context directly from provider
- Removed `containerPath` prop

### 6. `ActionVisibilityContext` (index.ts + useActionVisibility.ts)
- Made `editorType`, `devServerState`, `runningDevServerId` required
- Visibility hook now provides all values from hooks

### 7. Updated Call Sites
- `WorkspacesLayout`: Git actions now pass `repoId` as third parameter
- `WorkspacesMain`: Removed `containerPath` prop from ContextBarContainer

* Cleanup script changes for workspace e961e311-6db4-41bf-83a1-ef8dd96eb497

* All changes are complete and type checks pass. Here's a summary of the changes made:

## Summary of Changes

### 1. `ActionExecutorContext` - Made all properties non-optional
- Removed `?` from all properties
- Removed `gitRepoId` (moved to per-action parameter)
- Changed nullable properties to use `| null` type

### 2. New `GitActionDefinition` type
- Added new action type with `requiresTarget: 'git'`
- Takes `repoId` as explicit third parameter

### 3. Git actions updated
- `GitCreatePR`, `GitMerge`, `GitRebase`, `GitChangeTarget` now use `requiresTarget: 'git'`
- Each action's `execute` receives `repoId` as parameter

### 4. `ActionsContext` provider centralized
- Now calls `useDevServer()` to provide dev server state
- Provides all required context properties from hooks
- `executeAction` handles three action types: global, workspace, git
- Removed `contextOverride` pattern

### 5. `ActionVisibilityContext` - Made dev server properties required
- `editorType`, `devServerState`, `runningDevServerId` now required
- `useActionVisibilityContext` hook provides all values

### 6. `ContextBarContainer` simplified
- Removed extended context creation
- Uses executor context directly from provider

### 7. Provider order fix
- Moved `ExecutionProcessesProvider` up to `NewDesignScope`
- Required because `useDevServer` depends on `ExecutionProcessesContext`

### Files Modified:
- `vibe-kanban/frontend/src/components/ui-new/actions/index.ts`
- `vibe-kanban/frontend/src/components/ui-new/actions/useActionVisibility.ts`
- `vibe-kanban/frontend/src/contexts/ActionsContext.tsx`
- `vibe-kanban/frontend/src/components/ui-new/containers/ContextBarContainer.tsx`
- `vibe-kanban/frontend/src/components/ui-new/containers/WorkspacesLayout.tsx`
- `vibe-kanban/frontend/src/components/ui-new/views/WorkspacesMain.tsx`
- `vibe-kanban/frontend/src/components/ui-new/scope/NewDesignScope.tsx`

* The implementation is complete. Let me summarize what was changed:

## Summary of Changes

### `pages.ts`
- Added `'selectRepo'` to `PageId` type for dynamic repo selection page
- Created `StaticPageId` type (excludes `selectRepo`) for static page records
- Added `RepoItem` interface for repo selection items
- Extended `ResolvedGroupItem` union type to include `{ type: 'repo'; repo: RepoItem }`
- Updated `Pages` record and `getPageActions` to use `StaticPageId`

### `CommandBarDialog.tsx`
- Added `repos` from `useWorkspaceContext()`
- Added `pendingGitAction` state to track git actions awaiting repo selection
- Reset `pendingGitAction` when dialog opens/closes
- Modified `getPageWithItems` to generate dynamic `selectRepo` page with repo list
- Updated `handleSelect` to:
  - Execute git actions immediately with single repo
  - Navigate to `selectRepo` page when multiple repos exist
  - Execute pending git action when user selects a repo
- Clear `pendingGitAction` when navigating back from `selectRepo` page

### `CommandBar.tsx`
- Added `FolderIcon` import
- Added rendering for `'repo'` item type with folder icon

## Behavior

1. **Single repo**: When user selects a git action (e.g., "Create Pull Request") and the workspace has only one git repo, the action executes immediately with that repo's ID.

2. **Multiple repos**: When workspace has multiple repos, selecting a git action navigates to a "Select Repository" page where the user can choose which repo to use, then the action executes with the selected repo.

3. **Back navigation**: Pressing back from the repo selection page clears the pending action and returns to the previous page.

* Done! The `CommandBarDialog` has been refactored to use a state machine pattern with `useReducer`. Here's a summary of the changes:

## Summary of Changes

**State Machine Types (lines 38-67):**
- `CommandBarState`: Discriminated union with `browsing` and `selectingRepo` states
- `CommandBarEvent`: `RESET`, `SEARCH_CHANGE`, `GO_BACK`, `SELECT_ITEM`
- `CommandBarEffect`: Side effects returned from reducer (`none` or `execute`)

**Reducer (lines 73-201):**
- Pure function returning `[newState, effect]` tuple
- Handles all state transitions based on current state and event
- Git action flow: single repo → execute, multiple repos → transition to `selectingRepo`

**Component Changes:**
- Replaced 4 `useState` calls with single `useReducer`
- `currentPage` is now derived from state (line 249-250)
- `handleSelect` computes effect from reducer, dispatches event, then handles effect (lines 456-475)
- `goBack` and `handleSearchChange` simply dispatch events (lines 446-453)

**Benefits:**
- All state transitions in one place (the reducer)
- State transitions are pure and testable
- Clear separation between state updates and side effects
- Impossible states are unrepresentable (e.g., can't have `pendingAction` while `browsing`)

* Done! Here's the final result:

## Summary

**Before:** 520 lines in 1 file (after initial state machine refactor)
**After:** 487 lines across 4 files

| File | Lines | Purpose |
|------|-------|---------|
| `CommandBarDialog.tsx` | 101 | Thin orchestration (down from 520) |
| `useCommandBarState.ts` | 177 | State machine hook |
| `useResolvedPage.ts` | 150 | Page building logic |
| `injectSearchMatches.ts` | 59 | DRY search helper |

**Key wins:**
- Main component: **520 → 101 lines** (80% reduction)
- Search injection code: **100 → 59 lines** (4× duplication eliminated)
- Each file has single responsibility
- State machine is testable in isolation
- Page building logic is reusable

* Cleanup script changes for workspace e961e311-6db4-41bf-83a1-ef8dd96eb497

* Done! Here are the final results:

## Final Summary

| File | Before | After | Reduction |
|------|--------|-------|-----------|
| `CommandBarDialog.tsx` | 101 | 106 | +5 (linter formatting) |
| `useCommandBarState.ts` | 177 | 95 | **-82 (46%)** |
| `useResolvedPage.ts` | 150 | 95 | **-55 (37%)** |
| `injectSearchMatches.ts` | 59 | 42 | **-17 (29%)** |
| **Total** | **487** | **338** | **-149 (31%)** |

**Original single file:** 398 lines
**Final 4 files:** 338 lines (15% less code overall)

Key wins:
- Main component is now just 106 lines of thin orchestration
- State machine is flattened (if statements instead of nested switch/case)
- Page resolution is simplified with reused types
- Search injection uses reduce() instead of for-loop
- All files pass type check

* Cleanup script changes for workspace e961e311-6db4-41bf-83a1-ef8dd96eb497

* I've fixed both issues with the CommandBar. Here's a summary of what was wrong and how I fixed it:

## Root Causes

### Issue 1: Nested `<Command>` Components
The `CommandDialog` component was wrapping children in a `<Command>` component, and `CommandBar` also rendered its own `<Command>`. This nested cmdk context caused conflicts with state management.

**Fix:** Removed the `<Command>` wrapper from `CommandDialog` in `Command.tsx:26-44`, and moved the styling classes to `CommandBar`'s `<Command>` component.

### Issue 2: Unstable `dispatch` Function Causing Infinite RESET Loop
In `useCommandBarState.ts`, the `dispatch` function had `[state, repoCount]` in its `useCallback` dependency array. This caused `dispatch` to be recreated on every state change.

In `CommandBarDialog.tsx`, the `useEffect` that resets state when the modal opens had `dispatch` in its dependency array:
```tsx
useEffect(() => {
  if (modal.visible) {
    dispatch({ type: 'RESET', page });
  }
}, [modal.visible, page, dispatch]); // dispatch changes → useEffect runs → RESET
```

This created an infinite loop:
1. User types → state updates → `dispatch` recreated
2. `dispatch` changed → `useEffect` runs → `RESET` dispatched
3. State resets to empty → repeat

**Fix:** Made `dispatch` stable by using refs instead of state in dependencies:
```tsx
const stateRef = useRef<CommandBarState>(browsing(initialPage));
const repoCountRef = useRef(repoCount);

const dispatch = useCallback(
  (event: CommandBarEvent): CommandBarEffect => {
    const [, effect] = reducer(stateRef.current, event, repoCountRef.current);
    rawDispatch(event);
    return effect;
  },
  [] // No dependencies - uses refs for current values
);
```

## Files Changed
1. `vibe-kanban/frontend/src/components/ui-new/primitives/Command.tsx` - Removed nested `<Command>` wrapper from `CommandDialog`
2. `vibe-kanban/frontend/src/components/ui-new/primitives/CommandBar.tsx` - Added styling classes that were on the removed wrapper
3. `vibe-kanban/frontend/src/components/ui-new/dialogs/commandBar/useCommandBarState.ts` - Made `dispatch` stable using refs
2026-01-09 16:25:42 +00:00
Alex Netsch
29595c1929 Add Azure DevOps repository support for PR operations (Vibe Kanban) (#1808)
* All tasks are complete. Let me summarize what was implemented:

I've successfully implemented Azure DevOps repos support alongside the existing GitHub integration. Here's what was done:

- **`mod.rs`** - Defines the `GitHostService` trait and factory functions for creating services
- **`types.rs`** - Unified types: `GitHostProvider`, `RepoInfo`, `GitHostError`, `CreatePrRequest`, `UnifiedPrComment`
- **`detection.rs`** - URL pattern matching for auto-detecting GitHub (including Enterprise) and Azure DevOps
- **`github/mod.rs`** - `GitHubHostService` implementing the trait
- **`github/cli.rs`** - `GhCli` wrapper (moved from old location)
- **`azure/mod.rs`** - `AzureHostService` implementing the trait
- **`azure/cli.rs`** - `AzCli` wrapper for Azure DevOps CLI commands

1. **Auto-detection**: The system detects the provider from the git remote URL:
   - `github.com` → GitHub
   - `github.*.com` → GitHub Enterprise
   - `dev.azure.com`, `*.visualstudio.com`, or URLs with `/_git/` → Azure DevOps

2. **Unified trait interface**: Both providers implement `GitHostService` with methods for:
   - `get_repo_info()` - Get repository identification
   - `check_auth()` - Verify CLI authentication
   - `create_pr()` - Create pull requests
   - `get_pr_status()` - Get PR status by URL
   - `list_prs_for_branch()` - List PRs for a branch
   - `get_pr_comments()` - Get PR comments

3. **Azure CLI commands supported**:
   - `az repos pr create` - Create PRs
   - `az repos pr show` - View PR details
   - `az repos pr list` - List PRs
   - `az repos pr list-threads` - Get PR comments
   - `az account show` - Auth check

- `pr.rs` - Uses auto-detection for PR creation
- `pr_monitor.rs` - Uses provider detection from PR URL
- `task_attempts.rs` - Uses git_host for push auth checking
- `error.rs` - Updated `GitHost` error variant
- `share.rs` - Updated `GitHost` error variant
- `generate_types.rs` - Updated type exports

- Old `crates/services/src/services/github.rs` module and directory (replaced by git_host)

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

All tests pass, including the new URL decoding tests. The fix is complete - the URL-encoded components (like `Vibe%20Kanban%20Test`) will now be properly decoded to `Vibe Kanban Test` before being passed to the Azure CLI.

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

All done! Here's a summary of the changes:

Updated `get_repo_info()` to use the Azure CLI's `az repos show --detect true` command instead of manual URL parsing, similar to how GitHub uses `gh repo view --json owner,name`.

1. **Added `extract_repo_name_from_url()`** - A simple helper that extracts just the repository name from Azure DevOps URLs (looks for `/_git/{repo}` pattern). This is still needed because `az repos show` requires the `--repository` parameter.

2. **Updated `get_repo_info()`** - Now uses `az repos show --repository {name} --detect true --output json` which:
   - Auto-detects organization and project from git config
   - Returns canonical names (properly decoded)
   - Validates the repo exists

3. **Added `extract_org_from_response()`** - Extracts the organization from the `remoteUrl` field in the CLI response, with fallback to URL parsing.

4. **Fixed `run()` method** - Now properly passes the `dir` parameter to `Command::current_dir()` so the `--detect` flag works correctly.

5. **Kept `parse_azure_remote_url()`** - Still used as a fallback for organization extraction and for PR URL parsing.

6. **Added tests** - New tests for `extract_repo_name_from_url()` covering various URL formats.

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

Done! The cleanup is complete. Here's what was removed:

Removed the brittle `parse_azure_remote_url()` function and related code:

1. **Removed `AzureRepoInfo` struct** - No longer needed
2. **Removed `parse_azure_remote_url()` function** - The ~90-line function that manually parsed various Azure DevOps URL formats
3. **Updated `get_repo_info()`** - Changed from fallback (`unwrap_or_else`) to error (`ok_or_else`) when organization can't be extracted from the CLI response
4. **Removed 4 tests** - `test_parse_azure_remote_url_https`, `test_parse_azure_remote_url_visualstudio`, `test_parse_azure_remote_url_ssh`, `test_parse_azure_remote_url_with_spaces`

The code now relies entirely on:
- `extract_repo_name_from_url()` - Simple helper to get repo name from URL (for passing to `az repos show`)
- `az repos show --detect true` - Azure CLI command that auto-detects org/project from git config
- `extract_org_from_response()` - Extracts org from the CLI's `remoteUrl` JSON field

The implementation is complete. Here's a summary of the changes:

Simplified the Azure DevOps integration by using the CLI's `--detect` flag instead of parsing URLs to extract org/project/repo.

1. **`types.rs`** - Changed `RepoInfo::AzureDevOps` to store just `repo_path: PathBuf` instead of `organization`, `project`, and `repo_name`. Removed the unused `repo_name()` method.

2. **`cli.rs`** - Major simplification:
   - Removed URL parsing helpers: `decode_url_component()`, `extract_repo_name_from_url()`, `extract_org_from_response()`
   - `get_repo_info()` now just verifies it's a valid Azure repo via `az repos show --detect true` and returns the path
   - `create_pr()` now takes `repo_path` and uses `--detect true` instead of explicit org/project/repo
   - `list_prs_for_branch()` now takes `repo_path` and uses `--detect true`
   - `get_pr_threads()` now takes `repo_path` and uses `--detect true`
   - `view_pr()` now takes the full PR URL and parses org + PR ID internally
   - `parse_pr_url()` simplified to return just `(org, pr_id)` instead of 4 values
   - Parsing functions simplified to extract URLs from response's `repository.webUrl` field
   - Updated tests for the new API

3. **`mod.rs`** - Updated `AzureHostService` to:
   - Extract `repo_path` from `RepoInfo::AzureDevOps`
   - Pass `repo_path` to CLI methods that need it
   - Pass the PR URL directly to `view_pr()` for `get_pr_status()`

- URL parsing reduced to minimal extraction of org + PR ID from PR URLs (only needed for `get_pr_status()`)
- Repo-based operations don't parse URLs at all - CLI auto-detects via git config
- Much cleaner, less brittle code

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

All done. The implementation is complete:

**Summary of changes:**

1. **`types.rs`**: Updated `RepoInfo::AzureDevOps` to store `organization_url`, `project`, `repo_name` instead of `repo_path`

2. **`cli.rs`**:
   - `get_repo_info()` now parses the JSON response from `az repos show --detect true` to extract repo name, project name, and organization URL
   - Added `extract_org_url()` helper to extract the base org URL from the API URL
   - Updated `create_pr()`, `list_prs_for_branch()`, `get_pr_threads()` to take explicit `organization_url`, `project`, `repo_name` params

3. **`mod.rs`** (`AzureHostService`):
   - `create_pr()`, `list_prs_for_branch()`, `get_pr_comments()` all now extract org/project/repo from `RepoInfo` and pass them to the CLI methods

The key insight was that the `url` field from `az repos show` (e.g., `https://dev.azure.com/{org}/.../_apis/...`) can be truncated to `https://dev.azure.com/{org}` and used directly with the `--organization` flag — minimal URL parsing needed.

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

* Done. Refactored all 4 `serde_json::Value` parsing sites to use typed structs:

**Changes to `cli.rs`:**

1. **Added typed response structs** with `#[derive(Deserialize)]`:
   - `AzRepoShowResponse`, `AzProject` - for `az repos show`
   - `AzPrResponse`, `AzRepository`, `AzCommit` - for PR responses
   - `AzThread`, `AzThreadContext`, `AzFilePosition`, `AzThreadComment`, `AzAuthor` - for thread comments

2. **Updated parsing functions**:
   - `get_repo_info()` - now deserializes into `AzRepoShowResponse`
   - `parse_pr_response()` - now deserializes into `AzPrResponse`
   - `parse_pr_list_response()` - now deserializes into `Vec<AzPrResponse>`
   - `parse_pr_threads()` - now deserializes into `Vec<AzThread>`

3. **Replaced `extract_pr_info()`** with `az_pr_to_info()` that takes the typed struct directly

4. **Removed `serde_json::Value` import** - no longer needed

The code is now cleaner with no `.get().and_then().as_str()` chains, and serde provides better error messages on parse failures.

* Done. Added the missing `--repository` parameter to `get_pr_threads()`:

1. **`cli.rs`**: Added `repo_name: &str` parameter and `--repository` flag to the CLI command
2. **`mod.rs`**: Updated `get_pr_comments()` to extract both `organization_url` and `repo_name` from `RepoInfo` and pass them to the CLI

Done. Here's a summary of the changes:

**Changes made to `crates/services/src/services/git_host/azure/cli.rs`:**

1. **Removed git2 dependency** - No longer imports `git2::Repository`

2. **Added new typed structs** for `az repos list` response:
   - `AzRepoListItem` - with `name`, `project`, and `remote_url` fields
   - `AzRepoProject` - with `name` field

3. **Rewrote `get_repo_info()`** to use `az repos list --detect true`:
   - Runs CLI command from the repo directory to auto-detect org/project
   - Takes the first repo from the list (assuming single repo per directory)
   - Extracts org from `remoteUrl` field

4. **Replaced `parse_azure_remote_url()`** with simpler `extract_org_from_remote_url()`:
   - Only extracts the organization name from the URL
   - Handles both `dev.azure.com` and `visualstudio.com` formats
   - Much simpler than the previous 3-tuple URL parser

5. **Updated tests** - Replaced the old URL parsing tests with new `extract_org_from_remote_url` tests

The key improvement is that `az repos list --detect true` uses the Azure CLI's built-in detection (from git config) to find the org and project, then returns all repo info including project name. This avoids git2 library usage and complex URL parsing entirely.

Done. Here's a summary of all changes:

**Summary of Changes**

1. **`crates/services/src/services/git_host/types.rs`**:
   - Added `project_id` and `repo_id` fields to `RepoInfo::AzureDevOps` enum variant

2. **`crates/services/src/services/git_host/azure/cli.rs`**:
   - Added `id` field to `AzRepoListItem` struct
   - Added `id` field to `AzRepoProject` struct
   - Added `AzThreadsResponse` struct to wrap the `{ "value": [...] }` REST API response
   - Updated `get_repo_info()` to return `project_id` and `repo_id` from `az repos list` output
   - Updated `get_pr_threads()` to:
     - Accept `project_id` and `repo_id` instead of names
     - Use `az rest` with REST API URL instead of non-existent `az repos pr list-threads`
   - Updated `parse_pr_threads()` to unwrap the `value` field from REST API response

3. **`crates/services/src/services/git_host/azure/mod.rs`**:
   - Updated `create_pr` and `list_prs_for_branch` to use `..` pattern for new fields
   - Updated `get_pr_comments()` to extract and pass `project_id` and `repo_id` to CLI

**Key Improvements**:
- Uses UUIDs (`project_id`, `repo_id`) instead of names for REST API calls, avoiding URL encoding issues with names containing spaces like "Vibe Kanban Test"
- Fixed `get_pr_threads()` to use `az rest` since `az repos pr list-threads` doesn't exist as an Azure CLI command
- All unit tests pass

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

Done. The fix adds `--resource 499b84ac-1321-427f-aa17-267ca6975798` to the `az rest` command, which tells it to request an Azure DevOps token instead of a generic Azure token. This should now properly authenticate to the Azure DevOps REST API.

Done. The fix replaces `az rest` with `az devops invoke --area git --resource pullRequestThreads`. This uses the same authentication as other `az repos pr` commands, so it should work without requiring the separate "identity materialization" step.

Done. The fix replaces the single combined string for `--route-parameters` with individual arguments for each `key=value` pair. This matches how the Azure CLI expects the parameters to be passed - each route parameter should be a separate shell argument after the `--route-parameters` flag.

Done. Removed all the requested comments from:
- `crates/server/src/routes/task_attempts.rs` (lines 451, 490)
- `crates/server/src/routes/task_attempts/pr.rs` (lines 283, 516)
- `crates/services/src/services/git_host/azure/cli.rs` (section header comment, doc comments on structs and methods)

* Done. Removed the module-level doc comment and all the method doc comments from the `GitHostService` trait and public functions in `mod.rs`.

Done. Removed the obvious/redundant comments from `types.rs`.

Done. Removed the unnecessary `Arc` usage from all three functions in `mod.rs`. The strings are already cloned when extracted from `RepoInfo`, so we can just clone them directly in the retry closure.

* All tests pass. Fixed the `npm run check` and `npm run lint` issues by:

1. Regenerated TypeScript types from Rust
2. Updated `frontend/src/lib/api.ts` to use `CreatePrApiRequest` instead of `CreateGitHubPrRequest`
3. Updated `CreatePRDialog.tsx` to handle the new error types (`cli_not_installed`/`cli_not_logged_in` with a `provider` field instead of `github_cli_not_installed`/`github_cli_not_logged_in`)
4. Fixed clippy warnings about collapsible if statements in `parse_pr_url()`

* Done. I've made `url`, `diff_hunk`, and `author_association` optional in the `UnifiedPrComment` type:

**Changes made:**

1. **`crates/services/src/services/git_host/types.rs`** - Changed the `UnifiedPrComment` enum:
   - `url: String` → `url: Option<String>`
   - `diff_hunk: String` → `diff_hunk: Option<String>`
   - `author_association: String` → `author_association: Option<String>`

2. **`crates/services/src/services/git_host/azure/cli.rs`** - Updated Azure comment creation to use `None` instead of empty strings

3. **`crates/services/src/services/git_host/github/mod.rs`** - Wrapped GitHub values in `Some()`

4. **`frontend/src/components/ui/github-comment-card.tsx`** - Updated interface to allow `url?: string | null` and `diffHunk?: string | null`

5. **`frontend/src/components/ui/wysiwyg/nodes/github-comment-node.tsx`**:
   - Updated `NormalizedComment` interface
   - Fixed click handler to check `if (data.url)` before opening
   - Removed `data.url` from validation (only `id`, `comment_type`, `author`, `body` required)

All checks pass (`pnpm run check`, `pnpm run lint`, `cargo test --workspace`).

* Done. All three changes are complete:

1. **Removed unnecessary temp file** in `azure/cli.rs:create_pr()` - was writing body to temp file then immediately reading it back. Now just passes `body` directly to `OsString`.

2. **Added structs for JSON parsing** in `github/cli.rs:parse_pr_comments()` - replaced manual `item.get("field")...` parsing with `GhCommentsWrapper` and `GhCommentResponse` structs using serde.

3. **Added structs for JSON parsing** in `github/cli.rs:parse_pr_review_comments()` - replaced manual parsing with `GhReviewCommentResponse` struct.

All checks pass (`pnpm run check`, `pnpm run lint`, `cargo test --workspace`).

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

Done. Both changes are complete:

1. **Inlined single-field structs** - Consolidated `GhCommentAuthor` and `GhReviewCommentUser` into a single `GhUserLogin` struct that's reused by both `GhCommentResponse` and `GhReviewCommentResponse`.

2. **Converted `extract_pr_info` to struct parsing** - Added `GhPrResponse` and `GhMergeCommit` structs. Replaced the manual `Value::get()` parsing with serde deserialization. The new `pr_response_to_info()` helper converts the parsed struct to `PullRequestInfo`. Also removed the now-unused `serde_json::Value` import.

All checks pass (`pnpm run check`, `pnpm run lint`, `cargo test --workspace`).

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

* Done. I've updated `detection.rs` to use `GitCli` instead of `git2`:

1. **Added `get_remote_url` method to `GitCli`** (`git/cli.rs`) - Uses `git remote get-url <remote>` to get the URL
2. **Updated `detect_provider`** (`git_host/detection.rs`) - Now uses `GitCli::get_remote_url()` instead of `git2::Repository`

This keeps the codebase consistent with the pattern of using `GitCli` for git operations rather than mixing `git2` directly in various modules.

All checks pass (`pnpm run check`, `pnpm run lint`, `cargo test --workspace`).

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

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

**New Architecture:**

1. **`ProviderKind` enum** (was `GitHostProvider`) - The discriminant for provider types (GitHub, AzureDevOps, Unknown)

2. **`GitHostProvider` trait** (was `GitHostService`) - The interface that provider implementations must satisfy

3. **`GitHubProvider` struct** (was `GitHubHostService`) - GitHub implementation

4. **`AzureDevOpsProvider` struct** (was `AzureHostService`) - Azure DevOps implementation

5. **`GitHostService` struct** (new) - Main entry point that:
   - Holds repo context (`repo_path`, `GitCli`)
   - Provides `provider_for_remote(remote_name)` to get a provider for a specific remote
   - Provides `provider_from_url(url)` for URL-based detection (e.g., PR URLs)
   - Provides `provider_for_kind(kind)` for direct provider construction

**Benefits:**
- Provider detection is now contextual - callers specify which remote they want
- The service struct encapsulates provider detection logic
- Cleaner separation: `GitHostService` is the facade, `GitHostProvider` trait is the contract
- Ready for multi-remote support (different providers for different remotes)

All checks pass (`pnpm run check`, `pnpm run lint`, `cargo test --workspace`).

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

All the call sites have been updated to use the new cleaner `GitHostService` facade API. Here's a summary of the changes:

**Changes made:**

1. **`pr.rs:414-418` (`attach_existing_pr`)**: Simplified from:
   ```rust
   let git_host = git_host::GitHostService::new(&repo.path);
   let git_host_provider = git_host.provider_for_remote("origin")?;
   let repo_info = git_host_provider.get_repo_info(&repo.path).await?;
   let prs = git_host_provider.list_prs_for_branch(&repo_info, &workspace.branch).await?;
   ```
   To:
   ```rust
   let git_host = git_host::GitHostService::new(&repo.path);
   let prs = git_host.list_prs_for_branch(&workspace.branch).await?;
   ```

2. **`pr.rs:511-525` (`get_pr_comments`)**: Simplified from provider-based pattern to:
   ```rust
   let git_host = git_host::GitHostService::new(&repo.path);
   let provider = git_host.provider_kind()?;
   match git_host.get_pr_comments(pr_info.number).await { ... }
   ```

3. **`task_attempts.rs:451-453` (`push_task_attempt_branch`)**: Removed explicit `check_auth()` call since auth is now checked during the actual operation. Just verify provider is supported:
   ```rust
   let git_host = git_host::GitHostService::new(&worktree_path);
   git_host.provider_kind()?;
   ```

4. **`task_attempts.rs:490-492` (`force_push_task_attempt_branch`)**: Same simplification.

The new API is much cleaner - call sites just create a `GitHostService::new(path)` and call methods directly without dealing with providers, repo info, or explicit auth checks.

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

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

**Changes made:**

1. **`crates/services/Cargo.toml`** - Added `enum_dispatch` dependency

2. **`crates/services/src/services/git_host/mod.rs`** - Completely rewritten:
   - `GitHostProvider` is now a public trait with `#[enum_dispatch(GitHostService)]`
   - `GitHostService` is now an enum with `GitHub` and `AzureDevOps` variants
   - Constructors: `from_pr_url(url)` and `from_remote_url(url)` - no `new()` method
   - Methods now take `repo_path` as a parameter where needed

3. **`crates/services/src/services/git_host/github/mod.rs`** - Updated to match new trait signature (methods take `repo_path`, `check_auth` called inside `create_pr`)

4. **`crates/services/src/services/git_host/azure/mod.rs`** - Updated similarly

5. **`crates/services/src/services/git.rs`** - Added `get_remote_url()` method to `GitService`

6. **Call site updates:**
   - `pr_monitor.rs` - Uses `from_pr_url`
   - `pr.rs` - Uses `get_remote_name_from_branch_name` + `get_remote_url` + `from_remote_url`
   - `task_attempts.rs` - Same pattern for push functions

**New API usage:**
```rust
// From a PR URL (e.g., for checking PR status)
let git_host = GitHostService::from_pr_url(&pr_url)?;
let status = git_host.get_pr_status(&pr_url).await?;

// From a remote URL (e.g., for creating PRs)
let remote_name = git_service.get_remote_name_from_branch_name(&repo_path, &branch)?;
let remote_url = git_service.get_remote_url(&repo_path, &remote_name)?;
let git_host = GitHostService::from_remote_url(&remote_url)?;
let pr_info = git_host.create_pr(&repo_path, &pr_request).await?;

// Get provider kind (infallible since already constructed)
let provider = git_host.provider_kind();
```

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

All cleaned up. Here's the final architecture:

**`git_host/mod.rs`:**
```rust
pub trait GitHostProvider: Send + Sync {
    async fn create_pr(&self, repo_path: &Path, request: &CreatePrRequest) -> Result<PullRequestInfo, GitHostError>;
    async fn get_pr_status(&self, pr_url: &str) -> Result<PullRequestInfo, GitHostError>;
    async fn list_prs_for_branch(&self, repo_path: &Path, branch_name: &str) -> Result<Vec<PullRequestInfo>, GitHostError>;
    async fn get_pr_comments(&self, repo_path: &Path, pr_number: i64) -> Result<Vec<UnifiedPrComment>, GitHostError>;
    fn provider_kind(&self) -> ProviderKind;
}

pub enum GitHostService {
    GitHub(GitHubProvider),
    AzureDevOps(AzureDevOpsProvider),
}

impl GitHostService {
    pub fn from_url(url: &str) -> Result<Self, GitHostError>
}
```

**Changes made:**
1. Removed `check_auth` and `get_repo_info` from the public trait - they're now private methods on each provider
2. Consolidated `from_pr_url` and `from_remote_url` into a single `from_url` constructor
3. The trait now has exactly 5 methods - the minimal public API needed by call sites

**Call site usage is clean:**
```rust
// From any URL (PR URL or remote URL)
let git_host = GitHostService::from_url(&url)?;

// Use the trait methods
let pr_info = git_host.create_pr(&repo_path, &request).await?;
let status = git_host.get_pr_status(&pr_url).await?;
let prs = git_host.list_prs_for_branch(&repo_path, &branch).await?;
let comments = git_host.get_pr_comments(&repo_path, pr_number).await?;
let kind = git_host.provider_kind();
```

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

Done. The refactoring is complete:

1. **Created `GitHubRepoInfo`** in `git_host/github/cli.rs` - a simple struct with `owner` and `repo_name`
2. **Created `AzureRepoInfo`** in `git_host/azure/cli.rs` - a struct with `organization_url`, `project`, `project_id`, `repo_name`, `repo_id`
3. **Updated both providers** to use their respective provider-specific structs directly, removing all the match arms and error cases for "wrong variant" that could never happen
4. **Removed the shared `RepoInfo` enum** from `types.rs` and the public exports

The code is cleaner now - each provider has its own internal representation of repo info, and there's no shared enum that requires impossible error handling paths.

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

The fix compiles. The issue was that `get_remote_name_from_branch_name` was calling `get_remote_from_branch_ref` which uses `repo.branch_remote_name()` - this git2 function requires the branch to have upstream tracking configured. For local branches that haven't been pushed yet (or don't have tracking set), this fails with the error you saw.

The fix changes the behavior to fall back to the default remote (typically "origin") when the branch doesn't have upstream tracking configured. This makes sense because:

1. Most repos only have one remote anyway
2. When creating a PR for a local branch, we need to push to *some* remote - the default is the sensible choice
3. The original code computed `default_remote` but never actually used it as a fallback

Done. Added `get_remote_url_from_branch_or_default` to `GitService` and updated all 4 call sites. The pattern is now:

```rust
let remote_url = deployment
    .git()
    .get_remote_url_from_branch_or_default(&repo_path, &branch)?;
let git_host = git_host::GitHostService::from_url(&remote_url)?;
```

Two lines instead of four, and the function name makes the fallback behavior explicit.

Done. Removed the unnecessary provider detection checks from both `push_task_attempt_branch` and `force_push_task_attempt_branch`. The push operations now just push directly - git push works with any remote regardless of whether we support it as a PR provider. Auth errors from git push itself (SSH keys, HTTPS credentials) still come through `GitServiceError::GitCLI(...)` and propagate to the frontend the same way.

* All done. Removed the low-value comments:
- "Create git host from the PR URL"
- "Fetch comments"
- "Get the URL for a remote (e.g., "origin")."
- "Azure DevOps-specific repository information"
- "GitHub-specific repository information"
- "Get the remote URL for the branch to detect the provider" (2 places)
- "Get repository info from the GitHub CLI"
- "Get repository info from the Azure CLI"
- "Check authentication status" (2 places)

Kept comments that provide actual value like the fallback behavior explanation on `get_remote_url_from_branch_or_default`.

All done. Removed the low-value comments:
- "Create git host from the PR URL"
- "Fetch comments"
- "Get the URL for a remote (e.g., "origin")."
- "Azure DevOps-specific repository information"
- "GitHub-specific repository information"
- "Get the remote URL for the branch to detect the provider" (2 places)
- "Get repository info from the GitHub CLI"
- "Get repository info from the Azure CLI"
- "Check authentication status" (2 places)
- "Get PR status from URL (auto-detects provider)"
- "High-level errors originating from the Azure CLI."
- "High-level errors originating from the GitHub CLI."
- "Azure DevOps hosting provider implementation"
- "GitHub hosting provider implementation"
- "Newtype wrapper for invoking the `gh` command."
- "Newtype wrapper for invoking the `az` command."
- "Trait for git hosting provider operations (GitHub, Azure DevOps, etc.)"
- All the trait method doc comments (Create a pull request, Get PR status, etc.)
- "Git hosting service - dispatches to the appropriate provider."
- "Create a GitHostService by detecting the provider from a URL."
- Simplified the Azure DevOps pattern comments in detection.rs

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

**Problem**: `get_repo_info` used `az repos list --detect true` which returns ALL repos in the Azure DevOps project, then just took the first one. This was wrong for multi-repo projects.

**Solution**:
1. `AzureDevOpsProvider` now stores the remote URL passed to `from_url()`
2. `get_repo_info` now takes the remote URL and filters the repo list to find the matching repo using `remote_urls_match()`
3. Added `remote_urls_match()` helper that normalizes URLs (lowercase, strips trailing `/` and `.git`) for comparison
4. Added `extract_organization_url()` to get the Azure organization URL from a remote URL (supports both `dev.azure.com` and legacy `visualstudio.com` formats)
5. Removed the now-unused `extract_org_from_remote_url()` function

The flow is now:
- Call site gets remote URL via `get_remote_url_from_branch_or_default()`
- Creates `GitHostService::from_url(&remote_url)` which stores the URL on `AzureDevOpsProvider`
- When `get_repo_info` is called, it lists all repos in the project and finds the one matching the stored remote URL

Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

* Done. Summary of changes:

1. **`pr.rs:get_pr_comments`** - Now gets the remote URL from `workspace_repo.target_branch` instead of using the PR URL to create the `GitHostService`

2. **`azure/cli.rs`**:
   - Added `ssh_url` field to `AzRepoListItem`
   - Updated `get_repo_info` to detect if the input URL is SSH (`starts_with("git@")`) and compare against the appropriate field (`ssh_url` vs `remote_url`)
   - Renamed `remote_urls_match` to `urls_match` since it now handles both HTTPS and SSH URLs
   - Added SSH URL test case

* Build passes. The simple fix handles both SSH formats without adding a dependency.

* Build passes. Now `ssh_url` is optional - if it's not in the response and the user has an SSH remote configured, they'll get a clear error message ("No repo found matching remote URL: ...").

* Done. The `urls_match` function now normalizes `ssh://` prefix to scp-style before comparing.

* Done. Summary of changes:

1. **Removed `remote_url` field from `AzureDevOpsProvider`** - no longer stored on the struct

2. **Updated `GitHostProvider` trait** - added `remote_url: &str` parameter to:
   - `create_pr`
   - `list_prs_for_branch`
   - `get_pr_comments`

3. **Updated `AzureDevOpsProvider`** - methods now accept `remote_url` and pass it to `get_repo_info`

4. **Updated `GitHubProvider`** - methods accept `_remote_url` (unused, since gh CLI auto-detects)

5. **Updated call sites in `pr.rs`** - all three methods now pass `remote_url`:
   - `create_pr` passes `&remote_url`
   - `list_prs_for_branch` passes `&remote_url`
   - `get_pr_comments` passes `&remote_url`

6. **Fixed `attach_existing_pr`** - now uses `workspace_repo.target_branch` instead of `workspace.branch` when getting the remote URL (consistent with other call sites)

* Cleanup script changes for workspace 28eb9564-f95a-42e0-8cf2-5228c2ffc0bf

* Update frontend remote copy (vibe-kanban a7bf13b6)

We added azure support but in the frontend many things have github specific wording. Please fix!

* Done. I've addressed the PR comment by:

1. **Renamed `CreatePrError` to `PrError`** - A more generic name that works for both `create_pr` and `attach_existing_pr`

2. **Updated `attach_existing_pr`** to mirror the error handling from `create_pr`:
   - Changed return type from `ApiResponse<AttachPrResponse>` to `ApiResponse<AttachPrResponse, PrError>`
   - Added error handling for `GitHostService::from_url()` - handles `UnsupportedProvider` and `CliNotInstalled`
   - Added error handling for `list_prs_for_branch()` - handles `CliNotInstalled` and `AuthFailed`

3. **Updated `generate_types.rs`** to use the renamed `PrError`

4. **Updated `frontend/src/lib/api.ts`** to use `PrError` instead of `CreatePrError`

5. **Regenerated TypeScript types** and verified all checks pass
2026-01-09 15:50:34 +00:00
GitHub Action
3ad03a0a99 chore: bump version to 0.0.147 2026-01-09 14:46:16 +00:00
Alex Netsch
e73c1b4bff All done. Here's a summary of the fix: (#1875)
## Summary

Fixed PR comment labels showing raw translation keys instead of translated text.

**Problem:** The `CommentWidgetLine.tsx` and `ReviewCommentRenderer.tsx` components were using translation keys that didn't exist in the translation files:
- `comments.addReviewComment`
- `comments.addPlaceholder`
- `comments.editPlaceholder`
- `actions.cancel`
- `actions.saveChanges`
- `actions.copied`

**Solution:** Added the missing translation keys to `common.json` in all 6 locales:
- English (en)
- Spanish (es)
- Japanese (ja)
- Korean (ko)
- Simplified Chinese (zh-Hans)
- Traditional Chinese (zh-Hant)

**Verification:**
-  `pnpm run check` passes (TypeScript and Rust checks)
-  i18n check script confirms translation keys are consistent across all locales
-  No duplicate JSON keys
2026-01-09 12:32:50 +00:00
Louis Knight-Webb
06862ab010 Fix GitHub PR button display and refactor RepoCard styling (Vibe Kanban) (#1872)
* Both issues have been fixed:

**1. Fixed translation parameter mismatch** (`RepoCard.tsx:170, 176`)
- Changed `{ prNumber }` to `{ number: prNumber }` to match the translation key `Open PR #{{number}}`

**2. Refactored PR badge styling** (`RepoCard.tsx:156-180`)
- Replaced hardcoded Tailwind colors with design system tokens:
  - Merged badge: `bg-panel text-success` (uses semantic success color)
  - Open PR button/badge: `bg-panel text-normal hover:bg-tertiary transition-colors`
- Updated spacing to use consistent tokens: `gap-half`, `px-base`, `py-half`
- Changed border radius from `rounded-full` to `rounded-sm` to match other UI elements in the panel

* Both fixes are complete:

1. **Added spacing** - Added `mt-half` to the PR status row container (line 158) to create visual separation from the Actions row below

2. **Made merged PRs clickable** - When `prStatus === 'merged'` and `prUrl` is available, it now renders a clickable `<button>` with:
   - The external link icon (`ArrowSquareOutIcon`)
   - Hover state (`hover:bg-tertiary`)
   - Same transition effect as the open PR button

* improve styles
2026-01-09 09:59:54 +00:00
Louis Knight-Webb
af70dd9239 The implementation is complete. Here's a summary of the changes made: (#1871)
## Summary

I've implemented the GitHub PR status display on `WorkspaceSummary.tsx`. The changes include:

### Backend Changes

1. **`crates/db/src/models/merge.rs`** - Added a new method `get_latest_pr_status_for_workspaces()` that efficiently queries the latest PR status for all workspaces grouped by archived status.

2. **`crates/server/src/routes/task_attempts/workspace_summary.rs`** - Added `pr_status: Option<MergeStatus>` field to the `WorkspaceSummary` struct and included the PR status query in the summary endpoint.

### Frontend Changes

3. **`frontend/src/components/ui-new/hooks/useWorkspaces.ts`** - Added `prStatus` to the `SidebarWorkspace` interface and mapped it in `toSidebarWorkspace()`.

4. **`frontend/src/components/ui-new/primitives/WorkspaceSummary.tsx`** - Added:
   - Import for `GitPullRequestIcon`
   - `prStatus` prop to the component
   - Display logic showing:
     - **PR open**: `GitPullRequestIcon` with `text-brand` (orange) color
     - **PR merged**: `GitPullRequestIcon` with `text-success` (green) color
     - **No PR/closed/unknown**: No icon displayed

5. **`frontend/src/components/ui-new/views/WorkspacesSidebar.tsx`** - Passed the `prStatus` prop to both active and archived workspace summaries.

### Generated Types

6. **`shared/types.ts`** - Auto-generated to include the new `pr_status` field in `WorkspaceSummary`.
2026-01-09 09:09:11 +00:00
Anastasiia Solop
b743f849f7 Add rename workspace functionality (Vibe Kanban) (#1868)
* I've added the rename workspace functionality. Here's a summary of the changes:

## Summary

The backend already had rename workspace support via the `PUT /api/task-attempts/{attemptId}` endpoint with the `name` field. I added the frontend UI to expose this functionality.

### Files Created

1. **`frontend/src/components/ui-new/dialogs/RenameWorkspaceDialog.tsx`**
   - New dialog component for renaming workspaces
   - Shows the current name (or branch name as fallback)
   - Allows user to input a new name
   - Handles mutation with proper error handling and cache invalidation

### Files Modified

1. **`frontend/src/components/ui-new/actions/index.ts`**
   - Added `PencilSimpleIcon` import
   - Added `RenameWorkspaceDialog` import
   - Added new `RenameWorkspace` action that shows the rename dialog

2. **`frontend/src/components/ui-new/actions/pages.ts`**
   - Added `Actions.RenameWorkspace` to the `workspaceActions` page (at the top of the list)

3. **`frontend/src/i18n/locales/en/common.json`**
   - Added translations for the rename workspace dialog under `workspaces.rename`

### How to Use

Users can now rename a workspace by:
1. Clicking the three-dot menu (⋯) on any workspace in the sidebar
2. Selecting "Rename" from the command bar
3. Entering a new name in the dialog
4. Clicking "Rename" to save

* Cleanup script changes for workspace 4eb64331-cc43-43af-849e-3731664e53b9

* Added the missing translations for the rename workspace dialog to all locale files:
- **es** (Spanish)
- **ja** (Japanese)
- **ko** (Korean)
- **zh-Hans** (Simplified Chinese)
- **zh-Hant** (Traditional Chinese)
2026-01-09 10:06:29 +01:00
Louis Knight-Webb
078e7fc372 Done! I've changed block: 'nearest' to block: 'start' in ChangesPanelContainer.tsx:168. (#1869)
**What this fixes:**
- `block: 'nearest'` only scrolled the minimum distance to make the element visible, which often left users "halfway" through a file
- `block: 'start'` aligns the top of the selected diff with the top of the scroll container, ensuring the file header is always visible at the top
2026-01-09 08:44:08 +00:00
Louis Knight-Webb
6a07e5cc16 Fix new sessions to inherit last used variant from previous session (Vibe Kanban) (#1870)
* The implementation is complete. Here's a summary of the changes:

## Summary

Fixed the issue where new sessions were inheriting the last used executor but not the last used variant.

### Changes Made to `vibe-kanban/frontend/src/components/ui-new/containers/SessionChatBoxContainer.tsx`:

1. **Added import** for `useExecutionProcesses` hook

2. **Added `lastSessionId`** - gets the most recent session's ID only when in new session mode:
   ```tsx
   const lastSessionId = isNewSessionMode ? sessions?.[0]?.id : undefined;
   ```

3. **Added `useExecutionProcesses` call** - fetches processes from the last session to get the full executor profile:
   ```tsx
   const { executionProcesses: lastSessionProcesses } =
     useExecutionProcesses(lastSessionId);
   ```

4. **Added `lastSessionProfile` memo** - extracts the full profile (executor + variant) from the last session's processes:
   ```tsx
   const lastSessionProfile = useMemo(() => {
     if (!lastSessionProcesses?.length) return null;
     return getLatestProfileFromProcesses(lastSessionProcesses);
   }, [lastSessionProcesses]);
   ```

5. **Updated `latestProfileId` computation** - now uses `lastSessionProfile` (which includes the variant) before falling back to just the executor with `variant: null`

The type check passes successfully. When a user creates a new session, it will now correctly inherit both the executor AND variant from the most recently used session in that workspace.

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

## Summary

Refactored the `latestProfileId` logic in `SessionChatBoxContainer.tsx` to be cleaner:

**Before:** 4 separate declarations
- `lastSessionExecutor` memo
- `lastSessionId`
- `lastSessionProcesses` hook
- `lastSessionProfile` memo
- `latestProfileId` memo (referencing all the above)

**After:** 3 declarations, consolidated
- `lastSessionId`
- `lastSessionProcesses` hook
- `latestProfileId` memo (all logic inlined)

**Changes:**
- Removed 2 intermediate `useMemo` hooks
- Inlined `lastSessionExecutor` and `lastSessionProfile` directly into `latestProfileId`
- Same 3-tier fallback behavior preserved: current processes → last session processes → session metadata
- Type check passes
2026-01-09 08:43:57 +00:00
Anastasiia Solop
7d75a73fc8 Make sidebar sections collapsible in workspaces UI (Vibe Kanban) (#1867)
* Done! Here's a summary of the changes:

## Summary

I made the sections in the right sidebar collapsible by:

1. **Created `CollapsibleSectionHeader` component** (`frontend/src/components/ui-new/primitives/CollapsibleSectionHeader.tsx`):
   - Combines the `SectionHeader` styling (left border accent, border-bottom) with collapsible functionality
   - Supports optional icon with action handler (stops propagation to avoid toggling)
   - Uses persisted expanded state via `usePersistedExpanded` hook
   - Shows caret icon that rotates when collapsed

2. **Added new persist keys** (`frontend/src/stores/useUiPreferencesStore.ts`):
   - `gitPanelRepositories` - for Repositories section
   - `gitPanelProject` - for Project section
   - `gitPanelAddRepositories` - for Add Repositories section
   - `processesSection` - for Processes section

3. **Updated `GitPanel.tsx`**: Replaced `SectionHeader` with `CollapsibleSectionHeader` for the Repositories section, wrapping all repo cards and the Advanced section inside

4. **Updated `GitPanelCreate.tsx`**: Made all three sections collapsible:
   - Project section
   - Repositories section
   - Add Repositories section

5. **Updated `ProcessListContainer.tsx`**: Made the Processes section collapsible while keeping the search bar always visible

All sections now:
- Collapse when clicking on the section header
- Expand when clicking again
- Persist their expanded/collapsed state across sessions

* Done! I've made the Changes and Dev Server sections collapsible as well:

**Updated files:**
- `frontend/src/stores/useUiPreferencesStore.ts` - Added `changesSection` and `devServerSection` persist keys
- `frontend/src/components/ui-new/views/FileTree.tsx` - Made the "Changes" section collapsible
- `frontend/src/components/ui-new/views/PreviewControls.tsx` - Made the "Dev Server" section collapsible

All sections now use the `CollapsibleSectionHeader` component and persist their collapsed/expanded state.

* Cleanup script changes for workspace 05769879-a23f-49ac-81f4-b17e18f14025
2026-01-09 09:22:17 +01:00
Anastasiia Solop
3d46edc579 fix hash render in diff file names in the workspaces UI (#1864) 2026-01-09 07:49:23 +01:00
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