Skip to content

Adapter shim Identity uses catalog name instead of effective_capability, causing spurious KNOWN_CAPABILITIES warnings #1563

Closed

Description

@planetf1

Epic: #929 | Blocked by: — | Phase: 2 | Related: supersedes #1561 (closed as duplicate 2026-08-21) — this issue additionally covers EmbeddedIntrinsicAdapter

Found while working on: #1516 (unrelated — flagged during review, not fixed there to keep that PR scoped to the io_contract axis)

Problem

Six adapter functions in the catalog declare a capability token distinct
from their name — name is the hyphenated string used for lookup (e.g.
"guardian-core"), capability is a separate underscored token (e.g.
"guardian_core"):

mellea/backends/adapters/catalog.py:166-167   name="context-attribution"    capability="context_attribution"
mellea/backends/adapters/catalog.py:172-173   name="requirement-check"       capability="requirement_check"
mellea/backends/adapters/catalog.py:201-202   name="policy-guardrails"       capability="policy_guardrails"
mellea/backends/adapters/catalog.py:207-208   name="guardian-core"           capability="guardian_core"
mellea/backends/adapters/catalog.py:213-214   name="factuality-detection"    capability="factuality_detection"
mellea/backends/adapters/catalog.py:219-220   name="factuality-correction"   capability="factuality_correction"

IntrinsicsCatalogEntry.effective_capability (catalog.py:137-149) resolves
to capability when set, else name — and KNOWN_CAPABILITIES
(mellea/backends/adapters/capabilities.py:19-21) is built from
effective_capability, not name. So KNOWN_CAPABILITIES contains the
underscored form ("guardian_core") for these six, never the hyphenated
name.

But IntrinsicAdapter.__init__ and EmbeddedIntrinsicAdapter.__init__
(mellea/backends/adapters/adapter.py:251-257 and :960-964) build their
Identity as:

identity=Identity(
    name=intrinsic_name,
    adapter_type=...,
    capability=intrinsic_name,   # should be effective_capability
)

intrinsic_name here is the catalog name (the hyphenated string), not
effective_capability. Identity.__post_init__
(mellea/backends/adapters/_core.py:97-104) checks capability against
KNOWN_CAPABILITIES and warns on a miss — which fires for all six of these
adapters, every time resolve_adapter() lazily constructs one:

UserWarning: Capability 'guardian-core' is not in the KNOWN_CAPABILITIES
registry. This may indicate a typo or an unregistered capability.

Impact

Cosmetic only, confirmed by tracing the lookup path: resolve_adapter(name) →
_find_adapter(name) compares Identity.capability == name, and since the
shim's Identity.capability is also set from that same name, both sides
of the comparison are consistent — adapter resolution is unaffected.
KNOWN_CAPABILITIES membership is advisory only (warns, never raises), so
nothing breaks functionally. The only symptom is a spurious warning on every
resolution of these six capabilities, easily mistaken for a real
misconfiguration when debugging something else.

Reproducer

import warnings
from mellea.backends.adapters.adapter import IntrinsicAdapter
from mellea.backends.adapters.catalog import AdapterType

with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    IntrinsicAdapter(
        "guardian-core",
        adapter_type=AdapterType.ALORA,
        base_model_name="ibm-granite/granite-4.1-3b",
    )
    assert any("KNOWN_CAPABILITIES" in str(w.message) for w in caught)

(Also reproducible live — it fired during test/stdlib/components/intrinsic/test_guardian.py's qualitative suite for policy-guardrails, guardian-core, factuality-detection, and factuality-correction.)

Suggested fix

In both __init__ methods, use the catalog's effective_capability instead
of the raw intrinsic_name:

capability=fetch_intrinsic_metadata(intrinsic_name).effective_capability,

fetch_intrinsic_metadata is already called earlier in both constructors, so
this needs no new lookup — just reading .effective_capability off the
already-fetched entry instead of reusing intrinsic_name.

Scope note

IntrinsicAdapter and EmbeddedIntrinsicAdapter are the Phase 1 shim classes
#1144 (Phase 4) removes entirely. Worth fixing here rather than there, since
#1144 might delete the classes outright rather than patch them — the fix
should land before or independently of that removal, not depend on it.

Metadata

Metadata

Assignees

Labels

area/adapter-functions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions