Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(judge): treat an "unavailable" schema option as a schema rejection

Max Freedom Pollard72f381f4a7d7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 06a0be14..211d3f89 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -152,6 +152,11 @@ All notable changes to SkillEvaluator are documented in this file.
apparent improvement. Judge-free cases retain valid lift, bounded report loads
use the collector's recorded comparisons, and FINAL-strategy trials use only
the final step's judges. The CLI displays unavailable comparisons as `n/a`.
+- The LLM judge treats a schema option reported as `unavailable` as a schema
+ rejection and retries without it, so OpenAI-compatible endpoints such as
+ DeepSeek, which answer `response_format: json_schema` with HTTP 400 and
+ "This response_format type is unavailable now", can score Tier 3 instead
+ of failing every judge call (fixes #207).
- Tier 3 reports an inconclusive result when every observed positive with-skill
trial has zero activation, and omits skill-lift comparisons for that agent.
Activation counts are reported separately; negative controls and missing
diff --git a/src/skillevaluator/inference/client.py b/src/skillevaluator/inference/client.py
index 66fd83db..48bbff6a 100644
--- a/src/skillevaluator/inference/client.py
+++ b/src/skillevaluator/inference/client.py
@@ -193,6 +193,7 @@ _UNSUPPORTED_REASON_INDICATORS: tuple[str, ...] = (
"not permitted",
"not allowed",
"disallowed",
+ "unavailable",
)
# Gateways can turn a schema into a forced tool call, so a tool_choice rejection is a schema rejection too.
@@ -200,21 +201,23 @@ _SCHEMA_OPTION_PATTERN = (
r"(?:response_format|response format|output_config|json_schema|structured[_ ]outputs?|tool_choice)"
)
_SCHEMA_REJECTION_REASON = (
- r"(?:unsupported|not supported|not permitted|not allowed|disallowed|"
+ r"(?:unsupported|not supported|unavailable|not permitted|not allowed|disallowed|"
r"unknown (?:parameter|field|argument)|unrecognized (?:request argument|parameter)|"
r"unexpected (?:keyword )?argument|extra inputs?(?: are not permitted)?)"
)
_SCHEMA_REJECTION_AFTER_OPTION = re.compile(
rf"\b{_SCHEMA_OPTION_PATTERN}\b(?:\.[a-z0-9_]+)*"
+ rf"(?:\s+type)?"
rf"(?:\s+of\s+type\s+['\"]?[a-z0-9_]+['\"]?)?"
rf"\s*(?:(?:is|are|was|were)\s+(?:an?\s+)?|:\s*)?"
rf"{_SCHEMA_REJECTION_REASON}\b",
re.IGNORECASE,
)
_SCHEMA_REJECTION_BEFORE_OPTION = re.compile(
- rf"\b(?:unsupported|not supported|extra inputs?(?: are not permitted)?|unknown (?:parameter|field|argument)|"
- rf"unrecognized (?:request argument|parameter)|unexpected (?:keyword argument|argument)|"
- rf"invalid (?:parameter|argument)|not permitted|not allowed|disallowed)\b"
+ rf"\b(?:unsupported|not supported|unavailable|extra inputs?(?: are not permitted)?|"
+ rf"unknown (?:parameter|field|argument)|unrecognized (?:request argument|parameter)|"
+ rf"unexpected (?:keyword argument|argument)|invalid (?:parameter|argument)|"
+ rf"not permitted|not allowed|disallowed)\b"
rf"(?:\s+supplied)?[\s:'\"\[\]{{}}(),-]{{0,32}}\b{_SCHEMA_OPTION_PATTERN}\b",
re.IGNORECASE,
)
diff --git a/src/skillevaluator/tier3/harbor/templates/eval.py b/src/skillevaluator/tier3/harbor/templates/eval.py
index 073e236a..69360f1a 100644
--- a/src/skillevaluator/tier3/harbor/templates/eval.py
+++ b/src/skillevaluator/tier3/harbor/templates/eval.py
@@ -2105,6 +2105,7 @@ _UNSUPPORTED_REASON_INDICATORS = (
"not permitted",
"not allowed",
"disallowed",
+ "unavailable",
)
# Gateways can turn a schema into a forced tool call, so a tool_choice rejection is a schema rejection too.
@@ -2112,21 +2113,23 @@ _SCHEMA_OPTION_PATTERN = (
r"(?:response_format|response format|output_config|json_schema|structured[_ ]outputs?|tool_choice)"
)
_SCHEMA_REJECTION_REASON = (
- r"(?:unsupported|not supported|not permitted|not allowed|disallowed|"
+ r"(?:unsupported|not supported|unavailable|not permitted|not allowed|disallowed|"
r"unknown (?:parameter|field|argument)|unrecognized (?:request argument|parameter)|"
r"unexpected (?:keyword )?argument|extra inputs?(?: are not permitted)?)"
)
_SCHEMA_REJECTION_AFTER_OPTION = re.compile(
rf"\b{_SCHEMA_OPTION_PATTERN}\b(?:\.[a-z0-9_]+)*"
+ rf"(?:\s+type)?"
rf"(?:\s+of\s+type\s+['\"]?[a-z0-9_]+['\"]?)?"
rf"\s*(?:(?:is|are|was|were)\s+(?:an?\s+)?|:\s*)?"
rf"{_SCHEMA_REJECTION_REASON}\b",
re.IGNORECASE,
)
_SCHEMA_REJECTION_BEFORE_OPTION = re.compile(
- rf"\b(?:unsupported|not supported|extra inputs?(?: are not permitted)?|unknown (?:parameter|field|argument)|"
- rf"unrecognized (?:request argument|parameter)|unexpected (?:keyword argument|argument)|"
- rf"invalid (?:parameter|argument)|not permitted|not allowed|disallowed)\b"
+ rf"\b(?:unsupported|not supported|unavailable|extra inputs?(?: are not permitted)?|"
+ rf"unknown (?:parameter|field|argument)|unrecognized (?:request argument|parameter)|"
+ rf"unexpected (?:keyword argument|argument)|invalid (?:parameter|argument)|"
+ rf"not permitted|not allowed|disallowed)\b"
rf"(?:\s+supplied)?[\s:'\"\[\]{{}}(),-]{{0,32}}\b{_SCHEMA_OPTION_PATTERN}\b",
re.IGNORECASE,
)
diff --git a/tests/test_llm_judge.py b/tests/test_llm_judge.py
index 564e3638..7f71eec3 100644
--- a/tests/test_llm_judge.py
+++ b/tests/test_llm_judge.py
@@ -577,6 +577,63 @@ def test_client_and_template_downgrade_on_400_422_and_memoize_across_calls(
assert "response_format" not in http_requests[2]
+ ("message", "param", "expected"),
+ [
+ # DeepSeek rejects response_format json_schema with this wording and no "param".
+ ("This response_format type is unavailable now", None, True),
+ ("This response_format type is unavailable now", "response_format", True),
+ ("structured outputs are unavailable on this endpoint", None, True),
+ # "unavailable" on its own is an availability problem, not a schema rejection.
+ ("The model is currently unavailable, please retry", None, False),
+ ("Service unavailable", None, False),
+ ],
+)
+def test_message_rejects_schema_option_recognizes_unavailable(
+ message: str,
+ param: str | None,
+ expected: bool,
+) -> None:
+ """Verify an 'unavailable' schema option is a rejection in both the client and the Harbor template."""
+ from skillevaluator.inference import client as inference_client
+
+ assert inference_client._message_rejects_schema_option(message, param) is expected
+ eval_template = load_harbor_eval_template("harbor_template_eval_unavailable")
+ assert eval_template._message_rejects_schema_option(message, param) is expected
+
+
+def test_deepseek_unavailable_response_format_is_a_schema_error() -> None:
+ """Verify DeepSeek's 400 body downgrades the judge in both the client and the Harbor template."""
+ from skillevaluator.inference import client as inference_client
+
+ body = {
+ "error": {
+ "message": "This response_format type is unavailable now",
+ "type": "invalid_request_error",
+ "param": None,
+ "code": "invalid_request_error",
+ }
+ }
+
+ class _BadRequestError(Exception):
+ def __init__(self) -> None:
+ super().__init__("Error code: 400")
+ self.status_code = 400
+ self.body = body
+
+ assert inference_client._is_schema_unsupported_error(_BadRequestError()) is True
+
+ eval_template = load_harbor_eval_template("harbor_template_eval_deepseek")
+ http_error = urllib.error.HTTPError(
+ "https://api.deepseek.com/v1/chat/completions",
+ 400,
+ "Bad Request",
+ email.message.Message(),
+ io.BytesIO(json.dumps(body).encode()),
+ )
+ assert eval_template._is_schema_unsupported_http_error(http_error) is True
+
+
def test_transient_429_preserves_schema_and_does_not_memoize_unsupported(
monkeypatch: pytest.MonkeyPatch,
) -> None: