ci probe (will delete) - #3
Closed
wi-kshitij-nagvekar wants to merge 6 commits into
Closed
wi-kshitij-nagvekar wants to merge 6 commits into
wi-kshitij-nagvekar wants to merge 6 commits into
Conversation
Long-running Agents cache discovered skills at instance start, so updating the cloned files on disk is invisible to a running OpenCode server. Skills could not be kept in sync at all: Git contexts had a sync option, skill sources did not. Add sync to GitSkillSource, reusing the existing GitSync type so the field shape matches Git contexts. Skills default to a 15m interval rather than the 5m used for contexts, because each applied change triggers a server instance reload and skill catalogs change less often. Add reload to GitSync for contexts to opt into the same re-scan behavior. Skill sources always reload when syncing, since re-scanning is the point. Rollout is rejected for skills: it needs the controller to compare remote refs, which is not implemented for authenticated repositories, and would otherwise be a silently ineffective option.
Populate the sync fields for skill sources in processSkills, mirroring the existing Git context handling, and mark skill mounts as needing a server re-scan after an update. Pass OPENCODE_RELOAD_URL to git-sync sidecars whose mount requests a reload, pointing at the agent's own server over loopback. Only Agent servers get it: Task pods are ephemeral and never build git-sync sidecars, so the reload concept does not apply there.
When a reload is requested, the sidecar asks the server to re-scan its configuration so updated skills take effect without a Pod restart. Disposal releases the whole server instance, so it must not run during an active turn: doing so aborts the user's work (verified: the assistant message ends with MessageAbortedError). The sidecar therefore checks session activity and defers the reload while any session is busy, retrying every cycle. The "server is behind" condition is persisted on the shared volume as the commit hash the server last scanned. In-memory tracking was not enough: a restarted sidecar would see an unchanged remote, conclude there was nothing to do, and leave the server stale until the repository changed again.
Unit tests for the reload path against a fake OpenCode server: idle disposes, busy refuses to dispose, disposal and status failures propagate, and malformed status payloads fail closed rather than being read as idle. Cover processSkills sync propagation (including the 15m default and implicit reload for skills), the sidecar reload env gating, and the server wiring that points the sidecar at the agent's own port. The server test uses a non-default port so a hardcoded URL would fail.
Document why file sync alone cannot update skills in a running Agent (OpenCode caches discovery at instance start) and how to enable the reload. Add ADR 0043 recording the mechanism, the measured reload cost, and the constraints: the idle gate that prevents aborting an active turn, the persisted state that survives a sidecar restart, the names-filtering limitation, and why plugins are out of scope.
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.
throwaway