fix(eval): don't wrap sync answer_question with asyncio.run#4471
Merged
fix(eval): don't wrap sync answer_question with asyncio.run#4471
Conversation
agent.answer_question is a sync method that internally uses
_run_async_or_return to dispatch to the async implementation. Wrapping
its return value with asyncio.run() raised:
ValueError: a coroutine was expected, got ('', ReasoningTrace(...))
because asyncio.run was being handed the already-resolved tuple.
Symptom (observed in Simard daemon journal during gym benchmark runs):
File '/home/.../eval/agent_subprocess.py', line 167, in testing_phase
result = asyncio.run(
agent.answer_question(question, question_level=level, return_trace=True)
)
File '/usr/lib/python3.13/asyncio/runners.py', line 89, in run
raise ValueError('a coroutine was expected, got {!r}'.format(coro))
ValueError: a coroutine was expected, got ('', ReasoningTrace(...))
This caused L1-L12 benchmark testing phases to fail with
'Testing phase failed: WARNING: amplihack_memory.graph not available'
masking the actual asyncio misuse.
learn_from_content (line 120) is genuinely async and remains wrapped.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Repo Guardian - PassedAll 1 changed file(s) reviewed — no ephemeral content or temporary scripts detected.
|
This was referenced Apr 25, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
Observed in Simard daemon journal during gym benchmark runs (every L1-L12 testing phase failing):
The bench logs surfaced this as
Testing phase failed: WARNING: amplihack_memory.graph not available, which obscured the real cause.Root cause
agent.answer_questionis a sync method (AnswerSynthesizerMixin.answer_questioninsrc/amplihack/agents/goal_seeking/answer_synthesizer.py:52) that internally uses_run_async_or_returnto dispatch to the async implementation and return the value directly. Wrapping it withasyncio.run()then handed asyncio the already-resolved tuple('', ReasoningTrace)instead of a coroutine.Fix
Call
agent.answer_question(...)directly.learn_from_content(line 120) is genuinely async and remains wrapped.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com