Skip to content

fix(sleep): report a malformed char bound instead of crashing the judge - #462

Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
microsoft:mainfrom
Shizoqua:fix/sleep-invalid-char-bound
Open

Lanre Shittu (Shizoqua) wants to merge 1 commit into
microsoft:mainfrom
Shizoqua:fix/sleep-invalid-char-bound

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

Summary

_check() in skillopt_sleep/judges.py called int() on max_chars / min_chars arguments. A rule judge that skipped validate_checks(), such as a gbrain-style benchmark.jsonl, could carry a bound like "abc" or None, which raised and stopped the replay, or 500.5 and true, which were silently used as 500 and 1.

Changes

  • _check() parses the bound with char_bound(), the parser validate_checks() already uses.
  • A bound it rejects, or a negative one, fails the check with invalid char bound (...) in the rationale. The optimizer feedback then says the evaluator configuration is invalid, as it does for a bad regex.
  • Valid bounds (500, "500", 500.0) score as before.
  • CHANGELOG.md: entry under Fixed.

Tests

New tests/test_judges_char_bound.py:

  • for max_chars and min_chars, the bounds "abc", "500 chars", None, True, 500.5, inf and -1 fail closed with invalid char bound in the rationale and the invalid-configuration feedback, without raising
  • other checks in the same judge are still scored (soft 0.5 next to a bad bound)
  • valid integer, string and integral float bounds give the same results at the boundary

The malformed-bound tests fail on main and pass with the fix. tests/test_judges.py passes unchanged. Full suite: 2448 passed, 12 skipped, 4 xfailed. ruff check and ruff format --check pass on the changed files.

Fixes #460

_check() called int() on max_chars/min_chars arguments. A rule judge
imported without validate_checks(), such as a gbrain-style
benchmark.jsonl, could carry a bound like "abc" or None, which raised
and stopped the replay, or 500.5 and true, which were silently used as
500 and 1.

Parse the bound with char_bound(), the parser validate_checks() uses.
A bound it rejects, or a negative one, now fails the check and is named
as "invalid char bound" in the rationale, so the optimizer feedback
says the evaluator configuration is invalid, as for a bad regex.

This branch has not been deployed

No deployments
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.

SkillOpt-Sleep rule judge crashes on a malformed max_chars or min_chars bound

1 participant