Skip to content

Fix human feedback final answer visibility - #6094

Open
jmolz wants to merge 1 commit into
crewAIInc:mainfrom
jmolz:codex/fix-human-input-final-result-display
Open

Fix human feedback final answer visibility#6094
jmolz wants to merge 1 commit into
crewAIInc:mainfrom
jmolz:codex/fix-human-input-final-result-display

Conversation

@jmolz

@jmolz jmolz commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Fixes #6072.

When human_input=True is active, CrewAI now marks final-answer log events as visible even if the agent and crew are non-verbose. That ensures the human feedback prompt's "Final Result above" instruction has an actual final answer above it.

This is intentionally limited to AgentFinish events so intermediate tool/action logs still respect the existing verbose gate.

Tests

  • uv run pytest lib/crewai/tests/agents/test_agent_executor.py lib/crewai/tests/agents/test_async_agent_executor.py -k "show_logs_displays_final_answer_for_human_input or show_logs_keeps_non_final_human_input_logs_non_verbose"
  • uv run ruff check --no-fix lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/src/crewai/agents/crew_agent_executor.py lib/crewai/tests/agents/test_agent_executor.py lib/crewai/tests/agents/test_async_agent_executor.py
  • uv run ruff format --check lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/src/crewai/agents/crew_agent_executor.py lib/crewai/tests/agents/test_agent_executor.py lib/crewai/tests/agents/test_async_agent_executor.py

Note: running the full test_agent_executor.py file in this local environment also hit unrelated optional-dependency/input-prompt failures for missing crewai[anthropic] and exa_py.

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced execution logging during human-feedback interactions. Logs are now properly displayed with improved visibility when agents request user input for decision-making.
    • Improved tracking of agent execution during interactive workflows requiring human feedback.
  • Tests

    • Added unit tests validating agent logging behavior during human-feedback scenarios for both synchronous and asynchronous agent executors.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6890ca41-5b41-40a9-9105-46fbca393063

📥 Commits

Reviewing files that changed from the base of the PR and between ce42994 and 55fe0a4.

📒 Files selected for processing (4)
  • lib/crewai/src/crewai/agents/crew_agent_executor.py
  • lib/crewai/src/crewai/experimental/agent_executor.py
  • lib/crewai/tests/agents/test_agent_executor.py
  • lib/crewai/tests/agents/test_async_agent_executor.py

📝 Walkthrough

Walkthrough

When human_input=True is enabled on a task but the agent/crew is non-verbose, the user-facing feedback prompt references a "Final Result above" that was never displayed. The fix modifies both sync and async executor implementations to always emit the final result (AgentFinish) to logs when human input is requested, regardless of the verbose setting.

Changes

Human-input feedback result visibility

Layer / File(s) Summary
Sync executor result visibility during human feedback
lib/crewai/src/crewai/agents/crew_agent_executor.py, lib/crewai/tests/agents/test_agent_executor.py
CrewAgentExecutor._show_logs emits AgentLogsExecutionEvent.verbose=True when the result is AgentFinish and ask_for_human_input is enabled, ensuring the final answer is visible before the human-feedback prompt. Tests verify AgentFinish events are forced verbose while AgentAction events retain their original verbose flag.
Async executor result visibility during human feedback
lib/crewai/src/crewai/experimental/agent_executor.py, lib/crewai/tests/agents/test_async_agent_executor.py
AgentExecutor._show_logs applies the same logic: final results force verbose=True when human input is requested. Tests validate both AgentFinish and AgentAction event emission under the new condition, with a minor syntax adjustment in an adjacent LLM exception test.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

size/M, enhancement

Suggested reviewers

  • greysonlalonde

Poem

🐰 A feedback prompt that's truly kind,
Shows results before it asks thy mind,
No more "above" with nothing there,
The final answer floats through air!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix human feedback final answer visibility' directly and clearly describes the main change: ensuring the final answer is visible when human feedback is requested.
Linked Issues check ✅ Passed The PR implements the core fix for issue #6072 by modifying _show_logs to emit AgentFinish events with verbose=True when ask_for_human_input is active, addressing the root cause of the feedback prompt referencing unseen output.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing issue #6072: modifications to _show_logs logic in both crew and experimental agent executors, plus corresponding unit tests validating the new behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 45 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] human_input=True: the feedback prompt references a "Final Result above" that is never displayed unless verbose=True

1 participant