Repository navigation
opencode: find the dispatcher wherever the plugin is installed - #229
Open
Have-Purple wants to merge 1 commit into
Open
Have-Purple wants to merge 1 commit into
Have-Purple wants to merge 1 commit into
Conversation
The plugin assumed its launchers sit at <plugin dir>/../scripts. That holds in the checkout,
but not for the copy opencode loads from ~/.config/opencode/plugins, where it resolves to
~/.config/opencode/scripts -- which does not exist. Every hook then failed to spawn, and the
fail-open path answered {}, so there was no fold, no injection, no loop guard, and no log to
notice.
Resolve instead: TE_PLUGIN_ROOT, TE_CORE_PATH (the checkout pointer the bootstrap already
reads), an ancestor walk from the plugin's own directory, and the state-root launcher
(~/.tokeneconomizer/bin/te -> <plugin>/scripts/te). The old expression stays as the last
resort.
Tests assert dispatcher state, not hook-process count: a hook that cannot find
te_bootstrap.py still starts a Python, so counting processes would pass with the bug.
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #228.
Problem
The opencode plugin assumed its launchers live at
<plugin dir>/../scripts:That is true in the checkout, but not for the copy opencode loads from
~/.config/opencode/plugins, where it resolves to~/.config/opencode/scripts— which does not exist. Every hook then failed to spawn its dispatcher, and the fail-open path answered{}, so there was no fold, no injection, no loop guard, and no log entry to notice. Details and repro: #228.Change
Resolve the dispatcher instead of assuming a layout, first hit wins:
TE_PLUGIN_ROOT→<root>/scriptsTE_CORE_PATH→<root>/plugin/scripts(the checkout pointer the bootstrap already documents)scripts,../scripts,../../scripts,plugin/scripts)~/.tokeneconomizer/bin/teisexec '<plugin>/scripts/te' "$@", so its directory is the dispatcher'sThe old expression remains the last resort. No other behaviour changes.
Tests
In
tests/test_opencode_plugin.py(run by the existing opencode CI job):TE_CORE_PATHand writes dispatcher state;libbeside the plugin) still resolves withTE_CORE_PATHunset;The assertion is dispatcher state, not hook-process count: a hook that cannot find
te_bootstrap.pystill starts a Python, which would make a process-count test pass with the bug.Verification
opencode 2.3.0 on Windows; the branch applies cleanly to
main7042ea8. Removing the resolver makes the installed-copy test red while the bundle control stays green. Full offline suite locally: 910 passed, 34 skipped.