anomalyco / anomalyco/opencode

fix(core): ripgrep binary resolution ignores workspace placement

Open
#44,552 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

What

Ripgrep spawning routes through the Location environment (`ripgrep.ts:103,118-119`), so on a workspace-backed Location the process runs inside the remote sandbox. But the binary path is resolved on the server host: `RipgrepBinary` (`packages/core/src/ripgrep/binary.ts:31-135`) uses local `which`, `FSUtil`, `global.bin`, and HTTP download. A remote sandbox gets handed a server-local absolute path such as `~/.local/share/opencode/bin/rg` and the spawn fails.

Fix direction

Executable identity must follow placement. For workspace Locations, use the provider's executable identity (bare `rg` on the image PATH, or a driver-declared capability); keep local resolution/download only for implicit-local placement. This is the deferred "Environment-owned ripgrep executable selection" item from #44526 — the seam decision (executable resolver vs capability metadata vs search override on `Environment.Driver`) needs to be made first.

Acceptance

  • A fake workspace driver that rejects host-absolute binary paths passes filesystem search.
  • Local placement behavior unchanged, including download fallback.

Found while auditing boot-cycle process-vs-workspace resolution after #44526.

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.

Research direction

Start with packages/core/src/ripgrep/binary.ts, especially lines 31-135, and the ripgrep.ts references at lines 103 and 118-119. Trace how Location and Environment.Driver determine executable placement, then use the fake workspace driver acceptance case to verify that remote execution avoids host-absolute paths while local resolution and download fallback remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.