Skip to content

feat(mcp): require workspaceId in start_claude_session and return path from create_workspace#1274

Merged
Kitenite merged 2 commits into
mainfrom
kitenite/creator
Feb 8, 2026
Merged

feat(mcp): require workspaceId in start_claude_session and return path from create_workspace#1274
Kitenite merged 2 commits into
mainfrom
kitenite/creator

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 7, 2026

Summary

  • start_claude_session now requires a workspaceId parameter instead of creating a new workspace internally — callers must first create a workspace via create_workspace and pass its ID
  • create_workspace now returns worktreePath for each created workspace so callers know the filesystem path

Changes

  • MCP layer (packages/mcp): Added required workspaceId to start_claude_session input schema and validation; split validators so start_claude_subagent is unaffected
  • Desktop start-claude-session: Removed workspace creation logic; looks up existing workspace by ID and sets up pending terminal command on it
  • Desktop create-worktree: Added worktreePath to CreatedWorkspace interface and response data

Test Plan

  • Call create_workspace via MCP and verify response includes worktreePath
  • Call start_claude_session with a valid workspaceId and verify it launches in the correct workspace
  • Call start_claude_session without workspaceId and verify it returns an error
  • Verify start_claude_subagent still works without workspaceId

Summary by CodeRabbit

  • New Features

    • Workspace creation now requires selecting a project and returns the created worktree path for each workspace.
    • Claude sessions can be started by specifying an existing workspace ID.
  • Improvements

    • Sessions operate directly on existing workspace context (id and branch) instead of creating new workspaces.
    • Session initialization enforces workspace identification for clearer, more predictable behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 7, 2026

📝 Walkthrough

Walkthrough

Adds explicit workspaceId/projectId parameters across tools, tracks worktreePath on created workspaces, and shifts start-claude-session to locate and use existing workspaces instead of creating new worktrees; also introduces session-scoped and subagent-scoped argument validators and related error constants.

Changes

Cohort / File(s) Summary
Desktop: create-worktree
apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/create-worktree.ts
Added schema.projectId input, populated CreatedWorkspace.worktreePath from creation result, and switched to using provided projectId instead of deriving it.
Desktop: start-claude-session
apps/desktop/src/renderer/routes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/tools/start-claude-session.ts
Added workspaceId to input schema; replaced logic that created a new worktree with a lookup of an existing workspace by workspaceId; updated terminal/pending setup to use located workspace fields (workspace.id, workspace.projectId, branch).
MCP: start-claude-session / subagent
packages/mcp/src/tools/devices/start-claude-session/start-claude-session.ts
Introduced workspaceId in input schema; added validateSessionArgs (deviceId, taskId, workspaceId) and validateSubagentArgs (deviceId, taskId); added session-specific error constants and threaded workspaceId into start_claude_session command params.
MCP: create-workspace tool
packages/mcp/src/tools/devices/create-workspace/create-workspace.ts
Added required projectId arg to schema and runtime validation; updated error messaging and passed projectId into device operation parameters.

Sequence Diagram(s)

sequenceDiagram
    participant Agent as Agent/Client
    participant MCP as MCP Validator
    participant Desktop as Desktop Tool
    participant Store as Workspace Store

    rect rgba(100,150,200,0.5)
    Note over Agent,Store: New Flow — session uses existing workspace
    Agent->>MCP: start_claude_session(deviceId, taskId, workspaceId)
    MCP->>MCP: validateSessionArgs()
    MCP-->>Agent: validated args (deviceId, taskId, workspaceId)
    Agent->>Desktop: call start-claude-session with workspaceId
    Desktop->>Store: lookup workspace by workspaceId
    Store-->>Desktop: return workspace {id, projectId, branch, ...}
    Desktop->>Desktop: append pending terminal setup (workspace.id, projectId, branch, initialCommands)
    Desktop-->>Agent: return workspace context (workspaceId, branch)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through code both near and far,
Found worktrees, paths, and workspace stars.
With workspaceId I point the way,
Reuse the home, no need to sway—
Hooray for paths that save the day! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: requiring workspaceId in start_claude_session and returning worktreePath from create_workspace.
Description check ✅ Passed The description includes a clear summary, organized changes section, and a comprehensive test plan that covers all major functionality changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/creator

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ✅ Electric Fly.io app

Thank you for your contribution! 🎉

@Kitenite Kitenite merged commit a2f0319 into main Feb 8, 2026
14 checks passed
@Kitenite Kitenite deleted the kitenite/creator branch February 8, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant