Skip to content

Fix /loop trailing interval detection for words starting with every - #276

Merged
bbondy merged 3 commits into
brave:mainfrom
winshaurya:fix-issue-185
Sep 14, 2026
Merged

bbondy merged 3 commits into
brave:mainfrom
winshaurya:fix-issue-185

Conversation

@winshaurya

@winshaurya winshaurya commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Hi @bbondy,

Resolves #185 .

What was done

  • In crates/tui/src/loops.rs, updated trailing_interval to check that the match for every ends at a word boundary (whitespace or end of argument), in addition to checking its start.
  • Added unit tests covering words starting with every (such as everything, everyone, everywhere, everyday), and verified that they remain part of the prompt unless followed by a separate trailing interval clause.
  • Updated docs/specs/loop.md to pin the new test under LOOP-3.

Why and How

Previously, trailing_interval only verified the opening word boundary for every. When a prompt contained words like everything 20m, the parser matched every, consumed the rest of the word, measured 20m as an interval, and truncated the prompt. Requiring a closing word boundary ensures non-interval words starting with every stay intact.

Please let me know if anything more is needed or if any adjustments should be made. Thank you.

In /loop trailing interval detection, only the left edge was checked for a word boundary. As a result, words that merely begin with every (such as everything, everyone, everywhere, or everyday) were incorrectly recognized as the start of an every clause.

Verify that the match for every also ends at a word boundary before treating it as an interval clause, and add unit tests.
Record verified-by for a_word_that_merely_starts_with_every_is_not_an_interval under LOOP-3 in docs/specs/loop.md.
@winshaurya
winshaurya requested a review from bbondy as a code owner September 14, 2026 09:04
The clause listed what may follow `every` and left what precedes and ends
it to inference, so a reader holding a diff against LOOP-3 could not tell
whether a word that merely begins with those letters opens a clause. The
rule and a table row now say it, and the test that pins it is already
named below.
@bbondy

bbondy commented Sep 14, 2026

Copy link
Copy Markdown
Member

Thanks!

@bbondy
bbondy merged commit 5f3c354 into brave:main Sep 14, 2026
16 checks passed
@winshaurya
winshaurya deleted the fix-issue-185 branch October 10, 2026 20:12
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.

/loop: a word that merely begins with "every" is read as an interval clause

3 participants