opencode-model-router 2.7.0 → 2.9.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +583 -0
  2. package/README.md +20 -0
  3. package/package.json +5 -1
  4. package/src/commands/approvals.ts +354 -0
  5. package/src/commands/output.ts +34 -1
  6. package/src/compat/background.ts +2439 -0
  7. package/src/compat/child-session.ts +6 -0
  8. package/src/compat/turn-state.ts +215 -0
  9. package/src/compat/v2-client.ts +136 -17
  10. package/src/compat/v2-hooks.ts +2853 -109
  11. package/src/compat/v2-observations.ts +328 -0
  12. package/src/executor/capacity.ts +362 -0
  13. package/src/executor/child-guards.ts +40 -0
  14. package/src/executor/command.ts +265 -0
  15. package/src/executor/compile/edges.ts +809 -0
  16. package/src/executor/compile/estimate.ts +158 -0
  17. package/src/executor/compile/footprint.ts +829 -0
  18. package/src/executor/compile/index.ts +1080 -0
  19. package/src/executor/compile/parse.ts +1492 -0
  20. package/src/executor/compile/residue.ts +706 -0
  21. package/src/executor/compile/validate.ts +280 -0
  22. package/src/executor/create.ts +672 -0
  23. package/src/executor/expand.ts +551 -0
  24. package/src/executor/git.ts +1214 -0
  25. package/src/executor/host-preamble.ts +17 -0
  26. package/src/executor/instructions.ts +35 -0
  27. package/src/executor/integrate/bisect.ts +73 -0
  28. package/src/executor/integrate/checks.ts +1086 -0
  29. package/src/executor/integrate/land.ts +177 -0
  30. package/src/executor/integrate/phase-suite.ts +407 -0
  31. package/src/executor/integrate/queue.ts +3083 -0
  32. package/src/executor/integrate/run-resolver.ts +19 -0
  33. package/src/executor/launch.ts +652 -0
  34. package/src/executor/ledger.ts +2208 -0
  35. package/src/executor/observations.ts +212 -0
  36. package/src/executor/paths.ts +159 -0
  37. package/src/executor/platform.ts +39 -0
  38. package/src/executor/process-identity.ts +19 -0
  39. package/src/executor/qa-loop.ts +470 -0
  40. package/src/executor/recovery.ts +403 -0
  41. package/src/executor/runtime.ts +6233 -0
  42. package/src/executor/schedule.ts +246 -0
  43. package/src/executor/slots/env.ts +145 -0
  44. package/src/executor/slots/pool.ts +1564 -0
  45. package/src/executor/slots/provision.ts +853 -0
  46. package/src/executor/tool.ts +534 -0
  47. package/src/executor/types.ts +2064 -0
  48. package/src/executor/unattended.ts +488 -0
  49. package/src/guard/store.ts +3 -1
  50. package/src/index.ts +1789 -288
  51. package/src/router/config.ts +823 -26
  52. package/src/router/dispatch-header.ts +95 -2
  53. package/src/router/git-tools.ts +266 -19
  54. package/src/router/leases.ts +1469 -0
  55. package/src/router/logger.ts +44 -32
  56. package/src/router/protocol.ts +44 -10
  57. package/src/router/role-agents.ts +334 -20
  58. package/src/router/roles-config.ts +93 -1
  59. package/src/router/roles.ts +1 -1
  60. package/src/router/run-tools.ts +56 -4
  61. package/src/router/sessions.ts +11 -0
  62. package/src/router/tool-paths.ts +308 -0
  63. package/src/router/work-roots.ts +86 -0
  64. package/src/routing/advisor/findings.ts +25 -5
  65. package/src/routing/classify/index.ts +7 -1
  66. package/src/routing/classify/route-line.ts +96 -5
  67. package/src/routing/classify/rules.ts +11 -0
  68. package/src/routing/classify/types.ts +26 -0
  69. package/src/routing/commands/stats.ts +2 -2
  70. package/src/routing/outcomes/durations.ts +225 -0
  71. package/src/routing/outcomes/index.ts +59 -2
  72. package/src/routing/outcomes/persist.ts +409 -0
  73. package/src/routing/outcomes/signals.ts +17 -0
  74. package/src/routing/outcomes/stats.ts +170 -11
  75. package/src/routing/outcomes/timings.ts +836 -0
  76. package/src/routing/outcomes/types.ts +98 -0
  77. package/src/routing/roles/admission.ts +1028 -0
  78. package/src/routing/roles/approvals.ts +957 -0
  79. package/src/routing/roles/binding.ts +116 -13
  80. package/src/routing/roles/check-placement.ts +112 -0
  81. package/src/routing/roles/git-root.ts +500 -0
  82. package/src/routing/roles/orphans.ts +68 -0
  83. package/src/routing/roles/policy.ts +30 -3
  84. package/src/routing/roles/read-set.ts +325 -0
  85. package/src/routing/roles/work-root.ts +12 -2
  86. package/src/routing/wire/dispatch.ts +697 -30
  87. package/src/routing/wire/hint.ts +56 -8
  88. package/src/routing/wire/working-set.ts +58 -0
  89. package/src/util/linear-trim.ts +32 -0
  90. package/src/v2.ts +94 -49
  91. package/src/verify/batch.ts +7 -2
  92. package/src/verify/branch.ts +141 -0
  93. package/src/verify/canonical-path.ts +35 -0
  94. package/src/verify/deterministic.ts +268 -17
  95. package/src/verify/dispatch.ts +348 -37
  96. package/src/verify/dod.ts +46 -0
  97. package/src/verify/edges.ts +817 -0
  98. package/src/verify/exec.ts +52 -9
  99. package/src/verify/gate.ts +349 -16
  100. package/src/verify/git-top.ts +43 -0
  101. package/src/verify/head.ts +107 -0
  102. package/src/verify/pending.ts +1846 -18
  103. package/src/verify/perimeter.ts +1186 -0
  104. package/src/verify/pin.ts +109 -0
  105. package/src/verify/plan-task.ts +729 -0
  106. package/src/verify/reference.ts +297 -8
  107. package/src/verify/risk.ts +16 -3
  108. package/src/verify/runner.ts +706 -32
  109. package/src/verify/tree.ts +372 -16
  110. package/src/verify/types.ts +66 -2
  111. package/src/verify/wiring.ts +1594 -46
package/CHANGELOG.md CHANGED
@@ -7,6 +7,589 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.9.0] - 2026-10-25
11
+
12
+ ### Added
13
+
14
+ - **OpenCode v2: `routing.orphans.resume`**, `"refuse"` by default or `"allow"` to skip the early stale-role-resume check.
15
+ A bounded process-wide registry tracks refused resumes and lost role dispatches; the first refusal warns, later
16
+ ones log at debug. Binding-lookup failures share a separate process-once warning, then log at debug. Inert on v1,
17
+ where the existing v2-only-features notice also names orphan cleanup.
18
+ - **OpenCode v2: role-dispatch decision rows record where their risk came from.** `trace.riskSources` lists the class
19
+ base risk, the rules estimate, the route line's `risk=` claim, the merged facts, any inherited resume risk and the
20
+ effective risk, plus an optional bounded vocabulary label (a single word or a table id, never prompt text). Routing
21
+ is unchanged; older rows stay readable.
22
+ - **OpenCode v2: configurable `routing.roleFloor: "gated"`** (bundled `tiers.json` or global override, not project overrides;
23
+ code default `"strict"`). A role dispatch that may edit
24
+ and run commands, whose detection is `grader`, whose risk is not `high`, whose return gate runs and whose role can
25
+ be raised from `medium` straight to `heavy`, gets a `medium` authority floor instead of `heavy` (bounds reason
26
+ `gated:authority`, recorded only when gating lowers the final floor). A verification FAIL, and for gated children also
27
+ an UNVERIFIABLE return, raises the resumed child to `heavy`. Every other floor cell is unchanged; inert on OpenCode v1.
28
+ - **OpenCode v2: intrinsic service observations for the amended G8 oracle (A-6.1-1).** With the opt-in observations
29
+ below, verification checks/grading, integration rebase/checks/fast-forward and phase-suite commands emit paired
30
+ service spans that bracket only their execution; preparation, slot and lease waits, and retry backoff are recorded as
31
+ separate spans so they cannot inflate a bound term. Off by default and inert on OpenCode v1.
32
+ - **OpenCode v2: opt-in diagnostic observations.** Set `MODEL_ROUTER_V2_OBSERVATIONS=<directory>` to an existing
33
+ directory before setup to write bounded, sequence-numbered JSONL streams, sealed on adapter disposal. They
34
+ record dispatch native-argument fingerprints, completion effects, scheduler and physical-slot transitions,
35
+ without prompt or file content. Off by default and inert on OpenCode v1.
36
+ - **CPX e2e smoke diagnostics:** bounded wrapper/child-command timings and host/setup/launch checkpoints are
37
+ retained with failure evidence before scratch cleanup. These are diagnostic observations only; executor
38
+ behavior, offline checks and G1–G12 bounds are unchanged.
39
+ - **CPX soak: `npm run soak:analyze` offline soak analyzer (amendment A-6.1-3).** It reads retained soak evidence and
40
+ reports observations, violations and per-criterion and per-subcase status. Subcases the current logs cannot show
41
+ are reported as `not-observable` declared gaps, never as passes (A-6.1-6); an overall passing verdict requires at least
42
+ five working days and every required criterion to be `ok`. Absence of evidence is never a pass.
43
+ - **OpenCode v2: `/router stats` shows a "Dispatch durations" table and an "Orchestrator cache-read share" line** when
44
+ timing logs exist.
45
+ - **OpenCode v2: background dispatch.** A subagent dispatch whose predicted duration is long runs in the background
46
+ (`routing.background.mode`: `auto` decides from the predicted duration, `model` lets the orchestrating model decide,
47
+ `off` keeps every dispatch in the foreground as before; `routing.background.minPredictedMs` sets the `auto` threshold).
48
+ The router state lists the dispatches in flight and those completed since the last turn, and the router guarantees
49
+ apply when a background child completes.
50
+ - **OpenCode v2: held results with verdict delivery.** The result of a background dispatch that requires verification
51
+ is held: the orchestrator sees a placeholder until the verification gate settles, a resume of the held child is
52
+ refused, and the verdict is posted to the orchestrator's session. A held result whose gate gives no verdict (a
53
+ failed or interrupted child, no verification required, an error in the gate, a restart that lost the verification
54
+ data) is posted as `UNVERIFIABLE` with its reason, never as `PASS`. `router_verify` refuses a held handle: its own
55
+ gate posts the verdict.
56
+ - **OpenCode v2: work leases** (`routing.leases.mode`, `routing.leases.run`). A child session holds a lease on each
57
+ file it edits in its checkout; another child's edit of that file in the same checkout is refused until the lease is
58
+ released (a plan task's lease also refuses another plan task's edit of that path in any linked worktree), search
59
+ results under another holder's edit are omitted, and `router_run` annotates or refuses a run on a leased target.
60
+ - **OpenCode v2: restart recovery.** In-flight dispatches, held results and pending verifications are journaled in
61
+ `pending.jsonl` in the per-user state directory (`~/.local/state/opencode-model-router`, or
62
+ `$XDG_STATE_HOME/opencode-model-router` when set, outside Windows), never in the temp directory. `/router approve`
63
+ refuses that directory and any repository inside it (a protected location). After a restart the router recovers a
64
+ dispatch whose child finished, re-posts a verdict that was reached but not delivered, and keeps posted results
65
+ hidden. A restored pending verification keeps its cross-repo checks: the branch and HEAD recorded at return, the
66
+ unobservable writers and the check placements of a deferred dispatch are journaled and checked again, and a record
67
+ with a malformed one is dropped. A dispatch's perimeter is not journaled, so `router_verify` on a restored handle
68
+ whose dispatch had one reports `UNVERIFIABLE` (`perimeter lost in restart`), never `PASS`. A held result's
69
+ dispatch-time head is journaled and checked again: a held result whose head or perimeter was lost settles
70
+ `UNVERIFIABLE`, and a restored held result settles in place. A journal that vanishes under a running process is
71
+ rewritten from memory. OpenCode v1 ignores every `routing.background.*` and `routing.leases.*` key and logs one
72
+ notice per process that names them.
73
+ - **OpenCode v2: the plan executor is Windows only in this release.** Its execution slots need a drive-letter path
74
+ (`routing.executor.slotsDir`, default `<drive>:\.omr-slots\<planId>`). On platforms other than Windows it is inert:
75
+ `router_plan` and `/plan` are not registered, `/router` does not list `/plan`, role agents get no slots rule and no
76
+ executor-home lookup runs (`<git common dir>/omr-executor`, found on disk without running git, is still denied to
77
+ them whenever the common directory resolves, even before it exists), invalid `routing.executor.*` values are not reported, no executor discovery runs at start, and when
78
+ roles mode at start with enforced leases and verification not `never` would assemble it the router logs one notice
79
+ per process, `plan executor requires Windows; router_plan and /plan are not registered`.
80
+ - **OpenCode v2: plan executor registration.** `router_plan` and `/plan` are registered only in roles mode selected at
81
+ start, and `router_plan` resolves the executor at call time; `/router` lists `/plan` only when it is registered, not
82
+ user-defined, and the executor prerequisites hold (roles delegation, enforced leases, verification not `never`, a
83
+ location inside `routing.workRoots` when configured). State-changing and authority actions (`compile`, `residue`, `approve`, `adopt`, `abort`, `purge`, `land`,
84
+ `answer`, `pause`, `resume`, `add-tasks`, `done`, `gc`, and any other state-changing action) require a proven
85
+ depth-0 session with no parent, with no bound-plan-child exception; failed parent lookups refuse. Read-only
86
+ `status`, `ready`, `export` and `/plan inbox` allow roots or exactly bound plan children reading only their own
87
+ explicitly named plan, never another plan. The same rule guards the tool and command. An existing user-defined
88
+ `/plan` is preserved: v2 checks the host command registry, logs one conflict warning and keeps `router_plan` available;
89
+ v1 adds no `/plan` notice for that user command. Active plans add executor instructions to router state after the plan
90
+ section. Assembly requires a git repository, roles delegation, enforced leases and a plan-task verifier with
91
+ verification enabled; otherwise the tool and command report why the executor is unavailable. The keys, tool and
92
+ command have a user guide ([docs/EXECUTOR.md](docs/EXECUTOR.md)) and a design record
93
+ ([ADR 0007](docs/adr/0007-critical-path-execution.md)); `slotsDir`, `integrationChecks`, `phaseSuite`,
94
+ `provision` and `python` are trusted keys that only the global override sets. `/router approve` refuses a repository's
95
+ executor home (`<git common dir>\omr-executor`, with its plan and slot-marker directories) and any repository inside
96
+ it; that check runs git within one 15 s bound in all, and
97
+ refuses a candidate it could not finish in time. OpenCode v1 ignores every `routing.executor.*` key and logs one
98
+ notice per process that names them; a best-effort `/plan` use without a user-defined command shares that notice and
99
+ adds no output. The v1 tool, command and help maps are unchanged. Breaker answers and QA-cap `accept`/`fix` answers
100
+ that unpause a phase re-enqueue its verified tasks and wake the integration lanes, without duplicating queued entries
101
+ or bypassing task leases. Foreign plans attach read-only: startup and failed-adopt recovery check the ledger's
102
+ repository before opening a writer, so viewing a foreign plan takes no writer lock and changes no writer epoch or
103
+ journal. Status remains available; mutation requires that repository. The trusted slots root stays allowed after a
104
+ restart or `/router-reload` while slot and integration worktrees exist; roots inside or above a non-slot checkout are
105
+ refused, and the default slots drive comes from the location's repository toplevel; a registered worktree whose folder
106
+ is gone never blocks that allow. One executor runs per process: a plugin copy refused by the process claim waits and
107
+ assembles once the holder disposes, running recovery once, and is wired into the host exactly like an executor
108
+ assembled at start (plan state, executor instructions, host events, retry stop, ordered disposal). Plan-task
109
+ verification is cancelled first at disposal, a verdict decided before disposal is still journaled, manual `gc` of a
110
+ completed plan waits for pending phase tags, and `purge` creates no directories, removes the empty plan directory and
111
+ skips collection for an invalid `slotsDir` when the plan holds no slot markers. A `NEED MORE: budget` end resumes
112
+ the same child session as many times as the guard's cumulative call multiplier allows (`BUDGET_RESUMES`), then
113
+ parks as `budget-cap`; each budget resume starts a new guard round for that child across plugin locations (its per-dispatch budget and read
114
+ count restart, the cumulative ceiling stays). A superseded run's late rejection cannot interrupt or unregister its resumed round.
115
+ Plan children keep their resolved tier for both round budgets and cumulative ceilings. An editing task's
116
+ child gets the executor's `CAP:12` read cap (its `[cap: n/12]` and `CAP REACHED` banners, as a routed child's `CAP`)
117
+ and its route's `budget=` as its call budget; interrupted, parked or lost attempts keep
118
+ their uncommitted work on `omr/<plan>/wip/<task>` for the next attempt; WIP refs remain until purge, including after
119
+ abort. Unsaved-slot holds are rebuilt after restarts; gc and purge retry saving before collection. Purge waits up to
120
+ 30 seconds for abort cleanup and refuses if it is still pending. Successful clean or presaved releases clear rebuilt
121
+ holds too, preventing duplicate abort releases; retained gc predicates still refuse any remaining hold.
122
+ Metadata-less slot directories are quarantined,
123
+ not counted as clean, and pool gc preserves uncommitted work unless the caller explicitly marks it saved.
124
+ Orchestrator-shell filtering drops only the semicolon-delimited clause marked `(orchestrator shell)`, not its
125
+ neighbours, and compilation warns on mixed criteria lines. A block left with no criteria and no checks falls back to
126
+ the inferred DoD. A cap written in the plan is neutralised with the task's other directives, and shared-context
127
+ directives are neutralised at compile, keeping the stored text identical at launch; editing tasks receive the
128
+ executor's own `CAP:12`, placed first (right after `PLAN CONTEXT`, before the shared context and the task text), so
129
+ it is the first cap token in the child prompt even when a plan token split across lines survives neutralisation.
130
+ Compilation takes the base branch tip from the repository toplevel (detached HEAD is refused) using the
131
+ full branch ref, so a same-named tag cannot confuse it; approval reads the actual plan's ledger rather than deriving
132
+ its id from the slots directory and refuses a moved base with `E_STALE_BASE`. Integration/CI worktrees start from
133
+ the ledger's integration head. Disposal no longer waits on a launch begun after it started: once a plan is disposing,
134
+ the runtime hands the launcher no new child and no budget resume. A park whose slot work could not be saved keeps
135
+ the slot on the parked task (the ledger accepts a slot on a parked task for this), so the slot is never reset or
136
+ released while that work is unsaved. After an abort, slot collection (automatic or `gc`) waits until each cancelled
137
+ child's slot was saved and released, or held when its save failed, so a slot is never collected mid-save.
138
+
139
+ ### Changed
140
+
141
+ - **OpenCode v2: the cost doctor separates fresh unknown bindings from stale role resumes.**
142
+ `role-binding-unknown` warns only for fresh children; the new `role-child-stale-resume` info finding reports
143
+ resumed unknown-binding rows over 7 days and this process's refused resumes, without a notice. It suggests
144
+ `routing.orphans.resume: "refuse"` only when set to `"allow"`; role-stats totals are unchanged.
145
+ - **OpenCode v2: stale role-child resumes are refused before a new attempt starts.** An unregistered or retired
146
+ dispatch nonce would leave the child unbound (local actions only, no work root): dispatch a fresh task with the same
147
+ prompt and route line instead. Plan children, live/recovering attempts and other unknown-binding causes are unchanged.
148
+ A lost role-dispatch wake adds `Dispatch a fresh task: resuming it is refused.` only with live roles and resume mode
149
+ `"refuse"`. The refusal covers dispatches lost in a restart or already finished, and names the call's agent.
150
+ - **OpenCode v2: roles protocol teaches slicing for cost within its existing byte budget.** Non-design work is split
151
+ into edit-only implementer dispatches (`class=implement needs=edit d=deterministic` + `testsPass` acceptance), keeping
152
+ the authority floor at most `medium` even at high risk when verification is enabled; a slice that must run commands
153
+ gets a machine check and `VERIFY:required`, avoiding the `heavy` write + exec authority floor when the router gates
154
+ it. Routing is unchanged.
155
+ - **CI: pull requests are Linux-only; one Windows Node 22 typecheck + full-suite coverage job runs on master pushes
156
+ and manual runs.** Linux e2e and Bun smoke stay blocking. Without Windows coverage, only `src/verify/exec.ts`
157
+ and the `src/executor/` prefix are warn-only; with it, all coverage gates block (G-21).
158
+ - **OpenCode v2: register `router_plan` and `/plan` only in roles mode selected at start, like `router_run`.** Tiers
159
+ mode no longer carries the unusable plan-tool schema; switching to roles needs a restart. `/router` help never
160
+ advertises an unregistered or user-defined `/plan`. OpenCode v1's tool, command and help maps are unchanged.
161
+ - **OpenCode v2: shorter serial integration entries.** Integration checks on the slot the queue has just rebased to the
162
+ candidate no longer reset it a second time (clean and HEAD check only, falling back to the full prepare on a HEAD
163
+ mismatch or provisioning drift), and the check-selection reads overlap the clean. Bisect probes, reruns, reverts and
164
+ phase suites keep the full prepare.
165
+ - **CPX e2e smoke: the G8 makespan bound is recorded, not asserted (owner amendment A-6.1-2).** The throughput run
166
+ still reconstructs and records makespan, CP_eff, W_auth/p, ΣI_service, the bound, the ratio and whether it was met;
167
+ service-evidence integrity and the 10,000 ms idle-with-ready ceiling stay asserted. Delegated grading observed as
168
+ `service-unattributed` is recognized verification evidence credited at zero intrinsic cost, so the computed bound is
169
+ conservative.
170
+ - **CPX e2e smoke: amended G8 intrinsic-service oracle (A-6.1-1).** The bound uses the pre-run DAG, authored work,
171
+ attributable verification/integration/phase-suite service and configured parallelism, with fail-closed evidence
172
+ checks and raw CP/integration diagnostics retained. Throughput uses the default integration batching; resilience
173
+ keeps singleton batches.
174
+ - **OpenCode v2: declared plan writers must produce a diff in every verification mode.** The owner's 2026-10-14
175
+ amendment to M39 makes a nonempty write footprint with no changes a counted `commit-failed` (`no changes`) for
176
+ `VERIFY:required`, `deferred` and `none`: bounded retries, then park, never silent `done`. No idempotent exception
177
+ is allowed. Empty-write no-change success and its phase-gate reconciliation are preserved.
178
+ - **OpenCode v2: per-turn router state moves out of the system prompt.** The pending-verification list, late
179
+ verification notices and the route hint are delivered in a per-turn `<router-state>` message appended after the
180
+ conversation, so the system prompt stays byte-stable across turns. Late notices are repeated every turn until
181
+ `router_verify` reads them. OpenCode v1 is unchanged.
182
+
183
+ ### Fixed
184
+
185
+ - **OpenCode v2: `/router` lists `/plan` only when `/plan` is registered and the executor can assemble.** That is roles
186
+ mode selected at start and still configured, no user-defined `/plan`, enforced leases, verification not `never` and a location inside
187
+ `routing.workRoots` when configured. Without a routing block, help remains byte-identical to the legacy output;
188
+ OpenCode v1 is unchanged.
189
+ - **OpenCode v2: a task blocked by a reverted dependency keeps its unsaved work.** The integration queue no longer
190
+ gives such a task's slot back to the pool unsaved. The work is first saved at the task's WIP ref (a failed save keeps
191
+ the slot leased). A running task's slot is released once, by the executor, after its cancelled child has ended.
192
+ - **OpenCode v2: recovered plan work keeps interrupted-attempt safety.** Re-provisioning saves an owned slot before
193
+ releasing or resetting it and retains unsaved-work holds on failure. Recovered budget ends wait for root-context
194
+ admission before resuming the same child; launcher-liveness evidence follows the current resume round. Abort drains
195
+ attachment verification before saving/releasing its slots, and collection waits for those pipelines too.
196
+ - **OpenCode v2: executor recovery no longer deadlocks when a task was verifying at restart.** Recovered
197
+ re-verification (and a finished child's completion) no longer blocks the recovery barrier: it waits for the owning
198
+ root's next router call, then runs. An adopt cuts the old attachment's graders, and a cut observation is no longer graded as a counted
199
+ `unverifiable` by the next attachment.
200
+ - **OpenCode v2: plan slots are claimed in launch-priority order.** A slot acquisition took its place in the pool's
201
+ queue only after its own `git rev-parse` returned, so the highest-priority task could claim the last slot and wait
202
+ behind every other slot's provisioning. Claims now queue in call order and await their base lookup inside the claim.
203
+ - **OpenCode v2: after a host restart, the executor requeues a plan child at once when its launching process is
204
+ provably gone.** It records each child's launcher (pid, hostname, per-process token); recovery treats a child as lost
205
+ without the 60 s liveness probation only when that process is dead on this host and the child was not running a tool
206
+ when the host stopped (host contract C16). A child stopped inside a tool, whose processes (for example a `router_run`
207
+ test run) can outlive the host, keeps the probation, as does every other case.
208
+ - **OpenCode v2: diagnostic observations record a scheduler graph row for every committed ledger batch**, including
209
+ metric-only batches, so a runtime row never reports a ledger sequence that no graph row preceded.
210
+ - **OpenCode v2: a plan-task verification that cannot snapshot its slot says why.** The unverifiable result now
211
+ includes a bounded, scrubbed reason (for example a git timeout or a missing file) naming the git stage that failed;
212
+ it still fails closed. A grader that cannot start, and each transient verification rerun, log their reason.
213
+ - **OpenCode v2: integration check selection never treats a failed `git show` as a missing file.** Only git's explicit
214
+ "path does not exist" error means absent; any other read failure fails the check as `prepare`, never a `no-checks`
215
+ pass. A failed prepare now waits for its overlapped reads before the slot is retried.
216
+ - **OpenCode v2: integration-check pytest uses the slot's virtual environment again.** Since the guarded-executable
217
+ change, pytest checks ran the host interpreter without the slot's environment. They again run the slot's provisioned
218
+ `.venv` interpreter with `VIRTUAL_ENV` set, the virtual environment first on `PATH` and `PYTHONPATH`/`PYTHONHOME`
219
+ unset, as `router_run` does; credentials stay stripped and `ComSpec` is the validated system shell on Windows. The
220
+ `.venv` interpreter is accepted only when it matches the slot's post-provisioning snapshot (path, size and
221
+ modification time), the same trust rule as `router_run`. Otherwise the absolute host interpreter outside the slot runs.
222
+ A file planted in the slot root is never selected. As in `router_run`, a slot without a detected Python manager gets
223
+ no virtual environment (and unsets `PYTHONPATH`, `PYTHONHOME` and `VIRTUAL_ENV`); only outside a registered slot do
224
+ the host's values pass through. The interpreter is resolved again from the configuration for every slot a command
225
+ runs in, never reused from another slot.
226
+ - **OpenCode v2: QA fix tasks get a launchable route line for any repository path.** A repository or phase root that
227
+ cannot be written safely into a route line (brackets, quotes, separators) is omitted, since the slot root is always
228
+ appended at launch; fix tasks stored by the earlier build with an unbracketed line launch as well.
229
+ - **OpenCode v2: the executor's default QA fix task route line is now a well-formed `[route ...]` line**, so a fix task created at runtime without a phase `FIX` template launches instead of failing route rendering.
230
+ - **OpenCode v2: service observations exclude process preparation, mark native grading without provider-attempt events as insufficient evidence, and attribute plan-task checks and grading to the checked candidate.**
231
+ - **OpenCode v2: the executor admits tasks to physical slots in critical-path priority order.** A lower-priority
232
+ task no longer takes the only free slot ahead of a higher-priority ready task, and a durable slot release reschedules
233
+ slot-blocked tasks at once instead of waiting for their retry backoff.
234
+ - **OpenCode v2: reused executor slots no longer launch dirty or at the wrong base after dependency provisioning.** An
235
+ acquisition whose reset ran an installer afterwards gives no reset proof, so the launch resets the slot again.
236
+ - **OpenCode v2: executor children adopted after a launch-confirmation timeout get their timing row**, exactly once,
237
+ without reviving the launch's settled completion effects.
238
+ - **OpenCode v2: executor launches reuse acquisition's verified reset at the current integration head, avoiding a duplicate reset while retaining full preparation for moved heads and unproven leases.**
239
+ - **OpenCode v2: the executor's idle-with-ready metric reports a duration exactly equal to its endpoints.**
240
+ - **CPX e2e G8 idle checks reconstruct maximal episodes from committed v2 observations.** Failed slot/launch
241
+ reservations no longer hide stalls by fragmenting ledger metrics. The unchanged 10,000 ms ceiling applies to
242
+ whole episodes; every ledger fragment must be covered, and missing seals, sequence gaps or dropped events fail
243
+ closed. The asserted G8 idle predicate, confirmed by the owner on 2026-10-14, is **A: durable ready work with
244
+ provider capacity**, so time spent waiting for a physical slot counts as idle. The physical-slot-blocked/launchable
245
+ split (predicate B) is diagnostic only and cannot shorten an asserted episode; the 10,000 ms bound has not been
246
+ relaxed. Per-host streams are retained before scratch cleanup, including incomplete failure/restart diagnostics.
247
+ - **CPX e2e smoke throughput checks follow the strict G8 contract:** provider delays and the independent CP/W
248
+ oracle use authored fixture milliseconds, makespan has no additive slack, and idle with ready work is capped at
249
+ 10,000 ms. By owner amendment (2026-10-14) the fixed 90 s per-host watchdog, which cannot hold a complete run
250
+ (measured serial integration alone is ~75–85 s), is replaced by one derived from the contract: a 60 s setup
251
+ watchdog, then 1.3 × max(CP, W/p, entries × 5 s) plus a 60 s audit margin, capped at 300 s per host. The
252
+ per-entry allowance only sizes the watchdog; the G8 assertion keeps the measured serial integration.
253
+ - **OpenCode v2: malformed shared lease registry entries no longer disable enforcement.** Entries are validated
254
+ individually; an invalid entry is refused without replacing it or disturbing valid registries. If the registry cannot
255
+ start with leases enforced, lease-checked file, search, git and run tools are refused instead of bypassing enforcement.
256
+ - **OpenCode v2: plan checks re-resolve inherited router commands for the prepared execution slot.** Phase suites,
257
+ base checks, bisect probes and revert regressions refresh the command executable, environment and authorization
258
+ against the checkout under test rather than reusing the integration worktree's resolution. Explicit working-directory
259
+ and environment overrides are preserved. Configured commands and commands with explicit `cwd` or `env` overrides
260
+ execute unchanged in full instead of being replaced by scoped runs; ordinary equivalent package-script test scoping
261
+ is retained.
262
+ - **OpenCode v2: plan phase bisects distinguish actual file-scoped checks from full-command fallbacks.** A full or
263
+ mixed run cannot establish isolated-file evidence. With a failing base and no valid isolation, a regression remains
264
+ unattributed instead of blaming the wrong task; a file-scoped bisect also stops unattributed if a historical probe
265
+ falls back to full commands. Genuine file-scoped bisects are preserved.
266
+ - **OpenCode v2: explicit plan-writer routes are checked against the selected role's edit grant.** Compilation uses
267
+ the resolved role policy, including configured permission narrowing, rather than class/tier heuristics. A writer
268
+ routed to a general role without an `edit` grant is rejected with a task and line diagnostic; valid edit-capable routes
269
+ remain accepted.
270
+ - **OpenCode v2: failed rebase cleanup preserves the initiating Git error.** Cleanup checks the slot's rebase state
271
+ before aborting and retains the original failure alongside any cleanup error. Integration refusals persist bounded
272
+ diagnostic details in the journal with URL credentials redacted from keys and string values before clipping, with
273
+ bounded traversal and output handling.
274
+ - **OpenCode v2: inferred plan writers no longer launch as read-only explorers.** Before role selection, explicit
275
+ or ownership-inferred write footprints reconcile automatically inferred read-only classes and add the `edit` need,
276
+ keeping the tier, pin, risk and existing needs. Incompatible authored read-only routes fail compilation with a task
277
+ and line diagnostic instead of being silently overridden. Manual/preflight/QA tasks and `Writes: none` are excluded;
278
+ explorer permissions are unchanged.
279
+ - **OpenCode v2: plan phase suites and base checks run in the CI slot at the commit under test, not the integration worktree's current head.**
280
+ - **OpenCode v2: plan phases no longer stall after a no-change completion.** Tasks that finish without a commit and
281
+ manual/preflight tasks reported done reconcile their phase gates and dependent phases, so QA launches without another
282
+ orchestrator turn.
283
+ - **OpenCode v2: work leases no longer collide across linked worktrees.** Two child sessions that edit the same
284
+ repo-relative path in two worktrees of one repository (`git worktree add`) are both allowed: an ordinary write lease
285
+ is keyed by its checkout, not by the repository, and a write whose target the router cannot read is refused only while
286
+ another child holds a lease in the same checkout. The leases of plan tasks stay repository-wide among plan tasks, so
287
+ two plan tasks that edit one path in two slots still refuse each other, and a plan child's write whose target the
288
+ router cannot read is checked against the plan-task leases in the whole repository. A path spelling that may name
289
+ any file (a device path, an 8.3 short name, a drive-relative path) still fails closed against every holder anywhere.
290
+ A refusal names the file under edit and asks for the requester's own path in `NEED MORE: lease` (repo-relative for a
291
+ plan task). Reads were already keyed by the file on disk. OpenCode v1 is unchanged.
292
+ - **OpenCode v2: plugin module copies share one process-wide lease registry.** Snapshot restoration is attempted only
293
+ once when the registry is created, even if the snapshot is missing or invalid, so a later location cannot overwrite
294
+ live leases by restoring again.
295
+ - **OpenCode v2: a resumed background dispatch delivers its own answer.** It no longer takes an earlier turn's
296
+ completion as its own result, even when the earlier turn was still being processed when the parent saw it, nor the
297
+ child's earlier answer. Completions are told apart by the message that carries them rather than by their text, so two
298
+ turns with the same answer each get one verdict; a dispatch whose child ended before its answer could be read is
299
+ read again on the parent's next request instead of waiting for the 6 h sweep. Known limit: the set of completions
300
+ already taken lives in memory, so a resume right after a plugin restart can still mis-attribute.
301
+ - **OpenCode v2: background dispatches without a deterministic check are graded.** Their grader launches as the
302
+ orchestrator agent that made the call, also after a restart, never from a role child's context (which denies
303
+ `subagent`); an entry journaled by an older build falls back to the parent session's current agent and its latest
304
+ assistant message (looked up for at most 2 s, and not for a completion that did not succeed), and a result that
305
+ could not be verified is tagged `UNVERIFIABLE` instead of `PASS`. Acceptance is unchanged. OpenCode v1 is unchanged.
306
+ - **OpenCode v2: one plugin copy per process decides each background call.** Call claims are process-wide across the
307
+ plugin copies a host loads per location (bounded to 8000 claims in all, the oldest of any copy evicted first): a
308
+ call that reaches several copies is completed once, and the claiming copy's background decision stands. A copy that
309
+ lost the claim leaves the call's `background` flag as it found it and does not tell the orchestrator the result is
310
+ unverified. OpenCode v1 is unchanged.
311
+ - **OpenCode v2: an unrecorded child session never backgrounds a dispatch.** A child the plugin never recorded (after a
312
+ reload, or past the 1000-entry bound) no longer counts as a root parent in the background decision (root parents
313
+ only): its kind comes from the role decision's session read or from the host, and a failed lookup keeps the
314
+ foreground value. OpenCode v1 is unchanged.
315
+ - **OpenCode v2: background-first runs write `turns.jsonl` rows.** The end of a root session's run now closes its
316
+ orchestrator turn, so the kickoff and each wake-up (runs that no user prompt starts) get one row each, even while a
317
+ background dispatch is still open. OpenCode v1 is unchanged.
318
+ - **Role prompts: the dispatch's work root wins over the host's environment block.** The work-root rule of every role
319
+ prompt now says that the router's `Working directory:` line and the work root in the dispatch's ENVIRONMENT win over
320
+ the working directory in the host's environment block (role children get the task without the route line), so a role
321
+ no longer refuses its work root because the host named the parent's directory.
322
+ - **OpenCode v2: a second booted location no longer settles another location's running dispatch as `lost in
323
+ restart`.** When one host process loads a router instance per location, each instance now keeps a beat file in
324
+ `pending.instances` next to `pending.claims` while it holds a session claim. A new instance refuses to adopt a
325
+ session whose claim belongs to a live sibling instance, so that instance's records stay dormant and its verdict is
326
+ the only one delivered. A dead owner (stale beat, or dead pid) is still recovered as before. Journal and claim
327
+ records written by earlier builds read as before. OpenCode v1 is unchanged.
328
+ - **OpenCode v2: no start-up reference GC in a location outside `routing.workRoots`.** When `routing.workRoots` is
329
+ configured and non-empty, an instance loaded in a directory outside every entry skips the start-up reference GC and
330
+ logs one info line naming the skip. Role agent registration in roles mode still lists the repository's worktrees
331
+ there (`git worktree list`, read-only), so a `routing.workRoots` glob meant for later-created worktrees does not drop
332
+ the existing ones from the role agents' `external_directory` rules. With executor enforcement enabled, role agents
333
+ still deny the executor home there when worktrees were listed or their listing failed, and get no executor slots-root
334
+ allowance. The location check uses the documented
335
+ glob semantics (`*` crosses separators, as in the role agents' rules) and compares canonical paths. Without
336
+ `routing.workRoots` nothing changes. OpenCode v1 is unchanged.
337
+ - **OpenCode v2: `router_verify` on a held background handle reports the verdict its gate reached** (method, outcome,
338
+ reasons, caveats and notes). It used to settle every held gate verdict as a deterministic result with no caveats, so
339
+ a checker that could not verify showed "UNVERIFIED: deterministic" without the grader's reason and a pass with
340
+ caveats showed "✓ verified". The stored pass/outcome always match the posted tag (a trivial dispatch the gate accepts
341
+ unverified reads pass, a pass that `strictUnverifiable` rejects reads fail, also when re-posted after a restart). The
342
+ posted verdict is unchanged. OpenCode v1 is unchanged.
343
+ - **OpenCode v2: plugin copies loaded per booted location share the pending journal safely.** A fresh writer mark of
344
+ the same process under another module token counts as a live writer (start-up compaction is skipped), each copy
345
+ compacts through its own temp file, and a recreate merges the records of every copy. Beat files in
346
+ `pending.instances` are written atomically, a half-written beat counts as live while its modification time is
347
+ fresh, and stale beats are swept at start. When the host evicts a location while its child still runs, the adopting
348
+ instance keeps that dispatch dormant until its end event instead of reporting it `lost in restart`.
349
+ - **OpenCode v2: the background decision's parent lookup is bounded.** An unrecorded parent is looked up at most once
350
+ and for at most 1 s; on timeout the dispatch stays in the foreground.
351
+ - **OpenCode v2: plugin copies loaded per host location share one timing recorder.** When one host process loads the
352
+ plugin once per location, `turns.jsonl` no longer gets repeated rows and its turn numbers no longer restart, and the
353
+ `/router stats` orchestrator cache-read share is no longer over-counted. The recorder is shared per directory across
354
+ the copies of one build; a recorder registered by a build with another registry version is left alone. OpenCode v1 is
355
+ unchanged.
356
+ - **Plan executor: a child adopted after a restart no longer writes into a released slot.** When its task is blocked by
357
+ a reverted dependency or the plan is aborted, the child is interrupted and awaited before its slot is saved and
358
+ released. If it cannot be stopped, the slot stays held with one blocking inbox item.
359
+
360
+ ### Security
361
+
362
+ - **OpenCode v2: executor check discovery uses absolute, guarded executables.** Git searches use hardened arguments
363
+ and environment; pytest resolves its interpreter outside guarded checkouts, or takes the slot's provisioned
364
+ virtual-environment interpreter as `router_run` does. Both use a credential-stripped run
365
+ environment with explicit full-environment replacement and Windows current-directory search protection, so process
366
+ inheritance cannot restore provider credentials. Other process callers retain their default environment merging.
367
+ - **OpenCode v2 (v1 unchanged): an unbound plan child is refused every tool call.** A child session whose first message
368
+ is a plan launcher prompt (`PLAN CONTEXT` followed by the launch header at its grammar position) but that has no
369
+ matching plan binding is refused every tool call (fail closed). The prompt is recognized at the start of the message
370
+ or right after the one preamble line the host puts before a subagent's first message ("You are a subagent spawned by
371
+ another session."); any other leading text makes it an ordinary prompt. Parallel tool calls of such a session all
372
+ wait for the same check, and an ordinary prompt is never refused, even when the session's kind cannot be looked up.
373
+
374
+ ## [2.8.0] - 2026-10-13
375
+
376
+ ### Added
377
+
378
+ - **Approve repositories outside routing.repoParents with /router approve (OpenCode v2, roles mode; inert on v1)
379
+ (#107).** A role dispatch with `root=<path>` outside `routing.repoParents` is refused with a note composed from git
380
+ that names the repository and ends `Only the user can approve it: ask the user to run /router approve <path>, then
381
+ dispatch again.` The human types `/router approve <path>` in a top-level session: the router reads the repository's
382
+ identity from git (path, git common directory, root commits; origin and branch are shown), stores it and reloads the
383
+ role agents (`Role agents reloaded; dispatch again with root=<path>.`; if the reload fails, `Restart OpenCode to use
384
+ it.`); dispatch again with `root=<path>`. Only the main worktree of a repository can be approved, never a protected
385
+ location (a filesystem root, the user profile, the OpenCode config, data, state or cache directories, the directory
386
+ of the `OPENCODE_CONFIG` file, `~/.opencode`, the plugin install directory, the approvals store directory), nor a
387
+ repository that is or contains a `routing.repoParents` entry; `routing.repoExclude` wins, and the identity is checked
388
+ again at every use. After a revocation or expiry, an exact resume, `router_run` and `router_git_*` of a child bound
389
+ through the approval are refused. The approvals are stored in `opencode-model-router.repo-approvals.json` next to the router state file.
390
+ `/router repos` lists the approvals, their last use and expiry; `/router revoke <path>` removes one and drops the
391
+ repository from every working set. An approval expires `routing.repoApprovalDays` (new key, global only, 1–90, default
392
+ 14) days after its last use, and 90 days after approval at the latest. Worktrees of an approved repository outside its
393
+ main tree still need `routing.workRoots` or a restart. See
394
+ [Repositories outside routing.repoParents](docs/ROLES.md#repositories-outside-routingrepoparents).
395
+ - **Dependencies outside `node_modules` (OpenCode v2, roles mode; inert on v1) (#107).** A role dispatch's perimeter
396
+ also holds the repositories the work root declares a dependency on outside `node_modules` (owner decision D24, Tier
397
+ A): `file:`, `link:` and `portal:` specs in `package.json` (root and workspace manifests, `overrides`, `resolutions`,
398
+ `pnpm.overrides`); tsconfig/jsconfig `extends`, `references`, `paths`, `baseUrl`, `rootDirs`, `typeRoots`, `include`
399
+ and `files`; Python editable installs in a venv inside the work root (`.pth`, `.egg-link`, setuptools editable
400
+ finders); Go `replace` and `go.work use`. They are read as text, never evaluated, and bounded; no config key. An
401
+ admitted target is observed for I4, named in the verified-scope line and observed again at `router_verify` (S11), but
402
+ never pinned, so the reference does not cover it. A target that is not admitted is named `<name> (not admitted)`,
403
+ never refused. A working-set worktree that declares an edge into the work root is a consumer:
404
+ `links this work root (<via>)`, never the raw spec. A bound that cuts the reading at dispatch is logged:
405
+ `[verify] dispatch perimeter: declared dependency edges were cut by a bound`. See
406
+ [Dependencies outside node_modules](docs/VERIFICATION.md#dependencies-outside-node_modules).
407
+ - **Roles mode (OpenCode v2; cross-repo, #107, owner decision Q10): `repo=` also matches a worktree directory name.** A
408
+ route line's `repo=<name>` also matches a linked worktree whose directory name is `<name>` below `routing.repoParents`,
409
+ and binds that worktree (with `branch=`, the worktree of its repository on that branch). A repository and a worktree
410
+ directory sharing the name, or two such worktree directories of different repositories, are refused as ambiguous, each
411
+ candidate listed as `<worktree path> (repository <name>, branch <branch>)`.
412
+ - **Role dispatch header (OpenCode v2 roles mode; inert on v1) (#107).** A routed role dispatch with a work root and
413
+ read access now starts with a short header naming the role, the work root and, when known, the repository, branch and
414
+ head, so a role delegate is told where it works; the nonce line or carried acceptance block stays last. A header the
415
+ orchestrator copied from another dispatch is always stripped, and replaced only when the router adds its own. The
416
+ header is emitted only when it is relevant (owner decision Q8, invariant I9): `routing.repoParents` is set, the route
417
+ line declares `repo=`, `branch=` or `root=`, or the work root differs from the session directory; otherwise the
418
+ dispatch prompt is unchanged. No
419
+ header for a delegate's dispatch or a non-exact resume; with `dispatchHeader: false` there is no header either, except that a work root other
420
+ than the session directory still gets a minimal header (the identity and `Working directory:` paragraphs). The role
421
+ work-root rule now points to the `Working directory:` line. A read-only role is told "You read only in your working
422
+ directory." in the header wording, although its read set can also include the working set.
423
+ - **Checks in other repositories (OpenCode v2, roles mode) (#107).** A check of the `[acceptance]` block can run in
424
+ another repository of the read set: `check: testsPass cwd="<repo>" scope=full`. A relative `cwd=` stays inside the
425
+ work root; an absolute one must be in the read set; one outside it, or a `scope=` that is neither `affected` nor
426
+ `full`, is unverifiable and nothing runs. Changes are always captured in the work root; a change that no check root
427
+ covers is unverifiable (`is not covered by any check root`). A `testsPass` or `lintClean` check in another repository
428
+ must use `scope=full`; its failure there is unverifiable, never a fail, and it gets no reference. A working-set
429
+ worktree whose `node_modules` links into the work root is a consumer: a pass with a change and no tests, build, lint
430
+ or run check placed in it is UNVERIFIED, with the suggested check line. Consumers are discovered by package name
431
+ (a `node_modules` link into the work root) in the working set only; when discovery stops on its budget before
432
+ finishing a worktree, a pass with a change is UNVERIFIED (`consumer discovery stopped before finishing …`), so a
433
+ consumer may remain undiscovered. The link scan is bounded, and consumer discovery runs under the gate deadline. A
434
+ check placed in a consumer clears that incomplete-discovery caveat. When the change of the work root could not be
435
+ observed and no check covers it, the result is refused. A link target pinned at dispatch and
436
+ unchanged since keeps the reference exact (link pins). A tier dispatch on v2 refuses a per-check `cwd=`
437
+ (`a per-check cwd= is honoured only in roles mode`); `scope=` alone is ignored; v1 ignores both keys. A dispatch with
438
+ per-check keys may be deferred, see "Deferred verification across repositories" below. The configured roles protocol
439
+ (`routing.repoParents`) teaches the syntax.
440
+ - **Deferred verification across repositories (OpenCode v2, roles mode) (#107).** A role dispatch with a perimeter or
441
+ with per-check `cwd=`/`scope=` keys may now be deferred (`VERIFY:deferred`, the default). At return the router freezes
442
+ the perimeter (the statuses for I4 and I8, the working-set roots, the observed link targets, the placements and the
443
+ link pins). The dispatch is verified at once, not deferred, when I4 already refuses at return, when a linked
444
+ repository could not be observed within the deferral bound, and when a placement or a v2 tier per-check `cwd=` is
445
+ refused (the refusal reaches the verification, never the deferred finish). At
446
+ `router_verify` the I4 window is the dispatch (never decided again), consumers are discovered over the frozen
447
+ working-set roots, and link targets are observed again: one that changed since the producer returned, or cannot be
448
+ observed again, turns a pass UNVERIFIED with a caveat (a fail keeps it). Correction since P2e QA round 1: a pass held
449
+ back only by links that cannot be observed again is retryable instead: the handle is reported as not judged and stays
450
+ open, so call `router_verify` again (see `docs/VERIFICATION.md`, "Deferred verification across repositories"). A
451
+ placement whose path or git top changed since return runs nothing; one that cannot be checked now (an error other
452
+ than a missing directory) runs nothing and also stays open. Link pins kept for the deferred entry keep the reference
453
+ exact. With `routing.repoParents`
454
+ set, role dispatches are now deferred by default where they used to be synchronous; a "continue and finish" resume of
455
+ a deferred attempt cannot back a `deterministic` detection (see `docs/ROLES.md`).
456
+ - **Cross-repo work in roles mode (OpenCode v2; inert on v1) (#107).** New global-only keys `routing.repoParents`,
457
+ `routing.repoDepth` (1–4, default 2) and `routing.repoExclude` name the directories whose repositories role
458
+ dispatches may work in; registration adds `<parent>/*` `external_directory` allow patterns, so new clones need no
459
+ restart. The route line accepts `repo=<name>` and `branch=<ref>` (case kept), and the work root is bound through
460
+ admission (a git top level below a parent, or a worktree of a known repository). A role may read, glob and grep the
461
+ work root, the session's working set and the admissible repositories below the parents (reads outside the work root
462
+ are annotated `[router: read from <name> (<branch>) …]`) but edits only in its work root; edit refusals name the
463
+ other worktree or repository and the `repo=` dispatch needed. The verification perimeter snapshots the repository,
464
+ the working set and `node_modules`-linked repositories; an unattributable write there makes the result
465
+ unverifiable. The protocol and the tier dispatch header gain a cross-repo sentence. Limit: a worktree outside the
466
+ parents still needs a `routing.workRoots` glob or a restart.
467
+ - **Cross-repo hardening after two QA rounds.** Only fully qualified paths and explicit search roots reach the read set;
468
+ a relative path stays judged against the work root. A final admission gate checks `repoExclude` on the shown and the
469
+ canonical path and refuses a candidate that is a parent, an ancestor of one, or a link out of it, with no fallback to
470
+ the worktree rule. An invalid, duplicated or conflicting `repo=`/`branch=` is no longer ignored: it is an invalid
471
+ declaration, and the dispatch is refused with the note
472
+ (`<key>=<value> is not a valid repository name / branch name: no work root. Fix the route line.`, see the owner
473
+ decision Q9 entry under Changed). The verification perimeter is planned for every routed role dispatch with a work root whenever
474
+ `routing.repoParents` is set, even without `repo=`; a pass shows `verified scope: …` and link targets are named
475
+ `(not admitted)` or `(not observed)`.
476
+ - **`router_git_*` in other repositories (OpenCode v2, roles mode; inert on v1) (#107).** A role agent with an exact
477
+ binding and `read`, `glob` or `grep` in its grant may pass `root` to a `router_git_*` tool to read the history of
478
+ another repository of its read set, by absolute top-level path or by name below `routing.repoParents` (`repo=`
479
+ semantics, no branch). The output starts with the read-provenance line; git stays read-only. The argument exists only
480
+ when `routing.repoParents` is non-empty at start (restart after adding parents); tier agents and the orchestrator are
481
+ refused, and every refusal runs nothing (see `docs/ROLES.md`).
482
+ - **A consumer `testsPass` with `scope=affected` runs `vitest related` across a link (OpenCode v2, roles mode; inert on
483
+ v1) (#107).** An explicit `scope=affected` on a `testsPass` in another repository runs the consumer's tests related
484
+ to the change in the work root (vitest 5 only; jest, pytest and other vitest majors are unverifiable). A run that
485
+ selects no test, or misses a consumer test file that imports a package of the work root, is unverifiable; so is a
486
+ failure. A `testsPass` without `scope=` and a `lintClean` there still must use `scope=full` (see `docs/VERIFICATION.md`).
487
+
488
+ ### Changed
489
+
490
+ - **Worktrees of an excluded repository are refused (OpenCode v2, roles mode) (#107).** The linked worktrees of a
491
+ repository excluded by `routing.repoExclude` are now excluded with it: a `repo=`, `branch=` or `root=` route line that
492
+ names one is refused, and they are kept out of the read set.
493
+
494
+ - **A full-scope `testsPass` is no longer run synchronously when the producer changed nothing (OpenCode v2) (#107).**
495
+ Before, a dispatch with no changed files and config `testScope: "full"` ran the full suite synchronously before the
496
+ return. On OpenCode v2 such a dispatch (and one whose `testsPass` check has `scope=full`) now defers instead of
497
+ blocking the return; for a `delegate` this also means no synchronous ladder. Config `testScope` does not affect
498
+ `lintClean` (only a per-check `scope=full` runs lint unscoped), so a `lintClean`-only dispatch with no change still
499
+ passes without running anything. v1 is unchanged (owner decision OD-P2e-2).
500
+ - **Roles mode (OpenCode v2; cross-repo, #107, owner decision Q9): a refused declared target refuses the dispatch.** When
501
+ a role dispatch's route line declares `repo=`, `branch=` or `root=` (or an invalid `repo=`, `branch=` or `root=`: a
502
+ rejected, bare, duplicate or conflicting value, noted `root=<value> is not a valid absolute work root: no work root.
503
+ Fix the route line.`) and the router cannot bind a work root for it, the `task` call now fails with
504
+ `[router] role dispatch @<agent> refused: <note>` instead of running with no work root in the session directory. An
505
+ exact resume whose route line names a different target than the child's bound root is refused too (`this child is
506
+ bound to <work root>; a resume cannot change its work root: dispatch a new child`). A dispatch that declares nothing,
507
+ a delegate's dispatch and a resume that declares nothing or the bound target are unchanged.
508
+
509
+ ### Fixed
510
+
511
+ - **A dependency the producer adds during a deferred dispatch is frozen at return (OpenCode v2, roles mode) (#107).**
512
+ `router_verify` reported a dependency of the work root added during the dispatch as changed (`the linked repository
513
+ <name> at <root> changed since the producer returned; …`) every time. The work root's package links and declared
514
+ edges are now read again when the producer returns (owner decision D26): a new admitted dependency is observed then,
515
+ and `router_verify` compares it with that state; one that cannot be observed within the deferral bound, or more new
516
+ dependencies than the perimeter has room for, verify the dispatch at once (no handle); a new one that is not admitted
517
+ is named `<name> (not admitted)` in the verified-scope line. A dependency the producer removed during the dispatch is
518
+ no longer observed again at `router_verify`, unless the work root declares it again (then it is "changed").
519
+ - **A change set that mixes paths inside and outside the observed repository is no longer verified as a pass on the
520
+ inside paths alone.** The runner dropped the outside paths with a note and ran the scoped checks on the rest, and a
521
+ grader, which checks against and runs in the working directory, could not inspect them. The gate now reports
522
+ `unverifiable` ("the producer also changed files outside `<root>`: …", at most five paths named) on both the
523
+ deterministic and the grader path, where `<root>` is the git top-level the change set was observed in (for a deferred
524
+ `router_verify`, the one recorded at registration), so edits in sibling packages of one monorepo are not flagged. Any absolute changed path outside the repository, for example a
525
+ scratch file in the temp directory written by a write tool, mixed with repository edits, now makes the result
526
+ unverifiable; there is no temp-directory exemption (fail closed). A relative path that climbs out of the root
527
+ (`../x.ts`, resolved against the base) counts as outside. A change set that is entirely outside keeps its existing
528
+ message, and that all-outside safety net now also applies on the grader path (it used to run on the deterministic
529
+ path only).
530
+ - **`verify`: the pre-existing-failure reference is now approximate (cause `external-link`) when a package in a linked
531
+ `node_modules` is a link to a directory outside the repository**, for example an npm `file:` dependency or
532
+ `npm link`, a yarn/pnpm `link:`/`portal:` package, or a workspace link. Previously the rerun loaded that directory's
533
+ live code, so a failure caused by a change there was also reproduced at the reference and excused as pre-existing.
534
+ An approximate reference never excuses a failure, so such a run is now unverifiable.
535
+ - **`verify`: a package link to the repository root or to an ancestor of it is now an approximate reference too (cause
536
+ `root-link`).** The label is root-relative even when the linked `node_modules` itself lives outside the repository.
537
+ Only a real path whose parent directory is `node_modules` (or `node_modules/@scope`) counts as a package store and is
538
+ exempt from `external-link`; dot-entries such as `node_modules/.cache` are ignored. Residual limits: nested links
539
+ (`node_modules/<pkg>/node_modules/<dep>`, `.pnpm/*/node_modules/<dep>` for a transitive `link:`) and yarn PnP
540
+ `portal:`/`link:` are not detected. Cost: in a worktree whose `node_modules` is a junction to another checkout, every
541
+ package link into that checkout is an `external-link`, so failing tests there are unverifiable.
542
+ - **A branch switch of the verified working tree now makes the result unverifiable instead of passing on the other
543
+ branch.** Previously the diff between the two heads became the change set, so the checks verified another branch.
544
+ The dispatch reads a cheap head state (top-level, HEAD, branch name and the reflog entry count; one
545
+ `git rev-parse` and one `git rev-list --walk-reflogs --count HEAD`), kept even when the full snapshot is contaminated
546
+ or unavailable, and the gate reads it again. The gate reports `unverifiable` ("the working tree `<root>` switched
547
+ from `<A>` to `<B>` during the dispatch; the checks would verify another branch") for another branch name, and
548
+ "moved or was rewritten … (reflog: "<detail>")" for a same-branch history rewrite: a reflog that shrank, a HEAD
549
+ that moved without a reflog entry, a reflog window that does not start at the dispatch head and end at the current
550
+ head, or a reflog entry that moved HEAD for any reason other than a commit (including amend, initial and merge),
551
+ `merge`, `cherry-pick`, `revert`, `am` or `pull` without rebase (so checkout, reset, rebase, `pull --rebase` and an
552
+ unnamed `update-ref` count). Entries that left HEAD where it was (`git stash`, an unstaging `git reset`, a checkout
553
+ of the current branch, `merge --abort`, `cherry-pick --abort`) are ignored, and commits alone, also on a detached
554
+ HEAD, are not a move. A reflog count of 0 (reflogs disabled) leaves the decision to the branch-name rule. A
555
+ relocated top-level is reported too. The same checks with "since
556
+ the producer returned" cover a checkout between the producer's return and `router_verify`. `router_verify` now reads
557
+ the head state itself and no longer depends on the full snapshot for this check. Detached to detached at another
558
+ commit counts as a switch (reported as "moved"), and so does a new branch created at the same commit (fail closed).
559
+ Nothing is compared when there was no repository, or HEAD was unborn, at dispatch start (a producer that runs
560
+ `git init` or makes the first commit). If the dispatch head read failed, the dispatch snapshot's head and branch
561
+ stand in; only when both are unknown does the gate refuse ("cannot confirm the branch of `<root>`"). The dispatch
562
+ head read gets the whole `baselineTimeoutMs` per git process. `router_verify` gives the retryable form of that
563
+ message, and reports the handle as not judged, only when the head state cannot be read at all. On a move the commit diff is not run, so no path from the
564
+ other branch enters the change set. A switch the deferred finish already detected is carried to the required gate.
565
+ - **A pass on an empty change set is no longer reported as verified when the producer ran a tool whose writes the
566
+ router cannot observe** (`bash`, `router_run`, Code Mode `execute`, MCP and unknown tools). The result is
567
+ `unverifiable` with the caveat `no change was observed in <root> but the producer ran <tools>; a write those tools
568
+ made cannot be seen, so this is not a verified pass`, on the deterministic and the grader path, and at
569
+ `router_verify`. Read-only router tools (`router_git_*`, `router_request_authority`) and the context7 and Brave
570
+ documentation and search tools count as non-writing, matched by exact name; they also no longer discard an
571
+ in-flight change capture. The delegating tools `task`, `delegate` and `subagent` always count as writers (a nested
572
+ child's writes are not in the producer's lineage) but still do not contaminate captures. A writer is counted in the
573
+ before-hook once the guard allows the call, so a call that errors still counts. Tool names are matched
574
+ case-insensitively and sanitised in the caveat. Known limit: a user MCP server named `router`, `context7` or `brave`
575
+ that exposes those exact tool names would be treated as non-writing.
576
+ - **Roles mode: a carried role attempt now inherits the lineage's branch check and its unobservable-writer tally.** A
577
+ carried attempt is a resume that re-checks an earlier attempt's acceptance block. A branch switch since the attempt
578
+ that introduced the block (`... since the attempt that introduced this acceptance; ...`), or a switch any earlier
579
+ attempt already found (stored in the lineage; an inherited reason is prefixed "in an earlier attempt of this
580
+ acceptance: "), now makes it unverifiable. A carried attempt whose tree cannot be read, while the introducing attempt
581
+ recorded a branch, is unverifiable too. A "cannot confirm" reason is not recorded as the lineage's switch, and a
582
+ switch the deferred finish saw is folded into the attempt before the lineage records it. Carried attempts compare
583
+ names and heads only. Previously only the current dispatch's own window was checked.
584
+ - **OpenCode v2: a tier `subagent` call now passes the child session ID (from `result.output.sessionID`) to
585
+ verification**, so the child's edits and unobservable writers join the producer's lineage. Visible effects on
586
+ OpenCode v2 tier calls: a child's shell writes now count as unobservable writers; a child's edits reach the change
587
+ set; `VERIFY:deferred` tier calls now really defer and return a `vrf_` handle; and the trivial-dispatch skip,
588
+ outcome ingestion and false-refusal detection now run for tier children.
589
+ - **These verification fixes also change verdicts on OpenCode v1.** v1 shares the verification engine, and the v1
590
+ freeze allows integrity fixes; the changes only make verdicts stricter (a pass can become `unverifiable`, never the
591
+ reverse).
592
+
10
593
  ## [2.7.0] - 2026-10-10
11
594
 
12
595
  ### Added