Skip to content

Find each tag pair in parse_start_end_tags by position - #6367

Merged
markbackman merged 2 commits into
mainfrom
mb/parse-start-end-tags-pairs
Oct 25, 2026
Merged

markbackman merged 2 commits into
mainfrom
mb/parse-start-end-tags-pairs

Conversation

@markbackman

@markbackman markbackman commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

SkipTagsAggregator keeps text between a start and an end tag in one aggregation, so a sentence boundary inside the tags doesn't split it. It finds the tags with parse_start_end_tags, which counted start and end tags in the text instead of finding where each one is. That missed two cases. This scans the text by position instead.

  • Several tag pairs. The count loop returned on the first pair in the list, whatever it found, so only the first pair was recognized. With [("<spell>", "</spell>"), ("<card>", "</card>")], a <card>…</card> holding a period was split at it. Now the earliest start tag of any pair opens, and that pair's end tag closes it.
  • A pair whose start and end are the same. With ("**", "**"), the start and end counts were always equal, so the pair never opened. Now the first ** opens it and the next closes it.
  • The returned index. It's still where scanning resumes on the next call, which is how SkipTagsAggregator, its only caller, uses it. It's now just past an open tag's start, or past the last tag that closed, rather than the end of the text.

parse_start_end_tags scans from where the last tag ended for the earliest start tag of any pair, then for that pair's end tag after it. Every pair SkipTagsAggregator is given is recognized, and a pair whose start and end tags are the same, such as ("**", "**"), opens and closes.
@markbackman
markbackman requested review from a team and mattieruth October 24, 2026 22:22
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/pipecat/utils/string.py 89.38% <100.00%> (-0.10%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aconchillo

Copy link
Copy Markdown
Contributor

Makes sense. LGTM

@markbackman
markbackman merged commit 3e2aaef into main Oct 25, 2026
6 checks passed
@markbackman
markbackman deleted the mb/parse-start-end-tags-pairs branch October 25, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants