fix(migration-legacy): correct blank-title and corrupt-classification on kimi-cli import#729
Open
Dmatut7 wants to merge 3 commits into
Open
fix(migration-legacy): correct blank-title and corrupt-classification on kimi-cli import#729Dmatut7 wants to merge 3 commits into
Dmatut7 wants to merge 3 commits into
Conversation
…ing sessions A whitespace-only `custom_title` (e.g. " ") on an imported kimi-cli session was written verbatim as the session title and flagged `isCustomTitle: true`. The length guards (`custom_title.length > 0`) only counted characters, never trimming, while the sibling `fallbackTitle` is trimmed — so a blank title slipped past and surfaced as an all-spaces, falsely-custom entry in the session picker. Trim the custom_title and treat a blank result as absent, so the title falls back to the prompt prefix (or "Imported session") and isCustomTitle is false. Non-blank titles are now also trimmed, matching fallbackTitle. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…corrupt `analyzeContextContent` documents `corrupt` as "every non-blank line failed to parse" (disk damage / truncated write). But a line that JSON.parse accepted yet was a scalar/array (e.g. `42`, `"hi"`, `[]`) hit the object-shape `continue` before `hadParseableLine` was set, so a context of all valid-JSON non-objects was misreported as `corrupt` and surfaced as a migration failure instead of an empty/skipped session. Mark the line as parseable as soon as JSON.parse succeeds, before the shape check — matching the documented contract and the existing "at least one line parses → empty" test intent. Genuinely truncated lines still fail JSON.parse and remain `corrupt`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 8ce41d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No existing issue — two kimi-cli import edge cases explained below.
Problem
When importing legacy kimi-cli sessions: (1) a whitespace-only
custom_title(e.g." ") was written verbatim as the session title and flaggedisCustomTitle: true, surfacing an all-spaces, falsely-custom entry in the picker; (2)analyzeContextContentclassified acontext.jsonlwhose lines are valid JSON but not objects (42,"hi",[]) ascorrupt— even though its own doc comment defines corrupt as "every non-blank line failed to parse" — so such a session was reported as a migration failure instead of empty/skipped.What changed
(1) Trim
custom_titleand treat a blank result as absent (mirroringfallbackTitle), so it falls back to the prompt prefix andisCustomTitleis false. (2) Mark a line as parseable as soon asJSON.parsesucceeds, before the object-shape check, so an all-valid-JSON-non-object context isempty, notcorrupt. Genuinely truncated lines still fail to parse and remaincorrupt. Tests added for both.Checklist