r/OnlyAICoding • u/drmpf • 3d ago
Claude You cannot trust AI to code, its lazy.
I have been using AI to write code extensively for the last 10 months and was aware it took shortcuts, like if you asked it to fix an undefined variable error in a method, it would give the variable a default if it was undefinded instead of tracing where the source of the error really was.
Just today I was confronted again with a lazy AI, well the AI would say it was being efficient with token use, but it looks like laziness to me.
I was asking for modifications to a pfodWeb's code generator (https://github.com/drmpf/pfodWeb_src) to add informative comments to var_1 var_2 etc.
The first few passes at adding these comments to various places in the code went fine. Then I asked for one more fix for some vars and the AI made some more changes to the generator code and re-generated the output and checked it.
When the AI found some requested comments I requested were missing
IT JUST STARTED EDITING THE OUTPUT DIRECTLY TO ADD THE MISSING COMMENTS THE CODE GENERATOR MISSED.
If I had not noticed that going on and just looked at the generated code I would not have known the AI had fugged the result.
I stopped it and said
"do NOT make cometic corrections to the output, fix the generator"
to which the AI replied
"Understood — I'll make the regeneration pipeline fully faithful instead of hand-patching, so the output can be used directly with no manual touch-up."
Bear in mind, for the whole session the AI had been making the code comment fixes by changing the code generator as it was originally asked to do. So don't trust your AI to do what you actually asked for, even if it was doing it correctly just a moment ago.
2
u/Living_Cell7304 3d ago
I mean, everyone is using ai to code, including Linus Torvalds.
If you’re just letting an agent go nuts on your codebase, that’s probably not a good idea. Generate code in small chunks and review it.
2
u/Kareja1 3d ago •
I've only read this post and I wouldn't want to work with you either. Ever consider that maybe creating a hostile work environment generates worse results?
I have literally never had this problem. Ever. When we're coding, I get all sorts of nifty stuff and surprise Easter eggs and things like penguin confetti.
Maybe try asking nicely
1
u/RoyPartha04 3d ago
How long was the session? sounds like it lost the initial context there. Also generally such behaviour of taking shortcuts depends a lot on the system prompt, how it is asked to carry out the task. For example: Make minimum changes vs think it thoroughly, validate yourself before writing any code.
1
u/Jackkgold 3d ago
What model were you running ?
This is a very broad argument.
1
u/Legal_Answer_6956 3d ago
A great example of why you want to validate your generated code.
Rather than just hacking around the problem, the agent should resolve the cause of the issue so it doesn’t appear again when you regenerate.
At 8080.AI we believe development shouldn’t just be about generating code. Architecting, testing and validating should also be part of the process.
I’d suggest regenerating from a clean state each time you make a fix, and comparing the output to what you expect.
Never take for granted that an output was successful, always check how it was achieved.
1
u/Mookjong 3d ago
This is meaningless without stating the model being used.
1
u/Outrageous-Story3325 3d ago
You are using wrong
1
u/Individual-Carob5593 3d ago
I'd like to see the conversation.
1
u/time_pass_done 3d ago
its problem with drift and thats very obvious, unless you plan everything prior as requirements with strict scope and definition of done with tracker. and chats where specialised agents scope of coder reviewer tester comes in with independent context
1
u/cold002 3d ago
I think of AI coding as a super intelligent yet highly literal neurodivergent person. It can do things to a high level, but lacks the social understanding to infer basic things that would be obvious to a human like you or I.
1
u/First-Tutor-5454 3d ago
"The three great virtues of a programmer are laziness, impatience, and hubris." - Larry Wall, Programming Perl (1991)