Skip to content

fix(agentic): tolerate LLM call failures in attempt_answer and ensure trace completion - #62

Closed
suguanYang wants to merge 2 commits into
stagingfrom
fix/wangbinqi/llm-failure-tolerance
Closed

suguanYang wants to merge 2 commits into
stagingfrom
fix/wangbinqi/llm-failure-tolerance

Conversation

@suguanYang

@suguanYang suguanYang commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • attempt_answer no longer crashes on LLM errors — both text LLM failures and VLM+fallback double-failures now return NOT_FOUND instead of propagating exceptions
  • Orchestrator catches non-budget exceptions around attempt_answer and degrades gracefully with stop_reason='llm_error'
  • trace.complete() is now guaranteed via try/finally in Final Assembly, preventing orphaned DB rows
  • run() lives up to its docstring — "Never raises" is now actually true; unexpected exceptions produce a degraded AgenticResult

Root cause

Trace 019e2432a3f546cba83fdfb88cab66d6 showed a qwen-vl-plus 400 error (The image format is illegal and cannot be opened) cascading into INSERT failures and an unrecoverable pipeline crash. The pipeline already handles LLM failures gracefully in kg_document_select, navigate_step, and discovery_select_stepattempt_answer was the inconsistent outlier.

Test plan

  • Run existing contract tests: test_agentic_answer_policy_contract.py
  • Verify trace 019e2432a3f546cba83fdfb88cab66d6 type errors no longer crash the pipeline
  • Manual: trigger a VLM failure in dev and confirm pipeline returns degraded result with stop_reason='llm_error'

suguanYang and others added 2 commits May 14, 2026 10:58
… trace completion

- Return NOT_FOUND instead of re-raising when text LLM fails in attempt_answer
- Wrap VLM-to-text fallback in its own try/except to handle double-failure
- Catch non-budget exceptions around attempt_answer in orchestrator, degrade to llm_error
- Wrap Final Assembly in try/finally so trace.complete() always runs
- Return degraded AgenticResult on unexpected exceptions instead of crashing
- Text LLM failure returns NOT_FOUND instead of crashing
- VLM + text LLM fallback double-failure returns NOT_FOUND
- BudgetExceeded in fallback still propagates

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@suguanYang suguanYang closed this May 19, 2026
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