fix(core): Location liveness check stats the server fs for workspace Locations

Open Beginner friendly
#44,554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Start with the existence check in packages/core/src/location-services.ts and location-service-map.ts, then trace how workspaceID is handled for a Location. Confirm that workspace-backed Locations do not depend on the server filesystem while local Location eviction remains unchanged. Use the issue’s acceptance criteria to verify that a workspace directory absent on the host can still build and remain alive.

Written by the indexing model from the issue text.

Description

What

`LocationServiceMap` keeps a Location alive based on a process-local `existsSync(ref.directory)` (see `packages/core/src/location-services.ts` / `location-service-map.ts` existence check). For a workspace-backed Location whose directory only exists inside the sandbox (e.g. `/workspace` in a Modal image, DO-hosted sessions), this check consults the wrong filesystem: the Location can be evicted or never admitted even though the placement is healthy.

Fix direction

Skip the local existence check when `location.workspaceID` is set. Workspace liveness is owned by the workspace row plus the provider binding; a cheap substitute is "workspace row exists", which is already a point read. Do not probe the sandbox for liveness — that would provision lazily-idle workspaces.

Acceptance

  • A workspace Location whose directory does not exist on the server host builds and survives.
  • Local Location eviction behavior unchanged.

Found while auditing boot-cycle process-vs-workspace resolution after #44526. Mechanical fix; no design dependency.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 20m
Merged PRs (30d)
358

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.