Skip to content

CrewAgentExecutor does not reset messages and iterations between task executions#4390

Open
Killian-fal wants to merge 2 commits intocrewAIInc:mainfrom
Killian-fal:fix-crew-agent-executor
Open

CrewAgentExecutor does not reset messages and iterations between task executions#4390
Killian-fal wants to merge 2 commits intocrewAIInc:mainfrom
Killian-fal:fix-crew-agent-executor

Conversation

@Killian-fal
Copy link

@Killian-fal Killian-fal commented Feb 6, 2026

Fixes #4389

Description :
reset state before agent execution to prevent stale data


Note

Low Risk
Small, localized behavioral change with added test coverage; primary risk is breaking any callers that implicitly relied on cross-run message/iteration persistence.

Overview
Fixes stale state leakage when a CrewAgentExecutor instance is reused by clearing messages and resetting iterations to 0 at the start of both invoke() and ainvoke().

Updates async executor tests to assert stale state is cleared before execution, and adds a new test ensuring sequential invoke() calls on the same executor start with isolated message histories and do not carry over iteration counts.

Written by Cursor Bugbot for commit 4c0b689. This will update automatically on new commits. Configure here.

Copy link
Collaborator

@lorenzejay lorenzejay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome ! let me just double check one thing, but this looks good to me

Returns:
Dictionary with agent output.
"""
# Reset state for fresh execution
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lovely!

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.

[BUG] CrewAgentExecutor does not reset messages and iterations between task executions

2 participants