Repository navigation
Description
Problem
PR #701 (merged as 3b91864) closed the plugin-readiness race for the V1 attachment bridge (#700). Review of the identical content found the same race class still open on the V2 runner path.
Finding 1 (Low, pre-existing, outside #701's 3-file scope): packages/core/src/session/runner/llm.ts:337 — SessionRunnerLLM settles canonical tools with no readiness gate (toolMaterialization.settle, materialized at :251 from agents.select → {id, info: undefined} on an empty map, agent.ts:105-113, which does not fail). SessionRunnerLLM.node (:499) has no PluginInternal dependency. The path is live: session/execution/local.ts → wired at packages/opencode/src/server/routes/instance/httpapi/server.ts:292, reached via Session.resume, stream.transport.ts:1300. A canonical tool call in a run that starts inside the init window still reaches PermissionV2.configured → empty map → deny-all (permission.ts:15,150). #701 closed the reporter's path (V1 bridge), not the class: the invariant "canonical tool execution impossible before readiness" is currently path-local.
Finding 2 (Low, test strength): packages/opencode/test/tool/attachment-readiness.test.ts:78 — the terminal assertion is only exit._tag === "Failure", satisfied equally by "gate resolved → validation failed" and "gate itself failed/interrupted". The test pins ordering but is insensitive to the gate succeeding; a gate that always fails after release would still pass. Add a companion allow-after-readiness assertion (or an assertion that the negative path reaches settlement).
Finding 3 (Low, unstated behaviour change): packages/opencode/src/tool/attachment.ts:50 — the readiness gate guards the whole execute, including action: "list", which needs no permission (AttachmentStore.inventory, attachment-store.ts:264-301, touches no permission service). If PluginInternal.boot dies or is interrupted, every attachment call — including list — now fails with the boot defect, where previously list worked. Consistent with "failures must surface", but it couples a permission-free action to boot success and is not mentioned in the PR description.
Repro / evidence
- Code-path inference from the review (file:line refs above), verified at head
3b9186448b043b93265978e0632c010c05d949de. No CI failure observed from finding 1; the class is confirmed by the same mechanism as Agent initialization race: attachment save fails with deny-all permission when canonical tool runs before plugin/agent readiness #700 (emptyAgentV2map →PermissionV2.configureddeny-all fallback). - Agent initialization race: attachment save fails with deny-all permission when canonical tool runs before plugin/agent readiness #700's repro covered the V1 bridge path only (isolated 21/21 both commits; loaded base 1/10, head 3/10).
Suggested direction
Extend the readiness signal (PluginInternal.ready) to the V2 runner settlement path so canonical tool execution cannot proceed before readiness there either; tighten the readiness test per finding 2; decide and document the list-action behaviour per finding 3.
Activity