From ce750ff151835ffb66b353b668f6385f576f45f5 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 25 Sep 2026 18:05:09 -0500 Subject: [PATCH] fix(title): strip a quoted path's line-range suffix in the attachment-only guard A quoted (space-bearing) @file:/@folder: reference may carry a :start[-end] line range; the canonical parser (context_references.REFERENCE_PATTERN) claims the whole token. The guard's local copy stopped at the closing quote, leaving ":3" as residual "prose", so a quoted, line-ranged attachment-only opener kept a path-derived title (#92068 regression found in review of #122000). Mirror the canonical value shape and pin all three quote styles (#122000). --- agent/title_generator.py | 6 +++++- tests/agent/test_title_generator.py | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/agent/title_generator.py b/agent/title_generator.py index dce21a619e..c8f771f9ac 100644 --- a/agent/title_generator.py +++ b/agent/title_generator.py @@ -274,8 +274,12 @@ def _strip_one_wrapper(text: str) -> str: # written backtick-quoted). Kept local so the titler doesn't import the # context-reference machinery (circularity / startup cost) just to detect the # attachment-only shape (#92068). +_QUOTED = r"(?:`[^`\n]+`|\"[^\"\n]+\"|'[^'\n]+')" +# Mirrors the canonical agent.context_references value shape: a quoted +# (space-bearing) path may carry a ``:start[-end]`` line-range suffix, and a +# bare path swallows its own range via ``\S+``. _CONTEXT_REFERENCE_TOKEN_RE = re.compile( - r"(?