GeezerVison is showing github.com — refactor(core): load Console instructions and skills from their own endpoints by adamdotdevin · Pull Request #62507 · anomalyco/opencode
Conversation
adamdotdevin
commented
Nov 7, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
No issue. Replaces #62429 per discussion with Aiden.
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
The Console now serves workspace instructions and skills from their own endpoints (Console PR #6011) instead of a non-standard library key in /api/v2/config. This is the smallest change that points the built-in Console plugin at them. No config schema, @opencode/schema, HTTP API or client type changes.
- In
fetchConfig, after a successful config response, the plugin also GETs /api/v2/instructions and /api/v2/skills with the same credential headers and keeps the two lists next to the config. It uses the same cache entry and refresh cadence as before.
- A 404, or a 403 that isn't the SSO error, counts as an empty list, as does a malformed one. Any other error (a 429, a 5xx, a timeout) fails the load, so the plugin retries and keeps the last lists.
- Skill bundles download from
/api/v2/skills/:slug instead of /api/v2/library/skills/:slug.
library names in the plugin become instruction and skill names (ConsoleSkill, consoleSkills, syncInstructionsAndSkills). The sync and download code is otherwise unchanged.
- Fixes a pre-existing refresh bug that instruction and skill edits now trigger. The managed-deny check compared the layered Console document by identity, but
Config.integration keeps the old object when handed a deep-equal one. So any refresh that changed only the lists read as a deny and wiped both until restart. The check is now isDeepStrictEqual. A deny still withholds them: its policies-only copy never deep-equals the full document.
Config.testLayer now keeps a deep-equal document the way real config does (2 lines), so the regression test can catch this.
Merge after Console's new endpoints are in production: against a Console without them, this build gets empty lists.
How did you verify your code works?
packages/core: bun run script/test.ts test/plugin/provider-opencode.test.ts --rerun-each 10 --randomize: 530 pass, 0 fail. bun typecheck and bun run typecheck:tsc clean.
- Existing tests now serve the two list endpoints and the new bundle path. One new test changes only the instructions between refreshes and checks that both lists stay loaded, then that a 503 keeps them and a 404 clears them. It fails with the old identity check, and with any non-2xx treated as empty.
- Not rerun end to end against the dev Console for this reworked version. An earlier version of this PR was checked there, which is where the refresh bug was found.
Screenshots / recordings
Not a UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found nothing blocking. The new endpoints, ETag/304 revalidation and failure handling look right. Keeping the published document as the same object while it's unchanged correctly fixes the dropped-on-refresh bug, since real Config.integration already keeps deep-equal documents.
How I checked: test/plugin/provider-opencode.test.ts passes (58/58) and tsc -b is clean in packages/core. With the first commit's opencode.ts in place of the fix, the two "only the instructions/skills change" tests and two others fail, and they pass with the fix. I couldn't run it end to end against a Console here.
Public API: unchanged. No config, schema, HTTP API, SDK or plugin API changes; only the Console endpoints the plugin calls.
One deployment note: this build no longer reads library from /api/v2/config. Against a Console that doesn't serve /api/v2/instructions and /api/v2/skills yet, members would see no workspace instructions or skills until it does. That's fine if Console #6011 reaches production before this ships.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The earlier deployment note is addressed: the description now says to merge once Console's new endpoints are in production. The deep-equality check fixes the refresh bug. With the old identity check, the new test fails; with this change it passes. A managed deny still withholds the lists: I checked that the policies-only copy config makes never deep-equals the full document, even for a Console config that has only policies or is empty.
How I checked: test/plugin/provider-opencode.test.ts passes (53/53) and tsc -b is clean in packages/core. I couldn't run it end to end against a Console here.
Public API: unchanged.
One concern (inline): a temporary failure on the list endpoints now clears instructions and skills until the next poll.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
)
|
|
|
.pipe(
|
|
|
Effect.flatMap((response) =>
|
|
|
response.status >= 300
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any status of 300 or above counts as an empty list here, including a 429, a 5xx or a brief Console hiccup. With /api/v2/config still returning 200, one bad poll removes the workspace's instructions and skills mid-session, and the next poll downloads the skills again. Before, they came with the config, so a failed fetch kept them. Could only 404 and a non-SSO 403 mean "none", while other non-2xx responses fail the load? Then SharedCache retries temporary errors and the plugin keeps the last snapshot, the same way it already handles a transport error on these requests.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed: only a 404 or a non-SSO 403 now counts as empty; any other error fails the load, so the plugin retries and keeps the last lists.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
opencodejr[bot] reacted with eyes emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix in pr/head (12eee27) works.
- In
fetchConfig (opencode.ts ~L559–571), a 404 returns empty. A 403 also returns empty when its body isn't the SsoRequired shape. Every other status goes through filterStatusOk, which fails the load, so SharedCache retries and the last lists stay. This includes 429, 5xx and an SSO 403.
- An SSO 403 on a list endpoint shows up as a plain response error, not
SsoRequiredError. That's fine because /api/v2/config makes the same SSO check first.
- A 2xx response with a malformed body still counts as empty. That matches what the PR description says.
- The new test (
provider-opencode.test.ts ~L1628) checks all three cases: an edit, a 503 through the retries, and a 404 clearing both lists.
Verified: I ran bun run script/test.ts test/plugin/provider-opencode.test.ts on a temporary worktree of pr/head: 53 pass, 0 fail. I didn't rerun typecheck or the --rerun-each loop.
Note: the shared repo/ checkout is still on the older commit 776c42a, the version that treats any status ≥300 as empty. I didn't move it. I removed the temporary worktree afterwards, and nothing else changed.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ndpoints
After a successful /api/v2/config response, the OpenCode Console plugin reads /api/v2/instructions and /api/v2/skills with the same credential instead of the non-standard `library` config key, and downloads skill bundles from /api/v2/skills/:slug. A non-2xx list counts as empty. The deny check now compares the layered Console document by content, since config keeps a deep-equal document it already holds, which made an instruction or skill edit wipe both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thread 1 is addressed: only a 404 or a non-SSO 403 now means "no lists", and temporary errors fail the load, so the last lists are kept.
That creates a new problem (inline): the lists load inside fetchConfig, so a failing list endpoint fails the whole Console config. I checked it with a throwaway test. With config returning 200 and a tool.use deny policy, and both list endpoints returning 503 from startup, the Console policies stayed empty after the retries. They appeared only once the lists came back.
How I checked: test/plugin/provider-opencode.test.ts passes (53/53) and tsc -b is clean in packages/core. I couldn't run it end to end against a Console here.
Public API: unchanged.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
Option.isNone(yield* HttpClientResponse.schemaBodyJson(SsoRequired)(response).pipe(Effect.option))
|
|
|
)
|
|
|
return undefined
|
|
|
const ok = yield* HttpClientResponse.filterStatusOk(response)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A failure here now fails the whole fetchConfig, so the Console config's health depends on the list endpoints:
- At startup, with no snapshot yet, a 429 or 5xx on
/api/v2/instructions or /api/v2/skills leaves remote undefined, so the org's policies aren't applied. In a quick check, config returned 200 with a tool.use deny policy and the lists returned 503: consolePolicies stayed [] until the lists recovered.
- Later on, the same outage freezes config and policy changes at the last good version.
Could the lists fail on their own, without taking the config with them? For example, their own SharedCache entries as in the first version, or fetchConfig returning the config with "lists unavailable" so load keeps the previous lists.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Mackery6969
added a commit
to Mackery6969/opencode
that referenced
this pull request
Nov 7, 2026
* refactor(core): load Console instructions and skills from their own endpoints (anomalyco#62507)
* Add Nightly Builds
* Update release.yml
---------
Co-authored-by: Adam <[email protected]>
Mackery6969
added a commit
to Mackery6969/opencode
that referenced
this pull request
Nov 7, 2026
* refactor(core): load Console instructions and skills from their own endpoints (anomalyco#62507)
* Add Nightly Builds
* Update release.yml
* Update nightly-beta.yml
---------
Co-authored-by: Adam <[email protected]>
autonull
pushed a commit
to autonull/opencode_spacegraph
that referenced
this pull request
Nov 7, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|