Python: Rejected system messages leave AgentChat permanently active
メンテナーはふだん 3 日以内に返信
評価
調査の方向性
AgentChat.add_chat_messages()と既存のテストtest_add_chat_messages_throws_exception_for_system_roleから始めます。ロールの検証はアクティビティのクリーンアップ範囲内に置き、アクティビティの取得はその範囲外に維持します。続いて、履歴が保持されることと、システムメッセージが拒否された後に復旧できることを確認する回帰テストを追加します。ユーザーとシステムのメッセージが混在するバッチも対象に含めます。拒否されたメッセージによって履歴が変わらず、その後チャットが修正済みのメッセージを受け付けられれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C#
- スター
- 28.7k
- フォーク
- 4.8k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 23
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/semantic-kernel のほかの issue
-
Python: Bug: Anthropic, Bedrock, Google AI and Vertex AI tool formatters ignore include_in_function_choices=False対応中かも @wasim-builds が 6 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/semantic-kernel#14615 ·
メンテナーはふだん 3 日以内に返信
-
Python: Bug: AnnotationContent and StreamingAnnotationContent to_element writes CitationType.X, so annotations in a rendered chat history fail to parse対応中かも @CRYPTONIKAV が 10 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/semantic-kernel#14590 ·
メンテナーはふだん 3 日以内に返信
-
Python: Bug: TimePlugin timeZoneOffset and timeZoneName always return an empty string対応中かも @jeevan1098 が 8 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
microsoft/semantic-kernel#14583 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
.Net: gpt-image-1 is the default image model in the .NET OpenAI connector, and OpenAI shuts it down on October 23対応中かも @nightcityblade が 20 日前に担当しました。 オープン.NET triage
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
microsoft/semantic-kernel#14526 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
Python: VolatileMemoryStore.get_batch and get_nearest_matches ignore with_embeddings=False (deepcopy result is discarded)対応中かも @VANDRANKI が 22 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/semantic-kernel#14522 ·
メンテナーはふだん 3 日以内に返信
microsoft/semantic-kernel の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Nimblesite/SharpLsp#468 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
elastic/ecs-dotnet#575 ·
-
alerts bug effort:S P2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
nightscout/nocturne#2511 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
Crash in v3.00オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
arkane-systems/mousejiggler#140 ·