Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Python: Rejected system messages leave AgentChat permanently active

オープン 初心者向け
#14,638 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@Michael-Duck がすでに取り組んでいます。

2026年10月22日 から。

  • #14640 @Michael-Duck による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

AgentChat.add_chat_messages()と既存のテストtest_add_chat_messages_throws_exception_for_system_roleから始めます。ロールの検証はアクティビティのクリーンアップ範囲内に置き、アクティビティの取得はその範囲外に維持します。続いて、履歴が保持されることと、システムメッセージが拒否された後に復旧できることを確認する回帰テストを追加します。ユーザーとシステムのメッセージが混在するバッチも対象に含めます。拒否されたメッセージによって履歴が変わらず、その後チャットが修正済みのメッセージを受け付けられれば完了です。

索引モデルが issue の本文から書いたものです。

説明

python triage

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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/semantic-kernel のほかの issue

microsoft/semantic-kernel の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。