Skip to content

feat(export): add combined project, model and agent reporting - #1713

Open
wesm wants to merge 2 commits into
mainfrom
feat/joint-reporting-export
Open

feat(export): add combined project, model and agent reporting#1713
wesm wants to merge 2 commits into
mainfrom
feat/joint-reporting-export

Conversation

@wesm

@wesm wesm commented Sep 10, 2026

Copy link
Copy Markdown
Member

Reporting exports can preserve project, model and agent relationships at a chosen time resolution. Separate breakdowns cannot answer questions such as “how much did this model cost on this project?” Opt-in reporting schema 3 supplies those combined facts without session identifiers, messages or tool content.

  • Hour, day and digest exports accept repeatable --project-key selection and --bucket, such as 1m, 5m or 15m. Any positive whole-minute duration that divides an hour is valid. Five minutes remains the default; v3 documents declare bucket_seconds. Versions 1 and 2 keep their original bytes and digests, and version 2 remains the default schema.
  • Activity cells use the shared Activity calculation. Bucket duration does not change the inactivity gap cap or accounting rules. Usage deduplication and cost allocation precede project selection. Standalone usage remains unattributed, including when a real session has an empty project label. Known costs retain their pricing provenance; unknown pricing remains visible.
  • Each hour contains a complete replacement set. Scope, resolution and cells participate in its digest, so corrections and resolution changes replace old facts instead of adding another charge. Finer precision does not require more frequent uploads. Device bucket peaks tighten concurrency bounds, but do not establish exact selected or cross-device concurrency.

The synthetic SQLite benchmark compares one- and five-minute exports with overlapping sessions, model switches and two project counts. This adds aggregation and payload cost, not incremental history discovery: digest screening still computes full day exports.

Focused reporting checks, package checks, vet, lint and the documentation build pass. The broader short suite still has the three previously reproduced base failures in IPv6 artifact exchange and OpenCode sync; this change does not address them.

Independent project, model and agent totals cannot answer combined filters.
Add opt-in reporting v3 with session-free five-minute cells, cost provenance
and project-key selection. Use the shared Activity interval engine so these
facts follow the same activity rules as the report.

Select usage survivors and allocate authoritative costs before filtering
projects. Bind complete cell sets and scope into each hour digest so late
corrections replace prior usage instead of adding another charge. Retain the
device bucket peak to keep aggregate concurrency bounds useful.

Keep existing v1/v2 contracts and the v2 default unchanged. Document the
replacement and precision limits, and measure the extra aggregation and
payload cost with a synthetic SQLite benchmark.
@roborev-ci

roborev-ci Bot commented Sep 10, 2026

Copy link
Copy Markdown

roborev: Combined Review (fade53b)

Verdict: Changes require fixes for 1 finding.

Medium

  • internal/db/reporting_joint.go:24-25, 103-114: Standalone usage rows have no session and therefore an empty project, but projects[""] may contain a real archive-scoped key when any session has an empty project label. The scope filter can then include unattributed Cursor usage in that project, and jointReportingHour emits it with the fabricated project key. Track whether the usage row belongs to a known session; keep unknown/standalone rows on an empty project key and exclude them from any non-empty project scope. Only resolve projects[session.Project] for known sessions.

    Reported by: codex


Reviewers: 2 done | Synthesis: codex, 10s | Total: 10m48s

Reporting integrations need to choose their time precision without changing
the hourly publication cadence. Accept whole-minute durations that divide
an hour, declare the resolution in v3 documents and bind it to their content
identity. Preserve the v1/v2 bytes and the independent inactivity-gap rule.

Keep standalone usage unattributed even when a real session has an empty
project label. A missing session must not borrow that project's identity or
contribute to its scoped totals.

Compare one- and five-minute exports on the same synthetic archives so finer
precision has a measured aggregation and payload cost.
@roborev-ci

roborev-ci Bot commented Sep 11, 2026

Copy link
Copy Markdown

roborev: Combined Review (b567745)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 13m50s

@wesm wesm self-assigned this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant