Skip to content

fix(skills): send hub skills through install, not capture - #6463

Merged
kovtcharov-amd merged 3 commits into
mainfrom
fix/capture-skill-hub-source
Nov 2, 2026
Merged

kovtcharov-amd merged 3 commits into
mainfrom
fix/capture-skill-hub-source

Conversation

@kovtcharov-amd

@kovtcharov-amd kovtcharov-amd commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

A skill published on the GAIA hub is installed with its signature checked, but capture and gaia skill import could also bring one in from a hub link, skipping that check. Capturing a hub link, or a skill under a name the hub publishes, now refuses and points you to gaia skill install <name>. When an install fails signature verification, GAIA now says the skill must not be fetched, captured, downloaded, or rewritten some other way, and won't capture that name for the rest of the session. gaia skill migrate now applies the same tier and permission checks as import and records a lock entry, so a converted skill that needs a CLI is refused, and a skill in ~/.gaia/skills with no lock entry loads at the experimental tier.

Test plan

  • python -m pytest tests/unit/test_capture_hub_source.py tests/unit/test_skill_capture.py tests/unit/test_skill_import_gate.py tests/unit/test_skills_install.py tests/unit/test_skill_migrate_gate.py tests/unit/test_skills_migrate.py
  • python -m pytest -p no:randomly hub/agents/gaia/python/tests/test_skill_library_tools.py
  • gaia skill import https://hub.amd-gaia.ai/skills/research-report/1.0.0/research-report-1.0.0.zip refuses with the gaia skill install research-report hint and writes nothing
  • gaia skill migrate <openclaw skill with requires.bins: [gh]> exits 4 with the experimental-ceiling message and writes nothing; an instruction-only skill migrates and appears in skill-lock.json as source: migrated
  • Capturing a skill that isn't on the hub (pasted text, URL, folder) still works
  • Flagship eval on gaia_skills_lifecycle and gaia_skills_capture (tool-result text changed)

A skill published on the GAIA hub is installed with its signature checked;
capturing it from a hub link or under its hub name now refuses and points to
`gaia skill install <name>`.

- capture_skill refuses URLs on the configured hub (GAIA_HUB_URL, including
  its path) and on hub.amd-gaia.ai, and skills whose name the hub catalog
  lists. If the catalog cannot be read and there is no offline copy, capture
  fails with an actionable error instead of skipping the check.
- `gaia skill import` refuses hub URLs through the same check.
- When install_skill fails signature, checksum, or bundle verification, the
  result says the skill must not be obtained another way, and capture refuses
  that name for the rest of the session.
@kovtcharov-amd kovtcharov-amd added this to the v0.25.4 milestone Nov 2, 2026
@github-actions github-actions Bot added tests Test changes agents labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This PR closes a loophole where a skill published on the GAIA hub could be copied in through capture or gaia skill import, which skips the signature check that gaia skill install runs. Those paths now refuse and point the user to gaia skill install <name>. A name that fails verification during a session is also blocked from capture until the session ends. The URL matching is well tested against lookalike hosts, and the live CLI evidence shows it working.

Two things to look at before merging:

  • gaia skill import can still be redirected onto the hub. Capture re-checks where a redirect lands. Import only checks the URL you typed, so a short link that redirects to a hub bundle is still imported unsigned. Add the same final-URL check to import's download.
  • Capture now needs the hub catalog, even for pasted text. On an offline machine that has never cached the catalog, every capture fails, including a user's own skill that has nothing to do with the hub. That is fail-loud and the error says what to do, so it isn't a bug. It does change behaviour for a local-first product, though, so a maintainer should confirm it's intended and the PR description should say so.

Real-world evidence

The evidence stage ran the real CLI from a throwaway HOME. Every hub URL form was refused with exit 4. Local-folder import, live gaia skill search, and a signed gaia skill install summarize still work.

$ gaia skill import 'https://hub.amd-gaia.ai/skills/pdf-tools'
❌ pdf-tools is published on the GAIA hub. Install it with `gaia skill install pdf-tools` (or ask GAIA to install it), which checks its signature.
[exit 4]

$ GAIA_HUB_URL=http://127.0.0.1:9999/mirror gaia skill import http://127.0.0.1:9999/other/skills/my-skill
❌ Refusing to import 'http://127.0.0.1:9999/other/skills/my-skill': only https URLs are accepted, ...
[exit 4]
SkillCaptureError: summarize is published on the GAIA hub. Install it with `gaia skill install summarize` (or ask GAIA to install it), which checks its signature.
SkillCaptureError: summarize failed signature verification on the GAIA hub, so it must not be obtained any other way — do not fetch, capture, download, or rewrite it. Tell the user; they can report it at https://github.com/amd/gaia/issues.

The agent's install_skill / capture_skill tools were exercised through the library call only. A live agent run is pending the strix-halo lane. The tool-result text changed, so the gaia_skills_lifecycle and gaia_skills_capture evals in the test plan are the right ones to watch on the next RC.

🔍 Technical details

🟡 Import doesn't re-check a redirect target (src/gaia/skills/cli.py:720, _download at ~1368)

refuse_hub_url(args.source) runs only on the typed URL. _download uses requests.get(..., stream=True), which follows redirects. Capture covers this case in _fetch_url (capture.py:356-359), so the two paths disagree. Suggested fix in _download, right after raise_for_status():

        response = requests.get(url, timeout=60, stream=True)
        response.raise_for_status()
        if response.url != url:
            from gaia.skills.capture import refuse_hub_url

            refuse_hub_url(response.url)

Add a test next to test_a_redirect_onto_the_hub_is_refused_and_writes_nothing that patches requests.get to return a response whose .url is on the hub.

🟢 Capture fails closed with no catalog (capture.py:428-455, refuse_published_skill)

published_skill_names() raises when there is no network and no catalog-cache.json, so capture_skill refuses every source on a cold offline machine. test_an_unreadable_catalog_refuses_loudly shows this is deliberate. Flagging it only so a maintainer signs off and the PR body mentions it.

🟢 Session state lives on the agent object (skill_library_tools.py:117-124)

_failed_verification stores a (session_id, set) tuple on the agent and resets the set when the session id changes. That works, but if the agent has no current_session (CLI / gaia -p), the key is None and the block lasts for the agent's lifetime. That's probably fine. A one-line docstring note would save the next reader from tracing it.

Strengths

  • The URL parsing is thorough. Userinfo tricks, backslash variants, percent-encoded paths, a trailing-dot host, bad ports, and .. traversal each have a test, paired with a lookalike URL the guard must not catch. That pairing is what proves the check doesn't over-block.
  • Narrow exception subclasses (SkillChecksumError, SkillBundleMismatchError) let the tool tell verification failures apart from ordinary install errors without matching on message text. test_other_install_failures_keep_their_message_and_do_not_block_capture pins that boundary.
  • The autouse catalog stub is guarded by test_the_unit_suite_stubs_the_catalog_by_default, and the real catalog read is still exercised against the fake hub and the offline cache.

`gaia skill migrate` now applies the same tier and permission checks as
`gaia skill import` and records a skill-lock.json entry, so a converted
skill is held to the experimental tier when it loads.

- A source whose mapped permissions sit above the experimental ceiling
  (e.g. `requires.bins: [gh]`) is reported unmigratable with import's
  message; the dry run reports it too.
- install_migrated stages the converted skill and lands it via
  import_bundle: ceiling, symlink refusal, audit, --allow-experimental for
  code (new migrate flag), and a `source: migrated` entry with a content
  digest. Imports now record that digest as well.
- A user-root skill with no lock entry is held to the experimental ceiling
  at load; `gaia skill lock --relock` records an authored skill as local.
  Agent-bundled and .claude roots are unchanged.
- Relock records an unversioned skill as "unversioned" so the lock it
  writes can be read back.
… URL

gaia skill import checked only the URL the user typed, so a link that
redirected onto the hub was still imported. The download now applies the
same final-URL check capture uses and refuses a hub landing before writing
anything; a redirect to any other https host still imports.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator Author

gaia skill import now checks where a download actually lands, the same way capture does, so a link that redirects onto the hub is refused before anything is written. A redirect to any other https host still imports. Tests cover both cases through the real CLI.

The offline-capture behaviour (capture needs the hub catalog, even for pasted text) is unchanged; that one is a maintainer call.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Skill audit

Skill Verdict Claimed tier Cleared tiers Findings Rules
hub/agents/gaia/npm ✅ ALLOW experimental experimental 3 high body.injection.credential_request, body.injection.guardrail_bypass, body.injection.persona_override

✅ All audited skills cleared the tier they claim.

Per-finding detail is withheld here on purpose. Read it in the Security > Code scanning tab, or download the skill-audit-reports artifact from this run. Offending source text is withheld from CI everywhere — reproduce it locally with gaia skill audit <dir> --show-snippets.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit ce2b727 Nov 2, 2026
54 of 55 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the fix/capture-skill-hub-source branch November 2, 2026 23:01
kovtcharov pushed a commit to kovtcharov/gaia that referenced this pull request Nov 2, 2026
…messages (amd#6467)

Several skill messages sent the model and the user to commands that fail
or claimed things that don't happen. Installing a skill the agent
already bundles told the model to load the install, but the bundled copy
is what loads. `gaia skill import` without `--allow-experimental` exits
4 for a skill with code, `gaia skill deltas --drop-section` without
`--scope` exits 2, and `gaia skill info --remote` doesn't exist. The
skills catalog said `gh` is refused until a skill loads, but it actually
asks the user to approve each command. Now every named command runs as
written and every status claim matches the code.

**Needs a flagship eval:** the catalog line is in every system prompt,
and tool results and one tool docstring changed. Please re-run
`gaia_skills_lifecycle`, `gaia_skills_capture` and `gaia_skills_tasks`
in `eval_flagship.yml`.

## Test plan

- [x] New tests: shadowed-install message and `shadowed_by`; the import,
drop-section, install and search commands parse with the real `gaia
skill` argparse; the tainted-turn refusal and the not-loaded refusal
wording; the undo notice; the compact-tier hint names `capture_skill`
- [x] `python -m gaia.cli` in a temp home: `skill import <dir>` exits 4
and with `--allow-experimental` exits 0; `skill deltas --drop-section`
exits 2 and with `--scope` exits 0; `skill info --remote` exits 2;
`skill search` exits 0
- [x] Skills, agent and flagship suites: 8162 passed. The 9 failures are
3 that also fail on main, a test that passes on rerun, and 5 that pass
when run alone
- [x] `util/lint.py --all`: black, isort, flake8 and the
tool-description budget pass. Pylint's 2 errors are Windows-only, in
files this PR doesn't touch
- [ ] Flagship eval: `gaia_skills_lifecycle`, `gaia_skills_capture`,
`gaia_skills_tasks`

<details>
<summary>🔍 Technical details</summary>

Model-visible strings changed:

- `CATALOG_HEADER` (system prompt): "some pre-approve a CLI (such as gh)
— until the skill is loaded, each of its commands waits for the user's
approval." The golden fixture `non_claude_system_prompt.txt` is updated.
- `install_skill` result: new `next_step` and `shadowed_by` when a
bundled copy outranks the install; new `next_step` when the host has the
skill turned off.
- `load_skill` refusal for an imported skill with code: the command now
includes `--allow-experimental` and is shell-quoted.
- `load_skill` docstring, Returns: a missing CLI with no substitute
refuses the load.
- `list_skills` compact-tier hint: hub installs need a larger model, and
`capture_skill` still works.
- `remember_skill_lesson` "not loaded" error: says the lesson can be
saved on the user's next message.
- `remember_skill_lesson` empty-text error: `gaia skill deltas <skill>
--scope <scope> --drop-section <section>`.
- `remember_skill_lesson` success notice: "Undo, which takes effect when
GAIA next starts: …"
- `validate_delta` provenance refusal: "A tool already ran this turn,
and anything a tool returns — a web page, an email, a skill's text, a
command's output — …" The first clause appears only for `tool_content`.
- Hub errors (pin, SKILL.md fetch): `gaia skill install
<name>[@<version>]` and `gaia skill search <name>` replace `gaia skill
info --remote`.
- Skill-format errors: anchors are now `#the-metadata-gaia-namespace`
and `#tools-vs-tools_required-%E2%80%94-never-conflate-them`, checked
against the live page's ids.
- Permission refusals: the sandbox pointer is now open amd#2863 instead of
closed amd#1019.

Decisions:

- **C5:** `load_skill` still taints the turn. A loaded skill's text is
third-party, and `test_even_a_skill_listing_taints_the_turn` pins that.
So the guidance changed, not the taint.
- **C10:** `capture_skill` stays on the compact tier.
`test_gemma_keeps_installed_skills_and_documents` asserts that on
purpose, and amd#5892 withheld only the hub. The comment and hint now say
so.
- **`cli_setup` bundle:** it's defined once in `DOC_BUNDLES` and once in
`FULL_BUNDLES`, one per profile, like `shell_session`. That isn't a
duplicate, so it's unchanged.
- **Overlap:** amd#6463 adds imports on the line next to the one this PR
adds in `install_skill`. Whichever merges second needs a trivial rebase.
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant