[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-05-25 08:01:22 +00:00
commit 8508d2aea9

View file

@ -690,7 +690,7 @@ def test_compact_drops_orphan_tool_left_by_user_boundary():
{"role": "user", "content": "again"},
{"role": "tool", "tool_call_id": "t1", "content": "stale"},
]
out = SlidingWindowCompact(keep_recent=2).compact(msgs, budget_tokens=1)
out = SlidingWindowCompact(keep_recent = 2).compact(msgs, budget_tokens = 1)
# Any surviving tool message must have its assistant earlier in
# the output.
seen_ids: set[str] = set()
@ -702,9 +702,9 @@ def test_compact_drops_orphan_tool_left_by_user_boundary():
seen_ids.add(tcid)
elif m.get("role") == "tool":
tcid = m.get("tool_call_id")
assert isinstance(tcid, str) and tcid in seen_ids, (
f"orphan tool {tcid!r} survived; seen={seen_ids}"
)
assert (
isinstance(tcid, str) and tcid in seen_ids
), f"orphan tool {tcid!r} survived; seen={seen_ids}"
def test_compact_does_not_drop_anchored_multimodal_tool():
@ -725,8 +725,6 @@ def test_compact_does_not_drop_anchored_multimodal_tool():
{"role": "user", "content": "more"},
{"role": "user", "content": "even more"},
]
out = SlidingWindowCompact(keep_recent=2).compact(msgs, budget_tokens=1)
out = SlidingWindowCompact(keep_recent = 2).compact(msgs, budget_tokens = 1)
# The anchored tool survives.
assert any(
m.get("role") == "tool" and m.get("tool_call_id") == "t1" for m in out
)
assert any(m.get("role") == "tool" and m.get("tool_call_id") == "t1" for m in out)