fix(opencode): time out internal plugin init and config hooks; don't pin plugin version for 0.0.0-dev builds - #46162
Open
CannonRS wants to merge 2 commits into
Open
fix(opencode): time out internal plugin init and config hooks; don't pin plugin version for 0.0.0-dev builds#46162CannonRS wants to merge 2 commits into
CannonRS wants to merge 2 commits into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Related PR found:
No other duplicate PRs addressing the same plugin timeout or version pinning issues were found. The current PR (#46162) is the primary fix for these issues. |
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.
Issue for this PR
Closes #42002
Closes #46161
Type of change
What does this PR do?
Two related plugin-init safety fixes in the opencode package, split into one commit each so they are reviewable on their own:
Commit 1 —
fix(opencode): don't pin plugin version for 0.0.0-dev builds(packages/opencode/src/config/config.ts)When the running opencode binary is a
0.0.0-devbuild, the install of@opencode-ai/plugininto each project config directory was pinned to that exact0.0.0-dev.<commit>version, which is unpublished and not resolvable from the npm registry. The previous code only skipped the pin whenInstallationLocalwas true, so abun runagainst the dev build would fail to install the plugin at startup. The fix extends the existing guard to also skip the pin whenInstallationVersion.startsWith("0.0.0-dev"). Issue #42002.Commit 2 —
fix(opencode): time out internal plugin init and config hooks(packages/opencode/src/plugin/index.ts)internalPlugins(flags)and the per-hookconfig?.(cfg)notification were unbounded async calls. A misbehaving or hung plugin would block the entire plugin layer init forever (or, in the config hook case, silently hang the start-up sequence). This PR adds a 5-secondEffect.timeoutto both call sites, plus a stable per-plugin name (the plugin's ownnameif set, otherwiseinternal-<index+1>) and matchinglogInfostart/finish lines so the existinglogErroron timeout is actionable. The two changes are deliberately in one commit because they share the same debuggability story (a name to log against) and the same timeout scope (per-plugin init or per-hook call, not the layer).Both changes are non-breaking: existing successful plugin inits are unchanged, and timeouts only fire on genuinely stuck plugins, which were already breaking the layer anyway.
How did you verify your code works?
packages/opencode/src/config/config.ts+4/-1packages/opencode/src/plugin/index.ts+11/-5bun typecheckinpackages/opencodepasses (tsgo --noEmitexit 0) afterbun installin the worktree, againstupstream/devheaddc4449df0dplus both commits.config.ts:npmSvc.install(dir, { add: [...] })is the only place that pins@opencode-ai/plugin; the new guard sits next to the existingInstallationLocalcheck.plugin/index.ts:plugin(input)and(hook as any).config?.(cfg)are the only async plugin calls inside the layer; both previously had no timeout and only logged on rejection, not on hang.Screenshots / recordings
N/A — server-side fix, no UI change.
Checklist
bun typecheckinpackages/opencodepasses (tsgo --noEmitexit 0) afterbun installin the worktree, againstupstream/devheaddc4449df0dplus both commits.