Skip to content

fix(core): resolve configured instructions - #51422

Closed
vegerot wants to merge 1 commit into
anomalyco:devfrom
vegerot:fix-config-instructions
Closed

vegerot wants to merge 1 commit into
anomalyco:devfrom
vegerot:fix-config-instructions

Conversation

@vegerot

@vegerot vegerot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #51341
Closes #51262
Closes #55345

Type of change

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

What does this PR do?

V2 retained the instructions config field but never ported its resolver from the legacy runtime. This restores configured local files, relative globs, ~/ and absolute paths, and HTTP(S) URLs. Sources join discovered AGENTS.md instructions and refresh when their file or config changes.

How did you verify your code works?

  • bun test test/instruction-discovery.test.ts and bun typecheck in packages/core
  • bun run check at the repository root
  • bun run check:generated and bun run build in services/www

Screenshots / recordings

Not applicable; there is no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Co-Authored-By: OpenCode (GPT-5.6-Sol) [email protected]

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Sep 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@vegerot

vegerot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor Author

cc @kitlangton

tl;dr: OpenCode v2 accidentally deleted a feature from v1 without mentioning it anywhere, leading me to assume this is a bug.

(specifically, I think the doc saying "the config supports instructions but it's not respected" leads me to think this was some AI ad-hoc rationalizing about a deleted feature. It doesn't make any sense.)

@vegerot

vegerot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

cc @rekram1-node would you please take a look at this when you have time? It restores V2’s instructions config optoin, which appears to have been dropped accidentally during the V1-to-V2 port.

@johankrijt

Copy link
Copy Markdown

Need this fixed as well! It currently breaks our org distributed default instructions, one of many reasons to be using a tool like OpenCode.

@vegerot
vegerot force-pushed the fix-config-instructions branch from 62ab210 to a276e6f Compare October 6, 2026 01:41
@vegerot
vegerot changed the base branch from v2 to dev October 6, 2026 01:41
@vegerot
vegerot changed the base branch from dev to v2 October 6, 2026 01:41
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:issue labels Oct 6, 2026
@vegerot
vegerot force-pushed the fix-config-instructions branch from a276e6f to 8227111 Compare October 6, 2026 01:44
@vegerot
vegerot changed the base branch from v2 to dev October 6, 2026 01:44
@vegerot
vegerot changed the base branch from dev to v2 October 6, 2026 01:44
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

2 similar comments
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@vegerot

vegerot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Sorry for pinging again @rekram1-node . Thanks for merging a recent PR of mine. Would you please take a look at this too?

tl;dr: OpenCode v2 accidentally deleted a feature from v1 without mentioning it anywhere.

@ntcho

ntcho commented Oct 8, 2026

Copy link
Copy Markdown

This is a huge regression from v1, looking forward for this to be merged into v2!

@sayan1999

Copy link
Copy Markdown

This is a very necessary PR for this regression, should be looked into and merged.

wz-gsa pushed a commit to GSA-TTS/agentic-coding-patterns that referenced this pull request Oct 10, 2026
…#441)

## Summary

Adds `integrations/isolation/docs/scope-layers.md`: how global, team,
and personal `acq` kits stack through `ACQ_EXTRA_KITS`, a per-field
composition table, what belongs in each layer, authoring gotchas, one
list of backend differences, and the parser rules to check against your
`acq`.
Adds the copy-and-rename template `acq-kits/examples/team-kit/`: a valid
hybrid/v1 mixin with one live, harmless value per extension point, a
host-side `env.sh`, a sample ADR, README, TROUBLESHOOTING, and a
`scripts/verify` that asserts the composition live.
Second of three stacked PRs for #421:
#476, then this one, then the
`personal-kit` template.

**Reviewer ask: correct the composition table if any field composes
differently than described**, especially the rows marked "sbx: composed
natively". It was checked against acq v4.0.1
(GSA-TTS/agentic-coding-quickstart `1679530`), which includes the
`environment` and `publishedPorts[]` fixes
(GSA-TTS/agentic-coding-quickstart#519,
GSA-TTS/agentic-coding-quickstart#526) and adds the pinned OpenCode
agent kit between the global and team layers. The `volumes[]` and
`commands[]` rows describe current behavior while the stacked-kit
conflict rule is decided in GSA-TTS/agentic-coding-quickstart#533, which
names this PR as its trigger.

## 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). *Anyone may open issues without
this.*
- [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](../LICENSE) dedication.

## AI Assistance Disclosure

- [x] AI tools were used in this contribution.
- [x] I verified all AI-generated content: no fabricated/hallucinated
APIs, dependencies, citations, or placeholder content; any AI-suggested
dependency was confirmed to exist.
- [x] Any inherited/reused third-party material retains its original
license and is identified (not represented as public domain).

## Type of Change

- [x] New tool/editor integration (`integrations/`)
- [x] Documentation update

## Motivation

Every team adopting `acq` builds the same team layer between the global
kits and each repo's agent config, then a personal layer on top.
`ACQ_EXTRA_KITS` supports this, but nothing here said how stacked kits
compose, what belongs in each layer, or gave a validated starting point.
login.gov Team Data runs such a kit in production; this generalizes what
that team learned.

Parser and adapter defects the doc works around, stated once under
"Check against your acq" and filed upstream:

- a trailing `# comment` is kept in top-level fields and in
`commands[]`, where it skips the command or changes an argument
(GSA-TTS/agentic-coding-quickstart#558);
- `environment` values are cut at the first `#`, even inside quotes
(GSA-TTS/agentic-coding-quickstart#559);
- `acq kit validate` passes commands the translator skips or empties
(GSA-TTS/agentic-coding-quickstart#563);
- flow-style argv parses as an empty command
(GSA-TTS/agentic-coding-quickstart#560);
- on msb an empty file fails its drop, and a failed drop stops that
kit's `environment` and `commands[]`
(GSA-TTS/agentic-coding-quickstart#561).

OpenCode 2.x never loads `instructions` files (anomalyco/opencode#51341,
fix in anomalyco/opencode#51422, tracked in
#482), and the template delivers team
conventions that way. Which OpenCode runs depends on the image: the
agent kit installs 2.0.22, but an image that bakes 1.x puts it first on
`PATH`. Checked live on msb 0.7.7 with acq v4.0.1: acq's own template
image for `acq run opencode` (`sandbox-templates:opencode-docker`) runs
1.18.32 and `devenv-opencode:1.0.0` runs 1.18.23, so the conventions
load; `sandbox-templates:shell-docker` has no OpenCode of its own and
runs only 2.0.22, so they are ignored. `scripts/verify` now fails when
2.x is what runs, and did on `shell-docker`. The doc states this in
prose, and the permission sketch follows the global kit's default-allow
posture (ask before posting, deny merge/approve, pipeline runs, CI
variables, and API writes).

Not shipped: an optional `tui.jsonc` with `OPENCODE_TUI_CONFIG`. TUI
settings are mostly personal, a personal kit would replace the team file
whole, and `verify` could assert only that the variable and file exist.

## Testing

- [x] Ran `make validate` locally (all checks pass)
- [x] Ran `make test` (if applicable): 448 passed;
`scripts/tests/test_validate_kits_*.py`: 95 passed
- [x] Tested with at least one real scenario:
`examples/team-kit/scripts/verify` on msb 0.7.7 with acq v4.0.1: 20
passed, 0 failed, 1 skipped (the empty TEAM-SPECIFIC section). Not
re-run on sbx for this revision (the host's sbx session needed `sbx
login`); the doc no longer claims sbx observations.
- [x] Examples are concrete and realistic
- [x] Commit messages follow [Conventional
Commits](https://www.conventionalcommits.org/) format

Also run: `validate-kits.py --strict`, `acq kit validate` on the
template, `ruff check scripts/`, `ruff format --check scripts/`, `make
generate-check`, markdownlint, `shellcheck -s sh env.sh`, and `env.sh`
under sh, bash, zsh, and dash.

## Safety Checklist

- [x] No secrets, API keys, tokens, or passwords included
- [x] No PII (names, emails, SSNs, addresses)
- [x] No CUI (Controlled Unclassified Information)
- [x] No internal URLs, hostnames, or system paths (the reference
implementation is named, not linked; examples use
`example.gov`/`example.org`)
- [x] No customer data or proprietary information
- [x] Pattern defines `prohibited_content` in output contract (if
applicable): not applicable, no SKILL.md pattern

## Quality Checklist

- [x] Plain language used (Grade 10 or below preferred)
- [x] Examples included
- [x] Prerequisites clearly stated

## Validation Results

```
make validate
✓ All validators passed
```

## Related Issues

Relates to #421 (followed by the
`personal-kit` template)
Depends on #476 (placement B)
Relates to GSA-TTS/agentic-coding-quickstart#533 (stacked-kit merge
rules for volumes and startup steps)
Relates to GSA-TTS/agentic-coding-quickstart#517 (symlinked `files[]`
sources on msb)
Relates to GSA-TTS/agentic-coding-quickstart#482 (acq's `~/.rc.d` login
hook; the personal-kit row relies on it)
Relates to #482 (OpenCode 2.x ignores
`instructions`)
Relates to GSA-TTS/agentic-coding-quickstart#557 (`acq configure` and
team kits), GSA-TTS/agentic-coding-quickstart#558,
GSA-TTS/agentic-coding-quickstart#559,
GSA-TTS/agentic-coding-quickstart#560,
GSA-TTS/agentic-coding-quickstart#561,
GSA-TTS/agentic-coding-quickstart#562,
GSA-TTS/agentic-coding-quickstart#563 (filed from this work)
Relates to GSA-TTS/agentic-coding-quickstart#500,
GSA-TTS/agentic-coding-quickstart#509,
GSA-TTS/agentic-coding-quickstart#519,
GSA-TTS/agentic-coding-quickstart#526

## Additional Context

- `scripts/verify` cannot run in this repo's CI (no nested sandboxes);
the offline gate is `validate-kits.py`.
- The template README links the pattern doc through the repository root
with the file path as text: a copied kit cannot follow relative links,
and `blob/main/…` links to files added here would fail link-check until
merge.

## Reviewer Notes

**Reviewers should verify:**

- [ ] The composition table matches acq's behavior on msb, and the rows
marked "sbx: composed natively" describe sbx correctly
- [ ] Backend differences and Check against your acq match what you see
on your acq
- [ ] Safety checklist items confirmed
- [ ] `make validate` passes in CI
@thdxr
thdxr changed the base branch from v2 to dev October 10, 2026 19:18
@soar

soar commented Oct 11, 2026

Copy link
Copy Markdown

So, what is going on here? Should this be merged? It is definitely a bug.

### Issue for this PR

Closes anomalyco#51341
Closes anomalyco#51262

### Type of change

- [x] Bug fix
- [ ] New feature
- [ ] Refactor / code improvement
- [x] Documentation

### What does this PR do?

V2 retained the `instructions` config field but never ported its resolver from the legacy runtime. This restores configured local files, relative globs, `~/` and absolute paths, and HTTP(S) URLs. Sources join discovered `AGENTS.md` instructions and refresh when their file or config changes.

### How did you verify your code works?

- `bun test test/instruction-discovery.test.ts` and `bun typecheck` in `packages/core`
- `bun run check` at the repository root
- `bun run check:generated` and `bun run build` in `services/www`

### Screenshots / recordings

Not applicable; there is no UI change.

### Checklist

- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR

Co-Authored-By: OpenCode (GPT-5.6-Sol) <[email protected]>
@vegerot
vegerot force-pushed the fix-config-instructions branch from 8227111 to 3e6f389 Compare October 14, 2026 20:56
@vegerot

vegerot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

cc @neriousy tl;dr: OpenCode v2 accidentally deleted a feature from v1 without mentioning it anywhere.

There's been several Issues with lots of activity on them reporting this. lmk what I can do to help get this merged! 🙏🏼

neriousy pushed a commit that referenced this pull request Oct 14, 2026
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]>
@neriousy neriousy mentioned this pull request Oct 14, 2026
4 of 6 tasks
@neriousy

neriousy commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

added in #55539

thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

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) v2: config instructions entries are never loaded (only AGENTS.md scanned)

6 participants