GeezerVison is showing github.com — fix(core): load configured instructions by neriousy · Pull Request #55539 · anomalyco/opencode
Conversation
neriousy
commented
Oct 14, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
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]>
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.
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.
This was referenced Oct 15, 2026
basiliskus
added a commit
to GSA-TTS/agentic-coding-patterns
that referenced
this pull request
Oct 17, 2026
## 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
reachjalil
added a commit
to different-ai/openwork
that referenced
this pull request
Oct 23, 2026
… 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]>
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|