Skip to content

test(agents): cover human input flag on executor#6069

Open
fengjikui wants to merge 1 commit into
crewAIInc:mainfrom
fengjikui:fix/human-input-agent-executor-state
Open

test(agents): cover human input flag on executor#6069
fengjikui wants to merge 1 commit into
crewAIInc:mainfrom
fengjikui:fix/human-input-agent-executor-state

Conversation

@fengjikui

@fengjikui fengjikui commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Fixes #6065.

After rebasing onto current main, the implementation fix for AgentExecutor.ask_for_human_input is already present upstream. This PR has been narrowed to regression coverage that verifies the executor exposes the human-input flag expected by ExecutorContext consumers and that the sync human-input provider can clear the executor state flag after feedback handling.

Tests

  • uv run pytest lib/crewai/tests/agents/test_agent_executor.py::TestAgentExecutor::test_ask_for_human_input_delegates_to_state lib/crewai/tests/agents/test_agent_executor.py::TestAgentExecutor::test_human_input_provider_can_clear_executor_state_flag -q -> 2 passed
  • uv run pytest lib/crewai/tests/agents/test_agent_executor.py -q -> 93 passed
  • uv run ruff check lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/tests/agents/test_agent_executor.py -> passed
  • uv run ruff format --check lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/tests/agents/test_agent_executor.py -> passed
  • uv run mypy lib/crewai/src/crewai/experimental/agent_executor.py -> passed
  • uv run python -m py_compile lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/tests/agents/test_agent_executor.py -> passed
  • git diff --check -> passed

AI disclosure

This PR was authored with AI assistance and reviewed before submission. Per CONTRIBUTING.md, please apply the llm-generated label if I cannot apply it from my fork permissions.

@fengjikui

Copy link
Copy Markdown
Author

I attempted to add the required llm-generated label per CONTRIBUTING.md, but GitHub returned that I do not have permission to add labels on this repository. The PR body includes the AI-assisted disclosure.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an ask_for_human_input property to AgentExecutor that proxies the internal state flag via self.state, and adds tests verifying getter/setter synchronization and SyncHumanInputProvider.handle_feedback behavior when prompt input is empty.

Changes

Human Input Property Exposure

Layer / File(s) Summary
ask_for_human_input property
lib/crewai/src/crewai/experimental/agent_executor.py
AgentExecutor exposes ask_for_human_input as a public property with getter and setter that delegate to self.state.ask_for_human_input.
Property synchronization and feedback handling tests
lib/crewai/tests/agents/test_agent_executor.py
Imports SyncHumanInputProvider and adds two tests: one asserting AgentExecutor.ask_for_human_input stays synchronized with executor.state.ask_for_human_input, and another that patches _prompt_input to return an empty string and verifies handle_feedback returns the provided AgentFinish and clears executor.state.ask_for_human_input.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • crewAIInc/crewAI#6080: Adds an ask_for_human_input compatibility property in agent_executor.py (related implementation overlap).

Suggested labels

size/XS

"I hop through code with careful cheer,
A tiny gate for humans near.
A property set, a flag set free,
Tests confirm the harmony,
Now feedback finds its way to me."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'test(agents): cover human input flag on executor' is partially related to the changeset. While tests are added, the core change fixes the actual bug by adding a property/setter to AgentExecutor that proxies ask_for_human_input to self.state, not merely covering it with tests. Update the title to reflect the main fix: 'fix(agents): expose human input flag on executor' or similar, as the property implementation is the critical change enabling the test coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implementation matches issue #6065's objective: adds ask_for_human_input property and setter on AgentExecutor delegating to self.state.ask_for_human_input, with supporting tests verifying synchronization and flag clearing.
Out of Scope Changes check ✅ Passed All changes are within scope: AgentExecutor property implementation and test coverage for human input flag behavior directly address the linked issue.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fengjikui fengjikui force-pushed the fix/human-input-agent-executor-state branch 18 times, most recently from ba140f1 to 519855c Compare June 14, 2026 08:03
@fengjikui fengjikui force-pushed the fix/human-input-agent-executor-state branch 3 times, most recently from bfe1147 to 4bce2e0 Compare June 23, 2026 22:36
@fengjikui fengjikui changed the title fix(agents): expose human input flag on executor test(agents): cover human input flag on executor Jun 23, 2026
@fengjikui

Copy link
Copy Markdown
Author

Rebased this onto current main. Since upstream now already includes the AgentExecutor.ask_for_human_input implementation, I narrowed this PR to the regression tests only instead of keeping a duplicate property definition. This also clears the local mypy no-redef issue seen immediately after the rebase.

Validation after the update:

uv run pytest lib/crewai/tests/agents/test_agent_executor.py -q
# 93 passed, 83 warnings

uv run ruff check lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/tests/agents/test_agent_executor.py
# All checks passed!

uv run mypy lib/crewai/src/crewai/experimental/agent_executor.py
# Success: no issues found in 1 source file

@fengjikui fengjikui force-pushed the fix/human-input-agent-executor-state branch from 4bce2e0 to 9b80aa3 Compare June 24, 2026 02:31
@fengjikui

Copy link
Copy Markdown
Author

Rebased this PR onto current main again; the branch is mergeable and CI has re-run successfully.

Validation after the rebase:

uv run pytest lib/crewai/tests/agents/test_agent_executor.py -q
# 93 passed, 83 warnings

uv run ruff check lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/tests/agents/test_agent_executor.py
# All checks passed!

uv run mypy lib/crewai/src/crewai/experimental/agent_executor.py
# Success: no issues found in 1 source file

git diff --check origin/main...HEAD
# passed

@fengjikui fengjikui force-pushed the fix/human-input-agent-executor-state branch from 9b80aa3 to 71c6f8f Compare June 24, 2026 16:54
@fengjikui fengjikui force-pushed the fix/human-input-agent-executor-state branch from 71c6f8f to 87df41a Compare June 24, 2026 18:39
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] human_input=True on Task raises AttributeError: 'AgentExecutor' object has no attribute 'ask_for_human_input' with default experimental executor

1 participant