fix(agent): remediate connected OpenAI models - #14363
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe Agent remediation flow now distinguishes connected model instances from configured model selections. It applies overrides directly to connected models, caches overrides only for unconnected models, and validates the updated behavior and error matching. ChangesModel remediation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 7 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (7 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
✅ Test Coverage AdvisorNo source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json (1)
1413-1585: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftUse one remediation flow for every tool-enabled Agent output.
The new retry logic exists only in
message_response. Tool-enabledjson_responsecan still fail without applying the connected-model override. Regenerate each embedded implementation and its code hash after fixing the shared source.
src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json#L1413-L1585: update the research Agent fallback and regenerate its code hash.src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json#L2044-L2216: update the itinerary Agent fallback and regenerate its code hash.src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json#L2675-L2847: update the budget Agent fallback and regenerate its code hash.src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json#L1010-L1182: update the Twitter Agent fallback and regenerate its code hash.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/backend/base/langflow/initial_setup/starter_projects/Travel` Planning Agents.json around lines 1413 - 1585, Apply the same connected-model override and retry remediation used by the message_response path to the json_response fallback in AgentComponent, ensuring every tool-enabled Agent output follows one remediation flow. Update the embedded implementations at src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json lines 1413-1585, 2044-2216, and 2675-2847, plus src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.json lines 1010-1182; regenerate each corresponding code_hash after synchronizing the shared AgentComponent implementation.
🧹 Nitpick comments (1)
src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py (1)
67-68: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the redundant asyncio markers.
pytest-asyncioauto-detects async tests in this repository.
src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py#L67-L68: Remove@pytest.mark.asyncio.src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py#L111-L112: Remove@pytest.mark.asyncio.src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py#L146-L147: Remove@pytest.mark.asyncio.Based on learnings,
asyncio_mode = 'auto'means tests must not addpytest.mark.asyncio.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py` around lines 67 - 68, Remove the redundant `@pytest.mark.asyncio` decorators from test_message_response_remediates_a_connected_model_in_place_without_caching and the async tests at src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py lines 111-112 and 146-147; rely on the repository’s asyncio_mode = 'auto' configuration.Sources: Coding guidelines, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/backend/base/langflow/initial_setup/starter_projects/Vector` Store
RAG.json:
- Line 1847: The structured-output fallback in AgentComponent’s json_response
currently calls run_agent directly, bypassing connected-model remediation. In
both src/backend/base/langflow/initial_setup/starter_projects/Vector Store
RAG.json:1847-1847 and
src/backend/base/langflow/initial_setup/starter_projects/Youtube
Analysis.json:676-676, update _run_agent_for_fallback to reuse the shared
remediation helper used by message_response, and add regression coverage for
both embedded Agent implementations.
---
Outside diff comments:
In `@src/backend/base/langflow/initial_setup/starter_projects/Travel` Planning
Agents.json:
- Around line 1413-1585: Apply the same connected-model override and retry
remediation used by the message_response path to the json_response fallback in
AgentComponent, ensuring every tool-enabled Agent output follows one remediation
flow. Update the embedded implementations at
src/backend/base/langflow/initial_setup/starter_projects/Travel Planning
Agents.json lines 1413-1585, 2044-2216, and 2675-2847, plus
src/backend/base/langflow/initial_setup/starter_projects/Twitter Thread
Generator.json lines 1010-1182; regenerate each corresponding code_hash after
synchronizing the shared AgentComponent implementation.
---
Nitpick comments:
In
`@src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py`:
- Around line 67-68: Remove the redundant `@pytest.mark.asyncio` decorators from
test_message_response_remediates_a_connected_model_in_place_without_caching and
the async tests at
src/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py
lines 111-112 and 146-147; rely on the repository’s asyncio_mode = 'auto'
configuration.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 12a5461d-47ce-4267-9dd8-5b8dabae79ec
📒 Files selected for processing (29)
src/backend/base/langflow/initial_setup/starter_projects/Blog Writer.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Content Aggregator.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Custom Component Generator.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Deep Research Agent.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Document Q&A.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Financial Report Parser.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Hybrid Search RAG.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Market Research.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Meeting Summary.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Memory Chatbot.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Multi Agent Flow.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Portfolio Website Code Generator.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Price Deal Finder.jsonsrc/backend/base/langflow/initial_setup/starter_projects/SEO Keyword Generator.jsonsrc/backend/base/langflow/initial_setup/starter_projects/SaaS Pricing.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Sequential Tasks Agents.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Simple Agent.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Social Media Agent.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Text Sentiment Analysis.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Twitter Thread Generator.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Vector Store RAG.jsonsrc/backend/base/langflow/initial_setup/starter_projects/Youtube Analysis.jsonsrc/lfx/src/lfx/_assets/component_index.jsonsrc/lfx/src/lfx/base/models/model_remediation.pysrc/lfx/src/lfx/components/models_and_agents/agent.pysrc/lfx/tests/unit/base/models/test_model_remediation.pysrc/lfx/tests/unit/components/models_and_agents/test_agent_model_remediation.py
|
Addressed the remaining review feedback in 4d073ff: strict provider matching, validated connected-model provenance, alternate Responses API wording, real requirement-resolution coverage, and documented flow-scoped mutation. Forward-port intentionally deferred. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.11.2 #14363 +/- ##
==================================================
- Coverage 61.57% 61.45% -0.13%
==================================================
Files 2411 2452 +41
Lines 238468 239862 +1394
Branches 33755 34178 +423
==================================================
+ Hits 146836 147405 +569
- Misses 89832 90651 +819
- Partials 1800 1806 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Addressed in 22353a9: missing source vertices now degrade to unknown provider instead of aborting Agent execution, with coverage for the ValueError path and all three source-provider branches. I did not backport provider canonicalization: _canonical_provider_name is not present on release-1.11.2 (it arrived with newer 1.12.0 provider-registry work), and this branch already supplies canonical provider names. The same four custom-prompt assertions reproduce at base b1034af (4 failed, 4 passed). Validation: pre-commit green; 132 passed, 2 skipped; 282 passed, 10 skipped, 8 deselected. No forward-port included. |
What changed
function tools with reasoning_effort are not supportedconstraintWhy
Issue #14361 is valid on Langflow 1.10.2. The inline Agent model path has had an error-driven retry since 1.11.0, but an OpenAI Model component connected to the Agent bypasses it: provider identity is lost and the retry reuses the unchanged Chat Completions client.
The remediation remains error-driven rather than tied to
gpt-5.6-luna. Any OpenAI model that returns this exact constraint can switch to the Responses API, while known non-OpenAI providers and models without a compatibleuse_responses_apisetting are left unchanged.Validation
62 passed: remediation, Agent remediation, temperature-remediation regression, and component-index testsFixes #14361
Summary by CodeRabbit