Python: empty-string instructions inject a contentless system message
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start at the prepend_instructions_to_messages entry point and reproduce the empty-string case shown in the issue. Add coverage for empty and whitespace-only instructions, while confirming real instructions are prepended verbatim and no message is added for blank input.
Written by the indexing model from the issue text.
Description
Description
prepend_instructions_to_messages(messages, "") injects a system message whose content is an empty string. Only None short-circuits; an empty or whitespace-only instruction list still produces the contentless system message ahead of the real conversation.
Chat options commonly default instructions to "", so every request from an agent that never set instructions carries an empty system message into the model call.
Reproduction
from agent_framework import Message, prepend_instructions_to_messages
out = prepend_instructions_to_messages([Message(role="user", contents=["hi"])], "")
# result: [system(''), user('hi')] -- the empty system message is noise
Expected behavior
An empty or all-whitespace instruction adds no message; a real instruction prepends verbatim (its own whitespace untouched).
Environment
agent-framework python main (b0437908)
- Dominant language
- Python
- Stars
- 13.6k
- Forks
- 2.3k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 342
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/agent-framework
-
.NET compaction documentation
Difficulty 1/5 Under an hour Newbie friendliness 82/100
microsoft/agent-framework#4629 · 1 comment ·
-
harness python reproduced
microsoft/agent-framework#8567 · 2 comments · 1 assignee ·
-
.NET agents reproduced
microsoft/agent-framework#8566 · 1 comment · 1 assignee ·
-
.NET agents python
microsoft/agent-framework#8562 · 1 assignee ·
-
.NET python triage
Difficulty 4/5 3-5 days Newbie friendliness 52/100
microsoft/agent-framework#8559 ·
All issues in microsoft/agent-framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100