Skip to content

fix(cli): exclude imported sessions from stats by default#316

Open
WqyJh wants to merge 1 commit into
mainfrom
mirror/pr-492
Open

fix(cli): exclude imported sessions from stats by default#316
WqyJh wants to merge 1 commit into
mainfrom
mirror/pr-492

Conversation

@WqyJh

@WqyJh WqyJh commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Issue for this PR

Closes XiaomiMiMo#494

Type of change

  • Bug fix

What does this PR do?

mimo stats was counting imported Claude Code sessions in all metrics. This change filters them out by default using WHERE id NOT IN (SELECT session_id FROM claude_import) -- a subquery against the import tracking table rather than version-string matching, so any future importer is automatically excluded.

Added --all flag to include imported sessions when needed.

Related to XiaomiMiMo#377 (stop auto-import on startup) -- that PR removes the auto-import trigger so new sessions aren't pulled in on every CLI invocation. This PR handles the stats side: even if users manually run import-claude, stats stays clean by default. The two are complementary and independent.

How did you verify your code works?

Built and ran from source against a DB with 204 imported + 13 native sessions:

  • mimo stats -> Sessions: 13 (native only), Days: 1
  • mimo stats --all -> Sessions: 217 (all), Days: 32

Unit tests:

  • bun test test/cli/stats-exclude-imported.test.ts -- 1 pass
  • bun test test/cli/import.test.ts -- 5 pass (existing tests unaffected)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Mirrored from XiaomiMiMo/MiMo-Code#492 — original author @llupRisinglll.

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.

[bug]: mimo stats includes imported Claude Code sessions in all metrics

2 participants