Repository navigation
fix(utils): open frontmatter only on an exact --- line - #7
Closed
vchamarthi wants to merge 1 commit into
Closed
vchamarthi wants to merge 1 commit into
vchamarthi wants to merge 1 commit into
Conversation
Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
vchamarthi
force-pushed
the
fix/frontmatter-opening-fence
branch
from
October 21, 2026 19:00
8aa3dbd to
e5158ad
Compare
Owner
Author
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.
Summary
parse_frontmattercloses a block only on a line that is exactly---, but it opened one on any text that starts with---. A document that begins with a thematic break (-----) or a--- titleline and has a---line later was read as frontmatter. Its leading text was dropped from the body and the YAML between the two lines was discarded as invalid metadata. The same function also returned an unterminated block with its BOM still attached, where every other branch strips it.The opening line now has to be exactly
---, the same rule as the closing fence.frontmatter_blockinscripts/sync_skilltext_profile.pysays it mirrorsparse_frontmatter, so it gets the same one-line change.Evidence
5c70cbf90f4eab95b30dcd6ad7ae60a4f37de268pytest -p no:cacheprovider -p no:logging tests/test_treatments.py tests/test_sync_skilltext_profile.py -q --tb=short, run through the lab'sexperiment_safe.pysandbox with a Python 3.14 environment.parse_frontmatter("-----\nintro paragraph\n---\nrest")returned bodyrest. An unterminated block with a BOM returned the BOM in the body.frontmatter_blockreturned-----\nintro\n---\nas a header.---look-alike first line. This is a parser-consistency fix, not a skill-efficacy result.Blast radius
Two functions change by a few lines each:
parse_frontmatterindokimi/dokimi/utils.pyandfrontmatter_blockindokimi/scripts/sync_skilltext_profile.py. Callers are the skill loader, the agent profile loader, the skill treatment and benchflow skill metadata reads. A file whose first line is exactly---, with or without trailing spaces or a BOM, parses as before. Only a first line that merely starts with---changes, and it is now body. Two tests are added totests/test_treatments.py, one totests/test_sync_skilltext_profile.py, plus a changelog fragment.Overlap
tests/test_treatments.pyfor that. It does not change frontmatter parsing.Created with claude-sonnet-5-5.