Skip to content

V2 runner path can still settle canonical tools before plugin readiness (follow-up to #701) #702

Closed

Description

@agenteinstinct1-max

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions