Skip to content

Conversation

@LSRCT
Copy link
Contributor

@LSRCT LSRCT commented Jan 9, 2026

Summary

Fixes the VSCode extension which stopped working after commit 22ff27d8f ("feat: multi repo projects") removed the /containers/info endpoint.

Changes

  • Restored the GET /containers/info?ref={path} endpoint in containers.rs
  • Added ContainerInfo struct that returns project_id, task_id, and attempt_id
  • Maps workspace_id to attempt_id for backward compatibility with the extension

Why

The VSCode extension (vibe-kanban-vscode) calls /api/containers/info?ref={folder_path} to auto-detect workspaces when a folder is opened. This endpoint was accidentally removed during the multi-repo projects refactor. The extension expects a response with { data: { project_id, task_id, attempt_id } } to construct the URL for loading the sidebar.

Implementation Details

  • The endpoint reuses the existing Workspace::resolve_container_ref() method
  • Returns workspace_id as attempt_id since the frontend routes still use the "attempt" naming convention but now work with workspace IDs
  • Added a prominent comment at the route registration to prevent accidental removal in the future

Fixes #1793

  • tested

This PR was written using Vibe Kanban

LSRCT added 2 commits January 9, 2026 15:25
…changed:

**File: `crates/server/src/routes/containers.rs`**

1. Added `use uuid::Uuid;` import
2. Added `ContainerInfo` struct with `project_id`, `task_id`, and `attempt_id` fields
3. Added `get_container_info` handler that resolves the container reference and maps `workspace_id` → `attempt_id` for VSCode extension compatibility
4. Registered the `/containers/info` route

The VSCode extension can now call `GET /api/containers/info?ref={folder_path}` to auto-detect workspaces when opening a folder.
@LSRCT LSRCT changed the title Fix vscode extension (vibe-kanban) Fix VSCode extension by restoring /containers/info endpoint (Vibe Kanban) Jan 9, 2026
@vibe-kanban-cloud
Copy link

Review Complete

Your review story is ready!

View Story

Comment !reviewfast on this PR to re-generate the story.

@LSRCT LSRCT marked this pull request as draft January 9, 2026 15:28
LSRCT added 2 commits January 9, 2026 15:31
**How the fix works:**

| Scenario | `container_ref` in DB | Path VSCode opens | Lookup method |
|----------|----------------------|-------------------|---------------|
| Multi-repo | `/workspaces/abc123` | `/workspaces/abc123` | Exact match ✓ |
| Single-repo | `/workspaces/abc123` | `/workspaces/abc123/my-repo` | Prefix match ✓ |

The `resolve_container_ref_by_prefix` method:
1. First tries exact match (handles multi-repo case)
2. Falls back to prefix match using SQLite GLOB: `path GLOB container_ref || '/*'` (handles single-repo case where path is a subfolder)

This should handle both cases correctly. The confidence is higher now because we've accounted for how "Open in IDE" behaves differently based on repo count.
- Unix paths: `/workspaces/abc123/repo-name` matches `/workspaces/abc123` via `/*`
- Windows paths: `C:\workspaces\abc123\repo-name` matches `C:\workspaces\abc123` via `\*`
@LSRCT LSRCT marked this pull request as ready for review January 13, 2026 12:08
@LSRCT LSRCT requested a review from abcpro1 January 13, 2026 12:09
Instead of doing path prefix matching in SQL (which doesn't handle
Windows backslashes), we now:
1. Try exact match on the path
2. If not found, try the parent directory (handles single-repo case)

This uses std::path::Path::parent() which handles path separators
correctly on all platforms.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@LSRCT LSRCT force-pushed the vk/cba0-fix-vscode-exten branch from 7f7c559 to 1f9411d Compare January 13, 2026 13:30
@LSRCT LSRCT merged commit 08a466c into main Jan 13, 2026
2 checks passed
@LSRCT LSRCT deleted the vk/cba0-fix-vscode-exten branch January 13, 2026 18:13
stevepisani pushed a commit to TabbyStack/vibe-kanban that referenced this pull request Jan 15, 2026
…ban) (BloopAI#1884)

* The code compiles. The fix is complete. Here's a summary of what was changed:

**File: `crates/server/src/routes/containers.rs`**

1. Added `use uuid::Uuid;` import
2. Added `ContainerInfo` struct with `project_id`, `task_id`, and `attempt_id` fields
3. Added `get_container_info` handler that resolves the container reference and maps `workspace_id` → `attempt_id` for VSCode extension compatibility
4. Registered the `/containers/info` route

The VSCode extension can now call `GET /api/containers/info?ref={folder_path}` to auto-detect workspaces when opening a folder.

* Moved the doc comment to the route registration where it's more visible.

* Everything compiles. Let me summarize the logic:

**How the fix works:**

| Scenario | `container_ref` in DB | Path VSCode opens | Lookup method |
|----------|----------------------|-------------------|---------------|
| Multi-repo | `/workspaces/abc123` | `/workspaces/abc123` | Exact match ✓ |
| Single-repo | `/workspaces/abc123` | `/workspaces/abc123/my-repo` | Prefix match ✓ |

The `resolve_container_ref_by_prefix` method:
1. First tries exact match (handles multi-repo case)
2. Falls back to prefix match using SQLite GLOB: `path GLOB container_ref || '/*'` (handles single-repo case where path is a subfolder)

This should handle both cases correctly. The confidence is higher now because we've accounted for how "Open in IDE" behaves differently based on repo count.

* Everything compiles. Now the query handles both:
- Unix paths: `/workspaces/abc123/repo-name` matches `/workspaces/abc123` via `/*`
- Windows paths: `C:\workspaces\abc123\repo-name` matches `C:\workspaces\abc123` via `\*`

* Use std::path for cross-platform parent directory lookup

Instead of doing path prefix matching in SQL (which doesn't handle
Windows backslashes), we now:
1. Try exact match on the path
2. If not found, try the parent directory (handles single-repo case)

This uses std::path::Path::parent() which handles path separators
correctly on all platforms.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS Code extension not working(vscode and vscode insider)

2 participants