Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai>
Co-authored-by: Lucas Marandat <31749711+lucasmrdt@users.noreply.github.com>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Paul Cacheux <paul.cacheux@mistral.ai>
Co-authored-by: Peter Evers <pevers90@gmail.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Pierre Rossinès <pierre.rossines@protonmail.com>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Simon Van de Kerckhove <simon.vandekerckhove@mistral.ai>
Co-authored-by: Val <102326092+vdeva@users.noreply.github.com>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-04-09 18:40:46 +02:00 committed by GitHub
parent 90763daf81
commit e9a9217cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
113 changed files with 7202 additions and 541 deletions

View file

@ -1,9 +1,11 @@
from __future__ import annotations
import ast
from pathlib import Path
import pytest
from tests import TESTS_ROOT
from tests.conftest import build_test_agent_loop, build_test_vibe_config
from tests.stubs.fake_backend import FakeBackend
from vibe.core.agents.manager import AgentManager
@ -656,3 +658,22 @@ class TestAgentLoopInitialization:
f"System message should contain custom prompt content. "
f"Expected '{custom_prompt_content}' to be in system message."
)
class TestActConsumersUseAclosing:
def test_no_bare_async_for_over_act(self) -> None:
vibe_pkg = TESTS_ROOT.parent / "vibe"
violations: list[str] = []
for path in vibe_pkg.rglob("*.py"):
tree = ast.parse(path.read_text(), filename=str(path))
for node in ast.walk(tree):
if not isinstance(node, ast.AsyncFor):
continue
match node.iter:
case ast.Call(func=ast.Attribute(attr="act")):
violations.append(f"{path}:{node.lineno}")
assert not violations, (
"Bare `async for ... in .act()` found — wrap in "
"contextlib.aclosing(). See issue #569.\n" + "\n".join(violations)
)