Repository navigation
feat(traffic): show log senders' records against the raw cap, and why the bot report stops - #1224
Conversation
… the bot report stops
A Logpush job's or a Vercel drain's files count against the month's raw
cap (00184). Past it they are counted but not read, so no rows and no
totals are added and the bot report stops mid-month, but nothing said so:
the only note covered the event cap ("totals still counted").
GET /api/bots/connections now returns the month's raw records, when the
raw cap was reached, and the cap. For a brand with a log sender, the
connect dialog shows "Log records this month: X of Y" and, once the cap is
reached, that log files are paused until the next month; the report
section shows the same note under the bot types. A Worker's batches don't
count against the raw cap, so a Worker-only brand sees neither.
Follow-up to ansvisor#1181's review.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@gkhngyk This covers #1181's raw-cap note. The connections route now returns
|
gkhngyk
left a comment
There was a problem hiding this comment.
One small fix before merge:
The pause note keys on rawCappedAt (web/src/lib/ai-bots.ts, logsPausedUntil). 00184 sets that once a month and never clears it, but reading depends on raw < cap with today's plan:
- Upgrade: a Growth org that hit 20M upgrades to Enterprise. Its files are read again, but the dialog and the report keep saying "paused until Nov 1".
- Downgrade: an Enterprise org at 30M moves to Growth. Its files stop being read, but there's no note.
Use rawCap > 0 && raw >= rawCap, and add a raised-plan test.
Copy: "aren't counted" should be "aren't read" (en.json). The line above keeps counting, as the PR description says.
The pause note keyed on rawCappedAt, which 00184 sets once a month and never clears. The server reads files while raw < cap with today's plan, so an upgraded org kept seeing "paused until" after its files were read again, and a downgraded one over its new cap saw no note. Read it as the server does, and say the files aren't read (they're still counted). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@gkhngyk thanks, both fixed in 5aca4ce:
Checked locally against a cloud-mode server with a temporary drain + usage row: Growth 20,000,400/20M shows the note, Enterprise hides it, Growth at 30M with no |
gkhngyk
left a comment
There was a problem hiding this comment.
Thanks, both points are fixed.
- The pause note reads today's plan.
rawCap > 0 && raw >= rawCapmatchesai_bot_count_raw'sv_raw < p_cap, and there are tests for both a raised and a lowered plan. - The copy now says the files aren't read.
This goes in first of the bot-report PRs. #1216 conflicts with it in _bots-report.tsx (the getBotConnections import and the new note) and will be resolved on top.
Resolves _bots-report.tsx against ansvisor#1224 and ansvisor#1225: the connections keep their own read, and they keep ansvisor#1225's lastInfo so a failed read after a create doesn't close the dialog and lose the new secret. ansvisor#1224's logsPausedUntil import stays. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
Summary
Follow-up from #1181's review: the raw cap was never returned or shown.
A Logpush job's or a Vercel drain's files count against the month's raw cap (
raw_recordsandraw_capped_at, 00184). Past the cap they are counted but not read. No rows and no totals are added, so the bot report stops mid-month. The only note in the dialog covered the event cap ("totals still counted").Server
GET /api/bots/connections/:brandIdalso returnsusage.raw,usage.rawCappedAtandusage.rawCap(fromgetBotRawCap).Web
BotUsagegains the three fields.lib/ai-bots.ts:hasLogSender: a Logpush or drain connection;logsPausedUntil: the next month's first day once the raw cap is reached, for a brand with a log sender;rowsPausedUntilnow shares the next-month helper.web/messages/en.json(traffic.bots.rawUsage,traffic.bots.logsPaused).No migration.
Related issue
Follow-up to #1181 (review of 2026-10-19 14:05 UTC).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
IS_CLOUD=trueand set the organization togrowth(raw cap 20M).vercel_drainconnection, and a current-monthai_bot_usagerow withraw_recordsabove 20M andraw_capped_atset. Add a fewai_bot_dailyrows so the report has data.I checked this locally (API on :8082, web on :3002, temporary data removed afterwards) in light and dark mode, at 1440 and 1024 px.
Tests:
src/routes/bots.test.js: the route returns the raw fields.lib/actions/ai-bots.test.ts: parsing.lib/ai-bots.test.ts:logsPausedUntilonly with a log sender and a positive cap._bots-connect.test.tsx: the dialog lines, and none for a Worker._bots-report.test.tsx: the report note.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): 0 errors, only the existing warningsyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
yarn test(1779 passed), andyarn buildwith the CI placeholder env;npm run format,npm run lint,npm test(1818 passed).🤖 Generated with Claude Code