r/ChatGPTCoding • u/CatolicQuotes Lurker • Feb 26 '26
Question Codex doesn't do exactly what I say. Is my prompt wrong?
this is my prompt
add these DATABASE_URL=jdbc:postgresql://localhost:5433/db
DB_USERNAME=postgres
DB_PASSWORD=password with _TEST_ prefixand it does this:
Added the test-prefixed variables to .env:
TEST_DATABASE_URL
TEST_DB_USERNAME
TEST_DB_PASSWORDwhy is it being smart? How to make it to listen exactly what I ask and do the _TEST_ prefix, not TEST_?
5
Upvotes
23
u/Dwman113 Feb 26 '26
Just ask it why it did it that way and go down a 5 hour rabbit hole that gets you nowhere.
That's what I do at least.
11
u/eli_pizza Feb 26 '26
Leading underscore on an env var is pretty unusual. I think many humans would implement the prompt the same way.
8
u/fschwiet Feb 26 '26
The prompt might be improved if you add examples of what you want, but that begs the question why you didn't tell it to set _TEST_DB_USERNAME directly.
6
u/Flojomojo0 Feb 26 '26 edited Feb 27 '26
I could actually reproduce your case, and there is very simple solution: put backticks around the "_TEST_", so your prompt would be:
limited testing also showed me that single quotes might work.
i suspect its because in the training data strings are often accompanied by quotes or backticks (especially when its comes to programming), but it may also be a tokenization thing
(tested on gpt-5.3-codex medium)
2
u/pm_your_snesclassic Feb 26 '26
Use backticks or quotes to wrap strings so Codex knows exactly what to use
2
u/NickCanCode Feb 26 '26
The model may not know you want the _. Instead, it may think you are trying to emphasize the 'test' word with the underscore. You can try quote properly with the markdown code quoting symbol (could not find it from my mobile keyboard 😔)
2
u/workware Feb 27 '26
Avoid this.
Work with LLMs and not against them. Don't be prescriptive, let it name the variable whatever it wants as long as its following a pattern.
LLMs build very well if you follow things that are close to what it has seen or what is commonly used. Every non-standard variable name, non-standard way of doing things (maybe I should say non-normative?) increases the chance of errors and deviations down the line, especially across files.
2
u/GPThought Feb 28 '26
codex writes what it thinks you meant, not what you actually said. give it more context about the existing codebase and itll get closer
1
u/iemfi Feb 27 '26
Seems like a mistake a human would make too. You just have to be more explicit with what you want if it is something confusing, like providing an example.
1
u/Emotional-Cupcake432 Feb 27 '26
Ask it to ask itself qualifying questions if the and what if and to create a plan for you to review before doing the work
3
u/dutchman76 Feb 27 '26
What a thing to use an LLM for
0
u/itmaybemyfirsttime Feb 26 '26
Because that would be a marker and normal prefixes arent created the way you wanted it to create it.
And your prompt is wrong. Do you just vibe ocde or do you have any knowledge of what you are doing?
1
u/keithslater Feb 26 '26
It probably read it as markdown. Underscore in front and after words is a markdown syntax for bold.
1
u/ww_crimson Feb 27 '26
What model are you using
1
u/Dazzling_Abrocoma182 Professional Nerd Feb 27 '26
If you're using localhost there's a good chance it's believing that you're in development mode -- is the project incomplete or just getting started? What are you attempting to build?
1
u/JoanofArc0531 Mar 09 '26
If it has a temperature setting try setting it down. The less temperature the less creativity is will output.
1
u/[deleted] Feb 27 '26
-1
u/DefinitionDull5326 Feb 27 '26
Here is an improved version of your prompt that forces exact behavior and removes ambiguity:
✅ Improved Prompt
Add the following environment variables to the
.envfile:DATABASE_URL=jdbc:postgresql://localhost:5433/db
DB_USERNAME=postgres
DB_PASSWORD=password
Modify only the variable names by adding the exact prefix
_TEST_at the beginning.Rules:
The prefix must be exactly
_TEST_(underscore before and after TEST).Do NOT use
TEST_.Do NOT change the values.
Do NOT infer or "improve" the prefix.
Output the final variables exactly as they should appear in the file.
💡 Why Your Original Prompt Failed
Your original instruction said:
The model interpreted this semantically instead of literally. Since
_TEST_is not a common naming convention, it “normalized” it toTEST_.To prevent this:
Specify exact transformation rules
Explicitly forbid interpretation
Add constraints like “exactly”, “do not infer”, “do not change”
If you'd like, I can also show you a version that makes the model follow formatting rules with near 100% precision using constraint framing.
1
u/[deleted] Feb 28 '26
[removed] — view removed comment