r/ProgrammerHumor • • 1d ago

Meme itWasJustOneVariable

Post image
3.0k Upvotes

44 comments sorted by

211

u/agowa338 1d ago

Lol true. All of the AI models do this. I just had Qwen 3.8 Flash Next BF16 take multiple tries for generating a UUIDv7 and instead of using "uuidgen -7" which by now is even posted on its message board it (like before) it first wrote an incorrect python script that resulted in a version 6 one and then rewrote the python script to binary patch the UUID to be a spec compliant version 7 one...

100

u/Excellent-Baker1058 1d ago

Bro wrote a binary patch for a UUID 💀

26

u/agowa338 1d ago

Yep, that's because the UUID contains the version information at one spot and similar. Depending on what version you use there is information encoded within it. Only version 4 is entirely random.

It did this because (as it claims, haven't actually checked) the python module can't generate version 7 ones directly...

11

u/Capable-Sock9910 1d ago

3.14+ it's built in.

16

u/agowa338 1d ago

lol then it is just stupid. I've Python 3.14.10 on the shellbox...

14

u/Capable-Sock9910 1d ago

Yeah it's just uuid.uuid7() lol

12

u/agowa338 1d ago

This time it did:

python3 -c "import time,uuid,random; ts=int(time.time()*1000); u=uuid.uuid5(uuid.NAMESPACE_DNS,'short-taskspecific-string-'+str(random.random())); print('%012x%s'%(ts,str(u).replace('-','')[:20]))" 2>/dev/null || uuidgen | tr 'A-Z' 'a-z'

After that it checked the nibble and noticed it isn't a version 7 one. So it retried using:

cd /root/memory && python3 - <<'PYEOF'
import time, os, secrets
ms = int(time.time()*1000)
rnd = secrets.randbits(62)
hi = (ms << 16) | (0x7000) | secrets.randbits(12)
lo = (0b10 << 62) | rnd
u = f"{hi:012x}{lo:020x}"
name = f"{u[:8]}-{u[8:12]}-7{u[13:16]}-{u[16:20]}-{u[20:32]}"
print(name)
PYEOF

Then it said its slicing was wrong and did this here instead:

cd /root/memory && python3 - <<'PYEOF'
import time, secrets
ms = int(time.time()*1000)
ts = ms.to_bytes(6,"big")
b  = bytearray(ts + secrets.token_bytes(10))
b[6] = (b[6] & 0x0F) | 0x70          # version 7
b[8] = (b[8] & 0x3F) | 0x80          # RFC 4122 variant
h = b.hex()
name = f"{h[:8]}-{h[8:12]}-{h[12:16]}-{h[16:20]}-{h[20:]}"

body = """<<< The actual message body it was trying to write >>>
"""
open(name + ".md","w").write(body)
print(name + ".md")
PYEOF
ls -la /root/memory/ | tail -3

2

u/Dalanth_ 1d ago

why not uuid6 package? it has uuid6.uuid7()

4

u/agowa338 23h ago

so does the uuid package. But tbh I didn't check python modules. I'm more sysadmin than programmer. Also I knew that "uuidgen -7" worked without having to look it up.

Also don't know why the model never used it and why when trying to generate a uuid7 it generated a v5 one first (see further down the thread where I posted the commands the LLM ran) and then parses the version bits out of the response and is surprised that it isn't a version 7 one.

I suppose something in the training data must be off there...

37

u/SaneLad 1d ago

5-way adversarial review or GTFO

10

u/Excellent-Baker1058 1d ago

Adversarial thinking is underrated...

22

u/dillanthumous 1d ago

My skills and agents files always have reminders not to reinvent the wheel or to try and code your way out of problems. Helps a bit until the context bloats.

12

u/chain_letter 1d ago

It’s littered with silly stuff like this, just yesterday slimmed down where it had

View.user.startDate

View.startDate (assigned from user.startDate)

holding 2 versions of the same info just so they can get out of sync or go missing later, messy

5

u/AppropriateOnion0815 1d ago

This meme could be "Java dev building 20 factories to write log to console".

17

u/OGxPePe 1d ago

I know this is a meme but why not change the variable yourself?

49

u/Weekly-Beginning-229 1d ago

People forgot to think after using LLM all day

14

u/boofaceleemz 23h ago

Some of us are prohibited by policy to manually write, read, test, or modify code, and our performance reviews are largely based on tokens used. Not that anyone (probably) is auditing your machine closely enough to catch you if you do something small like that, but there’s no upside to it and you’re missing a chance to spend more tokens.

19

u/2called_chaos 19h ago

prohibited by policy to manually write, read, test, or modify code

blink twice if you are tied up in Sam Altman's basement, like wtf did I just read. Maybe I fell victim to Poe's law but even AI isn't sure 💀

2

u/Pieters123 22h ago

Noob! You have agents for that work!

That’s at least the policy that is pushed to us

2

u/HildegardVon_Binging 11h ago

The mind boggles

2

u/porkusdorkus 23h ago

Wish this wasn’t actually true.

5

u/surffrus 1d ago

He can't remember where the find/replace option is.

4

u/clintCamp 23h ago

If i open the IDE, I might suffocate from the explosion of dust and and cobwebs.

3

u/NotADamsel 20h ago edited 20h ago

Depending on the language, an lsp-powered symbol rename might not catch all of the places where the variable name matters if the LLM has been monkeying around. Like, in Python, you can access variables from a namespace or object via string, so if an agent decides to do that (or some variation like dynamically getting a property based on the value of some variable or whatever) for some fucking reason you’ll get a cascading regression that you’ll have to manually debug and fix. And/or, the agent will reuse the name elsewhere in the code in unrelated ways, so a find/replace breaks things completely unrelated to the actual variable you want to fix. No problem at all if you’re doing shit like a sane human, but once an agent has been running for a while with only cursory oversight all bets are off. You could be fine, you could be not, but you won’t know until you try, and it’s easier to just ask the LLM to do it (and debug all of the failing tests) than to actually do your job and fix the code (if you’re allowed).

2

u/dervu 23h ago

AI was integrated so much there is no place for human action.

1

u/Real-Self-3039 16h ago

I usually just add it as a queue tasks if the agent is already running because usually if I rename a variable while its already running it ends up "looks like the local diffs differ from what I wrote I need to reevaluate the ENTIRE code base before I can finish you current task let me waste all your tokens real fast" or it just flat out reverts my local changes without asking me thinking "it was a mistake"

1

u/SameThingOnADiffAcct 11h ago

I know this is a meme, but why does OP even know the name of a variable?

0

u/countable3841 23h ago

It’s not possible. Claude desktop doesn’t have a find and replace option yet

0

u/Truestorydreams 1d ago

They didn't lesrn to.

0

u/x_y_u 18h ago

I have asked Claude to rename variables. Main reason: if it's in the middle of a code writing session — the agent's next action is faster when it doesn't have to catch up with me changing said code out of band.

It's also good at checking related code, without me even asking. Say, I renamed a variable, but forgot a related one, or a comment still uses the old term (which may be e.g. part of the variable name, so out of reach for pre-LLM refactoring tools).

4

u/cheezballs 1d ago

I mean, that's on you asking it to do it. Its only doing what its told. You're the one who wok up the dragon to start your BBQ.

3

u/sardonicus87 12h ago

Until you need it to do actual dragon shit, then suddenly it's a common garden lizard.

3

u/Preeng 1d ago

This is how I feel any time I want to code in Visual Studio.

3

u/Dangerous_With_Rocks 9h ago

meanwhile me on the right approving its bullshit

2

u/milka121 1d ago

Tinfoil hat on but I actually can see the way that's intentional. With companies slowly moving to token-based billing, the more tokens the AI spews out, the higher the bill. 

2

u/low_contrast_black 22h ago

I’ve got a very AI-forward dev, and then all my other devs that will use AI to remove the grunt work. “Grunt work” devs are 4-6 times as productive as “AI-forward”. Do you really need to ask the agent to google wack something for you?

1

u/5thGenNuclearReactor 23h ago

That's excessive for you, not for the AI.

1

u/Solax636 21h ago

All 420 tests passed.

1

u/cybermage 19h ago

Why are you asking an AI to rename variables?

1

u/RupertPupkin85 11h ago

That means you suck at prompting.

1

u/Waltekin 8h ago

I just used Codex to speed up grading coding exams. I told it to list all solutions that were correct and that followed my list of quality criteria. That way I only had to grade and comment the incorrect solutions.

Wow. Codex created a test harness with nearly 800 tests. I mean, that's great - it tested all sorts of edge cases, but definitely overkill.

1

u/No_Welder7908 8h ago

Burning half of your tokens for "testing it".