Repository navigation
fix(install): write the global OpenCode plugin to ~/.config/opencode (#3398) - #4771
nothariharan wants to merge 1 commit into
Conversation
…raphify-Labs#3398) A global `graphify install --platform opencode` passed Path(".") as the plugin base and joined `.opencode/plugins/graphify.js` onto it, so the "global" plugin landed in whatever directory the command ran from and loaded only for that project. OpenCode's global plugin dir is ~/.config/opencode/plugins, with no `.opencode/` segment, so the base path alone could not be swapped. The plugin helpers now take the OpenCode config dir itself, chosen by _opencode_dir(): <project>/.opencode for a project install and ~/.config/opencode for a global one. `graphify uninstall` removes the global plugin as well, and the OpenCode 2 plugin refresh also checks the global dir. The legacy `.opencode/plugins/graphify.js` entry that older releases wrote into opencode.json is still matched by its old string. The slash-command half of the issue no longer applies: v8 has no _install_opencode_command.
|
Thanks for the pull request, @nothariharan. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 2 advisory finding(s) below merit a look before merge.
Not checked: tests were not run; formal verification proved 0 of 9 changed function(s) (5 sampled, not proven, 4 not verified).
Formal verification. PR-changed functions: 5/9 verified (0 proven, 5 may-equivalent, 0 distinguished) · 4 not verified (2 vacuous, 1 unsupported, 1 witness not reproduced).
Not verified on this run: \_agents\_install (vacuous: never exercised), \_install\_opencode\_plugin (witness not reproduced), install (vacuous: never exercised), uninstall\_all (unsupported).
Graphify review — findings
Fixes the global OpenCode install so install("opencode") writes the plugin to ~/.config/opencode/plugins instead of the cwd, via a new _opencode_dir helper that resolves the project (<project>/.opencode) or global directory. The plugin install and uninstall helpers and the opencode.json cleanup now take that directory rather than a project root, so the same positional argument means something different, and the agents-based install and uninstall paths always resolve the project directory. uninstall_all also removes the plugin from the global config dir, and the startup v1-plugin refresh now scans the cwd, home and global directories, with paths in printed messages now showing the actual location.
Worth a look
- _agents_install hardcodes project=True for the OpenCode plugin, so global installs still write to the cwd —
graphify/install.py:1977· Escalate · high- NOT verified (no proof, no reproducing execution) — needs human review
- uninstall_all leaves legacy home OpenCode plugin —
graphify/install.py:2330· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 791 functions depend on the 446 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
install()— 19 callers, 12 callees - worse:
_refresh_v1_opencode_plugins()— 19 callers, 8 callees - worse:
uninstall_all()— 8 callers, 15 callees - worse:
_agents_install()— 7 callers, 9 callees - worse:
_agents_uninstall()— 8 callers, 7 callees
Verification — 791 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 790 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
43 of 453 test file(s) selected (9%) via static blast radius.
tests/test_affected_cli.py— impacttests/test_agents_platform.py— impacttests/test_atomic_version_stamp.py— impacttests/test_claude_md.py— impacttests/test_codebuddy.py— impacttests/test_dedup_shrink_refuses_force_write.py— impacttests/test_detect.py— impacttests/test_devin.py— impacttests/test_explain_cli.py— impacttests/test_explain_same_file_tie.py— impacttests/test_extract_cli.py— impacttests/test_gemini_hook.py— impacttests/test_global_add_tag_inference.py— impacttests/test_god_nodes_cli.py— impacttests/test_hollow_chunks_arm_shrink_guard.py— impacttests/test_home_sandbox.py— impacttests/test_hook_strict.py— impacttests/test_incomplete_build_guard.py— impacttests/test_install.py— impact, changed-testtests/test_install_hook_identity.py— impacttests/test_install_line_endings.py— impacttests/test_install_references.py— impacttests/test_install_strings.py— impacttests/test_install_version_warning.py— impacttests/test_lookup_exit_codes.py— impacttests/test_merge_chunks_validation.py— impacttests/test_multigraph_diagnostics.py— impacttests/test_no_dedup_flag.py— impacttests/test_opencode_plugin_refresh.py— impact, changed-testtests/test_path_cli.py— impacttests/test_pi_guard_install.py— impacttests/test_query_cli.py— impacttests/test_query_induced_edges.py— impacttests/test_query_seeds.py— impacttests/test_read_hook.py— impacttests/test_replace_or_append_section.py— impacttests/test_search_hook.py— impacttests/test_skill_auto_refresh.py— impacttests/test_skill_version_warning.py— impacttests/test_truncation_full_answer.py— impacttests/test_uninstall_purge_safety.py— impacttests/test_uninstall_scope.py— impacttests/test_unverified_semantic_shrink.py— impact
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Formal verification
Could not verify: \_install\_opencode\_plugin: a possible difference could NOT be confirmed.
The solver proposed a distinguishing input for \_install\_opencode\_plugin, but re-running both versions on it did NOT reproduce a difference. Treat as unconfirmed, not a behavior change.
Guarantee:
Note: Solver-proposed witness refuted on replay — not a hard failure.
No difference found (not proven): No behavior difference found in \_refresh\_v1\_opencode\_plugins (not a proof).
The verifier ran both versions of \_refresh\_v1\_opencode\_plugins on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
Could not verify: Could not verify \_agents\_install.
The verifier did not have enough to check \_agents\_install, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: all 220 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly NameError — names the real obstacle, not a sampling gap)
No difference found (not proven): No behavior difference found in \_agents\_uninstall (not a proof).
The verifier ran both versions of \_agents\_uninstall on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
No difference found (not proven): No behavior difference found in \_drop\_opencode\_config\_entry (not a proof).
The verifier ran both versions of \_drop\_opencode\_config\_entry on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
No difference found (not proven): No behavior difference found in \_opencode\_config\_names\_plugin (not a proof).
The verifier ran both versions of \_opencode\_config\_names\_plugin on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
No difference found (not proven): No behavior difference found in \_uninstall\_opencode\_plugin (not a proof).
The verifier ran both versions of \_uninstall\_opencode\_plugin on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
Could not verify: Could not verify install.
The verifier did not have enough to check install, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: all 41 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly SystemExit — names the real obstacle, not a sampling gap)
Could not verify: Could not verify uninstall\_all.
The verifier did not have enough to check uninstall\_all, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: no capturable inputs from the test suite; property tier: not verifiable: the input domain has 20 values but only 10 distinct were tested — a small finite domain must be EXHAUSTED, not sampled (an untested input could invert the result)
· 5 more finding(s) on lines outside this diff (see the check run).
Go (#4867/#4868/#4866) and Python (#4773) extractor changes alter per-file AST output and are AST-cached, so one combined _AST_CACHE_SCHEMA bump 30->31 forces stale caches to re-extract. Install (#4770/#4771) and the skill reword (#4721) need no bump. Folded into the unreleased 0.9.99. Each PR omitted its own bump / carried a stale number; the single combined bump lands here. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Landed in v0.9.99, now on PyPI (pip install graphifyy==0.9.99). The global OpenCode plugin is written to ~/.config/opencode with install/uninstall/refresh kept symmetric. Thanks for the fix, @nothariharan. |
What does this PR do?
Fixes #3398. A global (non-
--project)graphify install --platform opencodecalled_install_opencode_plugin(Path(".")), and the helper joined.opencode/plugins/graphify.jsonto that base. The "global" plugin therefore landed in whatever directory the command ran from, and loaded only for that project. The issue explains why swapping the base path alone would not work: OpenCode's global plugin dir is~/.config/opencode/plugins/, with no.opencode/segment.The plugin helpers now take the OpenCode config dir itself, chosen by a new
_opencode_dir():<project>/.opencodefor a project install,~/.config/opencodefor a global one. To keep install and uninstall symmetric:graphify uninstallalso removes the global plugin. Before, the misplaced plugin sat in./.opencode, which uninstall already cleaned.~/.config/opencode, alongside the cwd and home.opencodedirs where older installs wrote..opencode/plugins/graphify.jsentry that older releases wrote intoopencode.jsonis still matched by its old string.The slash-command half of #3398 no longer applies: v8 has no
_install_opencode_command.This takes the same approach as #3459 by @nikhilsaxena04, which now conflicts with v8. This branch is built on current v8, including the auto-refresh and
opencode.jsoncleanup that landed after that PR. The diagnosis is theirs and the issue's.Type of change
Verification & Invariants
Invariant: a global install writes only under the user's config dir, never under the cwd, and a project install writes only under its project.
test_opencode_global_install_writes_plugin_to_config_dir,test_uninstall_all_removes_the_global_opencode_pluginandtest_a_v1_plugin_in_the_global_config_dir_is_rewrittenfail. The project-scope guardtest_opencode_project_install_keeps_plugin_in_projectpasses on both..opencode/stays there. It behaves as a project plugin for that project.How was this tested?
Windows 11, Python 3.12.
Graphify-specific checklist