Skip to content

[Bug]: Slack bridge fails on Windows with 'Directory must stay within workspace root' due to long path prefix #1296

@Lumi-AI-Colleague

Description

@Lumi-AI-Colleague

Summary

When using the Slack integration on Windows, the bot frequently responds with the error:
Directory must stay within workspace root: //?/c:/users/...

Root Cause

In apps/opencode-router/src/bridge.ts, the isWithinWorkspaceRoot function uses path.relative(workspaceRoot, resolved).
On Windows, workspaceRoot can sometimes include the long path prefix (e.g., //?/c:/), while resolved resolves to a standard absolute path (e.g., c:\...).
Node.js path.relative treats these as different roots and returns an absolute path. The check if (isAbsolute(relativePath)) return false; then incorrectly fails the validation, blocking legitimate directory access.

Steps to reproduce

  1. Run Openwork on Windows.
  2. Connect a Slack bot via opencode-router.
  3. Attempt to interact with the bot in Slack.
  4. The bot replies with the directory boundary error.

Suggested Fix

Normalize the workspaceRoot to strip the //?/ prefix before performing path comparisons, or use a more robust path normalization strategy for Windows paths in isWithinWorkspaceRoot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions