Skip to content

feat(adapters): name the unsupported technology in adapter not-found errors - #1843

Merged
planetf1 merged 4 commits into
generative-computing:mainfrom
planetf1:fix/issue-1837
Nov 20, 2026
Merged

planetf1 merged 4 commits into
generative-computing:mainfrom
planetf1:fix/issue-1837

Conversation

@planetf1

@planetf1 planetf1 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Thanks for sending a pull request! Please make sure you read the contributing guidelines.

Issue

Fixes #1837

Description

If a Granite Switch checkpoint contains an adapter whose technology Mellea doesn't support (e.g. sr), asking for it by name used to fail with a message that gave no reason. It now names the technology and what is supported. Discovery has skipped such slots with a warning since #1797; the warning is unchanged.

Before:

ValueError: No adapter found for adapter function 'future_slot' in <path>

After:

ValueError: No adapter found for adapter function 'future_slot' in <path>: technology 'sr' is not supported (supported: ['alora', 'lora', 'probe'])

When every slot is skipped, the error no longer reads like an empty index:

ValueError: No adapters found in <path>; skipped unsupported entries: 'future_slot': technology 'sr' is not supported (supported: ['alora', 'lora', 'probe'])

How it works. _embedded_adapters_from_model_directory records why each slot was skipped and raises _NoEmbeddedAdaptersError, a private ValueError subclass, so existing except ValueError handlers still catch it. _embedded_adapters_from_hub rebuilds the message with the repo ID instead of the cache path. Its generic except ValueError handler also keeps the original reason now: an io.yaml-not-found or io_config path-escape error used to be rewritten as a bare "No adapter found", stating the slot does not exist when the index lists it and only its config is broken.

Differs from the issue's plan. The issue proposed threading skip reasons through _discover_embedded_adapters so the KeyError in resolve_adapter would carry them. That KeyError never fires here: resolve_adapter re-runs discovery with intrinsic_name=<slot>, which raises the ValueError first. So this fixes the message directly, with no change to helper return shapes or call sites.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

New TestProbeSlots tests in test/backends/test_adapters/test_embedded_adapter.py cover an unsupported slot, an all-unsupported index, the Hub path (message names the repo ID), and resolve_adapter end to end, and an unsupported slot that omits io_config. The four original tests failed before the fix; the io_config case failed on the pre-fix code too.

uv run pytest test/ -m "not qualitative": 5,435 passed, 1 failed. The failure is test_adapter_versions_unchanged, a live Hugging Face drift check (skipped on CI) reporting that granitelib-rag-r1.0 and granitelib-core-r1.0 have moved past their pinned SHAs. This PR doesn't touch them. The ruff, mypy, and docstring quality gates are clean.

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

…errors

Resolving a Granite Switch slot whose technology Mellea skips (e.g. 'sr')
raised a bare 'No adapter found' ValueError; the reason was only in an
earlier log warning. An index where every slot was skipped read as empty.

Discovery now records each skipped slot's reason and includes it in the
error, and the Hub path restates it against the repo ID.

Closes generative-computing#1837

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>
@github-actions github-actions Bot added the enhancement New feature or request label Nov 16, 2026
@planetf1
planetf1 marked this pull request as ready for review November 18, 2026 15:44
@planetf1
planetf1 requested a review from a team as a code owner November 18, 2026 15:44

@ajbozarth ajbozarth 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.

Some feedback from Claude: looks good, one optional nit inline.

Comment thread mellea/backends/adapters/adapter.py Resolved
Co-authored-by: Alex Bozarth <[email protected]>
Signed-off-by: Nigel Jones <[email protected]>
@planetf1
planetf1 enabled auto-merge November 19, 2026 11:23

@markstur markstur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review findings from a fresh pass over the diff (head 8938fa9), verified by running the PR's tests locally. One must-fix, two lower-severity items.

}
(tmp_path / "adapter_index.json").write_text(json.dumps(index))
with pytest.raises(
ValueError, match="no adapter function has a supported technology"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Must-fix. This test fails on the PR head. The match regex expects the phrase "no adapter function has a supported technology", but _NoEmbeddedAdaptersError produces:

No adapters found in <path>; skipped unsupported entries: 'slot_a': technology 'sr' is not supported (supported: ['alora', 'lora', 'probe']); 'slot_b': ...

Verified locally: uv run pytest test/backends/test_adapters/test_embedded_adapter.py on the PR branch fails here with AssertionError: Regex pattern did not match (main passes all 54 tests in this file; the only other failures in a fresh checkout were missing extras and disappear after uv sync --all-extras --all-groups). The message appears to have been reworded in 8938fa9 without updating this regex, and the PR description quotes a third wording. The regex and the message need to agree before merge.

) from e
except _NoEmbeddedAdaptersError as e:
raise _NoEmbeddedAdaptersError(repo_id, e.intrinsic_name, e.skipped) from e
except ValueError as e:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lower severity. This generic handler still discards the reason for every non-no-adapters ValueError. An io.yaml-not-found or io_config-path-escape error raised by _embedded_adapters_from_model_directory is rewritten here into "No adapter found for adapter function 'x' in <repo_id>", which states the slot does not exist when the index actually lists it and its io.yaml is missing or escaping. The PR description notes the Hub path "replaced the whole message, so the reason was lost there too", but the new _NoEmbeddedAdaptersError branch only covers the no-adapters case. Restating only the location for these errors, or letting the directory-path messages pass through, would close the gap.

@@ -642,12 +643,14 @@ def _embedded_adapters_from_model_directory(
technology = entry.get("technology", "lora")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lower severity. The io_config_rel is None check just above (lines 640-642) continues before this technology check, so an unsupported-technology entry that omits its io_config key entirely never reaches the skipped dict. Requesting such a slot by name still yields the generic "No adapter found for adapter function 'future_slot' in <path>" with no mention of the unsupported technology — the exact case this change exists to explain. Since the technology check needs no file access (and the comment below notes unsupported slots may not publish an io.yaml), moving it above the io_config check would close the gap.

Move the technology check above the 'io_config is None' continue, so an
unsupported entry that omits io_config is recorded in 'skipped' and named
when the slot is requested, instead of falling through to the generic
'No adapter found' message.

Update the all-slots-unsupported test to the message wording from
8938fa9 ('skipped unsupported entries'), which the test still expected
in its old form, and cover the no-io_config case.

Assisted-by: pi (claude)
Signed-off-by: Nigel Jones <[email protected]>
The generic 'except ValueError' handler in _embedded_adapters_from_hub
replaced the message wholesale, so an io.yaml-not-found or io_config
path-escape error from discovery read as 'No adapter found for adapter
function x in <repo>' -- stating the slot does not exist when the index
lists it and only its config is broken. Restate the location against the
repo ID and keep the original reason, mirroring what
_NoEmbeddedAdaptersError already does.

Assisted-by: pi (claude)
Signed-off-by: Nigel Jones <[email protected]>
@planetf1

Copy link
Copy Markdown
Contributor Author

@markstur all three fixed in 940a49fd1.

  • The all-slots test now matches the message the code emits. 8938fa938 changed that wording to "skipped unsupported entries" and the test still expected the old form.
  • The technology check now runs before the io_config is None check, so an unsupported slot with no io_config is named. test_unsupported_slot_without_io_config_names_technology covers it, and it fails on the earlier code.
  • The generic handler keeps the original reason, restated against the repo ID, so an io.yaml-not-found or path-escape error no longer reads as "no such slot". Tested through the Hub path in test_hub_load_failure_reason_survives_rewrite.

Pre-commit and test/backends/test_adapters/ are green locally.

@planetf1
planetf1 added this pull request to the merge queue Nov 20, 2026
Merged via the queue into generative-computing:main with commit 5293201 Nov 20, 2026
14 checks passed
@planetf1
planetf1 deleted the fix/issue-1837 branch November 20, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(adapters): report unsupported-technology skips in the adapter not-found error

3 participants