Repository navigation
Conversation
Squash the net release fixes from #2828. Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
[Medium impact] The PR changes several bounded document-ingestion and local-inference workflows. Fix the service key choice, preserve the crop function's positional arguments, and add the required types before merging. FindingsFix with agent prompt### Issue 1
nemo_retriever/src/nemo_retriever/common/params/models.py:664-668
**Workers choose the wrong key.** When the service sets an explicit shared `api_key` while `NVIDIA_API_KEY` contains a different key, `_make_work_fn()` dumps the resolved stage keys into plain dictionaries. `_resolve_extract_params()` rebuilds them without `_api_key_env_defaulted`, so this check treats the environment-derived stage key as explicit.
Page-element detection now uses that key instead of the configured shared key, which can turn working service uploads into authentication failures. Preserve the key precedence across the worker round trip, and test that path with different shared and environment keys.
### Issue 2
nemo_retriever/src/nemo_retriever/common/api/util/pdf/pdfium.py:586-590
**Positional crop calls lose images.** The old second argument was `merge`. Adding `page_image` before it makes an existing call such as `extract_image_like_objects_from_pdfium_page(page, False)` pass a Boolean to `Image.fromarray()`. The exception is caught and the function returns no images.
Keep `merge` in its existing position and pass the new raster by keyword. The repository requires public API changes to preserve existing callers.
### Issue 3
nemo_retriever/src/nemo_retriever/models/nim/primitives/model_interface/yolox.py:1592
**New public options lack types.** The new `suppress_text_in_infographics` argument has no type annotation here or in `postprocess_included_texts()`. The new `match_infographics` argument in `match_structured_boxes_with_title()` has the same gap.
The repository requires type annotations on all public parameters. Add `bool` annotations to these new options so callers and type checkers can see their expected values.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThis PR updates local model startup, LanceDB failure cleanup, extraction settings, infographic text retention, and PDF rendering.
jioffe502 explicitly intends the stricter flag checks and removal of The review found a service credential regression, a broken positional argument, and missing types on new public options. Tests were not run. Reviews (1) · Last reviewed commit: "Render each PDF page once in pdf_extract..." · Reviewed by Greptile |
| and self._api_key_was_env_defaulted(field_name) | ||
| and not self._api_key_was_env_defaulted("api_key") | ||
| ): | ||
| return self.api_key | ||
| return stage_key or self.api_key |
There was a problem hiding this comment.
Workers choose the wrong key. When the service sets an explicit shared
api_key while NVIDIA_API_KEY contains a different key, _make_work_fn() dumps the resolved stage keys into plain dictionaries. _resolve_extract_params() rebuilds them without _api_key_env_defaulted, so this check treats the environment-derived stage key as explicit.
Page-element detection now uses that key instead of the configured shared key, which can turn working service uploads into authentication failures. Preserve the key precedence across the worker round trip, and test that path with different shared and environment keys.
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemo_retriever/src/nemo_retriever/common/params/models.py
Line: 664-668
Comment:
**Workers choose the wrong key.** When the service sets an explicit shared `api_key` while `NVIDIA_API_KEY` contains a different key, `_make_work_fn()` dumps the resolved stage keys into plain dictionaries. `_resolve_extract_params()` rebuilds them without `_api_key_env_defaulted`, so this check treats the environment-derived stage key as explicit.
Page-element detection now uses that key instead of the configured shared key, which can turn working service uploads into authentication failures. Preserve the key precedence across the worker round trip, and test that path with different shared and environment keys.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| def extract_image_like_objects_from_pdfium_page( | ||
| page: pdfium.PdfPage, | ||
| page_image: Optional[np.ndarray] = None, | ||
| merge: bool = True, | ||
| **kwargs: Any, |
There was a problem hiding this comment.
Positional crop calls lose images. The old second argument was
merge. Adding page_image before it makes an existing call such as extract_image_like_objects_from_pdfium_page(page, False) pass a Boolean to Image.fromarray(). The exception is caught and the function returns no images.
Keep merge in its existing position and pass the new raster by keyword. The repository requires public API changes to preserve existing callers.
Rule Used: Changes to public API surfaces (FastAPI endpoints, client library methods, CLI arguments, Pydantic models in api/) must maintain backward compatibility. Breaking changes require deprecation warnings, version bumps, and migration documentation. Flag a... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemo_retriever/src/nemo_retriever/common/api/util/pdf/pdfium.py
Line: 586-590
Comment:
**Positional crop calls lose images.** The old second argument was `merge`. Adding `page_image` before it makes an existing call such as `extract_image_like_objects_from_pdfium_page(page, False)` pass a Boolean to `Image.fromarray()`. The exception is caught and the function returns no images.
Keep `merge` in its existing position and pass the new raster by keyword. The repository requires public API changes to preserve existing callers.
**Rule Used:** Changes to public API surfaces (FastAPI endpoints, client library methods, CLI arguments, Pydantic models in api/) must maintain backward compatibility. Breaking changes require deprecation warnings, version bumps, and migration documentation. Flag a... ([source](https://github.com/nvidia/nemo-retriever/blob/370e9b217f5d65944c407031e2ccfec3429d46cb/.greptile/config.json))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| confs, | ||
| class_="title", | ||
| classes=["table", "chart", "title", "infographic"], | ||
| suppress_text_in_infographics=True, |
There was a problem hiding this comment.
New public options lack types. The new
suppress_text_in_infographics argument has no type annotation here or in postprocess_included_texts(). The new match_infographics argument in match_structured_boxes_with_title() has the same gap.
The repository requires type annotations on all public parameters. Add bool annotations to these new options so callers and type checkers can see their expected values.
Rule Used: All public functions, methods, and class attributes must have type annotations. This includes parameter types, return types, and class-level attributes. Private/internal helpers (prefixed with _) are encouraged but not required. (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemo_retriever/src/nemo_retriever/models/nim/primitives/model_interface/yolox.py
Line: 1592
Comment:
**New public options lack types.** The new `suppress_text_in_infographics` argument has no type annotation here or in `postprocess_included_texts()`. The new `match_infographics` argument in `match_structured_boxes_with_title()` has the same gap.
The repository requires type annotations on all public parameters. Add `bool` annotations to these new options so callers and type checkers can see their expected values.
**Rule Used:** All public functions, methods, and class attributes must have type annotations. This includes parameter types, return types, and class-level attributes. Private/internal helpers (prefixed with _) are encouraged but not required. ([source](https://github.com/nvidia/nemo-retriever/blob/370e9b217f5d65944c407031e2ccfec3429d46cb/.greptile/config.json))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Devin Review found 1 finding. It is left for you to triage below.
| and self._api_key_was_env_defaulted(field_name) | ||
| and not self._api_key_was_env_defaulted("api_key") |
There was a problem hiding this comment.
🟡 Saved graphs lose credential precedence
For environment-defaulted stage keys, stage_api_key loses an explicit shared key's precedence after graph reload. The credential serializer converts automatic defaults into explicit references, erasing their defaulted status. Auto-dispatched page-element extraction can then fail authentication.
Devin left this for you to triage: This only happens with a saved and reloaded graph where both a NVIDIA_API_KEY/NGC_API_KEY env var and a different explicit shared api_key are set. In that case the stage could use the env key. This is a narrow edge case, so I recommend shipping as-is and fixing in the graph credential serializer after the release if it matters.
Learn more
The new precedence rule depends on private provenance that the graph codec does not preserve. The credential serializer writes both explicit references and automatically resolved defaults as environment references. The model decoder reconstructs the params from those references. Reconstruction treats each reference as explicit and leaves _api_key_env_defaulted empty. The auto-dispatch graph retains the params object, so its page-element credential selection occurs after reconstruction.
Example: Set NVIDIA_API_KEY=default-key and SHARED_KEY=shared-key. Build an auto-dispatch graph with ExtractParams(api_key="os.environ/SHARED_KEY"). Page-element detection selects shared-key before saving, but selects default-key after loading the graph with the same environment.
Recommended fix: Preserve automatic-versus-explicit credential provenance through the graph codec, or serialize automatically defaulted stage fields in a form that reconstructs their fallback semantics. Retain explicitly supplied stage references. Add a save/load regression covering an explicit shared environment reference alongside automatically populated stage keys.
Was this helpful? React with 👍 or 👎 to provide feedback.
Description
This PR combines five small release fixes into one review. Each fix is its own signed, DCO-signed commit, so you can review them one at a time. Each commit squashes the original PR exactly as it was. The only differences are context lines in #2839, because it sits on top of #2856's stage API-key routing.
c0321d5nvcc, FlashInfer JIT used to fail and Parse quietly produced no output. Result: 1,940/1,940 pages parsed vs 0, engine startup 72s vs 739s, same pages/s.16a687a2b6d7f8method="audio". Release note included. Same rows and recall asmain.4710020370e9b2Supersedes #2857, #2830, #2856, #2839 and #2828. The originals will be closed with a link here. #2834 is not included; it stays separate.
Validation:
560 passed. It covers every test file the five PRs changed, plus the operator, single-render and PDF crop/render tests.pre-commitpassed on all changed files.mkdocs build --strictpassed.Checklist
Link to Devin session: https://nvidia-cloud.devinenterprise.com/sessions/1a26768094554997905f04cfc7e6a53a
Open in Devin Desktop: https://nvidia-cloud.devinenterprise.com/desktop/session/1a26768094554997905f04cfc7e6a53a?variant=devin
Requested by: @jioffe502
👀 1 finding for you to triage · Follow Devin's work