Skip to content

fix: clear stale metadata extraction errors after successful retries - #12533

Open
CoralGarden52 wants to merge 1 commit into
deepset-ai:mainfrom
CoralGarden52:fix/clear-stale-llm-metadata-errors
Open

fix: clear stale metadata extraction errors after successful retries#12533
CoralGarden52 wants to merge 1 commit into
deepset-ai:mainfrom
CoralGarden52:fix/clear-stale-llm-metadata-errors

Conversation

@CoralGarden52

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes

The failure metadata cleanup in LLMMetadataExtractor ran inside the loop over parsed metadata keys. A retry that returned a valid empty JSON object therefore left metadata_extraction_error and metadata_extraction_response on the successful document.

Move that cleanup after metadata is applied so every successful parse, including {}, clears stale failure state. The change includes synchronous and asynchronous regression tests for a failed extraction followed by an empty-JSON retry.

How did you test it?

  • uvx hatch env run -e test -- pytest -q test/components/extractors/test_llm_metadata_extractor.py (29 passed, 2 skipped)
  • uvx hatch run fmt-check haystack/components/extractors/llm_metadata_extractor.py test/components/extractors/test_llm_metadata_extractor.py
  • uvx hatch -e test run types haystack/components/extractors/llm_metadata_extractor.py
  • uvx hatch run reno lint .
  • uvx hatch run pre-commit run --files haystack/components/extractors/llm_metadata_extractor.py test/components/extractors/test_llm_metadata_extractor.py releasenotes/notes/clear-stale-llm-metadata-retry-errors-778a9d314d7459d1.yaml

Notes for the reviewer

{} is valid when expected_keys is not configured and represents a successful extraction with no metadata to add. Public behavior and documentation remain unchanged, so no docstring update is needed.

This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes.
  • I have added unit tests.
  • I have used a conventional commit title.
  • I have documented the user-facing fix through a release note.
  • I have run pre-commit hooks and fixed all issues.

@CoralGarden52
CoralGarden52 requested a review from a team as a code owner August 31, 2026 12:25
@CoralGarden52
CoralGarden52 requested review from julian-risch and removed request for a team August 31, 2026 12:25
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@CoralGarden52 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack/components/extractors
  llm_metadata_extractor.py
Project Total  

This report was generated by python-coverage-comment-action

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.

LLMMetadataExtractor retains failure metadata after a successful empty-JSON retry

1 participant