Skip to content
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

Improve error handling when choosing not to execute a potentially unsafe command #130

Open
adhintz opened this issue Oct 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@adhintz
Copy link
Contributor

adhintz commented Oct 9, 2024

When choosing not to execute an unsafe command, an exception is thrown that doesn't appear to be what we want:

We flagged the command: git push as potentially unsafe, do you want to proceed? [y/n] (y): n
Traceback (most recent call last):
  File "/Users/hintz/goose/src/goose/cli/session.py", line 162, in run
    self.reply()  # Process the user message.
    ^^^^^^^^^^^^
  File "/Users/hintz/goose/src/goose/cli/session.py", line 198, in reply
    response = self.exchange.generate()
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hintz/goose/packages/exchange/src/exchange/exchange.py", line 76, in generate
    message, usage = self.provider.complete(
                     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hintz/goose/packages/exchange/src/exchange/providers/google.py", line 147, in complete
    message = self.google_response_to_message(response)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hintz/goose/packages/exchange/src/exchange/providers/google.py", line 82, in google_response_to_message
    return Message(role="assistant", content=content)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<attrs generated init exchange.message.Message>", line 17, in __init__
    __attr_validator_content(self, __attr_content, self.content)
  File "/Users/hintz/goose/packages/exchange/src/exchange/message.py", line 23, in validate_role_and_content
    raise ValueError("Assistant message must include a Text or ToolUsage")
ValueError: Assistant message must include a Text or ToolUsage


The error above was an exception we were not able to handle.

These errors are often related to connection or authentication
We've removed the conversation up to the most recent user message - depending on the error you may be able to continue
@lamchau lamchau added the bug Something isn't working label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants