Summary
After a successful query, the per-user rate-limit counter (users.total_queries) increments correctly ("1 of 2 remaining" in the top nav), but the History panel keeps showing "No queries yet" and the cached-replay endpoint GET /api/history/:id cannot find the row.
Net effect: every query a user pays for (Claude call + their rate-limit budget) is lost from the audit log and unreplayable from cache.
Steps to reproduce
- Sign in with Google on https://insightiq-frontend.orangemeadow-25c8b891.westeurope.azurecontainerapps.io
- Ask any question (e.g. "What is our MRR?")
- Wait for the chart + insight to render.
- Top nav shows the budget badge has decremented (e.g.
1 of 2 remaining).
- History panel still shows
0 queries — click to load free / No queries yet.
SELECT COUNT(*) FROM query_history WHERE user_id = <me> returns 0.
Expected
After step 4, the History panel should list the question with a cached-result indicator, and clicking it should replay from result_json without a Claude call.
Actual
The row is never inserted. The user's rate-limit budget is consumed for nothing.
Summary
After a successful query, the per-user rate-limit counter (
users.total_queries) increments correctly ("1 of 2 remaining" in the top nav), but the History panel keeps showing "No queries yet" and the cached-replay endpointGET /api/history/:idcannot find the row.Net effect: every query a user pays for (Claude call + their rate-limit budget) is lost from the audit log and unreplayable from cache.
Steps to reproduce
1 of 2 remaining).0 queries — click to load free/No queries yet.SELECT COUNT(*) FROM query_history WHERE user_id = <me>returns 0.Expected
After step 4, the History panel should list the question with a cached-result indicator, and clicking it should replay from
result_jsonwithout a Claude call.Actual
The row is never inserted. The user's rate-limit budget is consumed for nothing.