fix(registry): fetch and parse package content for resolved registry references #138

Open
CoreRasurae wants to merge 1 commit from bugfix/m1-registry-content-fetch into tdd/m1-registry-content-fetch
Member

Summary

Fixes #135: PackageContentResolver._resolve_registry_async only performed the Package Registry Standard §8.2.2 "resolve" call and returned that stub directly as package content, never performing the required §8.2.1 get_package fetch. A type: llm agent referenced via a bare REGISTRY-scheme string in agents.<name> therefore failed AgentFactory.acreate_agent with AgentCreationError("Unknown agent type: agent").

_resolve_registry_async now follows up resolve_package with get_package/get_package_content, parses the returned YAML content, and merges the real package content over the resolve stub (routed through the per-server RegistryCache when available). The resolution cache now stores the fully-resolved content. A malformed/missing content response raises ValidationError instead of silently propagating the stub.

Also fixes robot/fake_registry_server.py's /packages/{id} handler, which was returning raw fields instead of the spec-compliant {"content": "<yaml>"} envelope for actor/skill packages -- this was previously masking the same defect in robot/skill_registry_auth.robot's real end-to-end skill-download flow and in robot/registry_full_cache_integration.robot.

Stacking note: This PR is based on tdd/m1-registry-content-fetch (PR #137, not yet merged) rather than master, since the regression test this fix turns green lives there. Please merge #137 first; this PR's diff against master will shrink to just the fix once that happens.

Closes #135

Test plan

  • nox -s unit_tests -- full Behave suite green (3084 scenarios)
  • nox -s coverage_report -- 96.8% (>= 96.5% threshold)
  • nox -s typecheck -- 0 errors
  • nox -s lint / nox -s format -- --check -- clean
  • nox -s security_scan / nox -s dead_code -- clean
  • nox -s integration_tests -- full Robot suite green (363 tests), including new REGISTRY-backed type: llm agent scenario in agent_package_references.robot
  • Removed @tdd_expected_fail from the @tdd_issue_135 scenario now that the fix lands
## Summary Fixes #135: `PackageContentResolver._resolve_registry_async` only performed the Package Registry Standard §8.2.2 "resolve" call and returned that stub directly as package content, never performing the required §8.2.1 `get_package` fetch. A `type: llm` agent referenced via a bare REGISTRY-scheme string in `agents.<name>` therefore failed `AgentFactory.acreate_agent` with `AgentCreationError("Unknown agent type: agent")`. `_resolve_registry_async` now follows up `resolve_package` with `get_package`/`get_package_content`, parses the returned YAML `content`, and merges the real package content over the resolve stub (routed through the per-server `RegistryCache` when available). The resolution cache now stores the fully-resolved content. A malformed/missing `content` response raises `ValidationError` instead of silently propagating the stub. Also fixes `robot/fake_registry_server.py`'s `/packages/{id}` handler, which was returning raw fields instead of the spec-compliant `{"content": "<yaml>"}` envelope for actor/skill packages -- this was previously masking the same defect in `robot/skill_registry_auth.robot`'s real end-to-end skill-download flow and in `robot/registry_full_cache_integration.robot`. **Stacking note:** This PR is based on `tdd/m1-registry-content-fetch` (PR #137, not yet merged) rather than `master`, since the regression test this fix turns green lives there. Please merge #137 first; this PR's diff against `master` will shrink to just the fix once that happens. Closes #135 ## Test plan - [x] `nox -s unit_tests` -- full Behave suite green (3084 scenarios) - [x] `nox -s coverage_report` -- 96.8% (>= 96.5% threshold) - [x] `nox -s typecheck` -- 0 errors - [x] `nox -s lint` / `nox -s format -- --check` -- clean - [x] `nox -s security_scan` / `nox -s dead_code` -- clean - [x] `nox -s integration_tests` -- full Robot suite green (363 tests), including new REGISTRY-backed `type: llm` agent scenario in `agent_package_references.robot` - [x] Removed `@tdd_expected_fail` from the `@tdd_issue_135` scenario now that the fix lands
CoreRasurae added this to the v2.1.0 milestone 2026-08-20 21:39:41 +00:00
PackageContentResolver._resolve_registry_async only performed the Package
Registry Standard §8.2.2 "resolve" call (GET /{package_type}/{namespace}/{name}
-> {"package_id", "type"}) and returned that stub directly as if it were the
resolved package content. It never performed the required §8.2.1 "get package
by ID" call (GET /packages/{package_id} -> {"content": "<YAML string>"}) to
fetch and parse the real package payload, so a REGISTRY-scheme agents.<name>
(and routes.<name>/skills:) reference ended up with type: "agent" (the resolve
stub's package-type field) instead of the real package's type: "llm", per
docs/index.md §4.1.1 and ADR-2037 D-3.

_resolve_registry_async now follows up resolve_package with get_package/
get_package_content for the returned package_id, parses the YAML content
string via a new _parse_package_content helper, and merges the parsed
content over the resolve stub so the real type/config win. The fetch routes
through the per-server RegistryCache when available, mirroring the existing
resolve_package cache/no-cache branching, and the resolution cache now stores
the fully-resolved content instead of the intermediate stub. A malformed or
missing content response now raises ValidationError (a RegistryError
subclass) instead of silently propagating the stub.

Removed @tdd_expected_fail from the issue #135 regression scenario in
features/registry_http_client.feature now that the fix lands. Updated
existing mocks that only modeled the single §8.2.2 call
(registry_http_client_steps.py, registry_reference_resolver_coverage_steps.py,
cache_coverage_steps.py/.feature) to also serve a valid §8.2.1 response, and
fixed robot/fake_registry_server.py's /packages/{id} handler to wrap known
package content in the spec-compliant {"content": "<yaml>"} envelope instead
of returning raw fields at the top level -- both registry_full_cache_integration.robot
(updated miss-count assertions, now 2 misses per fetch instead of 1) and
skill_registry_auth.robot's real end-to-end skill-download flow depend on this
shape and were previously silently red. Added a new Robot scenario in
agent_package_references.robot proving a type: llm agent referenced via a bare
REGISTRY-scheme string constructs successfully through AgentFactory.acreate_agent
against a real fake registry server.

ISSUES CLOSED: #135
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin bugfix/m1-registry-content-fetch:bugfix/m1-registry-content-fetch
git switch bugfix/m1-registry-content-fetch

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch tdd/m1-registry-content-fetch
git merge --no-ff bugfix/m1-registry-content-fetch
git switch bugfix/m1-registry-content-fetch
git rebase tdd/m1-registry-content-fetch
git switch tdd/m1-registry-content-fetch
git merge --ff-only bugfix/m1-registry-content-fetch
git switch bugfix/m1-registry-content-fetch
git rebase tdd/m1-registry-content-fetch
git switch tdd/m1-registry-content-fetch
git merge --no-ff bugfix/m1-registry-content-fetch
git switch tdd/m1-registry-content-fetch
git merge --squash bugfix/m1-registry-content-fetch
git switch tdd/m1-registry-content-fetch
git merge --ff-only bugfix/m1-registry-content-fetch
git switch tdd/m1-registry-content-fetch
git merge bugfix/m1-registry-content-fetch
git push origin tdd/m1-registry-content-fetch
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveractors-core!138
No description provided.