Skip to content

fix(books): invalidate stale attributed:false cache when wallets become eligible#160

Merged
danbuildss merged 1 commit into
mainfrom
claude/luca-aeon-skills-caYGZ
Jun 28, 2026
Merged

fix(books): invalidate stale attributed:false cache when wallets become eligible#160
danbuildss merged 1 commit into
mainfrom
claude/luca-aeon-skills-caYGZ

Conversation

@danbuildss

Copy link
Copy Markdown
Owner

Summary

  • fix(books): Cache staleness check in buildAgentBooks only handled the case where dbCached.attributed === true — a cached attributed:false result was served forever, even after wallets were fixed and became eligible. Added the inverse condition: if the cached result is false but wallets are now eligible, treat the cache as stale and recompute.

  • debug: Temporary GET /api/admin/debug-books-eligibility?slug=<slug> endpoint — returns raw wallet eligibility data from the DB. Used to diagnose the AEON books issue. Can be deleted after this is confirmed working.

Root cause

Every time the books snapshot ran and skipped AEON, it re-saved attributed:false to agent_books_cache. On the next run, the cache was served immediately without recomputation. The fix makes attributed:false + eligibleCount > 0 a staleness signal.

Post-merge steps

# 1. Purge the stale cache entry
curl -X DELETE "https://www.zettaai.co/api/admin/books/snapshot?slug=aeon" \
  -H "Authorization: Bearer <SECRET>"

# 2. Snapshot — should return snapshotted:1
curl -X POST https://www.zettaai.co/api/admin/books/snapshot \
  -H "Authorization: Bearer <SECRET>" \
  -H "Content-Type: application/json" \
  -d '{"slug":"aeon"}'

Generated by Claude Code

…me eligible

Cache staleness only checked dbCached.attributed === true, so a cached
attributed:false result was served forever even after wallets were fixed
and became eligible. Add the inverse condition so the cache is treated
as stale when wallets are now eligible but the cached result says false.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjpGP3kYKnQuQAUoK6RZky
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zetta Ready Ready Preview, Comment Jun 28, 2026 8:42pm

@danbuildss danbuildss merged commit 59f8ba4 into main Jun 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants