Feature hasn't been suggested before.
Describe the enhancement you want to request
opencode 1.15.1 documents tool.execute.before and
tool.execute.after as a paired event surface. Runtime test shows
they fire on different populations:
tool.execute.before fires for every tool call.
tool.execute.after fires only for successful tool calls.
A failed call (say, read on a nonexistent file) fires
tool.execute.before and routes the error to the message stream,
where the model receives and summarises it. No plugin-visible
after-side event fires. Neither session.error nor a flagged
message.part.updated fired in our test.
Use case: reflexion-style frameworks (retry-with-self-critique on
failure) need a plugin-observable failure signal. Wiring reflexion
on tool.execute.after alone is structurally broken; failures
bypass the hook entirely. The current workaround is to log callIDs
at before and reconcile orphans against the message stream, which
is fragile.
Possible shapes:
- Add
tool.execute.error for failed calls.
- Make
tool.execute.after fire for both success and failure with
a status field. This breaks plugins that assume current
semantics.
- Document the success-only semantics explicitly at
https://opencode.ai/docs/plugins/ so framework authors don't
assume symmetry from the name pair.
Related: #25918 (tool.execute.after is declared but never
triggered) covers the same hook surface. If the fix there also
handles error paths, this request may be subsumed. Filing
separately because the failure-event question is distinct from
"after never fires" — in our test, .after does fire on success.
Reproduction:
- Install opencode-ai 1.15.1.
- Create
.opencode/plugin/watch.js that logs every
tool.execute.before and tool.execute.after call as JSON.
opencode run "read ./does-not-exist.txt and report contents"
with any tool-calling-capable model.
- Inspect log:
before fires, after does not, despite the
failure surfacing to the user in the CLI output.
Verified 2026-05-16 with local Ollama provider (llama3.1:8b
32k-ctx). Full reproduction context:
https://github.com/haabe/mycelium/blob/main/docs/receipts/cases/2026-05-16-opencode-phase1-runtime.md
Feature hasn't been suggested before.
Describe the enhancement you want to request
opencode 1.15.1 documents
tool.execute.beforeandtool.execute.afteras a paired event surface. Runtime test showsthey fire on different populations:
tool.execute.beforefires for every tool call.tool.execute.afterfires only for successful tool calls.A failed call (say,
readon a nonexistent file) firestool.execute.beforeand routes the error to the message stream,where the model receives and summarises it. No plugin-visible
after-side event fires. Neithersession.errornor a flaggedmessage.part.updatedfired in our test.Use case: reflexion-style frameworks (retry-with-self-critique on
failure) need a plugin-observable failure signal. Wiring reflexion
on
tool.execute.afteralone is structurally broken; failuresbypass the hook entirely. The current workaround is to log callIDs
at
beforeand reconcile orphans against the message stream, whichis fragile.
Possible shapes:
tool.execute.errorfor failed calls.tool.execute.afterfire for both success and failure witha status field. This breaks plugins that assume current
semantics.
https://opencode.ai/docs/plugins/ so framework authors don't
assume symmetry from the name pair.
Related: #25918 (
tool.execute.afteris declared but nevertriggered) covers the same hook surface. If the fix there also
handles error paths, this request may be subsumed. Filing
separately because the failure-event question is distinct from
"after never fires" — in our test,
.afterdoes fire on success.Reproduction:
.opencode/plugin/watch.jsthat logs everytool.execute.beforeandtool.execute.aftercall as JSON.opencode run "read ./does-not-exist.txt and report contents"with any tool-calling-capable model.
beforefires,afterdoes not, despite thefailure surfacing to the user in the CLI output.
Verified 2026-05-16 with local Ollama provider (llama3.1:8b
32k-ctx). Full reproduction context:
https://github.com/haabe/mycelium/blob/main/docs/receipts/cases/2026-05-16-opencode-phase1-runtime.md