Problem
PreToolUse and PostToolUse events for the same tool call are stored as independent rows with no explicit link between them. The only way to correlate them is by matching on tool_use_id within a session — which requires a query-time join and assumes tool_use_id is unique within a session.
The API supports a parentEventId field, but the CLI never sends it.
Proposed solution
- When the sidecar processes a PreToolUse event, the backend returns an
event_id in the response
- The sidecar stores a map of
tool_use_id → event_id
- When the corresponding PostToolUse arrives, the sidecar attaches the PreToolUse's
event_id as parent_event_id
- Add
parent_event_id to the proto ProcessHookEventRequest
This gives the dashboard a direct parent→child link for every tool execution, enabling:
- Instant Pre→Post correlation without scanning
- Tool execution timeline visualization
- Duration calculation without query-time joins
Dependency
Requires #31 (bidi streaming) or at minimum reading the event_id from the unary response, which the sidecar currently ignores.
Problem
PreToolUse and PostToolUse events for the same tool call are stored as independent rows with no explicit link between them. The only way to correlate them is by matching on
tool_use_idwithin a session — which requires a query-time join and assumestool_use_idis unique within a session.The API supports a
parentEventIdfield, but the CLI never sends it.Proposed solution
event_idin the responsetool_use_id → event_idevent_idasparent_event_idparent_event_idto the protoProcessHookEventRequestThis gives the dashboard a direct parent→child link for every tool execution, enabling:
Dependency
Requires #31 (bidi streaming) or at minimum reading the
event_idfrom the unary response, which the sidecar currently ignores.