anomalyco / anomalyco/opencode
fix(core): Location liveness check stats the server fs for workspace Locations
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100