Skip to content

fix(agents): recover real tool calls from fabricated observation continuations - #6758

Draft
HUAN2022A wants to merge 1 commit into
crewAIInc:mainfrom
HUAN2022A:codex/parallel/fix-fabricated-observation-recovery
Draft

fix(agents): recover real tool calls from fabricated observation continuations#6758
HUAN2022A wants to merge 1 commit into
crewAIInc:mainfrom
HUAN2022A:codex/parallel/fix-fabricated-observation-recovery

Conversation

@HUAN2022A

Copy link
Copy Markdown

Summary

process_llm_response had a dead recovery block, so when a model that does not support stop words fabricated an Observation: + Final Answer: continuation after a real Action, the fabricated answer won and the real tool call was never executed. This PR replaces the dead exception path with an explicit shape check: when stop words are unsupported and a Final Answer: follows a parsed Action, everything from that Final Answer: onward is dropped so the real action executes.

Related: #3154, #6449.

Note: the issue author's PR #6450 is stale and unmerged; this is an independent implementation with a slightly different truncation strategy.

Validation

  • Reproduction confirmed on unmodified origin/main
  • test_agent_utils.py: 78/78 passed, including 5 new regression tests
  • ruff clean on changed files

…inuations

Models that ignore stop sequences can generate past the real Action/Action
Input and fabricate an Observation plus Final Answer in a single completion.
process_llm_response had a dead recovery block for this since crewAIInc#2483 removed
the parser error it relied on, so the fabricated Final Answer won and the
real tool call was never executed.

Replace the dead exception path with an explicit shape check: when stop words
are unsupported and a Final Answer follows a parsed Action, drop everything
from that Final Answer onward so the real Action is executed. Adds regression
tests for the fabrication shape, the stop-word path, Observation: text inside
action input payloads, and genuine final answers.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a31b1da-416c-4d34-a4bc-8a498393499a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

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