fix(ce-compound): detect Claude sessions with long metadata preambles in extract-skeleton#1082
Merged
tmchow merged 1 commit intoJul 9, 2026
Conversation
… in extract-skeleton
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.
Fixes #923
Summary
extract-skeleton.pycaps platform auto-detection at the first 10 lines. Current Claude Code session files front-load more than 10 metadata records before the first user/assistant message, so detection never fires, the file falls through to the codex handler, and the script returns an empty skeleton withparse_errors: 0. It reads as "no relevant prior sessions" rather than a bug, which disables session-history synthesis silently.The issue was filed against ce-sessions; the script now lives at
skills/ce-compound/scripts/session-history/extract-skeleton.pyand the cap is still present there. A prior PR (#958) predated that move and was closed; this PR applies the fix at the script's current location.Current behavior
Piping a session with a 12-record metadata preamble (the record types observed in #923: last-prompt, custom-title, agent-name, mode, permission-mode, attachments) followed by the repo's own
claude-session.jsonlfixture through the script:22 lines read, zero errors reported, nothing extracted.
Fix
Drop the cap:
if not detected and len(buffer) <= 10:becomesif not detected:, so detection scans until the first decisive record. The guard already short-circuits once a platform is detected, so files that detect early are processed identically. The same piped input after the fix:Verification
tests/session-history-scripts.test.ts: prepends the 12-record metadata preamble to the existing Claude fixture and asserts user and assistant messages are still extracted. Fails on main, passes with the fix.python3launcher, so the script tests were verified by piping throughpythondirectly; the bun-side tests exercise the same path on CI.bun testbaseline diff against main on this machine: zero new failures.Scope notes
The issue's optional hardening (fail loudly when detection falls through to the default handler) is left out to keep this the minimal detection fix. Happy to follow up on it separately.