opencode-model-router 2.9.1 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +482 -0
- package/README.md +4 -2
- package/package.json +12 -5
- package/src/compat/background.ts +56 -19
- package/src/compat/child-history.ts +134 -0
- package/src/compat/child-report.ts +185 -0
- package/src/compat/child-session.ts +10 -0
- package/src/compat/session-lookup.ts +21 -0
- package/src/compat/v2-client.ts +124 -6
- package/src/compat/v2-hooks.ts +525 -203
- package/src/compat/v2-observations.ts +1 -0
- package/src/compat/v2-vocabulary.ts +14 -0
- package/src/executor/create.ts +47 -28
- package/src/executor/git.ts +226 -30
- package/src/executor/integrate/checks.ts +29 -11
- package/src/executor/integrate/land.ts +32 -2
- package/src/executor/integrate/queue.ts +95 -13
- package/src/executor/ledger.ts +16 -12
- package/src/executor/lfs-restore.ts +492 -0
- package/src/executor/paths.ts +7 -2
- package/src/executor/recovery.ts +2 -1
- package/src/executor/runtime.ts +1062 -243
- package/src/executor/slots/pool.ts +120 -19
- package/src/executor/slots/provision.ts +111 -23
- package/src/executor/slots/root.ts +81 -0
- package/src/executor/types.ts +28 -2
- package/src/executor/unattended.ts +6 -1
- package/src/executor/verify-trees.ts +507 -0
- package/src/guard/enforce.ts +2 -1
- package/src/guard/fingerprint.ts +9 -0
- package/src/guard/guards.ts +7 -1
- package/src/index.ts +191 -31
- package/src/router/answer-dedup.ts +198 -0
- package/src/router/common-dir.ts +241 -0
- package/src/router/config.ts +228 -40
- package/src/router/diff-handles.ts +322 -0
- package/src/router/diff-summary.ts +318 -0
- package/src/router/git-metadata-guard.ts +317 -0
- package/src/router/git-tools.ts +1136 -49
- package/src/router/read-only.ts +37 -13
- package/src/router/role-agents.ts +100 -36
- package/src/router/run-summary.ts +253 -0
- package/src/router/run-tools.ts +177 -25
- package/src/router/sessions.ts +23 -1
- package/src/router/tool-paths.ts +62 -4
- package/src/routing/classify/rules.ts +93 -14
- package/src/routing/roles/read-set.ts +10 -1
- package/src/routing/roles/work-root.ts +20 -3
- package/src/routing/wire/hint.ts +9 -2
- package/src/v2.ts +3 -1
- package/src/verify/exec.ts +454 -2
- package/src/verify/head.ts +6 -1
- package/src/verify/pending.ts +14 -1
- package/src/verify/plan-task.ts +86 -26
- package/src/verify/reference.ts +60 -7
- package/src/verify/runner.ts +14 -6
- package/src/verify/tree.ts +34 -10
- package/src/verify/types.ts +44 -0
- package/src/verify/wiring.ts +134 -22
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,488 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.11.0] - 2026-11-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **OpenCode v2: an overrides file can remove a key it inherits inside `presets` by setting it to `null` (#80).** The
|
|
15
|
+
bundled `anthropic` preset sets `effort` on every tier and no overrides file could take it away, so the cost doctor's
|
|
16
|
+
`variant-effort` advice (drop `effort`, list `candidates`) could not be followed: `"effort": null` was an invalid
|
|
17
|
+
value, and its key path was dropped with a notice. On OpenCode v2 a `null` at any depth inside `presets` (a preset, a
|
|
18
|
+
tier, a tier key) now removes that key from the merged config before validation, as if no layer had set it; a `null`
|
|
19
|
+
with nothing to remove is a no-op. A removal that leaves the config invalid (a tier without `model`) is dropped with
|
|
20
|
+
its key-path notice like any invalid value, and the project-local file still cannot touch a global-only key. Outside
|
|
21
|
+
`presets` a `null` keeps its meaning as a value (`enforcement.maxDelegationDepth: null`,
|
|
22
|
+
`enforcement.verify.graderTemperature: null`). OpenCode v1 is unchanged. See "Removing an inherited key with
|
|
23
|
+
`null`" in docs/CONFIG_REFERENCE.md.
|
|
24
|
+
- **OpenCode v2 roles mode: a role agent's `router_git_diff` is stat-first (#108).** Without `path`, in mode `patch`
|
|
25
|
+
or `cached`, lockfiles, snapshots, goldens and fixtures (a fixed list, by a file's new path; goldens and fixtures
|
|
26
|
+
never include code or tests) are left out of the patch and listed after it as `content excluded (<kind>, +a/-b)`.
|
|
27
|
+
When the rest of the patch exceeds 8 KiB, or the excluded paths cannot be left out of it (more than 200, or a git
|
|
28
|
+
command line above 30000 characters), the answer is a summary instead: one `+added -removed` line per file,
|
|
29
|
+
excluded files marked, sensitive files (either name of a rename) by name only as `sensitive: content withheld`,
|
|
30
|
+
at most 4096 bytes, with the exact count of entries left out. `path`, `mode: "stat"` and `mode: "name-only"` answer
|
|
31
|
+
as before; tiers mode, the root session and OpenCode v1 are unchanged. See docs/ROLES.md.
|
|
32
|
+
- **OpenCode v2 roles mode: `router_run({ summary: "failures" })` for vitest npm scripts (#108).** Opt-in. The router
|
|
33
|
+
appends `--reporter=json --outputFile=<OS temp file>` to the script, reads the report (up to 8 MiB, its size
|
|
34
|
+
checked first) and deletes it, also after a timeout or a failed start, and answers with the counts and the failing
|
|
35
|
+
tests grouped by file, each with the first block of its error, within 4096 bytes (names first, then error blocks
|
|
36
|
+
while they fit, then the exact count of what was left out). Names and paths are kept on one line with URL
|
|
37
|
+
credentials redacted. Without a usable report it gives the reason and the output's last lines. Another entry, a
|
|
38
|
+
script body that is not one plain `vitest` command, a caller `--reporter`, `--outputFile` or `--`, and a relative
|
|
39
|
+
OS temp directory are refused before anything runs; without `summary` nothing changes. See docs/ROLES.md.
|
|
40
|
+
- **OpenCode v2 roles mode: `gd_` handles on a role agent's `router_git_diff` summary, expanded by `router_git_show`
|
|
41
|
+
(#108).** Every shown, non-sensitive line of a summary or excluded list that has a side with lines ends with
|
|
42
|
+
` | gd_<10 hex>`, a keyed digest of that file version for this session (not a content hash). Lines left out by the
|
|
43
|
+
4096-byte bound, binary files, symlinks, submodules and unmerged paths get none.
|
|
44
|
+
`router_git_show({ handle, lines: "a-b", side? })` returns a header line, then those lines of the blob of that side
|
|
45
|
+
(`new` by default, `old` for a deleted file), at most 400 lines or 16 KiB per call, with where to continue. Blobs
|
|
46
|
+
are read with `git cat-file blob` (at most 4 MiB). The working-tree side is never read: the call refuses and points
|
|
47
|
+
to `read`. Handles are kept in memory per session (2 hours after last use, 1024 per session) and are lost on
|
|
48
|
+
restart. Every expansion resolves the work root or `root` again, re-checks sensitive names, and passes only the
|
|
49
|
+
stored blob id to git. Under a role's guard profile an expansion is a read: `redundant_read` refuses an identical
|
|
50
|
+
repeat, `read_budget` applies to producers, and the read-only cap banner counts it. Tiers mode, the root session and
|
|
51
|
+
OpenCode v1 are unchanged. See docs/ROLES.md and docs/ENFORCEMENT.md.
|
|
52
|
+
- **OpenCode v2 roles mode: a repeated identical answer is a one-line stub; `force: true` gives it in full (#108).**
|
|
53
|
+
`router_git_diff`, `router_git_status`, `router_git_show`, `router_git_log` and `router_run` declare `force`. When a
|
|
54
|
+
role agent repeats a call (same tool, repository and arguments, defaults filled in; for a `gd_` expansion the same
|
|
55
|
+
handle, `lines` and `side`) and the answer is byte-identical to the last one that call got in full, the answer
|
|
56
|
+
names the earlier call and its size instead. The guards still see every call as before. `router_run` still
|
|
57
|
+
runs and is recorded, keeps its status line and ignores the duration in it. Only answers above 512 bytes are
|
|
58
|
+
compared; errors, aborted calls and refusals never are, and make the next identical call answer in full. A stub is
|
|
59
|
+
given only within 20 completed tool calls of the full answer it names. The SHA-256 and length of the last answer per
|
|
60
|
+
call stay in memory (128 calls per session, 4096 in all) until the session is compacted, reverted or deleted; without
|
|
61
|
+
the host's compaction hook dedup is off (one warning). Other sessions, tiers mode and OpenCode v1 are unchanged, and
|
|
62
|
+
no tool description changes. See docs/ROLES.md.
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- **OpenCode v2: a restart no longer re-verifies a plan task over the dead server's still-running checks (#189,
|
|
67
|
+
R2-pre-2).** A server killed by a signal skips the exit hook that ends its verification process trees, so the
|
|
68
|
+
restart's re-verification raced them (its clean, files held open on Windows, ports and locks) and could judge the
|
|
69
|
+
wrong tree. Plan-task verifications now record each process tree at spawn (its start, deadline and exit) in
|
|
70
|
+
`<executor home>/verify-trees/<plan>/<task>#<n>.json`. Before recovered work runs, one bounded sweep per activation
|
|
71
|
+
kills the trees of dead servers, and only these processes. On Windows: a recorded root still running whose creation
|
|
72
|
+
time lies in its spawn window (and before both the process now holding the dead server's PID and the sweep's process
|
|
73
|
+
snapshot), whose parent is the dead server and whose command line names its command or the slot, with its tree; and
|
|
74
|
+
a child of a recorded root that exited, created before that root's run ended (its exit, else its deadline plus the
|
|
75
|
+
kill grace, and at most 5 s after the dead server's last heartbeat: a journal with roots in flight has its
|
|
76
|
+
modification time refreshed every 2 s), whose command line names the slot, with its tree. On POSIX: a recorded
|
|
77
|
+
process group whose leader has the start ticks recorded at spawn. Any other process found where a recorded tree would
|
|
78
|
+
be is reported, never killed. A kill that cannot be confirmed (for example Constrained Language Mode, or a process
|
|
79
|
+
that does not name the slot) parks the slot's recovered work as `verify-tree-alive`, with one blocking item naming the
|
|
80
|
+
PIDs (a process started after the dead server's run could still start processes is listed apart, as possibly the
|
|
81
|
+
user's own); a journal that cannot be read or fails validation parks its task and is kept. `/plan resume` sweeps
|
|
82
|
+
again and closes the items of slots it finds clear. A restart's slot reset now removes a stale `index.lock` (git's
|
|
83
|
+
`Unable to create` error only) at most once, never in such a slot, and reports a reset that still fails. OpenCode v1
|
|
84
|
+
is unchanged.
|
|
85
|
+
- **OpenCode v2: the advise route hint is no longer lost after a dispatch (#191).** The hint is classified from the
|
|
86
|
+
latest user text. OpenCode 2.3+ reports every child to the orchestrator as a user-role entry after the tool result,
|
|
87
|
+
so the hint classified that entry (the host's `<background-result>`, the router's held placeholder or its
|
|
88
|
+
`<router-verdict>`) instead of the user's ask, and the turn-state tail lost the hint or got another one within the
|
|
89
|
+
same turn (seen on OpenCode 2.4.2). A user text that starts with a child report or a router verdict is now skipped,
|
|
90
|
+
as the `Instructions from:` attachments already were; the 2.0.x `<subagent …>` report of a background child is
|
|
91
|
+
skipped too. Requests without such an entry pick the same text as before. OpenCode v1 is unchanged.
|
|
92
|
+
- **OpenCode v2: off Windows the executor-home deny for role agents no longer fails open (#192, QA-62C-15).** Off
|
|
93
|
+
Windows the router finds `<git common dir>/omr-executor` on disk, without git, and denies it to role agents. A bare
|
|
94
|
+
repository, or under WSL a `.git` or `commondir` naming a Windows drive path (`gitdir: D:/…`, as Git for Windows
|
|
95
|
+
writes it), resolved no common directory, so the home was not denied and nothing was logged. The lookup now walks up
|
|
96
|
+
in git's order (`.git`, then a bare repository with a `HEAD` git accepts, then the parent directory), goes on past a
|
|
97
|
+
bare repository to the repository around it (a bare shape can be committed to a checkout) and denies every home it
|
|
98
|
+
finds, and under WSL reads a drive path at its automount path (`/mnt/d/…`, or below the `[automount] root` of
|
|
99
|
+
`/etc/wsl.conf`). On a Windows drive, where letter case does not matter, every `external_directory` rule that could
|
|
100
|
+
reach a home in another case is not granted (one warning). When a repository is found but its executor home cannot
|
|
101
|
+
be denied (a linked or unparsable `.git`, a pointer to a network or device path, a drive path outside WSL or missing
|
|
102
|
+
there, or a home with no canonical form: a `.git` pointer naming no git directory, or a home path with a glob
|
|
103
|
+
character or a `~N` segment), the router logs one warning and role agents get no `external_directory` rule at all
|
|
104
|
+
(fail closed). Windows is unchanged. See docs/ROLES.md.
|
|
105
|
+
- **OpenCode v2: a held `<router-verdict>` uses v2 vocabulary (#191).** The verdict of a background-verified dispatch
|
|
106
|
+
(every verified dispatch on OpenCode 2.3 and later) carried the OpenCode v1 tool result: a `task_id: …` line, the
|
|
107
|
+
child's text inside `<task_result>`, and the escalation hint ``re-run via `Task(subagent_type="medium")` ``. It now
|
|
108
|
+
carries what a foreground result shows on v2: the child's own text, unchanged, then the router's lines in v2
|
|
109
|
+
vocabulary, for example ``re-run via `subagent(agent="medium")` (escalated from fast)``. OpenCode v1 is unchanged.
|
|
110
|
+
- **OpenCode v2: the plan executor applies filters set only in system or global configuration (#162).** Its hardened
|
|
111
|
+
git reads no system or global configuration, so a filter (or merge driver) set only there, such as a globally
|
|
112
|
+
installed Git LFS or git-crypt, was not applied: executor commits stored the raw content and checkouts wrote LFS
|
|
113
|
+
pointer files. Every filter `clean`, `smudge`, `process` and `required` and merge `driver` whose value comes from
|
|
114
|
+
system, global or command-line configuration is now passed to the executor's git with `-c`, so it runs the filter
|
|
115
|
+
programs plain git runs, and a global Git LFS works without `git lfs install --local`. Those programs still run
|
|
116
|
+
without the rest of the user's system and global configuration (`credential.helper`, `lfs.*`, a custom
|
|
117
|
+
`core.attributesFile`, the system gitattributes). Git LFS objects already in the local store are checked out as
|
|
118
|
+
content; the executor's git never downloads one (#208, under Security). A forwarded filter program (git-lfs) also
|
|
119
|
+
reads the repository's configuration and `.lfsconfig` itself: see #184 under Security.
|
|
120
|
+
A driver only the repository's own configuration sets (or sets differently) is still blanked, and nothing is taken
|
|
121
|
+
from it. A user value `-c` cannot carry as git reads it (a line break, or a byte that is not UTF-8) is not passed
|
|
122
|
+
on: that filter is blanked and marked required, so git refuses only where it is used. The verification snapshot and
|
|
123
|
+
reference pass nothing on and send the same git commands as before; one change reaches them: an include target
|
|
124
|
+
whose existence check hangs now fails the snapshot closed after its own 10 s timeout (OpenCode v1 and v2).
|
|
125
|
+
- **Repository tools: `npm run soak:analyze` runs on Node 26, and the development Node floor is documented (#195).**
|
|
126
|
+
The analyzer's loader called `module.stripTypeScriptTypes` with `mode: "transform"`, which Node 26 removed, so every
|
|
127
|
+
run exited 2 with `The property 'options.mode' must be one of: 'strip'`. It now uses strip mode (Node 22.13 and
|
|
128
|
+
later); the product modules it imports already use erasable syntax only. `engines.node` stays `>=22`: it describes
|
|
129
|
+
the published plugin, not the repository tools. CONTRIBUTING.md now states the development floor separately: Node
|
|
130
|
+
22.18 / 23.6 or newer for the coverage merge and `npm run routing:stats`, Node 22.13 or newer for the soak analyzer.
|
|
131
|
+
- **OpenCode v2: plan executor restart and recovery edge cases (#189).** A repository toplevel spelled with a Windows
|
|
132
|
+
8.3 short name is now the same repository as its long form, so its plans are no longer treated as foreign. At start,
|
|
133
|
+
a plan of this repository whose writer lock is stale is taken over and reconciled even when the restart report
|
|
134
|
+
missed it, instead of waiting for an adopt or another restart; a live holder is still refused. A plan whose
|
|
135
|
+
recovery cannot classify its tasks is no longer run unrecovered: it is paused with one blocking item naming the
|
|
136
|
+
cause, and resuming it runs the recovery again. Recovery adopts a child only when the attempt records it. Adopting a
|
|
137
|
+
completed or aborted plan is refused before its attachment closes, so an abort's cleanup (child stops, slot saves
|
|
138
|
+
and releases) is no longer cut off. Recovered work that waits for leases another holder has no longer wakes the
|
|
139
|
+
orchestrator. Once the slot pool closes, no slot claim waits on its base lookup any more, and none claims a slot.
|
|
140
|
+
A task held because another holder has its leases, whose slot record vanishes meanwhile, stays held (QA-4.2-31): its
|
|
141
|
+
slot is re-provisioned from the task branch and kept, and the task resumes once (commit, verification or the
|
|
142
|
+
integration queue) when the leases are free. It no longer loses the new slot and gets an item asking to restore a
|
|
143
|
+
task branch that was fine; a task held this way for the first time gets the hold item. When re-provisioning fails,
|
|
144
|
+
the item names the reason (a lease registry at capacity, a failed checkout, …); it asks to restore the task branch
|
|
145
|
+
only when the branch is missing or does not reach the attempt's commit. Such a failure also ends the task's hold, so
|
|
146
|
+
a later lease release no longer resumes it on its old slot after that slot went back to the pool. A held task whose
|
|
147
|
+
slot the pool now records as free or leased to another task is re-provisioned as well, instead of being resumed on
|
|
148
|
+
that slot.
|
|
149
|
+
- **OpenCode v2: a held background verification whose verdict cannot be settled no longer stays `verifying` (#193).**
|
|
150
|
+
When a step before the held gate settled its pending entry threw, the entry stayed `verifying` with no verdict posted,
|
|
151
|
+
and `router_verify` on its handle waited for that run until its deadline. The entry now settles exactly once as
|
|
152
|
+
`UNVERIFIABLE` with the scrubbed error as its reason, the verdict is posted to the parent session, and the error is
|
|
153
|
+
logged. OpenCode v1 is unchanged.
|
|
154
|
+
- **OpenCode v2: plan executor integration lineage, regression runs and breaker window (#188).** When a reverted
|
|
155
|
+
task's retry branch is reused, it is rebased from the newest journaled upstream its tip contains (also when its retry
|
|
156
|
+
landed as a rebased copy), so it does not replay other tasks' reverted changes. A revert whose culprit has no failing
|
|
157
|
+
test ids is no longer landed without its regression run: the phase suite commands are resolved once more, and if they
|
|
158
|
+
still do not resolve the revert is not built and the item gives the reason; a suite setting pauses only that phase
|
|
159
|
+
(unpausing reruns the suite), a resolver error pauses the plan (unpausing rebuilds the revert). After a restart, a
|
|
160
|
+
completed task's commit is looked up on its task branch, whose tip its slot is then re-provisioned from; a commit only
|
|
161
|
+
another ref reaches raises the blocking item, naming it. A commit failure cancelled by an abort stays in the
|
|
162
|
+
circuit-breaker window.
|
|
163
|
+
- **OpenCode v2: observation and visibility gaps outside the soak (#194).** The plan executor's streak of launches
|
|
164
|
+
lost before their child started remembers every capture of the streak, not only the last, so interleaved losses
|
|
165
|
+
under captures C1, C2, C1 count C1 once; a capture is its boot id, epoch and router call, not the call id alone.
|
|
166
|
+
A role decision row's `trace.riskSources.term` names an open high-risk term by its vocabulary stem (`deploy`), never
|
|
167
|
+
the rest of the prompt's word (`deploySecretAlice`), and a term that can span words by its table id, also when the
|
|
168
|
+
prompt joins them with hyphens (`npm-acme-internal-publish`). A failed verification snapshot is labelled `harden` or
|
|
169
|
+
`finalize` when it fails outside a git call. Recovered work parked without a root context, or behind held leases,
|
|
170
|
+
is counted once per park in the ledger (`recovered-work-parked`, with task, attempt, work kind and reason).
|
|
171
|
+
- **OpenCode v2: plan executor lifecycle (#190).** A hot-reload copy no longer takes the old copy's `/plan` for a
|
|
172
|
+
user command; a failed adopt is undone; the runtime starts only after its retry hook is registered and never after
|
|
173
|
+
dispose. An executor whose wiring fails at startup is disposed with one warning
|
|
174
|
+
(`executor: it could not be wired; it is disposed and plans are not executed`), and the plugin starts without it.
|
|
175
|
+
A user-defined `/plan` with exactly the router's `/plan` description is treated as the router's own. Disposal now
|
|
176
|
+
waits, at most 10 s, for a start in flight; a start that ends later attaches nothing and closes the ledger it opened.
|
|
177
|
+
- **OpenCode v2: the plan executor's slot release, lock release and purge fail closed (#187).** `purge` now refuses
|
|
178
|
+
while the gc leaves a slot of the plan behind (files in use, a folder git does not list as locked by the executor,
|
|
179
|
+
an entry without a slot marker): the refs and the ledger are kept, and the error names each slot and the way out
|
|
180
|
+
(close what holds the files; or check the folder for work, then `git worktree unlock` and
|
|
181
|
+
`git worktree remove --force` it, see [EXECUTOR.md](docs/EXECUTOR.md#interrupted-attempts)). A slot the gc began
|
|
182
|
+
deleting after its unsaved-work check passed is marked `removing`, so the next purge finishes it instead of refusing
|
|
183
|
+
the half-deleted folder as unsaved work. A slot whose pool record cannot be read is no longer released on a guess. A
|
|
184
|
+
repo lock the integration queue cannot remove on release is reported and retried in the background (5 times, only
|
|
185
|
+
while the file is still that lock's), and a failed restart `reset`/`clean` of a slot (non-zero git exits included)
|
|
186
|
+
is logged; the task's next launch still resets that slot through the pool and is skipped if that reset fails. A
|
|
187
|
+
package manager install lock whose owner died on this host is no longer taken over at once (the install's process
|
|
188
|
+
tree can outlive the killed server), and a fresh rerun deletes `.venv` or `node_modules` only under that lock:
|
|
189
|
+
provisioning after a crash waits until the lock's heartbeat is 60 s old. This supersedes the rule in the phase 2.4
|
|
190
|
+
report ("stale when the pid is dead on this host or the heartbeat is older than 60 s").
|
|
191
|
+
- **Roles mode: `trace.needTerms` no longer logs prompt words (#200).** A needs-table term whose pattern has a gap
|
|
192
|
+
(`\s`, `[^\n]`, `.`, `*`, `+`, `{m,n}`) logged what it matched, so "remote acme internal push" was recorded as
|
|
193
|
+
`network:remote acme internal push`. Such a term now logs its id in the needs table (`network:term-5`), also when
|
|
194
|
+
the prompt joins the words with hyphens, by the same rule as `trace.riskSources.term` (#194). Single-word terms
|
|
195
|
+
still log the word, and a match is never logged with blanks. Rows written earlier are not rewritten.
|
|
196
|
+
- **OpenCode v2: purging a plan no longer touches another plan's slots (#202).** `router_plan action=purge` collected
|
|
197
|
+
the clean slots of every other plan in the repository, a paused one included, once their slot marker was more than
|
|
198
|
+
7 days old. It now follows the manual gc's rule: the slots of a plan whose ledger exists are kept, whatever their
|
|
199
|
+
age. Unsaved work in another plan's slot no longer refuses the purge; unsaved work in a slot under this plan's slots
|
|
200
|
+
directory still does.
|
|
201
|
+
- **OpenCode v2: with `routing.background.mode: "off"`, a verified dispatch is verified again on OpenCode 2.3+
|
|
202
|
+
(#191).** Since 2.3 the host runs every native subagent child in the background and returns only a running
|
|
203
|
+
acknowledgement, so under `off` the router never saw the child's final text: the call got `[router] This subagent is
|
|
204
|
+
still running. Its result has not been verified…` and no verification ever followed. Under `off` the router still asks
|
|
205
|
+
for the foreground, but a root orchestrator's verifying call the host backgrounds anyway is now held and verified as
|
|
206
|
+
under `auto`: the acknowledgement says `Its result is held until verification finishes.`, the `<background-result>`
|
|
207
|
+
text stays hidden until the verdict, the `<router-verdict>` entry is posted once, and the router state lists the hold.
|
|
208
|
+
The check of a background completion waits for the file leases of its tree, held or not. This also covers a verified
|
|
209
|
+
call the user backgrounds on 2.0.x, which was only marked unverified. A role-routed call is tracked without a hold
|
|
210
|
+
(`Router guarantees apply when it completes.`): it keeps its binding and its budget and authority notices, its
|
|
211
|
+
child's report gets the `[router` line defang of a foreground role result, and after a restart a lost role call wakes
|
|
212
|
+
the orchestrator once. Other calls, foreground results (OpenCode 2.0.x, still verified without a lease wait), the
|
|
213
|
+
dispatch arguments and the protocol are unchanged under `off`. The pending journal is now read under `off` too; while
|
|
214
|
+
it cannot be read, a report the router cannot prove processed is withheld and a resume of a child it does not know is
|
|
215
|
+
refused, as under `auto`, but an untracked call dispatched by this process and session keeps its report and its
|
|
216
|
+
resume in that session. A verified dispatch made by a child session is still not verified on 2.3+, in any mode.
|
|
217
|
+
- **OpenCode v2: a same-process adopt and the old attachment's verification (#190).** Work of the cut attachment stops
|
|
218
|
+
at its next checkpoint without an inbox item: a re-provisioning slot claim still queued is cancelled (a provisioning
|
|
219
|
+
already running finishes), and no trailer search, commit or `cleanForChecks` starts after the cut. The adopt still
|
|
220
|
+
waits for work in progress; after 5 s it logs one warning naming what it waits for (`close-wait-slow` observation).
|
|
221
|
+
A plan-task grader is cancelled with its gate's deadline, also one whose session the host creates after the cut, and
|
|
222
|
+
a cut or timed-out gate is drained, at most 5 s with one warning, before its lease exemptions go or a retry starts.
|
|
223
|
+
The next attachment waits for an observation the old one started and verifies the observed attempt instead of the
|
|
224
|
+
restart fallback, which counted an attempt whose child committed on its own as `unverifiable`. A user `abort` cuts
|
|
225
|
+
that work the same way: a just-aborted plan gets no "restore the task branch" item.
|
|
226
|
+
- **OpenCode v2: Git LFS no longer stops the plan executor (#215).** Every Git LFS filter run (checkout, commit)
|
|
227
|
+
installs its `pre-push`, `post-checkout`, `post-commit` and `post-merge` hooks into `core.hooksPath`, which was
|
|
228
|
+
the executor's empty hooks directory: git ran `post-checkout` in the same call, and every later executor call failed
|
|
229
|
+
with `hooks directory is not empty`. The executor's `core.hooksPath` is now an empty regular file
|
|
230
|
+
(`<executor home>/git/hooks-off`, checked before every call), under which git finds no hook and Git LFS installs
|
|
231
|
+
none. An older home's `git/no-hooks` directory is no longer used.
|
|
232
|
+
|
|
233
|
+
### Security
|
|
234
|
+
|
|
235
|
+
- **OpenCode v2: the plan executor's git-lfs no longer runs programs the repository or its `.lfsconfig` names (#184).**
|
|
236
|
+
A filter program the executor's git runs (git-lfs, forwarded since #162 or kept as a `git lfs install --local` copy)
|
|
237
|
+
reads the repository's configuration and `.lfsconfig` itself. An agent in a slot could
|
|
238
|
+
`git config lfs.extension.x.clean evil` and have the executor's next `add` run `evil`, and a committed `.lfsconfig`
|
|
239
|
+
could register a custom transfer agent that the LFS server it names then selects for a download. Before every
|
|
240
|
+
executor git call the executor now derives what git-lfs would read: every repository entry (local, worktree, include
|
|
241
|
+
targets of any condition) and the `.lfsconfig` present when the call starts (the work tree's, else the index's, else
|
|
242
|
+
`HEAD`'s, as git-lfs picks it; read only when a filter or merge program is configured) is rebuilt as the `key=value`
|
|
243
|
+
lines of `git config -l`, split at line breaks and each line at its first `=`, as git-lfs splits them. So a key
|
|
244
|
+
holding `=` or a value holding a line break cannot forge a setting. Every derived key that is an extension
|
|
245
|
+
`clean`/`smudge`, holds a custom transfer agent's path or args, names a standalone transfer agent, or is
|
|
246
|
+
`core.sshCommand`, `core.askPass` or `lfs.storage` is blanked with `-c`, matched after case folding as Go's
|
|
247
|
+
`strings.ToLower` or JavaScript would fold it; from `.lfsconfig`, an extension's `clean`/`smudge` is left alone, as
|
|
248
|
+
git-lfs ignores it there. A credential helper resets the helper list with `-c credential.helper=`. Nothing is kept
|
|
249
|
+
for also being in the user's configuration. A blanked extension makes git-lfs fail, so with `filter.lfs.required`
|
|
250
|
+
git refuses the write. An LFS download that needs a repository-configured credential helper now fails with `E_GIT`.
|
|
251
|
+
The call is refused (`E_GIT`) when a derived key cannot be passed with `-c` exactly (a CR, a byte that is not UTF-8,
|
|
252
|
+
a malformed name, a section or variable that is not lowercase); when the `.lfsconfig` is a link, is not a regular
|
|
253
|
+
file or includes another file (git would read the included file, perhaps from a network share); and when a
|
|
254
|
+
repository include target (any condition, existing or not) is inside a work tree of the repository, since the
|
|
255
|
+
call's own checkout may write it before git-lfs reads it: a tracked config included with
|
|
256
|
+
`include.path=../.gitconfig` (or similar) refuses every executor call. Not covered yet: a `.lfsconfig` the call's
|
|
257
|
+
own checkout, cherry-pick or rebase writes before git-lfs starts (a server it names could still select a custom
|
|
258
|
+
transfer agent). Config-based hooks (`hook.<name>.command` with `hook.<name>.event`, which git 2.56 runs whatever
|
|
259
|
+
`core.hooksPath` says) are refused too, whatever the git version and with or without forwarding: when the
|
|
260
|
+
repository's configuration (local, worktree, an include target of any condition) sets any `hook.<name>.command` or
|
|
261
|
+
`hook.<name>.event`, every executor git call fails with `E_GIT` ("repository config defines git hooks"). The
|
|
262
|
+
verification snapshot and reference (OpenCode v1 and v2), whose `worktree add` and index writes fire hook events
|
|
263
|
+
too, refuse the same way through one more `git config` pre-check listing; their own git commands are unchanged.
|
|
264
|
+
- **OpenCode v2: the plan executor's git never downloads Git LFS objects (#208).** Every executor git call sets
|
|
265
|
+
`GIT_LFS_SKIP_SMUDGE=1`: during a checkout, cherry-pick, rebase, fast-forward merge or `worktree add`, Git LFS asks
|
|
266
|
+
no endpoint and starts no transfer program the repository's configuration names (`lfs.customtransfer.*`), even
|
|
267
|
+
when the same checkout writes the `.lfsconfig` naming the endpoint. The executor then restores, offline, each LFS
|
|
268
|
+
file whose object is already in the local LFS store, in slots and in the owner checkout when landing: it copies the
|
|
269
|
+
object itself (size and sha256 checked) and git re-hashes the file through Git LFS's clean filter. Nothing is
|
|
270
|
+
restored when the configuration names a Git LFS extension (`lfs.extension.*` in any letter case, whose programs
|
|
271
|
+
clean would run) or opts out (`--skip`); `lfs.fetchinclude`/`lfs.fetchexclude` select the files (an include read
|
|
272
|
+
conservatively: case-sensitive, a pattern with a `/` anchored at the root). A missing object stays a pointer file
|
|
273
|
+
(`git lfs pull` fetches it). The restore never fails the call: over 10,000 files or 4 GiB, or on an error, the files
|
|
274
|
+
stay pointer files and the executor logs a warning, which also names a temporary `.omr-lfs-*` file it could not
|
|
275
|
+
remove (slots ignore that name). See [Safety model](docs/EXECUTOR.md#safety-model).
|
|
276
|
+
- **Development dependencies: patched `toml`, `zod`, `effect` and `minimatch`.** The lockfile resolved vulnerable
|
|
277
|
+
versions through the `@opencode-ai/plugin` peer (`effect` 4.0.0-beta.83 with `toml` 4.3.0, `zod` 4.1.8) and the
|
|
278
|
+
`@opencode/plugin` dev dependency (`minimatch` 9 and 10). `package.json` now overrides them to `effect` ^4.1.0 (which
|
|
279
|
+
no longer depends on `toml`), `zod` ^4.6.6 and `minimatch` ^11.0.1. The published package has no dependencies, so
|
|
280
|
+
installs of the plugin are not affected; this only changes what a clone of the repository installs.
|
|
281
|
+
|
|
282
|
+
## [2.10.0] - 2026-11-27
|
|
283
|
+
|
|
284
|
+
### Changed
|
|
285
|
+
|
|
286
|
+
- **OpenCode v2: plans in different repositories can run at the same time in one Claude Code process.** Executor
|
|
287
|
+
ownership is scoped to the repository's shared git common-directory home, not the whole process. A second plugin
|
|
288
|
+
copy for the same repository (including linked worktrees) still waits for the owner to dispose before taking over.
|
|
289
|
+
- **A filter defined only in a repository's own configuration now stops the verification reference (OpenCode v1 and
|
|
290
|
+
v2) and the plan executor (OpenCode v2) instead of being skipped.** Where git writes (executor commits, WIP saves
|
|
291
|
+
and restores, checkouts, resets, cleans, the reference's `stash create` and checkout), a filter that only the
|
|
292
|
+
repository's local, worktree or included configuration defines is blanked and marked required, so git refuses rather
|
|
293
|
+
than storing or checking out unfiltered content. Repositories whose filter lives only in local config (git-crypt,
|
|
294
|
+
`nbstripout --install`, a local-only Git LFS) now get an executor error or no reference. Remedy: define the filter in
|
|
295
|
+
global config (`git config --global filter.<name>.clean …`); a repository copy identical to the global one keeps
|
|
296
|
+
working, and the plan executor currently needs that copy: with the filter only in global config, the executor's git
|
|
297
|
+
does not see it and commits the content unfiltered (see Fixed). The executor also refuses to land into an owner
|
|
298
|
+
checkout with populated submodules (land manually), because the cleanliness check would run git inside them with
|
|
299
|
+
their own configuration.
|
|
300
|
+
|
|
301
|
+
### Fixed
|
|
302
|
+
|
|
303
|
+
- **OpenCode v2: held results are held again on OpenCode 2.3.0 and later, and the host's reports about the router's own
|
|
304
|
+
children no longer show their raw text to the orchestrator (#174, observed on 2.4.2).** Those hosts report a finished
|
|
305
|
+
child to its parent as `<background-result kind="subagent" sessionID="…" state="…" …>…</background-result>`, which
|
|
306
|
+
the router did not recognise (it knew only OpenCode 2.0's `<subagent …>`): a held background result reached the
|
|
307
|
+
orchestrator before its verdict, and the router did not take the completion from that report. One matcher now reads
|
|
308
|
+
both shapes, attributes in any order, for the completion scan, the held placeholder (in every request and every
|
|
309
|
+
compaction), the `[router` line rewrite of child text and the fail-closed redaction. The host also reports the
|
|
310
|
+
router's own children (an LLM grader, a `router_delegate` producer, a plan-executor task) to the session that ran
|
|
311
|
+
them. In every request and every compaction their report now carries one line,
|
|
312
|
+
`[router] internal child finished; its result is handled by the router.`, in place of the child's text; the router
|
|
313
|
+
still knows its children for an hour after their run, also after it removed them. The extra turns the host starts
|
|
314
|
+
for those reports are not removed.
|
|
315
|
+
- **OpenCode v2: the router's own child runs work again on OpenCode 2.3.0 and later (#167, reported on 2.4.1).** Those
|
|
316
|
+
hosts answer every native `subagent` call at once with a running result, so every child the router runs itself (an
|
|
317
|
+
LLM grader, a `router_delegate` producer, a plan-executor task) was refused as pending and interrupted: verification
|
|
318
|
+
came out UNVERIFIABLE, and delegations and plan tasks failed. The router now waits for its own running child
|
|
319
|
+
(`session.wait`; the wait ends with the run's deadline or cancellation even where the host does not cancel it) and
|
|
320
|
+
uses the child's final answer: the newest assistant entry of its current turn, only when that step ended and has
|
|
321
|
+
text. A child whose run ended on a step without a final answer (cut mid-stream, or stopped after a tool call) is not
|
|
322
|
+
used, and the text of an earlier step is never taken instead. A resumed child (delegate producer or plan task) is
|
|
323
|
+
read only from what its new run added after a marker taken before the run, and only from an answer that follows this
|
|
324
|
+
run's own prompt there; otherwise the previous turn's answer could be taken. A child that ends with no answer, an
|
|
325
|
+
empty one or an error, a run that ended failed or interrupted, a failed, aborted or timed-out result, or a cancelled
|
|
326
|
+
wait is not used: the run fails as before and the child is interrupted. The grading service span reports `completed`
|
|
327
|
+
only once the child really completed.
|
|
328
|
+
- **Router-run git commands in the work root no longer run repository-configured programs.** The verification
|
|
329
|
+
snapshot of the work root and the reference worktree's git calls now turn off `core.fsmonitor`, hooks (including
|
|
330
|
+
`post-index-change` on an index write), `gpg.ssh.defaultKeyCommand` and the external diff, refuse the `ext`, `file`,
|
|
331
|
+
`ssh`, `git`, `http`, `https`, `ftp` and `ftps` transports and any `protocol.<name>.allow` the repository sets, and
|
|
332
|
+
run with `GIT_NO_LAZY_FETCH=1`, while keeping git's index refresh, so snapshot fingerprints are unchanged. The
|
|
333
|
+
default snapshot's `status` no longer rewrites the user's index, and a submodule is refused before `status` or `diff`
|
|
334
|
+
runs. The snapshot (default and hardened), the reference worktree and every executor git call (GitOps, the
|
|
335
|
+
runtime's commits, WIP saves and restores, resets and cleans, the integration git and the landing probes) also blank
|
|
336
|
+
the filter (`clean`, `smudge`, `process`) and merge drivers that only the repository's own configuration names,
|
|
337
|
+
including the drivers its include files set, whatever the include's condition (a missing include target is skipped,
|
|
338
|
+
as git skips it, and so is a dangling include link; on Windows one naming a reserved device such as `NUL` is
|
|
339
|
+
refused); the executor reads them again for every git call. A driver set identically in system or global
|
|
340
|
+
configuration keeps working, so for the default snapshot and the reference a global Git LFS and its
|
|
341
|
+
`git lfs install --local` copy are unaffected (the hardened snapshot reads no system or global configuration and
|
|
342
|
+
sees only the repository's copy, read-only, as before). The plan executor's hardened git does not read system or
|
|
343
|
+
global configuration either, so it currently needs the filter in the repository's local configuration too (for Git
|
|
344
|
+
LFS, `git lfs install --local`): a filter set only globally is not applied by the executor, so it stores and checks
|
|
345
|
+
out that content unfiltered (tracked in #162). The listing runs in the environment of the command it protects. The
|
|
346
|
+
router's other hardened git calls now blank `gpg.ssh.defaultKeyCommand` and refuse `ftp`/`ftps` too. Reading driver
|
|
347
|
+
scopes needs git 2.26 or newer. If the driver configuration cannot be read (or the legacy `GIT_CONFIG` variable is
|
|
348
|
+
set, for the reference), there is no snapshot or reference, and no executor git call runs.
|
|
349
|
+
- **One invalid value in an overrides file no longer drops the whole file (#80).** A bad tier `effort`, an
|
|
350
|
+
`activePreset` naming no preset or an out-of-range `routing` key used to discard every other key of that file too,
|
|
351
|
+
`routing` included. Now only the offending key path goes: the top-level key it sits under, or inside `presets` the
|
|
352
|
+
narrowest of preset, tier and tier key (`presets.anthropic.fast.effort`). Each dropped path adds one config notice,
|
|
353
|
+
`ignoring <path> from <file>: <reason>; the rest of the file applies` (`/router` lists it as
|
|
354
|
+
`router: config notice: …`), and the rest of the file applies. The global override is still settled before the
|
|
355
|
+
project-local one, so a conflicting project key is the one dropped (QA-4.1-21). A file none of whose top-level keys
|
|
356
|
+
can be kept is dropped as a whole, as before. Valid configs load unchanged. OpenCode v1 and v2.
|
|
357
|
+
- **OpenCode v2: a background dispatch whose acknowledgement fails gives its reserved held handle back at once.** The
|
|
358
|
+
handle reserved for the hold just before the in-flight attempt is registered was released only once an attempt
|
|
359
|
+
existed: when the registration returned nothing or threw, the reservation stayed for `HELD_RESERVATION_TTL_MS`
|
|
360
|
+
(7 h), took one of the session's pending slots and made `router_verify` answer `held` for a dispatch that is not held.
|
|
361
|
+
It is now released on both failure paths.
|
|
362
|
+
- **OpenCode v2: `router_verify` on a background handle whose child is still running answers `held`, not `unknown handle`.**
|
|
363
|
+
The handle is reserved and listed every turn from the background ack but registered only when the child finishes, so
|
|
364
|
+
until then the registry did not know it and an orchestrator that polled it got `unknown handle` again and again. The
|
|
365
|
+
session the handle was issued to now gets the held answer, and the verdict is replayed once it settles. Another
|
|
366
|
+
session's reserved handle still reads as unknown, and a reservation is released when the held entry cannot be
|
|
367
|
+
registered, so the handle is not answered `held` for hours after the gate posted its verdict directly.
|
|
368
|
+
- **`router_verify` answers an unknown handle terminally, and a call without a session id explicitly.** `unknown handle`
|
|
369
|
+
now says the session has no record of it (never issued here, issued to another session, or no longer tracked after a restart,
|
|
370
|
+
eviction or a failed background run) and that retrying will not change the answer. A call with no session id, for handles or `pending: true`,
|
|
371
|
+
is answered `no session` instead of `unknown handle` or "no unverified delegations in this session". Wording only on
|
|
372
|
+
OpenCode v1.
|
|
373
|
+
- **Plan executor: task commits and slot WIP saves use the user's resolved git identity even when it is only global.**
|
|
374
|
+
Both paths explicitly disable signing and keep hooks and global config disabled in hardened git. Failures retain a
|
|
375
|
+
sanitized stderr tail and exit code in warnings, metrics or attempt contexts, and blocking inbox items, with identity
|
|
376
|
+
setup guidance when no identity is configured.
|
|
377
|
+
- **OpenCode v2: a hung plan-executor disposal no longer holds location cleanup forever.** The adapter waits at most
|
|
378
|
+
30 seconds, warns on timeout, aborts the launcher's controllers and continues teardown. The original disposal remains
|
|
379
|
+
observed and keeps the repository claim until it completes; restart the host if that claim stays stuck.
|
|
380
|
+
- **OpenCode v2: resumed background dispatches keep their own results and verification handles.** Historical completions
|
|
381
|
+
first scanned after a resume no longer supply the resumed attempt's result, and held placeholders retain their attempt's
|
|
382
|
+
announced handle instead of changing to the newest handle for the same child session.
|
|
383
|
+
- **OpenCode v2: repeated background finishes no longer discard a dispatch's verification.** A live held call keeps
|
|
384
|
+
its original gate and verdict instead of being reclassified as a read-only delegation after its inputs were consumed.
|
|
385
|
+
Missing dispatch inputs are reported explicitly as UNVERIFIABLE, never inferred as no acceptance and no changes.
|
|
386
|
+
- **OpenCode v2 / roles mode: `router_run` points script calls with arguments to configured commands.** Refusals
|
|
387
|
+
list argument patterns, with commands running the same package script first (such as the default `test-files`);
|
|
388
|
+
the tool description also includes a bounded list of commands accepting arguments. Argument acceptance is unchanged.
|
|
389
|
+
- **Plan executor: recompiling a plan after abort and purge in the same process can be approved again.** A new plan
|
|
390
|
+
reusing the same id gets fresh slot pools and collection state; stale slot handles from the purged plan remain fenced.
|
|
391
|
+
- **OpenCode v2 / roles mode: each parallel tool call of a role agent is checked against its own arguments (#86).** The
|
|
392
|
+
`execute.before` authority check now reads the call's tool and input when the hook is invoked, not after its awaits,
|
|
393
|
+
so a refusal no longer names another parallel call's path when the host reuses or rewrites a pending call's event.
|
|
394
|
+
- **OpenCode v2: read-only tiers recognise the host 2.0.31 default permissions.** Host 2.0.31 dropped the
|
|
395
|
+
`external_directory * ask` default, so its defaults were treated as explicit rules: the host's `.env` read rules were
|
|
396
|
+
re-appended after the tier policy and `host default permissions not recognised` was logged. Both the 2.0.22 and the
|
|
397
|
+
2.0.31 default sequences are now recognised (longest match); unknown sequences still fail closed. The v2 adapter now
|
|
398
|
+
typechecks against `@opencode/plugin` 2.0.31.
|
|
399
|
+
- **Verification never runs a `git` found in the work root (#141).** The verification's git calls in a work root (the
|
|
400
|
+
commits-since-dispatch diff, the test searches, the HEAD and reflog reads, the tree snapshot and the failure-recheck
|
|
401
|
+
reference) ran a bare `git`, which Windows can resolve from the working directory, so a model could plant a `git.exe`
|
|
402
|
+
there. They now run git by absolute path from outside the work root, as the router's git tools do, and refuse to run
|
|
403
|
+
when the only git is inside it. The diff, the test searches and the HEAD reads also pass the router's hardening
|
|
404
|
+
options (no hooks, fsmonitor, pager or signature programs, no optional locks). A security fix, on OpenCode v1 and v2.
|
|
405
|
+
- **OpenCode v2: a host session lookup that never answers no longer stalls the file tools (#161).** The session
|
|
406
|
+
record (directory, parent, agent) that the role checks, the file leases and the stale-resume check read gives up
|
|
407
|
+
after 10 seconds and then counts as a failed lookup, repeated after 2 seconds. A role agent's call is then refused
|
|
408
|
+
(its check needs the record), and a resume of that session is not checked for staleness. The file leases give up at
|
|
409
|
+
their own 5-second bound and skip their check for the call. A host answer that is no session record counts as a
|
|
410
|
+
failed lookup too. The session's current directory, which a tool call looks up once for both a relative
|
|
411
|
+
`read`/`write`/`edit` path and the git metadata guard, gives up after 2 seconds; the call then uses the directory of
|
|
412
|
+
the session's last successful lookup, else the session record's. When no directory is known, a relative `read`,
|
|
413
|
+
`write` or `edit` path fails the call (`[router] Refused: the session's location could not be read (…)`), as a
|
|
414
|
+
failed lookup did before, and the git metadata guard refuses a delegated session's write (see Security).
|
|
415
|
+
- **OpenCode v2: the git metadata guard checks a moved session in its current location (#161).** The `filePath` that a
|
|
416
|
+
relative `write` or `edit` `path` becomes was already resolved against a lookup made per call, but the guard resolved
|
|
417
|
+
everything else against the directory the session had at its first lookup: patch and `apply_patch` headers and their
|
|
418
|
+
path arguments, `multiedit` targets, the other path keys of a `write` or `edit` (`path` as written, `file`,
|
|
419
|
+
`file_path`), and the session's repository (its git and common directories). After the host moved the session these
|
|
420
|
+
were checked against the old directory. The guard now uses the call's own lookup, the one the relative path uses. The
|
|
421
|
+
file leases and the role checks still use the session's first directory.
|
|
422
|
+
- **OpenCode v2: a tool call's bookkeeping uses the directory its checks used (#161).** After a tool ran, the router
|
|
423
|
+
looked the session's directory up again to resolve the call's relative `read`/`write`/`edit` path for the
|
|
424
|
+
changed-file record, the session's tool history and the guard's after-call step. That lookup could wait up to about
|
|
425
|
+
12 seconds on a host that did not answer (2 seconds for its own lookup, then up to 10 for the session record when no
|
|
426
|
+
earlier directory was known), could see a session the host had moved since, and when no directory was known it
|
|
427
|
+
skipped that bookkeeping for the call. The router now keeps, per call, the directory the call was checked against
|
|
428
|
+
and reuses it, without asking the host again. So the after-call step records the directory the call was checked
|
|
429
|
+
against: a session the host moves while the call waits (for example on a permission prompt) is recorded at its old
|
|
430
|
+
location. It keeps at most 1000 calls, for up to an hour each (a call can wait that long on a permission prompt),
|
|
431
|
+
only for the session that made the call, and drops a call's entry when the call is refused and a session's entries
|
|
432
|
+
when the session is deleted. Past that, or when the call's checks needed no directory, it looks the directory up as
|
|
433
|
+
before.
|
|
434
|
+
- **OpenCode v2: five more host lookups no longer wait forever on a host that does not answer (#161).** Each now gives
|
|
435
|
+
up after 10 seconds, the bound of the session record, and then counts as a failed lookup, with the same result as
|
|
436
|
+
before:
|
|
437
|
+
- reading a role child's session to bind it to its dispatch: the child stays unbound, so its role calls are refused;
|
|
438
|
+
- reading that child's first message for the binding: the child is bound by its title, as when that read fails;
|
|
439
|
+
- reading a session's first message to check a plan task: the tool call is not checked and the next call tries again;
|
|
440
|
+
- reading a resume target's first message for the stale-resume check: the target counts as one that could not be
|
|
441
|
+
checked, so the resume is not refused as stale;
|
|
442
|
+
- checking whether a session is the root (the legacy plugin's lookup): the session is not proven to be the root, so
|
|
443
|
+
the git metadata guard refuses only the writes it refuses for a delegated session (paths that name git metadata,
|
|
444
|
+
or any write while the session's directory is unknown), and the delegation instructions are still added to its
|
|
445
|
+
prompt. On OpenCode v1 this lookup is not bounded, as before.
|
|
446
|
+
|
|
447
|
+
### Security
|
|
448
|
+
|
|
449
|
+
- **A bare repository opened as the project is protected as git metadata (#161).** When OpenCode is opened at a bare
|
|
450
|
+
repository that holds its worktrees (`proj.git`), the git metadata guard did not see a repository there (it looks
|
|
451
|
+
for `.git`), so delegated agents could write the repository's own files: `config`, `hooks/`, `HEAD`, `objects/`,
|
|
452
|
+
`refs/`. The guard now recognises git's bare shape (a `HEAD` file and `objects` and `refs` directories, which may be
|
|
453
|
+
links to local directories) in the session directory or the nearest directory above it with that shape, unless a
|
|
454
|
+
checkout comes first, and refuses writes into that repository with the usual refusal. The files of its linked
|
|
455
|
+
worktrees inside it stay writable, if the worktree's admin directory and its `.git` file point at each other and the
|
|
456
|
+
admin directory's `commondir` names the repository (the `.git` file itself stays refused); a worktree inside one of
|
|
457
|
+
git's own directories (`hooks`, `objects`, `refs`, `lfs`, …) never is. A session in a linked worktree is checked as
|
|
458
|
+
before. OpenCode v1 and v2.
|
|
459
|
+
- **A patch call whose extra patch text cannot be read is refused (#161).** The host reads the first string among
|
|
460
|
+
`patchText`, `patch_text`, `patch` and `input`; the git metadata guard also reads the others. One of those with a file
|
|
461
|
+
header that names no path (`*** Add File:` and nothing after it) was skipped, and now makes the call refused like an
|
|
462
|
+
unreadable patch. Another key's text without file headers is still ignored. OpenCode v1 and v2.
|
|
463
|
+
- **OpenCode v2: a delegated session's write is refused while its directory is unknown (#161).** When the session's
|
|
464
|
+
directory cannot be looked up and none is known, the git metadata guard cannot resolve the call's paths and the
|
|
465
|
+
session's repository. An `edit`, `write`, `multiedit`, `patch` or `apply_patch` call of a delegated session (a tier
|
|
466
|
+
or plugin agent, any session the router has not proven to be the root) is then refused: `[router] Refused: the
|
|
467
|
+
session's location could not be read, so this write cannot be checked for git metadata, which delegated agents may
|
|
468
|
+
not write (fail closed).` A path that names git metadata keeps the usual refusal. Before, the guard resolved such a
|
|
469
|
+
call against the plugin's directory and could miss the git metadata of the session's own repository (for example
|
|
470
|
+
`../<name>.git/config` from a linked worktree of a bare repository). The cost: while no lookup of that session's
|
|
471
|
+
directory has succeeded in this process (neither a tool call's own lookup nor the session record; other host
|
|
472
|
+
answers about the session do not count), its `patch`, `apply_patch` and `multiedit` calls and its `write` and
|
|
473
|
+
`edit` calls with an absolute path fail (with a relative path they fail already, see Fixed). A refused call first
|
|
474
|
+
waits for its lookups to give up: 2 seconds for the call's own lookup, and up to 10 more for the session record
|
|
475
|
+
when there is none yet. This refusal does not apply to read-class calls, but a relative `read` path fails in the
|
|
476
|
+
same state, as described under Fixed. The orchestrator is not affected once the router knows it as the root; a
|
|
477
|
+
root session not yet resolved as the root is refused like a delegated one, or waits for that lookup.
|
|
478
|
+
- **Delegated agents can no longer write repository git metadata with the file tools (edit, write, multiedit,
|
|
479
|
+
patch).** Role agents were already refused; tier agents, plugin agents (#81) and every other delegated session now are
|
|
480
|
+
too. An `edit`, `write`, `multiedit`, `patch` or `apply_patch` call is refused when a file it names is `.git` or below
|
|
481
|
+
it, in any spelling the filesystem treats as `.git` (case, trailing dots or spaces, NTFS streams, 8.3 names, a link,
|
|
482
|
+
`..` read either as the filesystem or as the host resolves it), or lies in the git or common directory of the
|
|
483
|
+
session's repository (a linked worktree's too, also a bare repository that holds the worktree; the checkout's own
|
|
484
|
+
files stay writable). On OpenCode v2 paths resolve against the session's own location. A path the router cannot
|
|
485
|
+
resolve, and a patch whose files it cannot read, is refused as well; that includes UNC and device paths, except paths
|
|
486
|
+
inside the session's own directory when the project itself is on a share. The refusal reads `[router] Refused:
|
|
487
|
+
writing git metadata (<path>) is not allowed for delegated agents.` The orchestrator session is not affected;
|
|
488
|
+
`/bypass` and the enforcement mode do not turn the check off. Shell commands are not covered. Ordinary files and
|
|
489
|
+
`.gitattributes`, `.gitignore` or `.github/` are unaffected. The published agent permissions are unchanged. OpenCode
|
|
490
|
+
v1 and v2.
|
|
491
|
+
|
|
10
492
|
## [2.9.1] - 2026-10-25
|
|
11
493
|
|
|
12
494
|
### Changed
|
package/README.md
CHANGED
|
@@ -265,7 +265,8 @@ Then install and configure model-router to handle the rest.
|
|
|
265
265
|
### OpenCode v2
|
|
266
266
|
|
|
267
267
|
The v2 adapter supports OpenCode hosts **2.0.20 or later** and typechecks against
|
|
268
|
-
`@opencode/plugin` **2.
|
|
268
|
+
`@opencode/plugin` **2.3.2**; hosts 2.3 and later were checked live on 2.4.2. Use
|
|
269
|
+
the v2 `plugins` key:
|
|
269
270
|
|
|
270
271
|
```json
|
|
271
272
|
{
|
|
@@ -1226,6 +1227,7 @@ With `routing.delegation: "roles"` the orchestrator stops picking tiers: it disp
|
|
|
1226
1227
|
| `general` | anything else; authority follows the task's needs | fast–heavy |
|
|
1227
1228
|
|
|
1228
1229
|
- **Least privilege.** Each role has a fixed maximum authority, and no role holds the web together with reads, runs or edits. Commands run through `router_run` (allowlisted scripts and commands, fixed argv, no shell controlled by the caller; npm script bodies still run in npm's pinned script shell); raw shell stays with the tier agents.
|
|
1230
|
+
- **Scoped test runs.** Use `router_run` with `script: "test-files"` and `args: ["test/unit/x.test.ts"]` (plus the dispatch's `cwd`). Package-script calls with arguments are refused with configured command names and patterns, same-script commands first; argument acceptance is unchanged.
|
|
1229
1231
|
- **Authority sets the floor.** Reading may use the cheapest tier; an edit goes below `medium` only when the router itself runs the acceptance checks on a low-risk, single-file change, and edit + run never goes below `medium` (`heavy` without those checks).
|
|
1230
1232
|
- **Budgets per role.** A role that runs out of calls returns `NEED MORE: budget` and is resumed in the same session; that is never counted as a failure.
|
|
1231
1233
|
- **Evidence from verification only.** Only verdicts move the routing evidence: the router's deterministic checks, and an independent LLM grader at half weight. Router-observed runs, incomplete returns and re-dispatches are recorded as routing statistics; a bare `DONE` counts for nothing.
|
|
@@ -1331,7 +1333,7 @@ These are character counts of the prompts the shipped config actually produces,
|
|
|
1331
1333
|
## Requirements
|
|
1332
1334
|
|
|
1333
1335
|
- [OpenCode](https://opencode.ai) v1 (`>=1.0.0 <2.0.0`) or v2 **2.0.20+** (TUI status: 2.0.24+)
|
|
1334
|
-
- Node.js 22+
|
|
1336
|
+
- Node.js 22+ (developing the plugin itself needs Node 22.18+, see [CONTRIBUTING.md](CONTRIBUTING.md#node-versions))
|
|
1335
1337
|
- Provider API keys configured in OpenCode
|
|
1336
1338
|
|
|
1337
1339
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-model-router",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "OpenCode plugin that routes tasks to tiered subagents (fast/medium/heavy) based on complexity",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -62,14 +62,21 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@lydell/node-pty": "1.2.0-beta.15",
|
|
65
|
-
"@opencode/plugin": "2.
|
|
65
|
+
"@opencode/plugin": "2.3.2",
|
|
66
66
|
"@types/node": "^26.2.0",
|
|
67
|
-
"@vitest/coverage-v8": "^5.
|
|
67
|
+
"@vitest/coverage-v8": "^5.1.1",
|
|
68
68
|
"@xterm/headless": "6.0.0",
|
|
69
69
|
"cross-env": "^10.1.0",
|
|
70
70
|
"istanbul-lib-coverage": "^3.2.2",
|
|
71
|
-
"solid-js": "1.9.
|
|
71
|
+
"solid-js": "1.9.17",
|
|
72
72
|
"typescript": "^7.0.2",
|
|
73
|
-
"vitest": "^5.
|
|
73
|
+
"vitest": "^5.1.1"
|
|
74
|
+
},
|
|
75
|
+
"overrides": {
|
|
76
|
+
"@opencode-ai/plugin": {
|
|
77
|
+
"effect": "^4.1.0",
|
|
78
|
+
"zod": "^4.6.6"
|
|
79
|
+
},
|
|
80
|
+
"minimatch": "^11.0.1"
|
|
74
81
|
}
|
|
75
82
|
}
|