Skip to content

Upgrade Copilot SDK to v1.0.0 and surface premium-request credits on the dashboard #309

Description

@spboyer

Goal

Two related pieces of work, naturally bundled:

  1. Upgrade github.com/github/copilot-sdk/go from v0.3.0v1.0.0 (major version bump).
  2. Surface premium-request credit counts on the dashboard — the data is already collected end-to-end, just not displayed.

Part 1 — SDK upgrade (v0.3.0 → v1.0.0)

Current pin in go.mod:

github.com/github/copilot-sdk/go v0.3.0
github.com/github/copilot-sdk/go/cmd/bundler

A v0.x → v1.0 jump may contain breaking changes. Touchpoints in this repo:

  • internal/execution/copilot.go — main consumer
  • internal/execution/session_usage_collector.go — uses copilot.SessionEvent, SessionEventType*, SessionShutdownData.{TotalPremiumRequests, ModelMetrics}, mm.Usage.{Input,Output,CacheRead,CacheWrite}Tokens, mm.Requests.{Count, Cost}
  • internal/copilotevents/ — event-decoding helpers (Shutdown, AssistantUsage)
  • internal/embedded/ — bundler integration
  • All *_test.go files that build copilot.SessionEvent fixtures

Acceptance

  • go.mod / go.sum updated to v1.0.0; go mod tidy clean.
  • All call sites compile against the new API; any renamed/moved types refactored.
  • make test and make lint green.
  • Existing eval runs still produce equivalent UsageStats (tokens + premium requests + per-model metrics).
  • Brief note in the PR about any behavior changes from the SDK release notes.

Part 2 — Premium request credits on the dashboard

The data is already there:

  • models.UsageStats.PremiumRequests float64 (internal/models/outcome.go:204) — populated from shutdown.TotalPremiumRequests (internal/execution/session_usage_collector.go:95).
  • models.ModelUsage.RequestCount float64 per model (internal/models/outcome.go:223) — populated from mm.Requests.Count (internal/execution/session_usage_collector.go:107).

But the webapi layer never reads either field — internal/webapi/store.go only pulls InputTokens + OutputTokens into RunSummary.

Plan

  1. Backend (internal/webapi/):

    • Add PremiumRequests float64 to RunSummary and SummaryResponse (types.go).
    • Populate from o.Digest.Usage.PremiumRequests in outcomeToSummary (store.go).
    • Aggregate in Summary() (storage_adapter.go) as AvgPremiumRequests (and/or total).
    • For RunDetail, expose per-model RequestCount so the UI can show a breakdown.
  2. Frontend (web/src/):

    • Add a Credits (or Premium Requests) column to RunsTable.tsx.
    • Add an Avg Credits KPI card to KPICards.tsx.
    • Add credits to RunDetail.tsx stats and CSV export (lib/export.ts).
    • Format as integer with thousands separators (no $).
    • In CompareView.tsx / TrendsPage.tsx, mirror token treatment (higher is "more usage", not "better").
  3. Display semantics: premium requests ≠ dollars. Make sure the label is clear ("Credits" or "Premium Requests" — pick one and stay consistent). Tooltip should explain it's the Copilot premium-request count reported by the SDK.

Acceptance

  • RunSummary / SummaryResponse carry premium request totals.
  • Dashboard runs table shows a Credits column.
  • KPI row shows Avg Credits alongside Avg Tokens / Avg Cost.
  • Run detail page shows credits + per-model breakdown (if non-empty).
  • CSV export includes credits.
  • Playwright e2e tests updated and passing.

Ordering

Do Part 1 first (SDK upgrade) — Part 2 reads SDK-derived fields, and if v1.0.0 renames anything (e.g. TotalPremiumRequests → something else) we don't want to wire the dashboard twice. Then Part 2 on top.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    dashboarddependenciesPull requests that update a dependency fileenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions