-
Notifications
You must be signed in to change notification settings - Fork 17
Fix compatibility issues and improve error handling in Navie #2253
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
base: main
Are you sure you want to change the base?
Conversation
Fixes Stack trace / error with Copilot + Sonnet related to counting tokens #2232
Unlimited number of subdirectory entries can easily blow up context length (eg. when one of the subdirectories is node_modules). Instead if the number of entries is high (currently hardcoded to a limit of 100) just pass the number of entries; the gatherer can request a directory listing explicitly when needed (the limit doesn't apply to toplevel entries).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The main thing I couldn’t understand is why the token reducer was refactored. Unless there was a bug? But then it would have been a fix commit.
I noticed that the token reducer spins when the token count estimate is wrong, trying to send the exact same request repeatedly. Solving this needed cooperation between the reducer and the completion service, which was difficult to implement with the Java-ish design, so I refactored it to be simpler and more idiomatically JS — @dustinbyrne said he was ok with that. You're right I should have split that into two commits; anyway, the end result is that if after reducing we're still getting token exceeded, we're adding a 10% margin before trying again. The new estimated max token count is remembered so it doesn't have to spin next time. Also, the input is truncated up front if it's too large (according to the latest max token count estimate). |
Migrate from
better-sqlite3
tonode-sqlite3-wasm
for better compatibility. Remove deprecated dependencies and reduce console error noise related to token counting with Copilot and Sonnet. Limit the number of subdirectory entries to prevent context overflow. Add performance measurements and code formatting tools to enhance development experience.Fixes #2232