fix(copilot): align service_helpers_test with prompt-too-long pattern removal

The max_tokens_exceeded pattern was intentionally removed from
_PROMPT_TOO_LONG_PATTERNS (too broad, matches non-context errors).
prompt_too_long_test.py correctly asserts it does NOT match, but
service_helpers_test.py still expected it to match. Fix the test
to align with the intended behavior.
This commit is contained in:
Zamil Majdy
2026-03-14 23:47:55 +07:00
parent ca0b3cde16
commit e17e1616d9
2 changed files with 3 additions and 4 deletions

View File

@@ -103,7 +103,6 @@ _PROMPT_TOO_LONG_PATTERNS: tuple[str, ...] = (
"request too large",
"maximum context length",
"context_length_exceeded",
"max_tokens_exceeded",
"input tokens exceed",
"input is too long",
"content length exceeds",

View File

@@ -41,8 +41,9 @@ class TestIsPromptTooLong:
def test_context_length_exceeded(self) -> None:
assert _is_prompt_too_long(Exception("context_length_exceeded")) is True
def test_max_tokens_exceeded(self) -> None:
assert _is_prompt_too_long(Exception("max_tokens_exceeded")) is True
def test_max_tokens_exceeded_not_matched(self) -> None:
"""'max_tokens_exceeded' is intentionally excluded (too broad)."""
assert _is_prompt_too_long(Exception("max_tokens_exceeded")) is False
def test_max_tokens_config_error_no_match(self) -> None:
"""'max_tokens must be at least 1' should NOT match."""
@@ -88,7 +89,6 @@ class TestIsPromptTooLong:
"request too large",
"maximum context length",
"context_length_exceeded",
"max_tokens_exceeded",
"input tokens exceed",
"input is too long",
"content length exceeds",