Repository navigation
fix(swe-smith): preserve parametrized test IDs when grading - #690
Open
Zhengyang Liu (liuzhengyang699) wants to merge 1 commit into
Open
Zhengyang Liu (liuzhengyang699) wants to merge 1 commit into
Zhengyang Liu (liuzhengyang699) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the change preserving complete parametrized pytest IDs.
No open issues 🎉
What changed in this PR
Fixes #689 by preserving complete parametrized pytest IDs when grading SWE-smith tasks, preventing passing tests with spaces in their IDs from receiving zero reward.
Changes:
- Matches pytest reports against escaped test IDs from evaluation metadata while retaining ANSI stripping and strict missing-test handling.
- Adds real-pytest evaluator regressions and parser cases for whitespace, punctuation, overlapping IDs, and report formats.
- Documents full-ID matching and missing-test behavior.
| File | Description |
|---|---|
tests/examples/test_swe_smith_test_statuses.py |
Adds evaluator and parser regression coverage for complete test IDs. |
examples/swe_smith/agents/smith_agent.py |
Matches report statuses against known, complete evaluation IDs. |
docs/75-example-coding-agent.md |
Explains full-ID matching and treatment of missing tests. |
Review effort: Balanced
This branch has not been deployed
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.
Fixes #689.
A pytest node ID can contain spaces, for example
test_example.py::test_pass[hello world]. The harness's\S+match truncates that ID at the first space. Even when pytest reports the test as passed, the evaluator cannot find its full F2P/P2P ID and assigns zero reward.Match reports against the complete escaped IDs already available in the evaluation metadata. This handles whitespace and punctuation without confusing a parameter such as
a - bwith pytest's failure-reason separator. The strict pass/missing-test rules and ANSI stripping are retained.Two regressions run real pytest subprocesses through
evaluate(): an all-passing parametrized suite now earns reward 1, while a suite containing a failed test still earns 0. Additional cases cover verbose and summary reports, xdist prefixes, colors, overlapping IDs, and regex punctuation. Both evaluator regressions fail on unchanged main.Validation
uv run --locked --no-sync pytest -v --durations=20 tests— 269 passed, 4 skipped.uv run --locked --no-sync pyright— 0 errors, 0 warnings.uv run --locked --no-sync pre-commit run --all-files --show-diff-on-failure— passed.uv run --locked --no-sync ruff check .,uv run --locked --no-sync ruff format --check ., anduv run --locked --no-sync python scripts/check_headers.py— passed.UV_PROJECT_ENVIRONMENT=/tmp/agent-lightning-nodeids-docs uv run --locked --no-sync mkdocs build --strict,uv build --no-sources, andgit diff --cached --check— passed.This was found during a follow-up audit of the coding example with AI assistance. AI assistance was also used for the fix, tests, and review. Validation used CPU pytest cases; no SWE-smith dataset rollout or GPU training was run.