Skip to content

[codex] collect kimi usage events#28

Merged
Miss-you merged 2 commits into
mainfrom
codex/ebta-005-kimi-usage-events
Apr 16, 2026
Merged

[codex] collect kimi usage events#28
Miss-you merged 2 commits into
mainfrom
codex/ebta-005-kimi-usage-events

Conversation

@Miss-you

Copy link
Copy Markdown
Owner

Summary

  • Add native Kimi CollectUsageEvents support that emits one UsageEvent per StatusUpdate.token_usage record.
  • Preserve Kimi session metadata behavior for session ID, title, workdir hash, metadata model priority, payload model fallback, and log model fallback.
  • Add EBTA-005 OpenSpec/workspace artifacts and close the task board row with verification and review notes.

Validation

  • go test ./provider/kimi -run 'Test(ParseKimiUsageEvents|CollectKimiUsageEvents)'
  • go test ./provider/kimi
  • make fmt
  • make test
  • make vet
  • make build
  • make lint

Notes

Kimi StatusUpdate.token_usage is intentionally treated as incremental for this task, matching the existing parser tests and EBTA plan. If future real logs prove cumulative semantics, that should be handled by a separate fixture-backed task.

@Miss-you
Miss-you marked this pull request as ready for review April 16, 2026 09:42
Copilot AI review requested due to automatic review settings April 16, 2026 09:42

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 native usage-event collection to the Kimi provider so downstream event-based aggregation can attribute token deltas to the correct status-update timestamps, while keeping existing session parsing behavior intact and documenting the EBTA-005 task artifacts/specs.

Changes:

  • Implement Provider.CollectUsageEvents for Kimi and add wire.jsonl parsing that emits one provider.UsageEvent per StatusUpdate.token_usage, including stable EventID.
  • Add focused unit tests covering incremental per-status token deltas, cross-day timestamps, and model fallback priority (metadata > wire payload > log fallback).
  • Add EBTA-005 workspace artifacts and an OpenSpec change documenting requirements/design/tasks, plus mark EBTA-005 done in the plan.

Reviewed changes

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

Show a summary per file
File Description
workspace/EBTA-005/test_strategy.md Test plan for new Kimi usage-event parsing/collection and repo gates.
workspace/EBTA-005/review.md Captures review notes and post-review verification commands.
workspace/EBTA-005/original_impl.md Documents prior Kimi behavior (session-level aggregation only).
workspace/EBTA-005/new_impl.md Candidate approach for adding Kimi event collection.
workspace/EBTA-005/final_impl_v1.md Finalized behavioral requirements for Kimi native events.
workspace/EBTA-005/final_impl.md Final implementation summary + OpenSpec change name.
provider/kimi/parser.go Implements CollectUsageEvents, usage-event parsing, token usage extraction helper, and stable EventID generation.
provider/kimi/parser_test.go Adds tests for per-status events, timestamps, EventID (message_id path), and model fallback priority.
openspec/changes/event-based-token-aggregation-kimi-events/tasks.md Tracks completed implementation/testing tasks for the OpenSpec change.
openspec/changes/event-based-token-aggregation-kimi-events/specs/kimi-native-usage-events/spec.md Specifies requirements/scenarios for Kimi native usage events.
openspec/changes/event-based-token-aggregation-kimi-events/proposal.md Rationale and scope for adding Kimi native events.
openspec/changes/event-based-token-aggregation-kimi-events/design.md Design decisions for event collection/parsing and metadata/model priority.
openspec/changes/event-based-token-aggregation-kimi-events/.openspec.yaml Registers the OpenSpec change with schema + created date.
docs/plans/2026-04-16-event-based-token-aggregation-task.md Marks EBTA-005 as done and records verification/review notes.

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

Comment thread provider/kimi/parser_test.go
Comment thread openspec/changes/event-based-token-aggregation-kimi-events/design.md Outdated
Comment thread workspace/EBTA-005/test_strategy.md Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b2b1f70ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread provider/kimi/parser.go Outdated
@Miss-you
Miss-you force-pushed the codex/ebta-005-kimi-usage-events branch 2 times, most recently from 1c8a335 to 782f7cf Compare April 16, 2026 10:14
- add native Kimi UsageEvent collection from StatusUpdate token usage records

- preserve metadata, payload, and log model fallback behavior with focused tests

- close EBTA-005 task artifacts and OpenSpec change notes
- cover EventID line-number fallback and clarify token_usage event docs

- make ParseParallel generic and use it for Kimi event collection
@Miss-you
Miss-you force-pushed the codex/ebta-005-kimi-usage-events branch from 782f7cf to 718a785 Compare April 16, 2026 10:26
@Miss-you
Miss-you merged commit 0caf7ba into main Apr 16, 2026
7 checks passed
@Miss-you
Miss-you deleted the codex/ebta-005-kimi-usage-events branch April 16, 2026 10:36
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