Skip to content

Commit c9d2281

Browse files
authored
fix(acq-kits): bump opencode kit to OpenCode 2.0.30 (#499)
## 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
1 parent 306906a commit c9d2281

9 files changed

Lines changed: 128 additions & 47 deletions

File tree

‎integrations/isolation/acq-kits/examples/team-kit/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ The OpenCode wiring gives the settings tier global → team → repo: the global
8282
`usai-provider` kit merges into OpenCode's global config path and leaves
8383
`OPENCODE_CONFIG` free for this layer. The rest of the kit is agent-agnostic.
8484
The conventions file reaches the agent through OpenCode's `instructions`
85-
field, which only OpenCode 1.x loads; `scripts/verify` fails when sandbox
86-
shells run 2.x (see "Check against your acq" in the pattern doc).
85+
field, which OpenCode 2.0.0 through 2.0.29 ignore; `scripts/verify` fails
86+
when sandbox shells run one of those (see "Check against your acq" in the
87+
pattern doc).
8788

8889
## What it does not carry, on purpose
8990

‎integrations/isolation/acq-kits/examples/team-kit/TROUBLESHOOTING.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ sandbox runs:
8383
acq exec <sandbox> -- opencode --version
8484
```
8585

86-
OpenCode 2.x accepts `instructions` but never loads the files it lists. See
87-
"Check against your acq" in the pattern doc.
86+
OpenCode 2.0.0 through 2.0.29 accept `instructions` but never load the files it
87+
lists. OpenCode 2.0.30 fixed the behavior. See "Check against your acq" in the
88+
pattern doc.
8889

8990
## A daemon still uses the old team settings
9091

‎integrations/isolation/acq-kits/examples/team-kit/docs/decisions/0001-team-settings-through-opencode-config.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ that variable; a personal kit does not override it.
2525
- Settings tier global → team → repo, with no merge script in this kit.
2626
- `OPENCODE_CONFIG` is single-valued and last-wins across kits, so any later
2727
kit that sets it hides the team settings without a warning.
28-
- The conventions reach the agent through OpenCode's `instructions` field,
29-
which OpenCode 2.x ignores. On an image whose sandbox shells run 2.x, the
30-
team settings still apply but the conventions do not load; `scripts/verify`
31-
fails there.
28+
- The conventions reach the agent through OpenCode's `instructions` field.
29+
OpenCode 2.0.0 through 2.0.29 accepted that field but did not load its files;
30+
OpenCode 2.0.30 fixed the behavior. On an affected image, the team settings
31+
still apply but the conventions do not load; `scripts/verify` fails there.

‎integrations/isolation/acq-kits/examples/team-kit/files/home/team-config/opencode.jsonc‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// wins over it. Prefer keys the global config does not set; do not redeclare
55
// the provider.
66
//
7-
// `instructions` below needs OpenCode 1.x: OpenCode 2.x accepts the field but
8-
// never loads the files it lists ("Check against your acq" in the pattern
9-
// doc). scripts/verify fails when 2.x is what sandbox sessions run.
7+
// `instructions` below needs OpenCode 1.x or 2.0.30+: 2.0.0 through 2.0.29
8+
// accept the field but never load the files it lists ("Check against your
9+
// acq" in the pattern doc). scripts/verify fails when one of those runs.
1010
//
1111
// Deliberately NOT set here:
1212
// - model / small_model. The global provider kit owns them and updates its

‎integrations/isolation/acq-kits/examples/team-kit/scripts/verify‎

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# generated LOWER fixture kit followed by this kit. It then asserts:
1111
# 1. the global layer is intact (USAi merged into OpenCode's global config);
1212
# 2. every live extension-point value in spec.yaml landed, and the OpenCode
13-
# that sandbox shells run is 1.x (2.x ignores `instructions`);
13+
# that sandbox shells run loads `instructions` (2.0.0–2.0.29 do not);
1414
# 3. the lower fixture itself was applied (its own env var, file, and
1515
# startup command landed), so the next checks are not vacuous;
1616
# 4. the composition-table rows it can observe (environment, files[],
@@ -32,6 +32,29 @@
3232

3333
set -uo pipefail
3434

35+
classify_opencode_instructions() {
36+
local version="$1" major minor patch
37+
version="${version#opencode }"
38+
read -r major minor patch <<EOF
39+
$(printf '%s\n' "$version" | sed -n 's/^[^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\([+-].*\)\{0,1\}$/\1 \2 \3/p' | head -n1)
40+
EOF
41+
if [ -z "$major" ]; then
42+
printf 'unreadable\n'
43+
elif [ "$major" = 2 ] && [ "$minor" = 0 ] && [ "$patch" -lt 30 ]; then
44+
printf 'affected\n'
45+
else
46+
printf 'supported\n'
47+
fi
48+
}
49+
50+
# Offline test seam: exercise the production version parser/classifier without
51+
# resolving acq, creating temp state, or starting a sandbox.
52+
if [ "${1:-}" = "--classify-opencode-version" ]; then
53+
[ "$#" -eq 2 ] || { echo "usage: $0 --classify-opencode-version VERSION" >&2; exit 2; }
54+
classify_opencode_instructions "$2"
55+
exit 0
56+
fi
57+
3558
KIT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
3659
KIT_NAME="$(basename "$KIT_DIR")"
3760
SBX_NAME="${KIT_NAME}-verify-$$"
@@ -232,20 +255,22 @@ if printf '%s' "$eff" | grep -q 'team-conventions.md'; then
232255
else
233256
bad "team-conventions.md missing from the effective config instructions"
234257
fi
235-
# Registered is not read: OpenCode 2.x accepts `instructions` but never loads
236-
# the files it lists, so the conventions would silently not reach the agent.
237-
# Check the OpenCode that sandbox shells resolve on PATH: an image that bakes
238-
# 1.x puts it ahead of the agent kit's 2.x, while an image with no OpenCode of
239-
# its own (such as sandbox-templates:shell-docker) runs only 2.x, and this
240-
# fails. Relax it once a 2.x release loads `instructions` files.
258+
# Registered is not read: OpenCode 2.0.0 through 2.0.29 accept `instructions`
259+
# but never load the files it lists, so the conventions would silently not
260+
# reach the agent; 2.0.30 fixed it. Check the OpenCode that sandbox shells
261+
# resolve on PATH: an image that bakes 1.x puts it ahead of the agent kit's
262+
# 2.x, while an image with no OpenCode of its own (such as
263+
# sandbox-templates:shell-docker) runs the kit's 2.x.
241264
oc_version="$(in_sbx 'opencode --version 2>/dev/null' | tail -n1)"
265+
oc_support="$(classify_opencode_instructions "$oc_version")"
242266
oc_version="${oc_version#opencode }"
243-
oc_major="$(printf '%s\n' "$oc_version" | sed -n 's/^[^0-9]*\([0-9][0-9]*\)\..*/\1/p' | head -n1)"
244-
case "$oc_major" in
245-
"") bad "could not read the OpenCode version in the sandbox ('${oc_version:-no output}')" ;;
246-
1) ok "OpenCode $oc_version loads instructions files" ;;
247-
*) bad "OpenCode $oc_version ignores the instructions field: team conventions will not reach the agent (pattern doc, Check against your acq)" ;;
248-
esac
267+
if [ "$oc_support" = unreadable ]; then
268+
bad "could not read the OpenCode version in the sandbox ('${oc_version:-no output}')"
269+
elif [ "$oc_support" = affected ]; then
270+
bad "OpenCode $oc_version ignores the instructions field: team conventions will not reach the agent (pattern doc, Check against your acq)"
271+
else
272+
ok "OpenCode $oc_version loads instructions files"
273+
fi
249274
# The file, not the directory: the global playbook kit creates
250275
# ~/.agents/skills itself, so a directory check would pass without this kit.
251276
# Once you replace the placeholder with real skills, this skips; add a check

‎integrations/isolation/acq-kits/opencode/docs/decisions/opencode-v2-npm-platform-tarballs.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Context
44

5-
OpenCode's upstream repository (`anomalyco/opencode`) now carries git tags
6-
through `v2.0.22`, and the stable v2 CLI is published to npm under the new
5+
When this decision was made, OpenCode's upstream repository
6+
(`anomalyco/opencode`) carried git tags through `v2.0.22`, and the stable v2 CLI is published to npm under the new
77
`@opencode/cli` package. The older `opencode-ai` package remains on the legacy
88
`1.18.x` line, and the `v2.0.x` git tags still do not have matching GitHub
99
Release objects or `opencode-linux-<arch>.tar.gz` release assets.
@@ -25,7 +25,8 @@ platform packages.
2525

2626
## Decision
2727

28-
Pin this kit to `@opencode/cli`'s current stable 2-series version, `2.0.22`, by
28+
Pin this kit to a stable 2-series version of `@opencode/cli` (`2.0.22` at the
29+
time of this decision; the current pin is `OPENCODE_VERSION` in `spec.yaml`) by
2930
fetching the matching `@opencode/cli-linux-<arch>` npm tarball directly from
3031
`registry.npmjs.org`, verifying the tarball SHA-256, and extracting
3132
`package/bin/opencode` without running npm lifecycle scripts. On x64 Linux,
@@ -34,8 +35,7 @@ postinstall selection logic.
3435

3536
## Consequences
3637

37-
- The kit now installs the most recent available stable 2-series OpenCode CLI
38-
while preserving the previous deterministic direct-download/verify/extract
38+
- The kit installs a pinned stable 2-series OpenCode CLI while preserving the previous deterministic direct-download/verify/extract
3939
model.
4040
- The egress allow-list changes from GitHub release hosts to `registry.npmjs.org`.
4141
- The kit intentionally does not run `npm install -g @opencode/cli`: that wrapper

‎integrations/isolation/acq-kits/opencode/spec.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ commands:
9898
- sh
9999
- -c
100100
- |
101-
OPENCODE_VERSION="2.0.22" \
102-
OPENCODE_SHA256_LINUX_X64="65434cbe256f23df397a4941039e5eee28b1a37c1bad5376a5217f583a353583" \
103-
OPENCODE_SHA256_LINUX_X64_BASELINE="acb904a82b570106d40e212061bfe0852900768d4722e7fc998908c086c1cb93" \
104-
OPENCODE_SHA256_LINUX_ARM64="49e5466de60f65001cddd7583419f842140697daead2b4d8826be54d9056e70b" \
101+
OPENCODE_VERSION="2.0.30" \
102+
OPENCODE_SHA256_LINUX_X64="fbbefd86fcd42f03d6253bd1a5a1e532558274679b669f829f3dd921ffa33205" \
103+
OPENCODE_SHA256_LINUX_X64_BASELINE="c32f6fa1164ed09287519252f0c2d52ae356aec6dd5e32522e46c8fecba1bfcc" \
104+
OPENCODE_SHA256_LINUX_ARM64="96ead471c33ad1486c271d40486c438ff44eadabc25c1b65ee1437941e6ec9ce" \
105105
sh /home/agent/opencode-install.sh
106106
107107
# No publishedPorts: opencode is a TUI, not a web UI (same as pi-coding-agent /

‎integrations/isolation/docs/scope-layers.md‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ acq secret set -g <service> --host <host> --env <VAR> # once per machine, host
157157
| Need | Mechanism |
158158
|------|-----------|
159159
| Egress for team hosts (VCS, package mirrors, MCP servers) | `caps.network.allow` (union) |
160-
| Conventions the agent must follow across the team's repos | A markdown file under `files/`, registered in the agent's instructions path (OpenCode: an `instructions` entry in a team config file). OpenCode 2.x does not load `instructions` files (see [Check against your acq](#check-against-your-acq)). |
160+
| Conventions the agent must follow across the team's repos | A markdown file under `files/`, registered in the agent's instructions path (OpenCode: an `instructions` entry in a team config file). OpenCode 2.0.0 through 2.0.29 do not load `instructions` files (see [Check against your acq](#check-against-your-acq)). |
161161
| Team agent settings that override the global defaults | Ship a config file and point the agent's config env var at it (OpenCode: `OPENCODE_CONFIG` in `environment`), giving the tier global → team → repo. Never pin `model` / `small_model` there, and never add an `allow` rule that overrides a global ask or deny (see the gotchas). |
162162
| Team TUI settings (OpenCode theme, keybinds) | A separate `tui.jsonc`, with `OPENCODE_TUI_CONFIG` pointing at it: OpenCode drops `theme` / `keybinds` / `tui` from `opencode.json(c)` on load. The variable is single-valued, so say in the team README whether a personal kit may override it. |
163163
| Gating a team CLI (for example the VCS CLI) | Permission rules in the team config, in the same default-allow posture as the global kit: reads fall through to its `"*": "allow"`; `ask` before anything that posts or opens a merge request; `deny` merge and approve, pipeline runs, CI variables, destructive admin commands, and the `api` subcommand's write flags and GraphQL. Any write verb you do not list stays allowed, so review your CLI's close, edit, delete, label, release, and CI retry verbs. Rules match the whole command text, so write each from the exact command prefix and see the gotchas. The team-kit template's `opencode.jsonc` sketches the shape. |
@@ -213,7 +213,7 @@ global layer does.
213213
| Terminfo for your terminal | Ship the *source* (`infocmp -x`) and compile it in a startup step (`tic -x`) |
214214
| Git preferences | One startup command per key, or ship a file and add it with `include.path` |
215215
| Overriding a team setting | `environment` (last wins) or a later file at the same path (last wins) — deliberately, and only for settings the team marks as personal |
216-
| Your own agent instructions (OpenCode) | A file under `files/`, added through `OPENCODE_CONFIG_CONTENT` in `environment`, for example `{"instructions":["/home/agent/personal/instructions.md"]}`. Do not append to the global rules file: the playbook kit symlinks `~/.config/opencode/AGENTS.md` and `~/.claude/CLAUDE.md` into its managed checkout, so an append edits that checkout. In a local test on OpenCode 1.18, the `instructions` lists combine in order (global, then team through `OPENCODE_CONFIG`, then this one); OpenCode's docs do not say how lists merge, and OpenCode 2.x does not load `instructions` files (see [Check against your acq](#check-against-your-acq)). Put nothing else in it: inline config loads after the repo's own config, so any other key overrides the repo. The variable is single-valued (last kit wins). |
216+
| Your own agent instructions (OpenCode) | A file under `files/`, added through `OPENCODE_CONFIG_CONTENT` in `environment`, for example `{"instructions":["/home/agent/personal/instructions.md"]}`. Do not append to the global rules file: the playbook kit symlinks `~/.config/opencode/AGENTS.md` and `~/.claude/CLAUDE.md` into its managed checkout, so an append edits that checkout. In a local test on OpenCode 1.18, the `instructions` lists combine in order (global, then team through `OPENCODE_CONFIG`, then this one); OpenCode's docs do not say how lists merge, and OpenCode 2.0.0 through 2.0.29 do not load `instructions` files (see [Check against your acq](#check-against-your-acq)). Put nothing else in it: inline config loads after the repo's own config, so any other key overrides the repo. The variable is single-valued (last kit wins). |
217217
| Extra egress for your tools | `caps.network.allow` (union) |
218218

219219
### Neither
@@ -353,18 +353,19 @@ date.
353353
- **Flow-style argv.** `command: [git, config, --global, alias.st, status]`
354354
parses as an empty argv, runs nothing, and passes `acq kit validate`. Write
355355
argv as a block list, one `- arg` per line, or a single `- |` block scalar.
356-
- **OpenCode 2.x ignores `instructions`.** OpenCode 2.x accepts the
357-
`instructions` config field but never loads the files it lists, so team
358-
conventions and personal instructions delivered that way silently do not
359-
reach the agent. The global `~/.config/opencode/AGENTS.md` still loads.
360-
Which OpenCode runs depends on the image. The agent kit installs 2.x, but an
361-
image that bakes OpenCode 1.x puts it earlier on `PATH`, so 1.x runs and the
362-
files load: `acq`'s own template image for `acq run opencode`
363-
(`sandbox-templates:opencode-docker`) and this repo's `devenv-opencode` both
364-
do. An image with no OpenCode of its own, such as
365-
`sandbox-templates:shell-docker`, runs only the kit's 2.x, and the files
366-
are ignored. Check with `acq exec <sandbox> -- opencode --version`; the
367-
team-kit template's `scripts/verify` fails when 2.x runs.
356+
- **OpenCode 2.0.0 through 2.0.29 ignore `instructions`.** Those releases
357+
accept the `instructions` config field but never load the files it lists,
358+
so team conventions and personal instructions delivered that way silently
359+
do not reach the agent. The global `~/.config/opencode/AGENTS.md` still
360+
loads. OpenCode 2.0.30 fixed it, and 1.x was never affected. Which OpenCode
361+
runs depends on the image. The agent kit installs 2.x, but an image that
362+
bakes OpenCode 1.x puts it earlier on `PATH`, so 1.x runs: `acq`'s own
363+
template image for `acq run opencode` (`sandbox-templates:opencode-docker`)
364+
and this repo's `devenv-opencode` both do. An image with no OpenCode of its
365+
own, such as `sandbox-templates:shell-docker`, runs the kit's 2.x, so the
366+
files load only if the kit your `acq` applies pins 2.0.30 or later. Check
367+
with `acq exec <sandbox> -- opencode --version`; the team-kit template's
368+
`scripts/verify` fails when an affected version runs.
368369
- **Empty files and failed drops (msb).** msb checks each file drop with
369370
`test -s`, so a zero-byte payload never counts as placed. A failed drop
370371
stops the rest of that kit's apply: the files placed before it stay, but
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""Regression coverage for the team-kit OpenCode instructions boundary."""
2+
3+
from __future__ import annotations
4+
5+
import subprocess
6+
from pathlib import Path
7+
8+
import pytest
9+
10+
ROOT = Path(__file__).resolve().parents[2]
11+
VERIFY = ROOT / "integrations/isolation/acq-kits/examples/team-kit/scripts/verify"
12+
13+
14+
@pytest.mark.parametrize(
15+
("version", "expected"),
16+
[
17+
("1.19.0", "supported"),
18+
("opencode 1.18.32", "supported"),
19+
("2.0.0", "affected"),
20+
("2.0.29", "affected"),
21+
("2.0.30", "supported"),
22+
("2.1.0", "supported"),
23+
("v2.0.30+build.1", "supported"),
24+
("", "unreadable"),
25+
("not-a-version", "unreadable"),
26+
("2.0", "unreadable"),
27+
("2.0.30junk", "unreadable"),
28+
],
29+
)
30+
def test_opencode_instructions_version_boundary(version: str, expected: str) -> None:
31+
result = subprocess.run(
32+
["bash", str(VERIFY), "--classify-opencode-version", version],
33+
cwd=ROOT,
34+
check=False,
35+
capture_output=True,
36+
text=True,
37+
timeout=10,
38+
)
39+
assert result.returncode == 0, result.stderr
40+
assert result.stdout.strip() == expected
41+
42+
43+
def test_classifier_requires_exactly_one_version_argument() -> None:
44+
result = subprocess.run(
45+
["bash", str(VERIFY), "--classify-opencode-version"],
46+
cwd=ROOT,
47+
check=False,
48+
capture_output=True,
49+
text=True,
50+
timeout=10,
51+
)
52+
assert result.returncode == 2
53+
assert "usage:" in result.stderr

0 commit comments

Comments
 (0)