Skip to content

fix(server): skip file initialization for remote workspaces#2070

Open
AllenSHH wants to merge 1 commit into
different-ai:devfrom
AllenSHH:fix/workspace-startup-crash
Open

fix(server): skip file initialization for remote workspaces#2070
AllenSHH wants to merge 1 commit into
different-ai:devfrom
AllenSHH:fix/workspace-startup-crash

Conversation

@AllenSHH

@AllenSHH AllenSHH commented Jun 3, 2026

Copy link
Copy Markdown

Summary

  • Skip local workspace file initialization (ensureWorkspaceFiles) for remote workspaces (workspaceType === "remote") in both the CLI (cli.ts) and embedded server (embedded.ts) startup paths.
  • Fix Managed OpenCode server startup to correctly boot in remote-only configurations when a fallback working directory (opencodeCwd or OPENWORK_MANAGED_OPENCODE_CWD) is explicitly provided, instead of incorrectly blocking on the absence of a local workspace.
  • Select the first non-remote workspace using .find() when resolving the default local path fallback.

Why

  • When running OpenWork with remote workspaces, the local server process attempts to initialize workspace assets on the local file system using the remote workspace's file path. Since the path only exists on the remote machine, it triggers ENOENT directory creation errors and causes the server/client startup to crash.
  • Gating Managed OpenCode startup entirely on finding a non-remote workspace prevented it from starting even when valid working directory overrides (opencodeCwd / OPENWORK_MANAGED_OPENCODE_CWD) were explicitly configured for remote-only environments.

Issue

  • Closes #

Scope

  • apps/server/src/cli.ts: Filter out remote workspaces during startup initialization, resolve the CWD prior to gating, and select the first local workspace using .find().
  • apps/server/src/embedded.ts: Same filtering, lookup, and conditional CWD gating improvements.

Out of scope

  • Local directory initialization logic (workspace-init.ts).
  • Desktop UI workspace settings.

Testing

Ran

  • pnpm --filter openwork-server typecheck
  • bun test src/workspace-init.test.ts

Result

  • pass/fail: pass
  • if fail, exact files/errors: N/A

CI status

  • pass: yes (types compile successfully)
  • code-related failures: N/A
  • external/env/auth blockers: N/A

Manual verification

  1. Configure a server instance or desktop configuration containing only remote workspaces and supply a OPENWORK_MANAGED_OPENCODE_CWD environment variable.
  2. Launch the application.
  3. Verify that the server boots up without attempting to create local starter files for the remote path, and successfully starts the Managed OpenCode server in the specified CWD.

Evidence

  • video/screenshot link, or N/A (docs-only): N/A

Risk

  • Low. The change introduces minor checks to safely bypass filesystem mutations on remote paths, and checks for valid working directories instead of blocking on local workspace configurations.

Rollback

  • Revert changes to apps/server/src/cli.ts and apps/server/src/embedded.ts.

@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Jun 3, 2026 2:53am

@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/server/src/embedded.ts Outdated
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