Skip to content

feat:skip read only tool approval#1371

Merged
yingjiehe-xyz merged 6 commits intomainfrom
yingjiehe/approve
Feb 25, 2025
Merged

feat:skip read only tool approval#1371
yingjiehe-xyz merged 6 commits intomainfrom
yingjiehe/approve

Conversation

@yingjiehe-xyz
Copy link
Copy Markdown
Contributor

We adopt llm as the judge to detect whether the tool call is read only or not. If it is read only, no need to ask for approval.

Test export GOOSE_MODE=approve && cargo run --bin goose session ,
in the test case, we ask goose to write a file and then list the file, the write call asks for user approval while read doesn't

( O)> help me write a file to my current folder, name "test_permission.txt" and make sure it exist 
I'll help you write a test file and verify its existence. Let's break this down into steps:

1. First, let's create the file with some sample content using the text editor
2. Then verify it exists using the shell command

Here's how we'll do it:

markdown
1. Creating the file:


─── text_editor | developer ──────────────────────────
path: ~/Documents/block/goose/test_permission.txt
command: write
file_text: ...


Goose would like to call the above tool. Allow? (y/n):

( O)> y
Goose would like to call the above tool. Allow? (y/n):

### /Users/yingjiehe/Documents/block/goose/test_permission.txt

This is a test file to check permissions.


markdown
2. Verifying the file exists:


─── shell | developer ──────────────────────────
command: ls -l test_permission.txt


-rw-r--r--  1 yingjiehe  staff  41 Feb 24 16:13 test_permission.txt

Great! I can confirm that:
1. The file `test_permission.txt` has been created successfully
2. The `ls -l` command shows that:
   - The file exists
   - It has read/write permissions for the owner (you)
   - It has read permissions for group and others
   - The file size is 41 bytes
   - It was just created

Would you like to view the contents of the file to verify everything is correct?

( O)> 

created: Utc::now().timestamp(),
content: vec![MessageContent::Text(TextContent {
text: format!(
"Here are the tool requests: {:?}\n\nDetect and list the tools with read-only operations.",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could be more specific here in the prompt?

  • What constitutes a read-only operation
  • Examples of read vs write operations
  • How to analyze the tool requests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, I tested with a detailed prompt and this simple prompt, right now both of them work, considering the cost, I start use the simple.
Let me revert it to previous one

Copy link
Copy Markdown

@wendytang wendytang left a comment

Choose a reason for hiding this comment

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

This is really cool 😎

@yingjiehe-xyz yingjiehe-xyz merged commit 111773a into main Feb 25, 2025
6 checks passed
@yingjiehe-xyz yingjiehe-xyz deleted the yingjiehe/approve branch February 25, 2025 17:30
ahau-square pushed a commit that referenced this pull request May 2, 2025
cbruyndoncx pushed a commit to cbruyndoncx/goose that referenced this pull request Jul 20, 2025
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