Skip to content

fix(agentchat): remove dead typo attribute in CodeExecutorAgent#7914

Open
nolanchic wants to merge 1 commit into
microsoft:mainfrom
nolanchic:fix/code-executor-agent-typo-system-messages
Open

fix(agentchat): remove dead typo attribute in CodeExecutorAgent#7914
nolanchic wants to merge 1 commit into
microsoft:mainfrom
nolanchic:fix/code-executor-agent-typo-system-messages

Conversation

@nolanchic

Copy link
Copy Markdown

Why are these changes needed?

CodeExecutorAgent.__init__ assigns a misspelled attribute self._system_messaages (note the extra a in messaages) that is never read anywhere in the codebase:

self._system_messaages: List[SystemMessage] = []   # <- typo, never read
if system_message is None:
    self._system_messages = []                      # <- this is the one actually used
else:
    self._system_messages = [SystemMessage(content=system_message)]

The agent consistently uses the correctly-spelled self._system_messages (assigned on the very next lines, read at lines 525, 756, 757). A grep -rn "_system_messaages" across the whole repo confirms the misspelled form appears only on this single line — it is dead state created on every instantiation.

This removes the dead attribute. No behavior change.

Related issue number

N/A — trivial dead-code cleanup.

Checks

  • I've included any doc changes needed for https://microsoft.github.io/autogen/. (None — internal cleanup.)
  • I've added tests (if relevant) corresponding to the changes introduced in this PR. (No new test — the change is a pure deletion of unreferenced state with no observable behavior. Existing CodeExecutorAgent tests still pass.)
  • I've made sure all auto checks have passed. (Local verification below.)

Local verification

cd python
uv run pytest packages/autogen-agentchat/tests/test_code_executor_agent.py -q   # 26 passed
uv run ruff format --check packages/autogen-agentchat/src packages/autogen-agentchat/tests   # already formatted
uv run ruff check packages/autogen-agentchat/src packages/autogen-agentchat/tests   # all checks passed
uv run pyright packages/autogen-agentchat/src packages/autogen-agentchat/tests      # 0 errors
uv run mypy --config-file pyproject.toml packages/autogen-agentchat/src packages/autogen-agentchat/tests   # no issues

CodeExecutorAgent.__init__ assigned self._system_messaages (note the
extra 'a' in 'messaages'), which is never read anywhere. The agent
actually uses self._system_messages (correctly spelled), assigned on
the very next lines. The misspelled attribute is dead state created on
every instantiation — remove it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant