Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ private Mono<PreCallEvent> handlePreCall(PreCallEvent event) {
}

boolean userProvidedResults =
inputMessages.stream().anyMatch(m -> m.hasContentBlocks(ToolResultBlock.class));
inputMessages.stream()
.flatMap(m -> m.getContentBlocks(ToolResultBlock.class).stream())
.anyMatch(tr -> pendingIds.contains(tr.getId()));
Comment thread
LearningGp marked this conversation as resolved.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[nit] Defensive consideration only (not a real bug today): ToolResultBlock.getId() is documented as nullable, and Set#contains(null) is a legal lookup. In normal flows pendingIds is sourced from non-null ToolUseBlock ids so a null result-id cannot match, but if a malformed user message ever ships a null-id ToolResultBlock the hook will silently ignore it (treat as not-HITL and auto-patch). That is arguably the safer behavior, so no change required — flagging only so the assumption is explicit.

if (userProvidedResults) {
return Mono.just(event);
}
Expand Down
Loading
Loading