GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): load configured instructions by neriousy · Pull Request #55539 · anomalyco/opencode

Conversation

@neriousy

@neriousy neriousy commented Oct 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Issue for this PR

Closes #51341
Closes #55345

Supersedes #51422 (thanks @vegerot, this builds on that PR and keeps you as co-author).

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

V2 still accepts the instructions config field but never loads it. The V1 resolver wasn't ported. This adds a configured source to ConfigInstructionPlugin next to the global and project AGENTS.md sources. It handles relative globs, ~/ paths, absolute paths and HTTP(S) URLs, with the same resolution rules as V1.

Changes from #51422:

  • A bad URL no longer blocks sessions. In fix(core): resolve configured instructions #51422, a 404 or timeout made the whole instruction source unavailable, AGENTS.md included. New sessions then failed with InitializationBlocked. Now a failed fetch logs a warning and keeps the last good copy, or skips the URL if it never loaded.
  • URLs are fetched when config loads, not on every rescan. They're fetched concurrently (up to 4) and cached. Saving an AGENTS.md no longer refetches every URL while holding the lock.
  • Relative patterns stay within the project. They search upward from the workspace to the project root only when project discovery applies. With OPENCODE_DISABLE_PROJECT_CONFIG, or when the workspace is outside the project, they resolve against the global config dir, as V1 did. Before, they could search every ancestor directory up to /.
  • Watches for configured files are reconciled on each refresh, so files removed from config stop being watched.
  • The config.updated subscription starts before the first config read, so an update that lands in between isn't lost.

InstructionDiscovery.File.path is now a plain string so a URL can be its identity. This only loosens the type, so stored values still decode.

The plugin now runs even when project and global discovery are both off (vanilla instances). Per the comment in instance.ts, a config value that explicitly names a file is a request, not discovery.

How did you verify your code works?

  • bun test test/instruction-discovery.test.ts in packages/core. Two new tests: one loads every entry type next to AGENTS.md, with an unreachable URL and a missing file skipped, and checks that rescans don't refetch URLs. The other reloads on config.updated and keeps the last fetched URL when a refetch fails.
  • bun test test/instance-vanilla.test.ts test/config test/session-generate.test.ts in packages/core
  • bun run check at the repo root
  • bun typecheck, bun run check:generated and bun run build in services/www

Screenshots / recordings

Not applicable; no 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.

vegerot and ntcho reacted with heart emoji
All reactions
  • ❤️ 2 reactions
Filip Hejmowski @vegerot
fix(core): load configured instructions
11e0279
Restores the V1 instructions config field in V2: local files, relative globs, ~/ and absolute paths, and HTTP(S) URLs load alongside AGENTS.md. Unreachable URLs are skipped instead of blocking new sessions.

Supersedes #51422.

Co-authored-by: vegerot <[email protected]>
opencode-agent[bot]
opencode-agent Bot reviewed Oct 14, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Looks sound. On the base branch, files listed in instructions (a plain path and a glob) never reached the model request. With this PR they do, alongside AGENTS.md; I checked this end to end with the simulated model. The instruction-discovery, vanilla-instance, config and session tests all pass, and packages/core type-checks cleanly.

Public API: the config schema is unchanged. The existing instructions key now takes effect, which is backwards compatible. InstructionDiscovery.File.path going from AbsolutePath to string only loosens an internal type, isn't exposed over HTTP, and existing stored values still decode.

No blocking concerns: failed fetches and globs only skip their own entry, watches on configured files are reconciled without leaking, and the new tests use a faked HTTP client rather than the real network.

Related: #47879

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Filip Hejmowski added 2 commits October 14, 2026 23:39
Filip Hejmowski
test(core): consolidate configured instruction tests
6fe042f
Filip Hejmowski
refactor(core): address configured instruction review notes
88dc950
@neriousy

neriousy commented Oct 14, 2026

Copy link
Copy Markdown
Member Author
image
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@neriousy
neriousy merged commit 1e63a3b into dev Oct 14, 2026
11 of 14 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@neriousy
neriousy deleted the config-instructions branch October 14, 2026 22:34
@neriousy neriousy mentioned this pull request Oct 14, 2026
fix(core): resolve configured instructions #51422
Closed
4 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
📊 AI CLI 工具社区动态日报 2026-10-15 litang9/big_model_radar#551
Open
@rekram1-node rekram1-node mentioned this pull request Oct 14, 2026
promote dev -> prod #55564
Merged
@kelos-bot kelos-bot Bot mentioned this pull request Oct 15, 2026
[kanon-fake-strategist] Render hooks per agent capability and add OpenCode hook support kelos-dev/kanon#100
Open
@opencode-agent opencode-agent Bot mentioned this pull request Oct 15, 2026
config: instructions entries are still never loaded in v2.0.29 #55734
Closed
This was referenced Oct 15, 2026
OpenCode v2 ignores config instructions (usai-provider list, scope-layers doc, team-kit template) GSA-TTS/agentic-coding-patterns#482
Open
fix(acq-kits): bump opencode kit to OpenCode 2.0.30 GSA-TTS/agentic-coding-patterns#499
Merged
basiliskus added a commit to GSA-TTS/agentic-coding-patterns that referenced this pull request Oct 17, 2026
@basiliskus
fix(acq-kits): bump opencode kit to OpenCode 2.0.30 (#499)
c9d2281
## Summary

Bumps the `opencode` acq kit from OpenCode 2.0.22 to 2.0.30, the first
release that loads config `instructions` again (upstream
anomalyco/opencode#55539). Only `spec.yaml` changes: the version and the
three Linux SHA-256 pins.

## Verification

- Hashes computed from the npm tarballs; each matches npm's published
sha512 integrity.
- `make validate`, `validate-kits.py --strict`, and `acq kit validate`
pass.
- Live `RUN_ACQ=1` kit verify (msb 0.7.8, acq 4.0.2,
`devenv-shell:2.0.0`): 23 passed, 0 failed, with 2.0.30 installed.
- An `OPENCODE_CONFIG` probe confirmed 2.0.30 loads `instructions`; the
control without the config returned `NONE`.

## Eligibility & Accountability

- [x] I am a **federal employee or contractor** (PRs merge with
`@GSA-TTS/agentic-coding-team` code-owner approval; eligibility is
attested here, not authenticated).
- [x] **I understand this change and can explain it in my own words** —
I am the author of record and accountable for it.
- [x] By opening this PR, I **attest I have the right to release this
work** under the repository's CC0-1.0 dedication.

## AI Assistance Disclosure

- [x] AI tools were used in this contribution.
- [x] I verified all AI-generated content.

Relates to #482
@dyoshikawa dyoshikawa mentioned this pull request Oct 18, 2026
Follow up OpenCode upstream updates: notification/permissionDenied hook mappings, references key, V2 beta tracking dyoshikawa/rulesync#2592
Closed
@reachjalil reachjalil mentioned this pull request Oct 23, 2026
fix(server): load configured instruction files from the first turn on v2 different-ai/openwork#6442
Merged
reachjalil added a commit to different-ai/openwork that referenced this pull request Oct 23, 2026
@reachjalil
fix(server): load configured instruction files from the first turn on…
a552c26
… v2 (#6442)

* fix(server): load configured instruction files from the first turn on v2

OpenCode 2.0.26 accepts the `instructions` array in opencode.json but never
reads it; only AGENTS.md files are discovered. A rules file listed there
reached the model only by accident, when the agent happened to read a file
next to an AGENTS.md, and any other file name never loaded at all.
OpenCode 2.0.30 loads the array itself (anomalyco/opencode#55539).

Until the engine pin moves, the server reads the workspace config's
`instructions` entries before each turn and writes the matching files as a
second session instruction entry next to OpenWork's own, so they are present
from the first turn and updated when they change.

- Only files inside the workspace are loaded (symlinks resolved); URLs,
  `~/` and absolute paths outside it are left for the engine.
- Under Bun the match uses Bun.Glob with dot files, since Bun's node:fs glob
  never matches paths such as `.opencode/AGENTS.md`.
- Clients cannot write the entry, as with `openwork.context`; it is capped below
  the engine's entry size limit, and its sync never blocks a turn.
- Once the pin is no longer 2.0.26 the server only deletes the entry.

Signed-off-by: Jalil <[email protected]>

* fix(server): only send shared instruction documents from workspace config

A workspace's opencode.json can come from someone else, such as a cloned
repository. Listing a local secret like `.env` under `instructions` would
have sent its contents to the model without the reader ever opening it.

Configured instructions now load only files that are part of the workspace
and are instruction documents:

- Markdown or text files (`.md`, `.mdc`, `.markdown`, `.txt`), judged by both
  a link's name and its target.
- Never a file the engine asks about before any agent reads it (`*.env`,
  `*.env.*`, `.env.example` aside).
- Never a file git ignores, checked with one `git check-ignore --stdin` call.
  Outside a repository there are no ignore rules; if git cannot read a
  checkout, nothing is synced.

Signed-off-by: Jalil <[email protected]>

---------

Signed-off-by: Jalil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

instructions array in opencode.json not injected in v2.0.28 — worked in v1.19.0 config: instructions field does not load instruction files (v2.0.16)

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@neriousy
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.