AbanteAI/mentat

Git submodules causes crash

rupurt opened this issue · 3 comments

rupurt commented

Howdy,

I have a project with git submodules and mentat crashes when I send a chat message.

Unhandled Exception: Traceback (most recent call last):
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/session.py", line 194, in run_main
    await self._main()
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/session.py", line 139, in _main
    parsed_llm_response = await conversation.get_model_response()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/conversation.py", line 283, in get_model_response
    code_message = await code_context.get_code_message(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/code_context.py", line 153, in get_code_message
    self._code_message = await self._get_code_message(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/code_context.py", line 214, in _get_code_message
    self.features = self.get_all_features(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/code_context.py", line 276, in get_all_features
    for path in get_paths_for_directory(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/include_files.py", line 255, in get_paths_for_directory
    paths = set(filter(is_file_text_encoded, paths))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alex/workspace/app/.venv/lib/python3.11/site-packages/mentat/include_files.py", line 21, in is_file_text_encoded
    with open(abs_path, "r") as f:
         ^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/Users/alex/workspace/app/services/zock/zock'

Hey @rupurt! Just put up a PR with the fix, once it gets merged let me know if you're still having any problems! Thanks!

Merged now! Thanks for the speedy fix @PCSwingle.

@rupurt let us know if that solves it and if you have any further issues. Thanks for reporting!

rupurt commented

@biobootloader yep it's working nicely now. 🍻