Repository navigation
fix(core): refresh plugins in background - #45993
Merged
Merged
Conversation
kitlangton
force-pushed
the
plugin-startup
branch
from
August 28, 2026 18:47
b3fb5cb to
01fe533
Compare
kitlangton
force-pushed
the
plugin-startup
branch
from
August 28, 2026 19:31
776908d to
db9ac74
Compare
kitlangton
enabled auto-merge (squash)
August 28, 2026 19:37
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
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.
Why
A fresh server can spend several seconds checking the network before it imports an already-cached plugin. Mutable package refresh runs during repository-marker discovery, so registry or Git latency blocks the initial Location graph and prompt even when a usable installation is available.
What Changes
Automatic updates remain enabled. The already-imported plugin definition stays active in the current process; the next server process imports the refreshed package.
Refresh Boundary
sequenceDiagram participant Startup as Location startup participant Supervisor as Plugin supervisor participant Loader as PluginModule participant Cache as Package cache participant Refresh as Background refresh Startup->>Supervisor: load configured plugins Supervisor->>Loader: load configured plugin Loader->>Cache: resolve cached package Cache-->>Loader: cached entrypoint Loader->>Loader: import and decode plugin Loader-->>Supervisor: plugin definition Supervisor->>Supervisor: activate all plugins Supervisor-)Refresh: start detached refresh Supervisor-->>Startup: open readiness Refresh->>Cache: update cached package Note over Startup,Cache: Next server process imports the updateRepository-marker discovery stays cache-only. The supervisor starts the detached refresh only after all plugin setup has completed, so imports, activation, and readiness do not wait for Arborist or the network.
The regression test blocks plugin setup and verifies that no refresh starts, then blocks the refresh itself and verifies that supervisor flush still completes. It releases both barriers before teardown so no detached test work remains.
Scope
This changes refresh scheduling and treats a successful first install as the service's refresh attempt. It adds no command, configuration, protocol, generated-client surface, or package-cache format.
Verification
The focused Core run passed 55 tests with one existing skip. The complete Core suite passed 3,794 tests with 40 skips and no failures. CLI tests, affected package builds/checks, the documentation build, and all 33 pre-push typecheck tasks passed.
A matched standalone benchmark used the same rebased source and warm package cache, toggling only whether the first package refresh was synchronous or detached: