Skip to content

[codex] Aggregate sessions by usage event date#34

Merged
Miss-you merged 2 commits into
mainfrom
codex/ebta-008-session-events
Apr 16, 2026
Merged

[codex] Aggregate sessions by usage event date#34
Miss-you merged 2 commits into
mainfrom
codex/ebta-008-session-events

Conversation

@Miss-you

Copy link
Copy Markdown
Owner

Summary

  • Switch codetok session from session-start filtering to localized usage-event filtering.
  • Group filtered usage events by provider/session while preserving the existing session JSON/table shape.
  • Add focused command tests, an OpenSpec change, EBTA-008 workspace artifacts, and update the Claude subagent e2e expectation for provider/session event grouping.

Validation

  • go test -count=1 ./cmd -run 'Test(RunSession|AggregateSessionEvents|ResolveSessionEventFilterDates|CollectUsageEvents)'
  • go test -count=1 ./e2e -run TestClaudeSubagentSessions_JSONOutput
  • make fmt
  • make lint
  • make test
  • make vet
  • make build
  • Manual CLI smoke with ./bin/codetok ... session --json --since 2026-02-15 --until 2026-02-15 --timezone UTC

Notes

  • Existing session JSON field names remain unchanged.
  • Turns remains best-effort using included usage-event count until an event-level turn model exists.

- switch session filtering to localized UsageEvent dates and group filtered events by provider/session

- add focused session command tests, OpenSpec change, EBTA workspace artifacts, and update stale Claude subagent e2e expectation
Copilot AI review requested due to automatic review settings April 16, 2026 15:53

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

Updates codetok session to filter and aggregate by localized usage-event dates (matching the existing event-based aggregation model) while keeping the session JSON/table output shape stable.

Changes:

  • Switch session from session-start-time filtering to timezone-aware usage-event filtering + aggregation back into SessionInfo rows.
  • Add focused cmd/session_test.go coverage for filtering, timezone behavior, grouping, and provider override routing.
  • Update the Claude subagent e2e expectation and add an OpenSpec change + EBTA-008 workspace artifacts documenting the work.

Reviewed changes

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

Show a summary per file
File Description
workspace/EBTA-008/verification.md Adds EBTA-008 verification notes, commands, and manual CLI smoke steps.
workspace/EBTA-008/test_strategy.md Documents RED/green evidence and focused coverage targets for EBTA-008.
workspace/EBTA-008/review.md Records multi-agent review outcomes and post-review verification commands.
workspace/EBTA-008/original_impl.md Captures the pre-change session behavior and the motivating gap.
workspace/EBTA-008/new_impl.md Describes the intended event-based session aggregation approach and contract.
workspace/EBTA-008/final_impl_v1.md Outlines a scoped implementation plan for the session command change.
workspace/EBTA-008/final_impl.md Finalizes decisions and test coverage expectations for the implementation.
openspec/changes/event-based-token-aggregation-session-command/tasks.md Tracks task checklist completion for the OpenSpec change.
openspec/changes/event-based-token-aggregation-session-command/specs/session-event-aggregation/spec.md Adds requirements/scenarios for session event-date filtering, timezone use, and provider/session grouping.
openspec/changes/event-based-token-aggregation-session-command/proposal.md Explains rationale and scope of switching session to usage-event aggregation.
openspec/changes/event-based-token-aggregation-session-command/design.md Documents design decisions and risks/trade-offs for the new pipeline.
openspec/changes/event-based-token-aggregation-session-command/.openspec.yaml Registers the OpenSpec change with creation date.
e2e/e2e_test.go Adjusts Claude subagent session JSON expectation to match provider/session event grouping.
docs/plans/2026-04-16-event-based-token-aggregation-task.md Marks EBTA-008 as done and records timeline notes.
cmd/session_test.go Adds new focused unit tests for session event filtering, timezone, aggregation, and overrides.
cmd/session.go Implements timezone flag, event filtering, event→session aggregation, and localized date rendering for session output.
cmd/collect.go Removes now-unused collectSessions wrapper (session now uses event collection).
Comments suppressed due to low confidence (1)

e2e/e2e_test.go:583

  • The comment says “Verify both are from claude provider”, but the test now expects exactly 1 combined session row. Update the wording to avoid confusion (e.g., “Verify provider is claude”).
	// Verify both are from claude provider
	for _, s := range sessions {
		if s.ProviderName != "claude" {
			t.Errorf("expected provider %q, got %q", "claude", s.ProviderName)
		}
	}

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

Comment thread cmd/session.go
Comment thread workspace/EBTA-008/verification.md
@Miss-you
Miss-you merged commit aac0258 into main Apr 16, 2026
7 checks passed
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