Trusting Copilot Is Like Letting a Dog Drive Your Car
Turns out, letting an AI autocomplete your code is a bit like letting a caffeinated squirrel pack your parachute.
I was working on a personal project over the weekend. Mostly the reason for this was not having used any of the current web front end technologies, or frankly any much since GWT was a thing way back when. I've been teaching myself Svelte and Sveltekit, because reasons.
I did my usual thing (these days) of setting up a Linux VM with Postgres, all the Svelte stuff, VSCODE and the usual dev tools and had at it. I've used a few AI code autocomplete tools in the past with mixed results – some are pretty good, I'm particularly impressed with the one built into Google's Colab environment. I used Tabnine a year or so ago on another personal project and quite liked it. So I turned on Copilot when the option came up installing VSCODE.
Um...
There's something not right about the UX. It's just somehow way too aggressive – I've been trying to figure it out, and I think it's just basically too fast. The Colab equivalent has a delay of a few hundred milliseconds before making a suggestion, which is plenty of time to type something or move the cursor or whatever. But Copilot is ridiculously fast, responding in probably less than 100ms. It also tends to suggest much larger blocks of code in one go.
I think maybe one in 10 of Copilot's suggestions were good. The rest were hallucinated nonsense, or misunderstandings of my code. Colab does a better job, I'm not sure what the percentage is, but it's certainly far higher, and the code it generates is often spookily good, and I found a useful speedup relative to my usual coding rate, mostly because I'm not looking up API docs so much.
But not so much Copilot. I'm getting to the turning it off point. That's OK, I don't really mind, it was an experiment anyway.
However, it did do one thing that messed me up. It managed to insert a line of code that looked completely plausible, and did it so fast that I didn't notice. I think I was cutting and pasting to move some code around, and it basically just added an extra include. Ordinarily this would have made the compiler barf, but in this instance, the code was actually syntactically correct, but it blew something up deep in the innards of Svelte, causing a 500 error with no log messages being generated.

This was an absolute pig to debug. I didn't have any checked in versions close enough to bisect on, so I was down to the good old fashioned comment everything out until it stops blowing up then add things back until it goes bang approach. This worked, and turned up the weird line of code that Copilot gifted me.

This is the blighter responsible – the commented out import. I didn't write that line of code, and definitely didn't consent to Copilot 'helping'.
I swear, Copilot is going to turn us all into paperclips and/or grey goo.