You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Usage: OpenCode history ignores each instance's XDG_DATA_HOME / OPENCODE_DATA_DIR #17631
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.
Implemented the requested per-instance history-root scope in #17759.
The regression seeds two temporary SQLite stores with unique messages and distinct instance environments. Before the change, the scanner returned only the unrelated host root; after the change, both stores contribute records (200 combined input tokens). The existing service-test junction fixture is extended to directly verify that canonical directory aliases shared across instances emit one scanner source before aggregation. Disabling cross-instance root deduplication makes that assertion fail (two sources instead of one). This reuses the established portable fixture without adding diagnostic suppression. Absolute, relative, and absent XDG defaults, plus the existing SQLite/WAL and legacy migration case, pass.
Independently reran the scanner and UsageService tests on the committed change: 33/33 passed at the updated head. Both provider/server package typechecks and scoped lint/format passed. The PR includes the exact commands, environment and Windows verification limit. No other provider fix is included.
Activity
fixfon commentedon Oct 10, 2026
Implemented the requested per-instance history-root scope in #17759.
The regression seeds two temporary SQLite stores with unique messages and distinct instance environments. Before the change, the scanner returned only the unrelated host root; after the change, both stores contribute records (200 combined input tokens). The existing service-test junction fixture is extended to directly verify that canonical directory aliases shared across instances emit one scanner source before aggregation. Disabling cross-instance root deduplication makes that assertion fail (two sources instead of one). This reuses the established portable fixture without adding diagnostic suppression. Absolute, relative, and absent XDG defaults, plus the existing SQLite/WAL and legacy migration case, pass.
Independently reran the scanner and UsageService tests on the committed change: 33/33 passed at the updated head. Both provider/server package typechecks and scoped lint/format passed. The PR includes the exact commands, environment and Windows verification limit. No other provider fix is included.
fix(antigravity): read usage from each instance data directory
fix(antigravity): read usage from each instance data directory