-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Right now, we rely on a manual line matching approach to match the output of chats to code. This has a few advantages (as is also the most robust way to do it perhaps)
- User can copy paste, apply, etc and we'd still match
- If the file changes or the lines are modified and switched around, we still match
The big disadvantage is that there are a lot of false positives or spurious matches! This occurs when chat output doesn't actually correspond to changes. This is because we don't match actual diffs, just the code content outputted by the LLM. The happens a lot when you make a chat that asks to explain something, or because the LLM regurgitates a ton of existing code with the edit.
We could fix this in the far future by associating the chat blocks with diffs, but this would require a deeper integration with the code editors (with apply) and also have to take into account copy and paste diffs (where some code that you copy and paste is unchanged).
The way we would do it today is be smarter with matching and timing. We could sorta solve this by only matching lines that are modified or created after the chat was created. This would prevent matches with changes in the past!
One piece of logic we would have to add is on gait initialization, the initial matched chats have to be exempt from this rule. Maybe for those, we can add a special tag in the kv_store.
Steps to resolve:
- Function that returns line-number to date last modified for a file using git log
- In filedecoration.ts, modify decorateActive to call this function and pass to matchDifftoFile or utilize this somehow to filter the matches.
- When we decorate every single file, add an exemption to the kv_store thing. This can be a parameter.
This might be a bit complicated, feel free to ask questions.