Fix dev server visibility when switching sessions within a workspace (Vibe Kanban)
Summary
This PR fixes a bug where dev servers would disappear from the preview panel when switching between sessions within the same workspace. The root cause was that the ActionsContext was using a session-scoped hook (useDevServer), which caused runningDevServers to be empty when viewing a different session than the one that started the dev server.
Changes
Backend (Rust)
-
New database query (
crates/db/src/models/execution_process.rs): Addedfind_dev_servers_by_workspace()to query dev servers across all sessions in a workspace -
New WebSocket endpoint (
crates/server/src/routes/execution_processes.rs): Added/stream/workspace-dev-servers/ws?workspace_id={id}for workspace-scoped dev server streaming -
Server-side filtering (
crates/services/src/services/events/streams.rs): Implementedstream_dev_servers_for_workspace_raw()that streams only dev server processes belonging to the specified workspace
Frontend (React/TypeScript)
-
New hook (
frontend/src/hooks/useWorkspaceDevServers.ts): Low-level hook that connects to the workspace dev servers WebSocket stream -
Updated
usePreviewDevServer(frontend/src/components/ui-new/hooks/usePreviewDevServer.ts): Changed from session-scoped to workspace-scoped data source -
Fixed
ActionsContext(frontend/src/contexts/ActionsContext.tsx): Switched fromuseDevServertousePreviewDevServerfor workspace-scoped visibility -
Updated preview components: Removed unnecessary
attemptIdprop since workspace ID is now sourced from context
Why These Changes
Previously, dev servers were tracked at the session level. When a user started a dev server in Session A, then switched to Session B, the preview panel would show no running dev server because Session B's execution processes didn't include the dev server from Session A.
With this change, dev servers are now tracked at the workspace level, making them visible regardless of which session is currently active. This matches user expectations since dev servers are workspace-wide resources.
Implementation Details
- The new WebSocket endpoint filters events server-side, only sending dev server processes that belong to sessions within the target workspace
- Uses JSON Patch protocol (RFC 6902) for efficient incremental updates
- Follows existing patterns in the codebase (
useJsonPatchWsStream, similar streaming endpoints)
This PR was written using Vibe Kanban
Review Complete
Your review story is ready!
Comment !reviewfast on this PR to re-generate the story.
Review Complete
Your review story is ready!
Comment !reviewfast on this PR to re-generate the story.