Fix stale race cache and update agent suggested prompts#99
Merged
Bitpass-dev merged 2 commits intomainfrom Mar 15, 2026
Merged
Conversation
Co-authored-by: Bitpass-dev <186615221+Bitpass-dev@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix stale race data in response cache
Fix stale race cache and update agent suggested prompts
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Response cache was serving stale "next race" answers across hour boundaries because the cache key didn't include time-of-day. Separately, agent chat panel suggested prompts were generic/future-focused rather than today-focused.
Backend —
chat.tsFrontend —
AgentChatPanel.tsxhorse_racing,soccer,golf, and the default fallback:Original prompt
Two fixes needed
Fix 1 — Response cache serves stale race data (wrong next race shown)
File:
AI-Sports-Almanac/backend/src/api/routes/chat.tsProblem: The response cache key is
${sport}:${targetDate}:${trimmed}. This means if a user asks "give me your tip for the next race please" at 2:00pm, the answer is cached. When they ask the same question at 3:30pm, they get the cached 2:00pm answer (the already-run race) instead of the 3:30pm next race.Fix: Include the current hour in the cache key so the cache expires every hour:
Find this line:
Replace with:
Also reduce the cache TTL from whatever it currently is to 10 minutes for horse racing queries to ensure fresher data. Find
CACHE_TTL_MSand if it's longer than 10 minutes, change it to:Fix 2 — Update suggested prompts in the agent chat panel
File:
AI-Sports-Almanac/frontend/components/AgentChatPanel.tsxProblem: The current suggested prompts are generic and not today-focused. Need to update them.
Current
SUGGESTED_PROMPTS:And the default fallback:
Replace ALL suggested prompts with the new ones below. ALL sport categories (horse_racing, soccer, golf) AND the default fallback should use these same three prompts:
And update the default fallback to:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: ok both merged ?
Assistant: Let me check!
Assistant: ✅ Both merged successfully!
Now you need to deploy to your VPS. Run this:
cd /root/awesome-intercom/AI-Sports-Almanac git pull origin main docker compose up -d --build backendAlso — add the ADMIN_EMAILS env var before restarting (from PR #98):
That single restart will deploy all the fixes:
🚀
User: ok done !
Assistant: Now pull and rebuild on your VPS to deploy everything:
cd /root/awesome-intercom/AI-Sports-Almanac git pull origin main docker compose up -d --build backendThat single command will:
Once it's done, test an agent and let me know how it goes! 🏇
User: done
Assistant: 🎉 Perfect — everything deployed successfully!
All fixes are now LIVE on your server. Here's what's active right now:
Go test it now — ask any horse racing agent:
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.