Skip to content

Creating workspace failed #1

@b0tm1nd

Description

@b0tm1nd

Steps to Reproduce

  1. Clone repo, run cd plugin && npm install && npm run build
  2. Add path-based entry in opencode.jsonc pointing to the build:
    ["/path/to/plugin", { "providers": { "default": { "hosts": [...] } } }]
  3. Run OPENCODE_EXPERIMENTAL_WORKSPACES=1 opencode
  4. Press /warp — you see "New workspace: SSH Provider" option
  5. Select it — error appears immediately: "Creating Workspace Failed"

Root Cause (initial)

The resolveProvider function in src/index.ts throws immediately if extra.provider is not set:

if (!workspace.extra || typeof ...provider !== "string") {
  throw new Error("Workspace extra.provider must be configured");
}

OpenCode TUI’s workspace creation does not pass extra.provider, so it fails instantly.

After Patching

We added a fallback to the first available provider when extra is empty. After that:

  • The plugin proceeds to bootstrap (SCP stub, kill old process, start stub, SSH tunnel)
  • But bootstrap itself has bugs (see below)
  • After fixing those, bootstrap succeeds (~10s), health check passes, workspace is saved to SQLite DB
  • But the TUI still shows "Creating Workspace Failed" (now after 10 seconds timeout) — this is a separate issue

Additional Bugs Found in the Plugin Code

  1. SCP fails when stub is running — SCP happens before pkill, so if stub exists, the file is locked
  2. pkill -f kills the SSH session — the command itself contains the pattern it’s searching for
  3. pkill without -f silently fails — Linux truncates process names to 15 chars
  4. No python3 fallbackbuildRemoteStartCommand uses python2 or python, not python3
  5. No start_new_session=True — child process may die when SSH closes
  6. State not persistedRuntimeState is in-memory only; after TUI restart, getTarget fails
  7. Bootstrap is slow — each step (mkdir, SCP, pkill, start) is a separate SSH connection (~12s)

Tested with OpenCode 1.14.51 and 1.15.7 — same behavior.

Missing npm Package

The opencode-remote-provider npm package does not exist on npmjs.com.
This means the documented package-based installation ("opencode-remote-provider" in config) cannot work.
Only path-based local development loading is possible.

Config Format

Scripts in ./scripts/ only support opencode.json (JSON), not opencode.jsonc (JSON with comments). Had to use OPENCODE_CONFIG env var to point to the config file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions