Skip to content

IntrinsicAdapter.__init__ sets Identity.capability from the raw catalogue name, not effective_capability #1561

Closed as not planned

Description

@planetf1

Epic: #929 | Blocked by: — | Phase: 2 | Related: likely duplicate of #1563, which covers this same fix plus EmbeddedIntrinsicAdapter.__init__

Problem

IntrinsicAdapter.__init__ (mellea/backends/adapters/adapter.py) builds its
Identity as:

identity=Identity(
    name=intrinsic_name,
    adapter_type="alora" if self.adapter_type == AdapterType.ALORA else "lora",
    capability=intrinsic_name,
)

capability is set to the raw catalogue name, not
IntrinsicsCatalogEntry.effective_capability. The catalogue's own docstring
for effective_capability says explicitly:

Use this property — not name — whenever building the capability
vocabulary or resolving an Identity capability.

Six catalogue entries have a hyphenated name but an underscored capability
override: context-attribution, requirement-check, policy-guardrails,
guardian-core, factuality-detection, factuality-correction. Constructing
an IntrinsicAdapter for any of these fires a UserWarning ("Capability X is
not in the KNOWN_CAPABILITIES registry") every time, because Identity's own
validation checks against the registry built from effective_capability
values.

requirement-check is the highest-impact case: it's the adapter every
auto-routed ALoraRequirement check uses by default.

Impact

  • Spurious UserWarning on construction of any of the six affected adapters.
  • Identity.capability doesn't match the stable capability token the rest of
    the codebase (hooks, telemetry, _find_adapter) expects to see, for those
    six adapters.

Suggested fix

identity=Identity(
    name=intrinsic_name,
    adapter_type="alora" if self.adapter_type == AdapterType.ALORA else "lora",
    capability=self.intrinsic_metadata.effective_capability,
)

Context

Found during #1465's code review (routing intrinsic generation through
adapter_scope). #1465 fixed the symptom on its own call site (reusing
adapter.identity instead of rebuilding a fresh Identity per generate
call, which had been re-triggering this warning on every call instead of
once at construction) but did not fix this root cause, since it's a
repo-wide behavior change unrelated to that issue's scope (lock reentrancy
and adapter_scope routing).

Pre-existing since #1140/#1141 (Epic #929 Phase 1/2).

Activity

  1. added
    area/alora
    area/adapter-functions
    p2
    on Aug 18, 2026
  2. planetf1 commented on Aug 21, 2026

    @planetf1
    ContributorAuthor

    Duplicate of #1563, which covers this same fix (IntrinsicAdapter.__init__ using effective_capability) plus the same bug in EmbeddedIntrinsicAdapter.__init__. Closing this one in favor of the superset; no PR exists against either yet, so no rework is being discarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/adapter-functionsarea/alorap2refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions