Skip to content

[bug] Agent.step_user_message → inner_step missing required first_input_messge arg #127

@nanxingw

Description

@nanxingw

Severity: Medium — anyone calling Agent.step_user_message directly hits TypeError immediately. The production REST path is unaffected because it routes through server.send_messages → _step, not through step_user_message.

Where

mirix/agent/agent.py:2599 on origin/main.

Reproduction

agent = await server.load_agent(agent_id, actor=client)
await agent.step_user_message("hello")
# TypeError: Agent.inner_step() missing 1 required positional argument: 'first_input_messge'

Root cause

step_user_message calls:

return await self.inner_step(messages=[user_message], **kwargs)

but inner_step's signature requires first_input_messge as a positional argument (the typo is in the original):

async def inner_step(
    self,
    first_input_messge: Message,
    messages: Union[Message, List[Message]],
    ...
):

Suggested fix

One-line change at mirix/agent/agent.py:2599:

return await self.inner_step(first_input_messge=user_message, messages=[user_message], **kwargs)

Plus a behavioral test in tests/test_agent.py that mocks _get_ai_reply and calls step_user_message, asserting it returns an AgentStepResponse without raising.

Discovery

Surfaced during end-to-end validation of #126 (top-level session_id feature). That PR works around this bug by driving the agent through the production code path server.send_messages → _step (the same path used by REST → queue worker), so step_user_message is never called. This bug is therefore independent of #126 — just a pre-existing latent issue made visible during testing.

Codex review of #126 also flagged this as a medium-severity finding unrelated to that work.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions