Skip to content

The agent that grows with you

fix(cli): skip unreachable support files instead of aborting URL skill install

PRATHAMESH757d87bab5024b
diff --git a/tests/tools/test_skills_hub.py b/tests/tools/test_skills_hub.py
index 56486d789fb..05da436699d 100644
--- a/tests/tools/test_skills_hub.py
+++ b/tests/tools/test_skills_hub.py
@@ -379,6 +379,38 @@ class TestUrlSource:
# ── fetch ───────────────────────────────────────────────────────────
+ @patch("tools.skills_hub._ssrf_safe_http_get")
+ def test_fetch_skips_missing_support_file_instead_of_aborting(self, mock_get):
+ # One referenced support file 404s; the other is reachable. The
+ # install should still succeed with the file that could be fetched,
+ # rather than aborting the whole fetch (regression for a bug where
+ # any single missing companion file failed the entire URL install).
+ skill_md = (
+ "---\n"
+ "name: my-skill\n"
+ "description: Has support files.\n"
+ "---\n\n"
+ "See `references/good.md` and `references/missing.md`.\n"
+ )
+
+ def _side_effect(url, **kwargs):
+ if url.endswith("SKILL.md"):
+ return MagicMock(status_code=200, text=skill_md)
+ if url.endswith("references/good.md"):
+ return MagicMock(status_code=200, content=b"good content")
+ if url.endswith("references/missing.md"):
+ return MagicMock(status_code=404)
+ raise AssertionError(f"unexpected URL: {url}")
+
+ mock_get.side_effect = _side_effect
+
+ bundle = self._source().fetch("https://example.com/my-skill/SKILL.md")
+ assert bundle is not None
+ assert bundle.name == "my-skill"
+ assert bundle.files["SKILL.md"] == skill_md
+ assert bundle.files["references/good.md"] == b"good content"
+ assert "references/missing.md" not in bundle.files
+
@patch("tools.skills_hub._ssrf_safe_http_get")
@patch("tools.skills_hub.check_website_access", return_value=None)
@patch("tools.skills_hub.is_safe_url", side_effect=[True, False])
diff --git a/tools/skills_hub.py b/tools/skills_hub.py
index 0888950fda3..0aebdaa379b 100644
--- a/tools/skills_hub.py
+++ b/tools/skills_hub.py
@@ -1549,7 +1549,15 @@ class UrlSource(SkillSource):
return None
content = self._fetch_bytes(support_url)
if content is None:
- return None
+ # A referenced support file that 404s (or is otherwise
+ # unreachable) shouldn't sink the whole install — skip it
+ # and let the bundle install without it.
+ logger.warning(
+ "URL skill %s: referenced support file %r could not be "
+ "fetched from %s; skipping it",
+ url, rel_path, support_url,
+ )
+ continue
files[rel_path] = content
# When auto-resolution fails, return a bundle with an empty name and