From 02a4f2d20dde223edacbcd9d374869ccdaed9936 Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 18 Nov 2026 09:40:50 +0800 Subject: [PATCH] fix(agent): skip YAML setext lookalikes in document-scope parser --- plugins/agent/src/context_scope.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/agent/src/context_scope.rs b/plugins/agent/src/context_scope.rs index bb9a148..b970d57 100644 --- a/plugins/agent/src/context_scope.rs +++ b/plugins/agent/src/context_scope.rs @@ -97,7 +97,13 @@ pub fn project(args: &Value) -> Result { .and_then(Value::as_u64) .unwrap_or(1600) .clamp(32, 16000) as usize; - let marks = headings(&source); + // YAML frontmatter may look like a setext Markdown heading; never treat it + // as a Marqdo class or function boundary. + let front_end = frontmatter_end(&source); + let marks: Vec
= headings(&source) + .into_iter() + .filter(|heading| heading.start >= front_end) + .collect(); let results: Vec<(usize, usize)> = match scope { "file" => { let end = marks.first().map_or(source.len(), |h| h.start);