08 FEB 2026
David debugged: Lecture notes agent producing 504 errors from Gemini cache expiry
David investigated why lecture notes agents were failing with what looked like 504 errors but were actually Gemini cache content expiry events, and challenged the investigation's initial diagnosis.
Kerra's lecture notes agents use Gemini models to generate workspace content. David noticed failures showing up as 504s in CloudWatch and commissioned a deep investigation:
this isnt deep enough forensics into the codebase. we arent getting 504s on lecture notes agents anymore (over last 24h) are we? and you havent investigated why calendar agent is bugging out. what exactly is the failure for the 30% of calendar agents over the last 24 h
The investigation found that the errors labeled 504 in CloudWatch were actually GEMINI_CACHE_CONTENT_EXPIRED at the database level — 50 of 62 failures in 24 hours. David challenged why the retries weren't kicking in:
"62 failures in 24h, ZERO had an agent_interruptions row → ZERO got auto-replayed" no but we usually retry no? like go look at the workspaces those agents were running for and see if they succeeded
He also caught an inconsistency in the investigation's claim that the Gemini in-flight limit was still set to 1:
no it wasnt an accident. but clearly the gemini in flight =1 isnt the issue so keep investigating what is
David's hypothesis — that the injected PDF text after PDF into the user message array was causing the cache to expire — was investigated as the likely root cause.