Skip to content

A throwing tool_call extension handler aborts the tool call and skips remaining handlers #985

Description

@Adolanium

emitToolCall in packages/coding-agent/src/core/extensions/runner.ts:804-825 awaits each handler without a try/catch. Every other emit method (emitToolResult, emitMessageEnd, emitInput, and so on) wraps handlers and routes failures through emitError, so one broken extension cannot take down the rest.

For tool_call events a throw propagates out of emitToolCall. The caller in agent-session.ts catches it but re-throws, so the net effect is: remaining handlers never run, the tool call fails with the extension's error, and the failure bypasses the extension diagnostics the other events get. One buggy extension can break tool execution for the whole session.

Fix: mirror the try/catch + emitError pattern from the other emit methods. Only an explicit block result should short-circuit.

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