Fixing stubborn bugs
Give GLM-5 the failing code, the log lines around the failure and what you expected to happen, and ask for the cause before the fix. Reproduce the bug yourself with its explanation before you merge the change.
Example: Why does the cache show some users the wrong currency?
Material
- Code
- key = "price:" + str(product_id) if cached := cache.get(key): return cached price = pricing.get(product_id, currency=user.currency) cache.set(key, price, ttl=600)
- Report
- A user in Germany saw $49 instead of €45 a few minutes after a US user opened the same product.
PromptFind why some users see prices in the wrong currency, explain the cause and give the smallest fix.
Sample answer · written by hand to show the reasoning
The cache key has only the product ID, so the first price stored for a product is served to everyone for 10 minutes, whatever their currency. Add the currency to the key, for example price:<product_id>:<currency>. Clear the existing price:* entries when you deploy, or wait for the 600-second TTL to expire.