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

Include paths from diff/pr-diff if no paths given #241

Merged
merged 2 commits into from
Nov 3, 2023
Merged

Conversation

granawkins
Copy link
Member

@granawkins granawkins commented Nov 3, 2023

Addresses #239: Use --diff or --pr-diff to set paths if no paths arg given. We used to do this but it must've gotten lost at some point.

Another issue: If the diff/pr-diff is too big for context, it raises a MentatError but doesn't close Mentat. Seems to be a lifecycle issue - the shutdown listeners maybe not yet in place. I'd defer to @waydegg on the best way to address this. Might be related to #237 too - handling errors in the session startup phase.

@jakethekoenig
Copy link
Member

I wanted to add a test and it was easier if the logic was in code_context.set_paths then the session constructor. You can verify this test fails before this PR (and passed without the assert, it didn't require any paths to be passed to the python client).

I'm okay with this PR but will wait for someone else to LGTM since I made the last change.

I'm not entirely sure the behavior is what users will expect. I personally would expect all the changed files to always be added to the context if --diff was included. This is a more complicated change but maybe it would be best to include intervals around the actual changes so much larger changes would have a hope of fitting in context?

@jakethekoenig
Copy link
Member

conversation_viewer.json
Oh one more thing. I was sort of unhappy with this conversation with mentat (rename to .html, github doesn't like you uploading htmls). I don't like how it said The added lines are marked with a "+" symbol at the beginning.. Not sure how common such a sentence is in diff explanations. Maybe a fluke or we should do some prompt engineering to suppress it.

Copy link
Member

@biobootloader biobootloader left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @granawkins and the test @jakethekoenig

I'm not entirely sure the behavior is what users will expect. I personally would expect all the changed files to always be added to the context if --diff was included. This is a more complicated change but maybe it would be best to include intervals around the actual changes so much larger changes would have a hope of fitting in context?

Yeah that seems like it'd be the more expected behavior. I'll make an issue to discuss and potentially change this, it'll be easier once we have function-level features instead of whole files, so even diffs touching a lot of files can be added.

Oh one more thing. I was sort of unhappy with this conversation with mentat (rename to .html, github doesn't like you uploading htmls). I don't like how it said The added lines are marked with a "+" symbol at the beginning.. Not sure how common such a sentence is in diff explanations. Maybe a fluke or we should do some prompt engineering to suppress it.

I'll also make an issue for this

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.

3 participants