Repository navigation
Description
What happened?
When submit_plan is called without the required edits argument (for example, the model emits an empty/malformed tool call), OpenCode reports the tool call as interrupted instead of returning the existing friendly "No edits provided" error. No Plannotator review window opens, no plan backing file is created, and the agent gets no actionable error to recover from.
This is easy for a model to hit because submit_plan is an edit-based tool and a malformed call can omit edits entirely.
Plannotator version
0.28.32
OS
macOS 27.0.1
Agent
OpenCode
Where did it happen?
Plan review
Steps to reproduce
- Use OpenCode 2.1.4 with
@plannotator/[email protected]and theplan-agentworkflow. - In Plan mode, call
submit_planwith{}(missingedits), or any malformed arguments object withoutedits. - Observe the tool result:
Tool execution interrupted. - Observe that no Plannotator review UI opens and no
~/.plannotator/active/<project>/_active-plan.mdis created.
Calling submit_plan with {"edits":[]} is different: it reaches executeSubmitPlan and returns Error: No edits provided..., which the agent can recover from. The problem is specifically the missing field being rejected before execute.
Expected behavior
The tool should return a normal, recoverable tool result such as:
Error: No edits provided. Pass at least one edit with start and content.
The agent can then retry with a valid edits array. No review UI should open for an invalid call.
Actual behavior
OpenCode aborts the tool call with a generic Tool execution interrupted, so the agent does not know why it failed and cannot correct the call. The user sees no review window and no useful error either.
Root cause
apps/opencode-plugin/index.tsdeclareseditsas a required tool argument:args: { edits: tool.schema.array(...) }
- OpenCode validates tool arguments before calling
execute, soexecuteSubmitPlannever runs. - The friendly guard already exists in
apps/opencode-plugin/submit-plan-executor.ts:but it is unreachable when the schema rejects the missing field first.if (!invocation.edits || invocation.edits.length === 0) { return "Error: No edits provided. Pass at least one edit with start and content."; }
- OpenCode then surfaces the validation failure as an interrupted tool call rather than a tool error the model can read.
Suggested fix
Plugin-side, make edits optional in the tool argument schema and let the existing executor guard handle it:
args: {
edits: tool.schema
.array(
tool.schema.object({
start: tool.schema.number(),
end: tool.schema.number().optional(),
content: tool.schema.string(),
}),
)
.optional(),
},Alternatively use .default([]) if OpenCode applies schema defaults before execute. Keep the executor guard as the single source of the friendly error.
Add a regression test for missing/empty edits:
executeSubmitPlan({ edits: undefined, ... })returns the friendly error.- Ideally an integration test that calls the registered tool with
{}and asserts it does not throw/abort.
Broader fix (OpenCode side): schema validation failures should be returned as recoverable tool errors with the validation message, rather than as Tool execution interrupted. That would make any tool with invalid arguments self-correctable.
Additional context
- The tool result was the only signal:
Tool execution interrupted. - No
submit_planentry reached the Plannotator plan review flow, and no active plan file was created for the project. - This is not the same as the existing OpenCode TUI rendering bug in [Bug] OpenCode TUI breaks during submit_plan #1893; the TUI itself is not involved here.
Activity