Python: Rejected system messages leave AgentChat permanently active
Los mantenedores suelen responder en 3 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
Línea de trabajo
Empieza con AgentChat.add_chat_messages() y la prueba existente test_add_chat_messages_throws_exception_for_system_role. Mantén la validación del rol dentro del ámbito de limpieza de la actividad y conserva la adquisición de la actividad fuera de este. Después, añade cobertura de regresión para la conservación del historial y la recuperación tras rechazar un mensaje del sistema, incluido un lote mixto de mensajes de usuario y del sistema. El objetivo se cumple cuando los mensajes rechazados dejan el historial sin cambios y el chat puede aceptar después un mensaje corregido.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
AgentChat.add_chat_messages() sets its activity signal before validating message roles. If it rejects a system message, it raises before entering the try/finally that clears the signal. After the caller catches this validation error, the same AgentGroupChat cannot accept a corrected message, read its history, or reset: each operation reports that another agent is active.
Reproduced against current main, commit 25501830b9483ad6b23955dee340c8590fa54152, with Python 3.12.13 on macOS arm64:
import asyncio
from semantic_kernel.agents import AgentGroupChat
from semantic_kernel.contents import ChatMessageContent
from semantic_kernel.contents.utils.author_role import AuthorRole
from semantic_kernel.exceptions.agent_exceptions import AgentChatException
async def main():
chat = AgentGroupChat()
await chat.add_chat_message("seed")
try:
await chat.add_chat_message(
ChatMessageContent(role=AuthorRole.SYSTEM, content="unsupported")
)
except AgentChatException:
pass
print(chat.is_active) # True, although no operation is running
await chat.add_chat_message("corrected input")
# Exception: Unable to proceed while another agent is active.
asyncio.run(main())
Expected behavior: keep rejecting system messages, preserve the existing history, and release the activity signal so the caller can recover. A mixed user/system batch is correctly rejected without partially appending the user message, but it leaves the same stuck activity signal.
The existing test_add_chat_messages_throws_exception_for_system_role checks the rejection but does not check recovery. The existing group-chat and strategy tests pass (77 tests) while six real-API rejection/recovery scenarios reproduce the problem and three valid-message controls succeed. These checks require no model or provider API.
I would like to take on a small fix that keeps role validation inside the activity cleanup scope, with regression coverage for history preservation and recovery. The activity acquisition would remain outside the try so a rejected competing operation cannot release another operation's signal. Is this correction still welcome in the legacy group-chat API given the Agent Framework migration?
This issue and the offline reproduction were prepared with Codex assistance. No implementation patch has been submitted.
- Lenguaje dominante
- C#
- Estrellas
- 28.7k
- Forks
- 4.8k
- Merge medio
- 2 d 15 h
- PR fusionados (30 d)
- 23
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/semantic-kernel
-
Python: Bug: Anthropic, Bedrock, Google AI and Vertex AI tool formatters ignore include_in_function_choices=FalsePosiblemente ocupada @wasim-builds la tomó hace 6 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/semantic-kernel#14615 ·
Los mantenedores suelen responder en 3 días
-
Python: Bug: AnnotationContent and StreamingAnnotationContent to_element writes CitationType.X, so annotations in a rendered chat history fail to parsePosiblemente ocupada @CRYPTONIKAV la tomó hace 9 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microsoft/semantic-kernel#14590 ·
Los mantenedores suelen responder en 3 días
-
Python: Bug: TimePlugin timeZoneOffset and timeZoneName always return an empty stringPosiblemente ocupada @jeevan1098 la tomó hace 8 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
microsoft/semantic-kernel#14583 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
.Net: gpt-image-1 is the default image model in the .NET OpenAI connector, and OpenAI shuts it down on October 23Posiblemente ocupada @nightcityblade la tomó hace 20 días. Abierto.NET triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
microsoft/semantic-kernel#14526 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Python: VolatileMemoryStore.get_batch and get_nearest_matches ignore with_embeddings=False (deepcopy result is discarded)Posiblemente ocupada @VANDRANKI la tomó hace 21 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/semantic-kernel#14522 ·
Los mantenedores suelen responder en 3 días
Todos los issues de microsoft/semantic-kernel
Issues similares
-
V4 alert-rule reads have no scope gate, so any authenticated credential can list alert rulesAbiertoalerts bug effort:S P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
nightscout/nocturne#2511 ·
Los mantenedores suelen responder en 1 día
-
feature-request
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
stripe/stripe-dotnet#3484 ·
Los mantenedores suelen responder en 2 días
-
bug mcp misleading small
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
accessibility help wanted macos
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
dorlugasigal/annotator#42 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
AvaloniaUI/Avalonia#22568 ·
Los mantenedores suelen responder en 2 días