Skip to content

fix: prompt user explicitly for reason upon denying tool request #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

arjun37602
Copy link
Collaborator

Issue #, if available: https://t.corp.amazon.com/D232774013

Description of changes: Added new branch logic for user responding no to tool use request. Now we send more informative information to model instead of just 'n'.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@arjun37602 arjun37602 requested a review from a team as a code owner June 2, 2025 19:51
@arjun37602 arjun37602 changed the title Prompt user for a reason upon denying tool request fix: prompt user for a reason upon denying tool request Jun 11, 2025
@arjun37602 arjun37602 changed the title fix: prompt user for a reason upon denying tool request fix: prompt user explicitly for reason upon denying tool request Jun 11, 2025
@@ -1347,6 +1348,23 @@ impl ChatContext {
tool_use.accepted = true;

return Ok(ChatState::ExecuteTools(tool_uses));
// Prompt reason if no selected
} else if ["n", "N"].contains(&prompt.as_str()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you instead just define a variable like tool_use_denied_without_reason or something for the ["n", "N"].contains(&prompt.as_str()) check? In case we also add other cases like "no" etc.

};
reason_prompt.push_str(&reason);
reason_prompt.push_str(
". Take user feedback and try again if reason provided, else continue conversation.",
Copy link
Contributor

Choose a reason for hiding this comment

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

The only way to provide no reason seems to be ctrl+c - in which case, let's not send the request to the model since its response seems to be junk.

Instead, I think the flow should be:

# model requests a tool use

> n

Please provide a reason for denying this tool use, or otherwise continue your conversation:\n\n

# user hits ctrl+c, and gets into the exit flow where we check two consecutive ctrl+c's before exiting

(To exit the CLI, press Ctrl+C or Ctrl+D again or type /quit)

> n

Please provide a reason for denying this tool use, or otherwise continue your conversation:\n\n

# we give the same message if they enter "n" again.

> i instead want this tool use....

# send the response with the abandoned tool use and this new prompt

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.

2 participants