Skip to content

Commit d0397f7

Browse files
fix: use correct Message attributes in _validate_sign_offs (text/author_name)
_validate_sign_offs was using msg.content and msg.source which do not exist on agent-framework 1.3.0 Message objects, causing runtime crashes. Updated to use msg.text and msg.author_name. Updated corresponding test mocks to use the new API attributes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent db7c837 commit d0397f7

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

src/processor/src/libs/agent_framework/groupchat_orchestrator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ def _validate_sign_offs(self, conversation: list[Message]) -> tuple[bool, str]:
398398

399399
# Search for sign-off patterns in messages
400400
for msg in recent_messages:
401-
content = str(msg.content).upper()
402-
agent_name = msg.source if hasattr(msg, "source") else None
401+
content = (msg.text or str(msg.contents)).upper()
402+
agent_name = getattr(msg, "author_name", None) or getattr(msg, "source", None)
403403

404404
if not agent_name or agent_name == self.coordinator_name:
405405
continue

src/processor/src/tests/unit/libs/agent_framework/test_groupchat_orchestrator_internals.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,38 +219,38 @@ class TestValidateSignOffs:
219219
def test_all_pass(self):
220220
orch = _make_orch()
221221
msgs = [
222-
_Msg(source="A", content="SIGN-OFF: PASS"),
223-
_Msg(source="B", content="SIGN-OFF:PASS"),
222+
_Msg(author_name="A", text="SIGN-OFF: PASS"),
223+
_Msg(author_name="B", text="SIGN-OFF:PASS"),
224224
]
225225
ok, reason = orch._validate_sign_offs(msgs)
226226
assert ok is True
227227

228228
def test_pending_blocks(self):
229229
orch = _make_orch()
230-
msgs = [_Msg(source="A", content="SIGN-OFF: PENDING")]
230+
msgs = [_Msg(author_name="A", text="SIGN-OFF: PENDING")]
231231
ok, reason = orch._validate_sign_offs(msgs)
232232
assert ok is False
233233
assert "PENDING" in reason
234234

235235
def test_fail_blocks(self):
236236
orch = _make_orch()
237-
msgs = [_Msg(source="A", content="SIGN-OFF: FAIL")]
237+
msgs = [_Msg(author_name="A", text="SIGN-OFF: FAIL")]
238238
ok, reason = orch._validate_sign_offs(msgs)
239239
assert ok is False
240240
assert "FAIL" in reason
241241

242242
def test_missing_blocks(self):
243243
orch = _make_orch()
244-
msgs = [_Msg(source="A", content="some text without signoff")]
244+
msgs = [_Msg(author_name="A", text="some text without signoff")]
245245
ok, reason = orch._validate_sign_offs(msgs)
246246
assert ok is False
247247
assert "missing" in reason
248248

249249
def test_excludes_coordinator_and_resultgenerator(self):
250250
orch = _make_orch()
251251
msgs = [
252-
_Msg(source="Coordinator", content="ignored"),
253-
_Msg(source="ResultGenerator", content="ignored"),
252+
_Msg(author_name="Coordinator", text="ignored"),
253+
_Msg(author_name="ResultGenerator", text="ignored"),
254254
]
255255
ok, _ = orch._validate_sign_offs(msgs)
256256
assert ok is True

src/processor/src/tests/unit/libs/agent_framework/test_groupchat_orchestrator_termination.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
@dataclass
1515
class _Msg:
16-
source: str
17-
content: str
16+
author_name: str = ""
17+
text: str = ""
18+
contents: object = None
19+
role: object = None
1820

1921

2022
def _make_orchestrator() -> GroupChatOrchestrator:
@@ -34,8 +36,8 @@ async def _run():
3436

3537
# Everyone who participated signed off PASS.
3638
orch._conversation = [
37-
_Msg(source="AKS Expert", content="SIGN-OFF: PASS"),
38-
_Msg(source="Chief Architect", content="SIGN-OFF: PASS"),
39+
_Msg(author_name="AKS Expert", text="SIGN-OFF: PASS"),
40+
_Msg(author_name="Chief Architect", text="SIGN-OFF: PASS"),
3941
]
4042

4143
orch._current_agent_start_time = datetime.now()
@@ -65,7 +67,7 @@ async def _run():
6567

6668
# Agent participated but never produced a SIGN-OFF.
6769
orch._conversation = [
68-
_Msg(source="AKS Expert", content="Reviewed; looks good."),
70+
_Msg(author_name="AKS Expert", text="Reviewed; looks good."),
6971
]
7072

7173
orch._current_agent_start_time = datetime.now()

0 commit comments

Comments
 (0)