Repository navigation
[Tests] Add regression tests for reasoning parser edge cases - #34157
Closed
dinesh20073 wants to merge 0 commit into
Closed
dinesh20073 wants to merge 0 commit into
dinesh20073 wants to merge 0 commit into
Conversation
dinesh20073
force-pushed
the
parser-regression-tests
branch
from
August 9, 2026 06:33
8b16483 to
8a15b9a
Compare
Collaborator
|
Heads-up: #34458 (5899674) landed and added The other two are not covered and are worth keeping: One conflict to expect on rebase: |
dinesh20073
force-pushed
the
parser-regression-tests
branch
2 times, most recently
from
August 12, 2026 16:52
85b3ccc to
baaa88b
Compare
Contributor
Author
|
/tag-and-rerun-ci |
dinesh20073
force-pushed
the
parser-regression-tests
branch
from
August 12, 2026 17:00
baaa88b to
c049d71
Compare
dinesh20073
force-pushed
the
parser-regression-tests
branch
from
August 16, 2026 06:17
c049d71 to
b501311
Compare
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.
Motivation
SGLang issue #20865 asks contributors to improve unit-test coverage for
core runtime components that don't require a GPU, specifically calling out
test_reasoning_parser.pyas a starting point. The reasoning parser'sstreaming path (
parse_streaming_increment) has several edge cases thatwere not previously covered: malformed/nested tags, Unicode boundaries
that span multiple streaming chunks, and behavior consistency between
streamed and full-input parsing. Gaps here can lead to silent state
corruption, dropped output, or divergent behavior between streaming and
non-streaming code paths in production.
Modifications
Added 4 new regression tests to
TestBaseReasoningFormatDetectorintest/registered/unit/parser/test_reasoning_parser.py:test_parse_malformed_nested_tags— verifies nested<think>tagsdo not corrupt or drop the extracted normal text.
test_parse_unicode_grapheme_streaming_chunks— verifies a Unicodegrapheme cluster (base character + combining accent) split across two
streaming chunks is reassembled correctly.
test_round_trip_consistency— verifies streaming parsing(character-by-character and 5-character chunks) produces output
identical to
detect_and_parseon the full input.test_chunk_size_invariance— verifies streaming output isidentical across chunk sizes 1, 2, 5, and full-length input, guarding
against buffer/boundary-management bugs.
No production code was touched. Only the test file above was modified.
Accuracy Tests
Not applicable — this PR adds unit tests only and does not change model
output, kernel code, or forward-pass logic.
Speed Tests and Profiling
Not applicable — no inference-path code was changed.
Validation performed locally
python -m py_compileon the modified file — passed.flake8 --select=F541,E301,E303on the modified file — passed.git diff --stat/git status --porcelain— confirmed onlytest/registered/unit/parser/test_reasoning_parser.pywas modified.pytestexecution was not possible locally: this environmentis Windows, and SGLang's import chain requires the Linux-only
resourcemodule (
ModuleNotFoundError: No module named 'resource'at collectiontime, unrelated to the new tests). Test execution is deferred to this
PR's CI run.
Submitted by Dinesh (@dinesh20073)
CI States
Latest PR Test (Base): ❌ Missing
run-cilabel -- add it to run CI tests.Latest PR Test (Extra): ❌ Blocked --
run-ciis required first.