Skip to content

fix: surface post-tool hook decisions in tool feedback #561

Description

@LeXwDeX

Why

PostToolUse block/reason is discarded after native and MCP tools complete, hiding failed validation from the model.

Scope

Propagate post-tool block reasons, contexts and stop feedback for native, MCP and manually wrapped tool paths without claiming the already-completed tool was undone.

Approach

Turn the audit reproduction into a repository regression, fix the runtime boundary, and verify callers and adjacent hooks tests using Bun 1.3.14. Keep the user's existing working-tree edits outside this delivery.

Acceptance

Actual tool execution remains observable and each post-hook reason reaches the model-facing result; failure-hook feedback is preserved.

Runtime validation

A full-session read of a missing file reproduced a second failure boundary: Tool.wrap converts failures into Effect defects, and rejected MCP promises also become defects. The previous typed-error catch never fired PostToolUseFailure in either path. The repair handles both failure channels, propagates session interruption without invoking failure hooks, and preserves the original cause when hooks add no feedback. Native read and rejected MCP integration regressions now verify that both the original error and hook feedback reach the model; cancellation and Bash output finalization remain covered.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions