fix(adk): swarm team vacío lanza ValueError descriptivo en vez de IndexError - #11
Open
01luyicheng wants to merge 1 commit into
Open
Conversation
…exError `_run_swarm` hacía `entry = team.entry_agent or team.agents[0]` sin guardar: si el team no tenía `entry_agent` ni `agents`, estallaba con `IndexError: list index out of range`, sin decir nada sobre la configuración incorrecta. Ahora lanza `ValueError` con el nombre del team, y el patrón swarm queda cubierto por tests de `run_team` (que hoy no tenía ninguno). Closes monaccode#3.
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.
Motivo
Closes #3.
Cuando un
AgentTeamcon patrónswarmse construye sinentry_agentniagents,ADKRuntime._run_swarmhacíaentry = team.entry_agent or team.agents[0]y estallaba conIndexError: list index out of range— un error opaco que no dice nada sobre la configuración incorrecta del team.Cambios
astromesh_adk/runner.py:_run_swarmvalida al inicio que el team tengaentry_agentoagents; si no, lanzaValueError("swarm team '<name>' has no entry_agent and no agents").tests/test_runner_local.py: agrega dos tests —test_run_team_swarm_returns_entry_answer(camino feliz, que además cubre el patrón swarm que hoy no tenía tests derun_team) ytest_run_team_swarm_empty_team_raises_valueerror(el caso del issue).CHANGELOG.md: entrada bajo[Unreleased] → Fixed.Cómo probar
Resultado local: 18 passed en
test_runner_local.py. La suite completa deastromesh-adktiene 1 fallo preexistente entest_public_api.py::test_version(espera0.1.9pero el paquete ya está en0.2.0), no introducido por este PR y fuera de su alcance. El jobtestde CI raíz no ejecutaastromesh-adk/tests/(testpaths=["tests"], sin jobtest-adk), así que este fallo preexistente no pone CI en rojo.Notas / fuera de alcance
parallel,pipeline,supervisor): ninguno indexateam.agents[0], así que el guard solo hace falta en_run_swarm— el "Consider the same guard" del issue queda cubierto por esa revisión.supervisorsí tiene un problema análogo de configuración incompleta (team.supervisor is None→AttributeErrorensupervisor.name), pero es otro tipo de excepción y otro modo de configuración; queda fuera del alcance de este issue. Lo dejo anotado por si les sirve decidir abrir otro issue para ello.