Skip to content

Commit 0b5bc5b

Browse files
committed
fix: update test assertions for graceful oversized message recovery
- Update test_run_agent_stdio_buffer_limit to expect a warning log instead of a crash, matching the new recovery behavior - Apply ruff format to test_connection_recovery.py (line wrapping)
1 parent 7d6e33f commit 0b5bc5b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

tests/real_user/test_stdio_limits.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ async def list_capabilities(self):
6969
[sys.executable, small_agent], input=large_msg, capture_output=True, text=True, timeout=2
7070
)
7171

72-
# Should have errors in stderr about the buffer limit
73-
assert "Error" in result.stderr or result.returncode != 0, (
74-
f"Expected error with small buffer, got: {result.stderr}"
75-
)
72+
# The oversized message should be skipped with a warning (graceful recovery).
73+
# Prior to the LimitOverrunError fix, this would crash; now it logs and continues.
74+
assert (
75+
"oversized" in result.stderr.lower() or "buffer limit" in result.stderr.lower() or result.returncode != 0
76+
), f"Expected warning about oversized message or error, got: {result.stderr}"
7677

7778
# Test 2: Large buffer (200KB) succeeds with large message (70KB)
7879
large_agent = os.path.join(tmpdir, "large_agent.py")

tests/test_connection_recovery.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ async def test_receive_loop_logs_warning_on_oversized_message(caplog: pytest.Log
156156
with caplog.at_level("WARNING"):
157157
await conn._receive_loop()
158158

159-
assert any("oversized" in record.message.lower() or "buffer limit" in record.message.lower() for record in caplog.records)
159+
assert any(
160+
"oversized" in record.message.lower() or "buffer limit" in record.message.lower() for record in caplog.records
161+
)
160162
await conn.close()
161163

162164

0 commit comments

Comments
 (0)