fix: shorten overlong Summary titles instead of discarding the generation - #511
Merged
Conversation
…tion `spool share` rejected a local-Agent Summary whose front-matter `title` or `title_zh` ran past 96 characters, throwing away the whole generation over the tail of one line. Every reader already bounds titles to 96 characters via `boundTitle`, so the overflow never reached a reader anyway. Repair the front-matter before validation: cut back to a word boundary for space-delimited titles, slice by codepoint otherwise, and mark the cut with an ellipsis. Bodies are left byte-identical, and the CLI reports which title was shortened. Structural defects stay hard failures. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Problem
spool sharethrew away a complete local-Agent Summary when the front-mattertitleortitle_zhran past 96 characters:The whole generation — minutes of provider usage — was discarded and never written anywhere, over the tail of one line. That contract was also inconsistent: every reader already bounds titles to 96 characters through
parseSummaryFrontMatter→boundTitle, so the overflow was never going to reach a reader.Change
repairOverlongSummaryTitles(apps/cli/src/commands/share.ts) runs before validation and rewrites only the leading front-matter:title_zhcase.…, landing at ≤96 characters.Shortened `title` to the 96-character Session title limit.Bodies are left byte-identical. Structural defects — missing delimiters, missing titles, a body repeating the title as its H1, >64 KiB — stay hard failures. The validator keeps its overflow branch as a backstop and now derives the number from the shared
SUMMARY_TITLE_CHAR_LIMIT.Tests
Full CLI suite green (254 tests / 26 files),
tsc --noEmitclean, lint and format clean.Known gap
The "Summary bodies must not repeat the Session title as their first H1" rule is the same class of cosmetic-but-fatal check and is equally mechanical to repair (drop the duplicate heading line). Left out to keep this scoped to the reported failure.
🤖 Generated with Claude Code