Skip to content

fix: reject blank refusal keyword markers - #512

Open
jovial-liu wants to merge 2 commits into
p-e-w:masterfrom
jovial-liu:pr/reject-blank-keyword-markers
Open

jovial-liu wants to merge 2 commits into
p-e-w:masterfrom
jovial-liu:pr/reject-blank-keyword-markers

Conversation

@jovial-liu

@jovial-liu jovial-liu commented Oct 20, 2026 •

Copy link
Copy Markdown

Empty keyword markers match every response, while a space matches most ordinary sentences. Both can silently inflate the keyword match rate.

This change rejects empty and whitespace-only markers during configuration validation. An empty list remains valid.

Regression tests cover invalid markers and the empty-list behavior. All 24 unit tests pass locally, along with formatting, lint, type checks, and package builds. Remote CI is awaiting maintainer approval.

I have personally reviewed and understand all changes in this PR.

@jovial-liu
jovial-liu marked this pull request as ready for review October 22, 2026 09:17
settings=Settings(keyword_markers=[]),
)

self.assertFalse(scorer._is_match("This is a normal answer."))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But passing an empty keyword list doesn't make sense, and should also be disallowed.

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