Skip to content

feat(schedule): track per-execution tokens and dashboard totals - #1123

Open
newexploreor wants to merge 2 commits into
mainfrom
feat/schedule-execution-tokens
Open

newexploreor wants to merge 2 commits into
mainfrom
feat/schedule-execution-tokens

Conversation

@newexploreor

Copy link
Copy Markdown
Collaborator

Summary

  • Record token usage and optional estimated cost per scheduled AI execution, including retries and usage reported before failure, without counting earlier turns in fixed sessions.
  • Show total tokens in the execution overview and per-run token details. Keep four overview cards by moving success/failure counts beneath the success rate.
  • Add usage aggregation regression coverage, update API/design contracts, and provide manual legacy hourly-statistics backfill without inventing historical token usage.

Main sync

  • Merged latest origin/main (6f606cf) using a merge commit; no conflicts.

Validation

  • npm --prefix chatbot run build
  • go build ./...
  • go vet ./internal/schedule ./internal/repo ./internal/httpapi
  • go test ./internal/domain ./internal/schedule ./internal/repo ./internal/httpapi
  • node --test webtest/tests/schedule-executions.test.mjs webtest/tests/sync-schedule.test.mjs webtest/tests/shared-schedules.test.mjs (32 passed)
  • Legacy backfill was verified on isolated MySQL temporary tables and applied to the development instance before acceptance. Repeated backfill preserves existing counters and token usage.

Upgrade notes

  • New usage columns are additive; existing executions without usage remain unreported.
  • migrations/039_schedule_execution_legacy_stats.sql is manual only, requires MySQL 8.0.16+, a database backup, and the platform stopped after additive schema upgrade. Run without mysql --force.
  • Only missing hourly buckets of retained, finished legacy executions are restored. Partial overlaps are rejected; existing buckets and previously trimmed history are never overwritten.
  • Deployment-specific files, credentials, local snapshots, and demo images are not included.

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.

1 participant