Skip to content

Copilot review check: #160 subagent session cost fix - #1

Closed
blineadam wants to merge 2 commits into
DEVfrom
fix/160-subagent-session-cost
Closed

blineadam wants to merge 2 commits into
DEVfrom
fix/160-subagent-session-cost

Conversation

@blineadam

Copy link
Copy Markdown
Owner

Throwaway PR to request a Copilot review of af61c29 before submitting to phuryn#165. Not intended to merge.

…uryn#160)

/api/data now ships each session a per-model token breakdown (by_model,
grouped from turns), and a sessionCost() helper sums calcCost over it.
Recent Sessions, Cost by Project, and Cost by Project & Branch previously
billed a session's total tokens at its single primary model, so sub-agent
turns on cheaper models were charged at the main model's rate. Falls back
to primary-model pricing when the breakdown is empty (old DBs).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds per-model session pricing to correctly account for subagent usage.

Changes:

  • Adds per-session model/token breakdowns to dashboard data.
  • Uses model-specific pricing across session, project, branch, sorting, and CSV views.
  • Adds mixed-model regression tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
dashboard.py Adds per-model breakdowns and session cost calculation.
tests/test_dashboard.py Tests mixed-model token aggregation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dashboard.py
Comment thread tests/test_dashboard.py
sessionCost() prices each model in a session's by_model breakdown
separately, so a session can be billable even when its primary model
isn't (e.g. a non-billable main model that dispatched a billable
sub-agent). The Recent Sessions table still gated its n/a display on
isBillable(s.model) alone, so that real cost was computed but hidden.
sessionIsBillable() checks the whole breakdown instead.
@blineadam

Copy link
Copy Markdown
Owner Author

Used this to trigger a Copilot review before submitting the real PR. It flagged a real inconsistency (sessionCost() vs. the n/a display gate), fixed in the follow-up commit. Closing without merging.

@blineadam blineadam closed this Jul 27, 2026
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.

2 participants