fix(agents): AgentInterface declared a coroutine where every caller wants a generator
`generate_response` was `async def` with a `pass` body and no `yield`. An async function that never yields is a coroutine, so the declared type was Coroutine[..., AsyncGenerator[OutputItem, None]] — something a caller must await before it can be iterated. Nobody awaits it. Both implementations contain yields (TatlockAgent 5, LoremTesterAgent 3), which makes them async generators directly, and both call sites do `async for item in agent.generate_response(...)`. The abstract method's own docstring says "Yields:" and its own example iterates the call without awaiting. Implementations, consumers and prose all agreed; only the declaration dissented. Removing one word fixes it, and it is the declaration that was wrong rather than the four places reporting it. WHY NOTHING CAUGHT THIS. The abstract body is `pass` and nothing calls super().generate_response — verified across the tree — so the wrong declaration has no runtime consequence and cannot fail a test. It was invisible by construction, and it presented as four unrelated errors in four files (two override, two attr-defined), none of which named the cause. Anyone fixing them where they appeared would have annotated the implementations to match the interface and made the real defect permanent. tests/agents/test_agent_interface.py covers it going forward. The load-bearing case is not "the interface is X" or "the implementation is Y" separately — both could drift together and still pass — but that the two AGREE about what kind of callable this is. Mutation-checked: restoring `async` fails 3 of the 5 new tests, the two that still pass being the implementation checks, which are correctly unaffected. Anchor asserted unique before the mutation was written, and the fix asserted back into place afterwards. 95 errors -> 71 across this branch; this commit accounts for 4 of them. Suite 662 passed, 1 failed — that failure is the known LLM-nondeterministic calculator test, which passed on the previous run of this same branch and failed on this one, which is the clearest available evidence that it is unrelated to any of this work. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ class AgentInterface(ABC):
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def generate_response(
|
||||
def generate_response(
|
||||
self,
|
||||
messages: list[dict],
|
||||
reasoning: dict | None = None,
|
||||
|
||||
Reference in New Issue
Block a user