Skip to content

fix(memory): skip meta json files during session migration#1340

Merged
lxowalle merged 1 commit intosipeed:mainfrom
wj-xiao:fix/meta-json-migration
Mar 11, 2026
Merged

fix(memory): skip meta json files during session migration#1340
lxowalle merged 1 commit intosipeed:mainfrom
wj-xiao:fix/meta-json-migration

Conversation

@wj-xiao
Copy link
Collaborator

@wj-xiao wj-xiao commented Mar 11, 2026

📝 Description

Skip *.meta.json files during session migration so startup does not treat JSONL metadata as legacy session snapshots. This prevents MigrateFromJSON() from overwriting existing .jsonl history with an empty message list and renaming metadata files to .meta.json.migrated.

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

📚 Technical Context (Skip for Docs)

  • Reference URL:
    • pkg/memory/migration.go
  • Reasoning:
    • Startup migration scanned all *.json files, including *.meta.json.
    • meta.json belongs to the JSONL storage format, not the legacy session snapshot format.
    • Re-importing it caused SetHistory(..., emptyMessages) and cleared the paired .jsonl file.

🧪 Test Environment

  • Hardware: PC
  • OS: macOS
  • Model/Provider: N/A
  • Channels: Pico

📸 Evidence (Optional)

Click to view Logs/Screenshots
env GOCACHE=/tmp/picoclaw-go-build-cache GOTMPDIR=/tmp GOLANGCI_LINT_CACHE=/tmp/picoclaw-golangci-cache make lint
env GOCACHE=/tmp/picoclaw-go-build-cache GOTMPDIR=/tmp go test ./pkg/memory -run 'TestMigrateFromJSON_(Basic|WithToolCalls|MultipleFiles|InvalidJSON|RenamesFiles|Idempotent|ColonInKey|RetryAfterCrash|NonexistentDir|SkipsMetaJSONFiles)'

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

@wj-xiao wj-xiao changed the title fix: skip meta json files during session migration fix(memory): skip meta json files during session migration Mar 11, 2026
Copy link
Collaborator

@lxowalle lxowalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lxowalle lxowalle merged commit e74820c into sipeed:main Mar 11, 2026
4 checks passed
fishtrees pushed a commit to fishtrees/picoclaw that referenced this pull request Mar 12, 2026
dj-oyu pushed a commit to dj-oyu/picoclaw that referenced this pull request Mar 14, 2026
dj-oyu pushed a commit to dj-oyu/picoclaw that referenced this pull request Mar 16, 2026
@wj-xiao wj-xiao deleted the fix/meta-json-migration branch March 23, 2026 01:53
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