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
State root consistency: migrate tmpdir state to CLAUDE_PLUGIN_DATA #30
/opencode:setup --enable-review-gate may write config to a different state directory than the Stop hook reads from, depending on whether CLAUDE_PLUGIN_DATA is present in the execution environment.
This can make setup appear successful while the Stop hook still sees the default disabled state.
Local evidence
plugins/opencode/scripts/lib/state.mjs selects the state root as:
setup is run through a Bash command from plugins/opencode/commands/setup.md. Hooks are run through Claude Code's hook system from plugins/opencode/hooks/hooks.json. Those two paths may not receive the same environment.
Expected behavior
Review gate state should be read and written from the same persistent location across setup commands, lifecycle hooks, and Stop hooks.
Suggested fix
Options:
Make setup resolve the same persistent plugin-data path hooks use, even when CLAUDE_PLUGIN_DATA is absent.
Have the setup command explicitly pass/derive CLAUDE_PLUGIN_DATA before invoking Node.
As a compatibility bridge, write review-gate config to both the persistent state root and the legacy /tmp/opencode-companion fallback.
Add a regression test that simulates setup with no CLAUDE_PLUGIN_DATA and hook execution with CLAUDE_PLUGIN_DATA set.
changed the title [-]Review gate setup and Stop hook can use different state roots[/-][+]State root consistency: migrate tmpdir state to CLAUDE_PLUGIN_DATA[/+]on Apr 12, 2026
Consolidating #47 here. The canonical scope is state-root consistency across setup/hooks plus migration from the legacy tmpdir fallback when persistent CLAUDE_PLUGIN_DATA is available.
Fixed by PR #51 commit 3535f56 — tmpdir fallback path replaced with os.tmpdir(); state migrates from tmpdir to CLAUDE_PLUGIN_DATA on first availability with absolute-path rewriting in state.json and jobs/*.json.
Activity
[-]Review gate setup and Stop hook can use different state roots[/-][+]State root consistency: migrate tmpdir state to CLAUDE_PLUGIN_DATA[/+]JohnnyVicious commentedon Apr 12, 2026
Consolidating #47 here. The canonical scope is state-root consistency across setup/hooks plus migration from the legacy tmpdir fallback when persistent CLAUDE_PLUGIN_DATA is available.
JohnnyVicious commentedon Apr 12, 2026
Fixed by PR #51 commit 3535f56 — tmpdir fallback path replaced with os.tmpdir(); state migrates from tmpdir to CLAUDE_PLUGIN_DATA on first availability with absolute-path rewriting in state.json and jobs/*.json.