The OpenCode usage reader resolves its data roots from the host environment only (HostProcessEnvironment). It doesn't use each configured instance's merged environment, even though the scan reader receives the instances.
Problem: an OpenCode instance configured with its own XDG_DATA_HOME or OPENCODE_DATA_DIR doesn't get its usage history counted. The scan reads the host's OpenCode directory instead.
Scope: this has been the behavior since before the usage-reader refactor (UsageService used hostEnvironment), and #17577 preserved it on purpose. Macroscope flagged it on #17628 (thread).
Fix: in packages/provider-opencode/src/server/usage.ts, resolve roots from each instance's environment (already merged over the host env by the aggregator) and dedupe the canonical paths. Add a test with two instances pointing at different data homes.
Grok and Claude transcript readers already resolve per instance. Antigravity and Cursor are worth checking for the same gap.
The OpenCode usage reader resolves its data roots from the host environment only (
HostProcessEnvironment). It doesn't use each configured instance's merged environment, even though the scan reader receives the instances.Problem: an OpenCode instance configured with its own
XDG_DATA_HOMEorOPENCODE_DATA_DIRdoesn't get its usage history counted. The scan reads the host's OpenCode directory instead.Scope: this has been the behavior since before the usage-reader refactor (UsageService used
hostEnvironment), and #17577 preserved it on purpose. Macroscope flagged it on #17628 (thread).Fix: in
packages/provider-opencode/src/server/usage.ts, resolve roots from each instance'senvironment(already merged over the host env by the aggregator) and dedupe the canonical paths. Add a test with two instances pointing at different data homes.Grok and Claude transcript readers already resolve per instance. Antigravity and Cursor are worth checking for the same gap.