Repository navigation
fix(email): recover the request when a disclaimer shares its paragraph - #115
Merged
NandhaKishorM merged 1 commit intoSep 23, 2026
Conversation
An unpunctuated request line glued to a disclaimer line fused into one boilerplate-positive sentence and was dropped whole. Split such sentences at uppercase-led newlines; lowercase continuations stay glued so wrapped footers still drop whole.
SaiDheeraj-19
added a commit
to SaiDheeraj-19/laya
that referenced
this pull request
Sep 22, 2026
Closes NandhaKishorM#115 - Uses a _FRESH_NEWLINE regex (newline followed by uppercase) to intelligently split unpunctuated user requests from boilerplate disclaimers. - Updates regression tests in test_email to enforce full request recovery.
SaiDheeraj-19
added a commit
to SaiDheeraj-19/laya
that referenced
this pull request
Sep 22, 2026
Closes NandhaKishorM#115 - Uses a _FRESH_NEWLINE regex (newline followed by uppercase) to intelligently split unpunctuated user requests from boilerplate disclaimers. - Updates regression tests in test_email to enforce full request recovery.
Owner
|
Thank you, and sorry this waited a while. The fused-line split is careful: it only breaks where a new sentence starts, keeps wrapped disclaimer lines together, and leaves uncased scripts alone. The email suite passes with your new cases on today's |
baninaveen
pushed a commit
to baninaveen/laya
that referenced
this pull request
Sep 24, 2026
NandhaKishorM#115) An unpunctuated request line glued to a disclaimer line fused into one boilerplate-positive sentence and was dropped whole. Split such sentences at uppercase-led newlines; lowercase continuations stay glued so wrapped footers still drop whole. Co-authored-by: Bruce-Yii <[email protected]>
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.
clean_email_bodydrops the sender's request when an unpunctuated request lineis immediately followed by a disclaimer line in the same paragraph:
Agent.predict/Router.predictthen classifies an email it can no longer see,and nothing warns.
Cause
laya/email.py::_strip_disclaimersplits a paragraph into sentences only at[.!?], solocked\nThis ...forms one sentence that tests boilerplate-positiveand is dropped whole, carrying the request with it. The existing test pinned this
as partial recovery.
Change
A boilerplate-positive sentence containing
\nis further split at newlines thatstart a fresh sentence (first letter uppercase):
locked\nThis ...splits, so therequest line is kept and only the disclaimer line drops;
are\nconfidential(lowercase continuation) stays glued, so a wrapped boilerplate footer still drops
whole. Paragraphs without disclaimer text return early, untouched.
Before / after
request\n<disclaimer>\nrequest2'request2''request request2'request.\n<disclaimer>\nrequest2...in error,\nPlease delete it.'Please delete it.'(keep-ward)Trade-off
A capitalised continuation of a boilerplate sentence stays, and an all-lowercase
fusion still loses its first line (indistinguishable from a wrapped footer) —
both pinned in tests. Like #94, this errs towards keeping text: an extra
boilerplate line does no harm, but a missing request does.
Independence from #111
Open #111 touches the same two files but a disjoint function (sign-off vs
disclaimer) and disjoint hunks. I reconstructed its 41 test expectations and ran
them with and without this change: identical 22-pass/8-fail (the 8 are #111's own
fail-before cases). Zero regression delta either way.
Verification
tests/test_email.py: 15 passed, 0 failed (1 updated expectation + 4 new checks)test_router150,test_criteria34,test_shortlist81,test_packaging9/9,ruff check laya/ --select=E9,F63,F7,F82,F401,F811 --line-length=120: clean;compileall: OK (Python 3.11, CPU-only torch, Windows worker)test_decision_model.pypassed on this exact code during the hunt run, butaborted on a native OpenBLAS memory allocation failure when re-run on the
publication branch in this memory-pressured worker (2.6 GB free of 16 GB) —
environmental, no assertion involved; CI will adjudicate
test_download.pyhas 5 Windows-only path-separator failures, byte-identicalwith and without this change (green on Linux CI)