You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eef0525
Browse filesBrowse the repository at this point in the historyBrowse files
## What
Correct the OpenCode capability strategy declaration for issue sipyourdrink-ltd#3676.
## Why
The source matrix currently uses the default `AdapterStrategy()`, which
renders OpenCode as:
`unsupported | unsupported | text-signals`
That contradicts the adapter's current OpenCode invocation and the
upstream capabilities verified in version 1.18.16.
## How
Declare OpenCode with the same capability axes as Claude:
- resume: `flag`
- dangerous mode: `cli-flag`
- event channel: `stream-json`
The generated documentation remains unchanged because it is derived from
this source matrix.
This PR intentionally does not implement NDJSON consumption, explicit
permission configuration, or session resume wiring; those remain
separate follow-up changes as requested in the issue.
## Verification
The change is limited to the authoritative strategy matrix in
`src/bernstein/adapters/_contract.py`. The contract renderer/drift check
should now resolve OpenCode to the declared values.
Local test commands were not run in this environment.
---
## Update from the maintainers
The declaration above is correct on the resume and dangerous-mode axes,
and the
decomposition in the original description is what made the rest
briefable. The
remaining wiring has been pushed to this branch so the two halves land
together
rather than leaving the matrix describing something the adapter does not
do.
Added on top of the original commit:
- **Permission posture is pinned per spawn.** Every spawn carries an
explicit
`OPENCODE_PERMISSION` policy derived from the declared dangerous-mode
strategy — escalated alongside `--auto` when it permits unattended
action, a
deny policy when it does not — applied after the environment allow-list
so the
pinned policy is what the worker sees rather than the host's. Neither
direction resolves to `ask`, which blocks a headless run indefinitely
against
upstream `anomalyco/opencode#36762`.
- **`--continue` backs the resume axis.** The adapter opts into the
continuation
path, so the warm retry `checkpoint_retry_capability` already derives
from
`resume=flag` is backed by a flag the adapter passes. The per-task
worktree
makes "the prior session here" unambiguous.
- **Command construction moved into `_build_command`**, so the argv is
assertable without mocking subprocess. The matrix row, the capability
profile
and the pinned contract move together.
- **`event_channel` stays `text-signals`.** The CLI does emit NDJSON
under
`--format json`, but nothing consumes it yet, and declaring a channel no
parser reads would claim a surface that does not exist.
Tests: `tests/unit/test_adapter_opencode.py` asserts the escalated flag,
the
restricted policy, that a host `OPENCODE_PERMISSION` never reaches the
worker,
and that the continuation flag lands in the constructed command — each
failing
against the previous adapter.
`tests/unit/adapters/test_capability_enums.py`
pins the derivation from the resume axis to the retry surface so the
declaration
and the implementation cannot drift apart again.
Because NDJSON consumption is still outstanding, this is a partial
implementation and sipyourdrink-ltd#3676 stays open after the merge.
Partial implementation of sipyourdrink-ltd#3676.
---------
Co-authored-by: chernistry <[email protected]>
Copy file name to clipboardExpand all lines: docs/release-notes/unreleased.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ rather than as its own attribution is exempted by hand there, with the reason.
15
15
- Volunteer tasks enforce `allowed_paths`, re-run the project's gates, and assemble the signed receipt (#4033). `finish_volunteer_task` takes the patch a run produced plus the project's manifest and returns either a `SignedResultBundle` or a `VolunteerRefusal` — never a bundle marked failed, because a signed bundle is a claim the work is acceptable and one that says otherwise in a boolean field is a misreading away from being treated as a pass. Scope is enforced before any gate subprocess starts, and a glob match is not the whole check: the same filesystem containment barrier the rest of the project uses refuses a path that is not repository-relative (`docs/../src/x.py` is a spelling `docs/**` matches) and a path that resolves out of the worktree through a symlinked component, and only then are the project's globs consulted through the one matcher shared with credential scoping. Matching stays case-sensitive on every platform, so a scope written for `src/` cannot be satisfied by `SRC/` on a case-insensitive filesystem. Gates run as argv under one wall-clock budget shared across them rather than one budget each, stop at the first failure, and take an environment built from the sandbox profile rather than inherited from the donor's shell. A passing run's bundle carries the manifest's own digest as `manifest_sha256` and the profile's digest as its sandbox identifier, continuing the manifest → profile → receipt chain, and its worker identity is derived from the signing key so the bundle cannot name one worker while the signature is by another. Refusals carry stable, append-only reason codes. Part of #3869. Docs: [`docs/reference/volunteer-manifest.md`](../reference/volunteer-manifest.md).
16
16
- One answer to "which paths does this diff touch" (`bernstein.core.diff_paths`). The Tier-3 auto-heal cordon and volunteer scope enforcement both fail open on a path an extractor misses, so the extraction moved out of `autofix/tier3.py` into a shared module alongside `path_scope`, and gained the shapes it was missing: a content-preserving rename or copy, a mode change, and a binary file each touch a file while printing no hunk at all, and were previously invisible to the cordon. Quoted non-ASCII paths are decoded rather than handed to a matcher as escape sequences, and an ambiguous `diff --git` header contributes every candidate split — the extractor over-approximates on purpose, since a spurious path costs a readable refusal and a missing one costs an unchallenged write. `bernstein.core.autofix.tier3.extract_paths_from_unified_diff` still resolves for existing callers.
17
17
- Parking a task now writes the grant-bound agent checkpoint the resume path has been checking for (#4043). Nothing in the shipped code produced an `AgentCheckpoint`, so the authority check `bernstein task resume` runs — recompute the grant hash from the role and refuse when the permission set has moved — had no input on a live run and passed by having nothing to inspect. `park_task` now writes the checkpoint after the suspend receipt exists, keyed per task rather than per adapter so two tasks parked on one adapter no longer evict each other, and hashes the same permissions the resume re-derives so the two sides agree. The role is read where it is actually recorded, the task log, and the owning run comes from `$BERNSTEIN_RUN_ID`; `--role` and `--parent-run-id` pin either explicitly. When no role can be sourced the checkpoint is written with an empty grant hash rather than one over the unrestricted default permission set, which the resume would re-derive identically — a checkpoint that reads as bound and can never refuse is worse than one that admits it is not bound. Part of #3649. Docs: [`docs/operations/durable-suspend-resume.md`](../operations/durable-suspend-resume.md).
18
+
- The OpenCode adapter pins its own tool permissions and can re-enter a prior session (#3676). The contract row for `opencode` read `unsupported | unsupported` on resume and dangerous mode, and the adapter matched it: the spawn was a fixed `opencode run -m <model> --format json <prompt>` with no permission configuration at all, so a worker inherited whatever the operator's personal `opencode` config resolved to and two operators running the same plan got different agent behaviour. Both axes now describe flags the adapter passes. Every spawn carries an explicit `OPENCODE_PERMISSION` policy derived from the declared dangerous-mode strategy — escalated alongside `--auto` when it permits unattended action, tightened to a deny policy when it does not — applied after the environment allow-list so the pinned policy is what the worker sees rather than the host's. Neither policy resolves to `ask`, which would hang a headless run indefinitely against upstream `anomalyco/opencode#36762` and surface as a timeout rather than a blocked permission. `--continue` re-enters the prior session on a continuation retry, which the per-task worktree makes unambiguous, and the adapter opts into the continuation path so the warm retry the resume axis already derives is backed by something real. The event channel deliberately stays `text-signals`: the CLI does emit NDJSON under `--format json`, but nothing consumes it yet, and consuming it is the remaining half of #3676.
18
19
## Security
19
20
20
21
- The agent task-scope gate no longer depends on how FastAPI happens to store
0 commit comments