Skip to content

fix(cli): add clear warning when import-jsonl brings zero files#927

Open
sham-jadhav03 wants to merge 1 commit into
rohitg00:mainfrom
sham-jadhav03:fix/jsonl-import-empty-warning
Open

fix(cli): add clear warning when import-jsonl brings zero files#927
sham-jadhav03 wants to merge 1 commit into
rohitg00:mainfrom
sham-jadhav03:fix/jsonl-import-empty-warning

Conversation

@sham-jadhav03

@sham-jadhav03 sham-jadhav03 commented Jun 13, 2026

Copy link
Copy Markdown

Purpose

This PR addresses a silent data-loss scenario where running agentmemory import-jsonl completes successfully with a deceptive success status even when 0 valid historical session logs are imported (often due to Claude Code's native cleanupPeriodDays: 30 auto-purge setting).

Changes

  • Added an explicit validation check after the import request resolves inside runImportJsonl().
  • If json.imported evaluates to 0 or is undefined, the CLI now prints a clean warning (p.log.warn) alerting the user about the missing files and the Claude Code cleanup policy.
  • Suggests the user connect live auto-capture hooks instead via agentmemory connect claude-code --with-hooks.

Verification Done

  • Verified compilation with npm run build.
  • Ran the entire test pipeline (npm test) locally, ensuring all 1423+ unit and integration tests continue to pass seamlessly without any regression.

Summary by CodeRabbit

  • Bug Fixes
    • When imports detect no records, the CLI now displays a warning explaining why historical logs may be missing and recommends enabling auto-capture hooks for better continuity.

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@sham-jadhav03 is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7aae94d2-55d4-4997-b6d8-f7f160d64dc8

📥 Commits

Reviewing files that changed from the base of the PR and between f6f9e3c and 0bd1b55.

📒 Files selected for processing (1)
  • src/cli.ts

📝 Walkthrough

Walkthrough

The CLI's runImportJsonl function now detects when the server reports zero imported records and emits a warning explaining that Claude Code's default cleanup may have purged older logs, while recommending the use of agentmemory's live auto-capture hooks for historical continuity.

Changes

Import Result Validation

Layer / File(s) Summary
Import result validation and warning message
src/cli.ts
After successful import completion, the CLI checks if json.imported is missing or zero and prints a warning with guidance about Claude Code cleanup behavior and a recommendation to use live auto-capture hooks via agentmemory connect claude-code --with-hooks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related issues

Poem

🐰 A warning hops into the logs so bright,
When Claude's cleanup dims the historical light,
"Connect with hooks!" the rabbit doth sing,
For memories preserved are the finest thing! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a warning when import-jsonl completes with zero imported files, which is the primary fix implemented in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant