Skip to content

ACP: carry the originating tool-call id on hook events #6

Closed

Description

@JAORMX

What's missing

A blocked PreToolUse hook can't be surfaced on the correct ACP tool card. HookPayload carries no originating tool-call id, so projectHook falls back to an agent_thought_chunk instead of marking the related tool_call_update as failed.

Validated (independent cross-check):

  • HookPayload has exactly Phase, Tool, Decision — no call id (internal/session/event.go); the proto Hook message mirrors that (contracts/proto/mecatl/v1/harness.proto).
  • All hook emit sites in internal/agent/dispatch.go have the tool-call c.ID in scope but never thread it into the payload.
  • projectHook emits a thought chunk because the id is absent — its comment is effectively the spec for this fix (internal/adapter/acp/projector.go).

Proposed approach

Add the originating tool-call id to HookPayload (domain event.go → proto Hook message + regenerate → the dispatch.go emit sites → server/mapper.go); the ACP projector then marks the correct tool_call_update failed with the veto reason. Small but cross-cutting (proto change). Also improves the existing TUI hook rendering.

Part of ACP Phase 3 long-tail (docs/adr/0001-acp-adapter.md).

Activity

  1. JAORMX commented on Jun 1, 2026

    @JAORMX
    ContributorAuthor

    Done in 22bd0f4. Implemented beyond the original scope: surfacing the veto required opening the tool_call card before the permission/hook gate (a new openCard helper in dispatch, emit removed from execute), since EvToolCall was previously emitted only inside execute — which PreToolUse blocks and permission denials short-circuit before reaching. That also fixes the pre-existing permission-deny phantom-card bug. PostToolUse blocks stay thought-chunk annotations (annotate-only domain semantics). Panel-reviewed (architecture caught the phantom-card gap; security confirmed no dropped vetoes / no premature execution).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions