fix(harness): resolve skill name to hub slug before download#630
Open
yaozheng-fang wants to merge 2 commits into
Open
fix(harness): resolve skill name to hub slug before download#630yaozheng-fang wants to merge 2 commits into
yaozheng-fang wants to merge 2 commits into
Conversation
A harness lists skills by name (e.g. 'web-scraper') but the hub downloads by slug (e.g. 'clawhub/yinanping-cpu/web-scraper'). Bare names that aren't a top-level slug got a 200 JSON error body, which zipfile then rejected as 'File is not a zip file'. Resolve name -> slug via the search API (scanning all results for an exact Name match, since the top hit isn't always exact), then download by slug; values already containing '/' are treated as explicit slugs. Also surface a non-zip 200 response as a clear error instead of a BadZipFile. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A harness lists skills by their human name (e.g.
web-scraper,byted-arkclaw-paper-research), but the skill hub downloads by slug (e.g.clawhub/yinanping-cpu/web-scraper,volcengine/arkclaw/byted-arkclaw-paper-research)._download_and_extract_skillused the name verbatim as the download path. For aname whose slug isn't a top-level identifier, the hub answers HTTP 200 with a
JSON error body (not a zip), which
zipfilethen rejects as the veryconfusing
File is not a zip file— surfaced to users as:Fix
_resolve_skill_slug(): resolve a skill name → slug via the search API(
/v1/skills?query=<name>&pageSize=3), scanning all results for an exactNamematch — the top hit isn't always the exact one (web-scraperranksbelow
smart-web-scraper). A value already containing/is treated as anexplicit slug and used as-is. No exact match raises a clear error.
_download_and_extract_skillnow resolves the slug first, then downloads by slug.instead of letting
zipfilefail withFile is not a zip file.Tests
tests/cloud/test_harness_app_contract.py— exact-match-not-first, explicit-slugpassthrough, no-match error, search HTTP error, and the non-zip-200 clear error.
21 passed.Verified
Deployed a codex harness built from this branch and invoked with
--skills data-visualization-cloud,byted-arkclaw-paper-research,academic-deep-research,web-scraper:all four now resolve and load (no
File is not a zip file); the run completes.