Skip to content

fix(ahp): preserve tool results when observers fail - #282

Merged
danielkov merged 3 commits into
mainfrom
fix/ahp-observer-tool-results
Oct 18, 2026
Merged

danielkov merged 3 commits into
mainfrom
fix/ahp-observer-tool-results

Conversation

@danielkov

@danielkov danielkov commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Preserve completed tool results when an observe-only tool.after hook fails during preparation or dispatch. Retain attachment ownership through the SDK's typed boundary and surface sanitized dispatch diagnostics through the existing session hook-message channel.

Motivation

Kit discarded owned attachment sources when converting tool.after inputs to raw events. It also converted top-level observer preparation failures into CustomPolicyDenied, withholding otherwise successful tool results.

Technical details

Use the typed tool_after SDK entry point so binary attachment sources survive projection and participate in SDK preparation. Observer-only dispatch failures retain the native outcome, including output and execution metadata.

Any registered tool.after interceptor conservatively retains fail-closed behavior for dispatch failures, including mixed observer/interceptor configurations and payload-filtered interceptors. Native failures and cancellation remain intact.

Diagnostics expose the SDK classification rather than arbitrary error strings that may contain output or secrets. This change does not raise attachment limits or alter the SDK's attachment-admission ordering.

Comment thread docs/user/agent-hooks-protocol.md Outdated
kit-code-agent[bot]
kit-code-agent Bot previously approved these changes Oct 18, 2026

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found. The changes look good to merge.

Took 2 min 34 sec

@kit-code-agent kit-code-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found. The changes look good to merge.

Took 2 min 8 sec

@danielkov
danielkov enabled auto-merge (squash) October 18, 2026 15:22
@danielkov
danielkov merged commit f060c84 into main Oct 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant