anomalyco / anomalyco/opencode-drive

Canonicalize the artifact root (realpath) so isolated projects avoid symlinked temp paths

Open
#72 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
32
Forks
3
Avg merge
12m
Merged PRs (30d)
17

Description

Drive 2.0.0 (464f9a3), OpenCode V2 0b771030ed and e73fa5f476.

Default artifacts live under os.tmpdir(), which on macOS is /var/folders/... → symlink to /private/var/folders/.... OpenCode currently discovers the isolated project's .opencode directory under both spellings, starts two watchers, loads every local plugin twice, and fails activation with Duplicate plugin ID. That is an OpenCode bug (tracked separately), but Drive is the thing putting every isolated project under a symlinked root, so every plugin probe on macOS hits it.

Proposal: resolve the artifact root with realpath in instance.ts (resolve(join(tmpdir(), "opencode-drive"))) and pass the canonical path everywhere (--dev, project files, OPENCODE_CONFIG_DIR). Until then the workaround is TMPDIR="$PWD/.drive-output/tmp", now documented in the tui-regressions README under "Plugin registry".

Repro: test/manual/tui-regressions/plugin-registry.ts without TMPDIR; server log shows two watcher started path=…/.opencode lines in one boot span followed by failed to reload plugins cause=Die(Error: Duplicate plugin ID: alpha).

Contributor guide

No contributing guide indexed for this repository

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 in instance.ts, where the artifact root is resolved from os.tmpdir(), then trace how that path is passed to --dev, project files, and OPENCODE_CONFIG_DIR. Run test/manual/tui-regressions/plugin-registry.ts without TMPDIR and compare the watcher and plugin-loading logs. Done means the root uses one canonical realpath and the isolated project no longer starts duplicate watchers or fails with Duplicate plugin ID.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.