fix: ChatGPT cannot find allowed workspaces without a root catalog - #177
fix: ChatGPT cannot find allowed workspaces without a root catalog#177dbc-hbin wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThe server adds a read-only ChangesAllowed root discovery and diagnostics
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant MCPServer
participant AllowedRoots
Caller->>MCPServer: Call list_allowed_roots
MCPServer->>AllowedRoots: Read configured root paths
AllowedRoots-->>MCPServer: Return root names and paths
MCPServer-->>Caller: Return structured and text content
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR adds a read-only workspace-root discovery tool so MCP hosts can select a configured project boundary before opening a workspace.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defects identified. The new tool exposes only the intentionally configured root catalog to authenticated MCP clients, while existing path validation remains responsible for enforcing workspace boundaries.
|
| Filename | Overview |
|---|---|
| src/server.ts | Adds root discovery, updates host instructions, and returns the configured catalog without widening workspace access. |
| src/roots.ts | Makes denied-path errors actionable by including the same configured allowed-root catalog. |
| src/server.test.ts | Verifies pre-workspace root discovery and confirms the response excludes project instructions. |
Sequence Diagram
sequenceDiagram
participant Host as MCP Host
participant Server as DevSpace Server
Host->>Server: list_allowed_roots()
Server-->>Host: Configured root names and paths
Host->>Server: open_workspace(path under listed root)
Server->>Server: Validate path against allowed roots
Server-->>Host: workspaceId
Reviews (1): Last reviewed commit: "feat: expose allowed workspace roots" | Re-trigger Greptile
|
Thanks for the PR, btw can you attach and attribute info about which model/harness you made this PR with? |
|
Thanks — I added the model/harness attribution to the PR description. ChatGPT Project instructions are a useful workaround for a stable single-root project. The gap this PR addresses is the generic connector path: a fresh normal chat has no project instructions, and a DevSpace server can expose multiple explicitly configured roots. Before
I am happy to adjust the name or response shape if you prefer this under a more general read-only server metadata tool. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/roots.ts`:
- Around line 40-42: Extend the tests covering the access-denied path around
AccessDeniedError to assert the complete message contract, including the
rejected path and every allowed root. Remove the platform-gated-only matching so
the Windows branch is exercised as well, while preserving platform-specific path
handling where needed.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b6022704-b9ec-49b6-8928-fe3ac883db39
📒 Files selected for processing (3)
src/roots.tssrc/server.test.tssrc/server.ts
|
Addressed the review comment in 8561071. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/roots.test.ts (1)
33-47: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAdd MCP-level coverage for outside-root rejection.
src/workspaces.test.tsalready coversWorkspaceRegistry.openWorkspace()for paths outside allowed roots, but the newsrc/roots.test.tscontract should be linked through anopen_workspacecall failure or an MCP tool-response test. This does not require broad real-host testing; use the existing in-memory MCP test fixture.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/roots.test.ts` around lines 33 - 47, Add MCP-level coverage using the existing in-memory MCP test fixture to invoke the open_workspace tool with a path outside the configured allowed roots. Assert that the tool call fails or returns the expected access-denied response, linking the roots.test.ts rejection contract through the MCP boundary rather than only testing assertAllowedPath directly.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/roots.test.ts`:
- Around line 33-47: Add MCP-level coverage using the existing in-memory MCP
test fixture to invoke the open_workspace tool with a path outside the
configured allowed roots. Assert that the tool call fails or returns the
expected access-denied response, linking the roots.test.ts rejection contract
through the MCP boundary rather than only testing assertAllowedPath directly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d404fb0c-3630-4aaf-bb6d-9b1e426a517d
📒 Files selected for processing (1)
src/roots.test.ts

ChatGPT cannot know an arbitrary local filesystem path before it opens a workspace. With multiple configured roots, it can therefore guess a path outside the DevSpace boundary and fail before it has a usable workspace ID.
Add a read-only
list_allowed_rootstool that returns only the configured root catalog. Server instructions direct the host to use it when the project path is unknown, and rejected paths now include the same actionable catalog. The change does not scan directories or widen filesystem access.Validated with
npm run typecheck,npx tsx src/roots.test.ts,npx tsx src/server.test.ts, andnpm run build.Development attribution
Built with the Codex desktop coding harness using gpt-5.6-sol. The change was inspected, implemented, and validated against the local repository checkout; the tests listed above were run on the submitted commit.
Summary by CodeRabbit