Skip to content

fix: patch hitl datapart rejection message - #102

Merged
schiwekM merged 3 commits into
mainfrom
fix/hitl-data-part-rejection
Sep 11, 2026
Merged

fix: patch hitl datapart rejection message#102
schiwekM merged 3 commits into
mainfrom
fix/hitl-data-part-rejection

Conversation

@Akatuoro

Copy link
Copy Markdown
Contributor

Closes #93

Have you...

  • Added relevant entry to the change log?

@Akatuoro
Akatuoro requested review from a team as code owners September 10, 2026 13:04
@hyperspace-pr-bot

Copy link
Copy Markdown

Summary

The following content is AI-generated and provides a summary of the pull request:


Fix: Ensure HITL Rejection Messages Are Properly Communicated to the LLM

This PR fixes an issue where rejected HITL (Human-in-the-Loop) tool calls could be misreported to the LLM as having executed, because bare rejection tokens (e.g., "no") were passed through as-is, suppressing LangChain's built-in "did not execute" default message.

What changed

srv/handlers/graph-executor/hitl.js

  • Added a new patchRejectMessage function that normalizes reject decisions coming from DataParts by wrapping the message in a clear contextual prefix: "The user rejected this particular tool invocation with the reason: ...".
  • Applied patchRejectMessage to the DataPart path in resumeHitl, ensuring both text-based and DataPart-based rejections now consistently produce an unambiguous rejection signal for the LLM.

lib/preview/chat.html

  • Updated the "Reject" button in the preview UI to send a structured DataPart ({ decisions: [{ type: "reject", message: "no" }] }) instead of a plain "reject" text string.
  • Updated the resume function to support sending either a text part or a data part depending on the type of the decision payload.

tests/integration/graph-executor-unit.test.js

  • Added unit tests for patchRejectMessage verifying it correctly wraps rejection messages.
  • Added an integration test confirming that a DataPart rejection with a bare token is enriched with the full rejection context before being forwarded to the graph.

CHANGELOG.md

  • Added entry: Better message to the LLM on HITL rejection.

Category

🐛 Bug Fix

Closes #93

Have you...

  • Added relevant entry to the change log?

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.31.20

@schiwekM
schiwekM merged commit c92fe23 into main Sep 11, 2026
13 checks passed
@schiwekM
schiwekM deleted the fix/hitl-data-part-rejection branch September 11, 2026 06:00
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.

[0.9.1: ] Rejected HITL tool calls can be reported as executed because parseResumeDecision always forwards raw resume text as decision.message

3 participants