Skip to content

[BUG]: POSIX server resolves foreign Windows directory hints against its cwd #34255

Description

@romanilyin

Description

On a Linux/WSL server, a request directory such as C:\Work\Repo or a Windows UNC path can reach instance loading and be treated as a relative path. The value is then resolved under the server cwd, producing a mangled directory and a later 500 or misleading tool error.

The request boundary should consume query/header encoding once, detect foreign rooted syntax before InstanceStore.load, and return a structured 400 explaining that the server expects a native POSIX/WSL path.

This is only the server-side validation and diagnostic fix. It does not make Desktop preserve /mnt/c/...; that remains the client-side part of #30895.

OpenCode version

Current dev / 1.17.11

Steps to reproduce

  1. Start opencode serve on Linux or WSL.
  2. Request:
GET /session?directory=C%3A%5CWork%5CRepo
  1. Observe that the path is resolved under the server cwd and fails later instead of being rejected at the request boundary.

The same class of failure can be reproduced with a UNC directory hint such as:

\\wsl.localhost\Ubuntu\home\user\repo

Expected behavior

The server returns a structured HTTP 400 before instance creation and explains that a server-native POSIX/WSL path is required.

Operating System

Linux or Windows 11 with WSL2

Terminal

Any HTTP client, or OpenCode Desktop connected to a WSL-hosted server

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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