Repository navigation
fix(skills): load the coding skill when pytest is only in a virtualenv - #3791
Conversation
The coding skill was refused outright unless a pytest executable sat on the global PATH, which is not where most projects keep it. In one benchmark run, 42 of 48 attempts to load it failed this way. A command policy can now name a substitute. When the command is missing and a substitute exists, the skill loads without that grant and load_skill tells the model what to do instead: for pytest, run the suite through execute_python_file with pytest.main. gh has no substitute, so a missing gh still refuses github-triage. Closes amd#3790 Co-Authored-By: Claude Opus 5 <[email protected]>
Verdict: Request changesGood fix for a real problem — a skill that names The skill's own text still tells the model the opposite. The coding skill's instructions say it grants The advice reaches the model on only one of the two ways a skill gets loaded. An agent that pre-loads skills from its manifest never goes through the library tool, so the skill loads without the grant and nothing is said at all. The substitute belongs at the place skills are loaded, not only in the tool wrapper. One doc still states the old rule. The permission-model spec says a missing binary refuses the skill at load. That is no longer true for a binary with a substitute, and the project's rule is that a behavior change updates every doc that describes it in the same change. Real-world evidenceNo evidence bundle was produced for this PR ( 🔍 Technical detailsIssues🟡 The loaded skill body contradicts the new state, and the shell refusal misleads ( The skill says "This skill grants
The skill is loaded, so that hint invites a no-op reload loop. Two fixes, ideally both: reword 🟡 Only the tool path tells the model anything (
🟡 Spec doc still states the pre-PR rule (
That is now conditional on Nits🟢 🟢 Strengths
|
…y load path The coding skill still told the model to run pytest directly, and a refused pytest call told it to "load that skill first" even with the skill loaded, so a model without pytest on PATH was pointed at a reload loop. Agents that load skills from a manifest got no substitute at all. - The loaded skill's prompt now carries a note naming the missing command and its substitute, rendered every turn, so the load_skill tool and manifest loads behave the same. The skipped grant is logged. - The shell gate says a policed binary is not installed (with the substitute or install hint) instead of blaming a missing skill. - coding SKILL.md makes direct pytest conditional on PATH and names the execute_python_file + pytest.main route; version 0.1.1. - skill-format.mdx states the substitute exception to the missing-binary rule. - unavailable_binaries is re-exported from gaia.skills. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Thanks — all five points are addressed in 0edca9c.
Not run: PR description footer: the "Generated with Claude Code" line conflicts with CLAUDE.md, but this session's instructions require it, so I left it. A maintainer should decide which rule wins. 🔍 Technical detailsChanges
Tests
Results (local)
|
`shutil` is already imported at module scope; the local one inside the Unix-to-Windows command mapping shadowed it and failed Pylint's W0404, which the code-quality gate treats as blocking.
|
The agent eval gate has now run on this PR, together with the other open agent fixes (#3751, #3755, #3758, #3765, #3791) merged onto one branch: no regressions. Every category passes the same scenarios as the unchanged base commit, and no scenario flipped between pass and fail. 🔍 Technical detailsBoth legs ran on the same machine with local
|
# Conflicts: # src/gaia/agents/tools/shell_tools.py # src/gaia/skills/binaries.py
|
Merged Both conflicts were with the shell rewrite that landed in #4049, and main's version won in each place it had moved the code — the branch's own change (refusing a not-installed binary outright, instead of telling the model to reload a skill) sits untouched in 🔍 Technical details
Tests on the merge result: |
# Conflicts: # src/gaia/agents/tools/skill_library_tools.py
…g one (amd#3765) GAIA almost never used its skills on real work. Before each turn it scored the user's words against skill descriptions, and on a 24-task benchmark that loaded a skill **zero** times. Precise requests score lowest, because repo names, issue numbers and output formats count against the match. Without `github-triage` loaded, `gh` is refused too, so most models never tried it. The flagship now lists every installed skill, one line each, in its system prompt, and the model calls `load_skill` when the work fits — at the start of a task or partway through. The list only changes when a skill is installed, so it stays cached. It costs **1,062 tokens** for the starter pack. This deletes the retriever and discovery machinery (−2,339 / +334 lines). - **Refusals name the skill.** A refused `gh` or `pytest` now says which skill to load, instead of "a skill that declares it". - **Latent prompt bug fixed.** ChatAgent dropped any prompt section containing the words "Stable Diffusion". The catalogue mentions it (the `image-gen` skill), so the whole catalogue vanished with no warning. The filter now matches the method that produced the section. Closes amd#3764. Supersedes amd#3763. ## Test plan - [x] `pytest tests/unit/test_skill_catalog.py tests/unit/test_skill_binary_grants.py`: every installed skill listed with its description; stable across renders; `.claude/skills` imports not listed; the granting skill found for `gh` and `pytest`; refusals name it, or point at the hub when none is installed. - [x] `pytest hub/agents/gaia/python/tests/test_full_tool_bundles.py::test_skill_catalogue_renders_for_the_flagship`: the catalogue reaches the real flagship prompt. It failed before the Stable Diffusion filter fix. - [x] Targeted suites (skills, prompt composition, verification scope, flagship tests): 947 pass. `pytest tests/unit -k "skill or prompt or shell"`: 1,961 pass. The 6 failures also fail on untouched `main`: `search_documentation` is absent from this environment, and the profile goldens drift on audio wording. - [x] Flagship system prompt measured: 3,130 → 4,192 tokens, sourcing rule still present. - [x] Benchmark A/B, the same 144-run battery before and after (six Fireworks models), all batches complete: **101 vs 100 passes overall**. GitHub tasks 10/30 → **17/30**; runs that loaded a GitHub skill 4 → 16, runs that used `gh` 4 → 14. Adversarial tasks 19/30 → 15/30, all 4 points lost by minimax-m3; deepseek-v4p1-flash went 21 → 24/24 and kimi-k2p7-code 19 → 22. Visible skills also exposed amd#3790: `coding` was refused over pytest in 28 runs, which amd#3791 fixes. - [ ] `gaia eval agent`: required by CLAUDE.md for prompt changes. It can't run on this machine (no `claude` CLI for the judge). --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: f <f@f> Co-authored-by: kovtcharov-amd <[email protected]>
Both sides changed how a missing binary is explained to the model, so the
resolution keeps both intents rather than either one.
- main taught `python -m pytest` and maps that spelling onto the pytest
grant, so an absent pytest refuses it too. The substitute text now says
so and points at execute_python_file, which works wherever pytest is
importable.
- The shell refusal keeps main's grant-route message ("load skill X") for
an installed-but-ungranted binary, and uses this branch's
not-installed message only when the binary is genuinely absent —
reloading a skill cannot fix that.
- main's three grant-route tests now pin gh onto PATH; without that the
not-installed refusal would answer first on a runner that lacks gh.
|
Conflicts with This PR changes what the model reads: the skill text gains a sentence when a declared command is missing, and Needed before merge: I could not run it on the triage machine: its single Lemonade backend already had four concurrent eval runs against it, and a fifth would have produced a race-corrupted scorecard rather than a measurement. 🔍 Technical detailsThe merge kept both sides' intent rather than either one:
Local verification: 790 passed / 15 skipped across the skill suites, 539 passed / 33 skipped across the shell and skill-prompt suites, |
A missing binary with a substitute still loads the skill; one without a substitute now names the setup route main added. The ungranted-pytest test stubs the binary as installed, which is the case it describes.
|
🟡 The new "not installed" refusal steers the agent away from installing the CLI itself. When a CLI with a guided setup (today Suggested fix: use the new branch only for policies with a 🔍 Technical details
|
|
Folded into #4408, which carries this change together with the other two PRs that rewrite the same refusal branch in the shell tool. Landing any two of the three without the third leaves the guard describing behaviour that no longer exists, so they are being reviewed and tested as one story. Nothing here is dropped. The replay is in #4408's merge commits, and anywhere the two PRs disagreed with each other or with main, the resolution is named in the commit message and called out in the PR description. This PR will be closed once #4408 merges. |
|
Landed on Every commit from this branch is an ancestor of what merged — |
… refuse, one name for full access (amd#4408) Three open PRs rewrite the same refusal branch in the agent's shell tool, and landing any two without the third leaves guard messages describing behaviour that no longer exists. This folds all three into one branch so the shell story can be reviewed and tested as one thing. **What a user gets.** The agent stops refusing work you are sitting right there to approve: `git commit`, `npm test`, `rm notes.txt` are now shown to you and run once you say yes, instead of coming back as a flat "not allowed". A `cd` survives to the next command, so `cd build && cmake ..` followed by `make` works the way it reads. And the coding skill loads on a machine where `pytest` lives only in a virtualenv, which is most machines. Replaces amd#3791, amd#3400 and amd#3808. ### The one decision a reviewer should confirm amd#3400 and amd#3808 forked 143 and 184 commits back, and main moved under both. Where the two disagreed about behaviour, **main's newer design won** and amd#3808's older expectations were updated: - **`git push` stays refused outright** rather than becoming confirmable — amd#3374 made push/reset/rebase refusals that the `git` grant itself will not run. - **Full access keeps the developer command set** rather than lifting the allowlist entirely, so `rm` and `touch` stay out. amd#3808's own later commit ("keep unattended runs narrow; leave shell lifting to amd#3394") is what settled this. If either call is wrong, it is a small edit here rather than a re-merge. <details> <summary>🔍 Technical details</summary> **Merge shape.** `amd#3791` (the only mergeable member) anchors; `amd#3400` and `amd#3808` were merged onto it in that order, each as a `--no-ff` merge whose message records its own resolutions. **One name for full access.** Main carried `console.bypass_permissions` and amd#3808 added `console.full_access` for the same session-wide grant — the naive merge shipped both, which would have been a live bug (`full_access_active()` reading one while `PermissionState` wrote the other). Collapsed onto `full_access`, keeping main's semantics and amd#3808's name: | before | after | |---|---| | `console.bypass_permissions` | `console.full_access` | | `ShellToolsMixin.bypass_gates_active` | `full_access_active` | | `client.PermissionBypasser` (Go) | `client.FullAccessSetter` | | `SetBypassPermissions` (Go) | `SetFullAccess` | | `PermissionState.set_bypass` | `set_full_access` | | stdio control verb `bypass` | `full_access` | The HTTP route keeps its original `/v1/{agent}/sessions/{id}/bypass` spelling — renaming it would break every already-published sidecar. `--bypass-permissions` and the `bypass` control verb stay accepted as retired spellings. **Superseded, deliberately not carried over from amd#3808:** `_resolve_git_subcommand` and `SAFE_GIT_COMMANDS` (main moved `git` into `BINARY_POLICIES` with a read-only ungranted floor), its git-subcommand branch, and its SPEC claim that `/tool_decision` and the session toggle are stdio-only (contract 2.14 gave HTTP both). **`shell_session` is a new bundle, not two more members of `shell`.** Folding `get_shell_state` / `reset_shell_session` into `shell` put it at 7 members, over `MAX_BUNDLE_MEMBERS` — a cap that exists so one pull-in cannot exhaust the dynamic-tool slots. Registered tool count 86 → 88, with `gaia-agent.yaml`, `gaia_agent/__init__.py`, `CAPABILITY_MATRIX.md` and the guide updated together. **Two fixes that fell out of the merge rather than out of any of the three PRs:** - Under full access a shell keyword (`for`, `while`) was reported as "not in the developer command set" instead of being named as control flow. `_validate_bypass_command` now names it, because no mode can run it. - `wait_for_condition` refused a confirmable predicate in front of the prompt — the same dead end the confirm tier exists to remove. **One stale test corrected:** `test_a_pipe_is_refused_for_its_binary_not_for_the_pipe` asserted the exact grant-id refusal for `pytest`, which amd#3791 replaces with a "not installed" refusal wherever `pytest` is not on `PATH`. It passed in CI only because CI has `pytest` on `PATH` — exactly the hidden-state masking CLAUDE.md warns about. It now holds in both machine states. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: f <f@f> Co-authored-by: Kalin Ovtcharov <[email protected]>
…profile pins #4038's docstring trim dropped "call it directly as a tool instead" from run_python's no-tool-access warning, leaving only what NOT to do without the actionable alternative -- restored within the same char budget. Also refreshes test_tool_loader_token_budget.py's doc-profile pins: the tool count drifted from 39 to 44 (and char/token counts with it) as today's merges (#3122, #4021, #3335, #3791, #4376, and others) each added or exposed a doc-profile tool. Re-measured all five values fresh rather than estimating.
GAIA refused its
codingskill whenever thepytestexecutable was not on the global PATH. That is the usual state for a Python project, where pytest lives in a virtualenv. In a benchmark run where models could see and load skills, 42 of 48 attempts to loadcodingwere refused, so models lost the skill's guidance on the very tasks it was written for.A missing command now refuses a skill only when nothing can stand in for it. pytest can: the skill loads, and
load_skilltells the model to run the suite throughexecute_python_filewithpytest.main.ghcannot, so a missingghstill refusesgithub-triage.The refusal also appears to derail models. Every one of 12 benchmark runs that ended in "I had trouble formatting my tool call" had a refused
codingload earlier in the turn; the build before skills became visible had none. It is an association, not a measured cause: a re-run of those cells with this fix will show whether they recover.Closes #3790
Test plan
pytest tests/unit/test_skill_binary_grants.py: a missing pytest resolves without refusing and is reported as unavailable; an installed one is never reported; missingghstill refuses.pytest hub/agents/gaia/python/tests/test_skill_library_tools.py:load_skillon a pytest-declaring skill with pytest off PATH succeeds, returnsunavailable_commands: ["pytest"]with the substitute inwarning, and grants nothing.pytest tests/unit/test_skill_binary_grants.py hub/agents/gaia/python/tests/test_skill_library_tools.py tests/unit/test_starter_skills.py tests/unit/test_skills_manager.py: 523 pass.codingskill with pytest absent from PATH.mainfails with "Skill 'coding' needs the 'pytest' command, which is not on PATH…". This branch loads it with the warning "'pytest' is not on PATH, so this skill'spyteststeps cannot run as written. Run the suite with execute_python_file…".gaia eval agent: it changes what the model is told on skill load. It can't run on this machine (noclaudeCLI for the judge).