Skip to content

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

Merged
julian-risch merged 2 commits into
deepset-ai:mainfrom
CoralGarden52:fix/clear-stale-llm-metadata-errors
Sep 8, 2026
Merged

julian-risch merged 2 commits 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
Contributor

@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

github-actions Bot commented Aug 31, 2026 •

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

@github-actions github-actions Bot added the type:documentation Improvements on the docs label Sep 8, 2026

@julian-risch julian-risch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @CoralGarden52 ! THe changes look good to me. Ready to be merged.

@vercel

vercel Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
haystack-docs Ignored Ignored Preview Sep 8, 2026 9:53am UTC

Request Review

@julian-risch
julian-risch enabled auto-merge (squash) September 8, 2026 09:53
@julian-risch
julian-risch merged commit 3cabaec into deepset-ai:main Sep 8, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LLMMetadataExtractor retains failure metadata after a successful empty-JSON retry

2 participants