Repository navigation
fix(skills): a loaded skill brings the tools it declares - #4369
Conversation
Loading a skill left its declared tools out of the prompt, so every skill-driven task spent an extra round trip on load_tools (e.g. load_skill github-triage followed by load_tools shell) before it could act. The loaded skills' tools_required now feed the tool loader's SKILL signal, ahead of recalled-procedure tools and deduped. A shell:execute:<binary> grant also admits run_shell_command. Unloading a skill drops its contribution, and admission stays cap-bound. Fixes #3901
…stop rotating A loaded skill's tools used to take dynamic tool slots every turn, even on turns its instructions were hidden, and a skill needing more tools than the free slots swapped its own tools in and out each turn. Now only skills whose body renders this turn feed the tool loader (the body filter runs first so it is current), and a requested tool that is already loaded is held for the turn instead of being evicted by the next pick. The shell-tool check reads the skill's live binary grant rather than re-parsing its permissions every turn.
# Conflicts: # src/gaia/agents/base/agent.py # tests/unit/test_skill_discovery_integration.py
|
Verdict: Approve with suggestions The fix is correct and the test coverage is thorough. The ordering swap ( One 🟡 to address and one nit: 🟡 🟢 🔍 Technical detailsCHANGELOG gap
Type-safety gap active = self._active_skill_names()
assert active is not None # guarded by the active_filter is None early-return aboveOr narrow Eval gate |
|
Verdict: Approve with suggestions. Loading a skill now also brings the tools that skill says it needs, so the model stops burning a turn asking for them — a real win, cleanly scoped and well covered by tests. One thing to know before trusting the headline number: when the model loads a skill in the middle of answering, the tools still don't arrive until the user's next message, so the extra Follow-ups worth doing:
Real-world evidence
🔍 Technical details🟡 The SKILL signal doesn't apply on the turn
|
…md#4374) Replicates amd#4145 (`kovtcharov/gaia` fork, push access blocked) onto a branch this session can push to. No content changes beyond conflict resolution against current `main`. GAIA could claim it saved a file it never wrote this turn, or turn a long workshop transcript into a condensed list presented as complete. Now a save counts only when that exact file was written and read back, and a long document is extracted page by page into a full inventory in which every item keeps a verbatim quote from the source. The result is kept in memory, and anything unfinished is reported as incomplete. Ordinary questions ("What time does the store close?") behave exactly as on `main`. Fixes amd#3983 and amd#4141; related to amd#4009. Closes amd#4145. ## Test plan - [x] `python -m pytest tests/unit/agents/ -q`: 1,663 pass, 51 skip. The one failure (`test_symlinked_directory_is_the_same_output`) is this Windows box lacking the symlink privilege, not the code. - [x] `python -m pytest tests/unit/ -k "memory" -q`: 1,136 pass. The one failure (`test_memory_discovery.py::TestCredentialManagerContractShape`) reproduces on pristine `main`. - [x] `python -m pytest tests/unit/ -k "inventory or transcript or overlap or youtube or extract" -q`: 547 pass; remaining failures are a local `mcp` package version mismatch and a live-Lemonade ASR test. - [x] `black --check` / `isort --check-only` clean on every touched file. - [ ] Reporter check: Patrick reruns the original workshop transcript. - [ ] Judged `gaia eval agent` run: deferred by maintainer; the completion gate changes final answers, so decide before merge. <details> <summary>🔍 Technical details</summary> **What a reviewer should know** - **Saves** - A request that names a file, folder or disk is a hard obligation: the file must be written and read back this turn. - A save claim is checked hard when a save was requested, a disk tool ran, or the answer says "I" or "we" saved something. Any other claim gets one correction and then stands, as on `main`. - A file written through the shell counts only when a successful call modified it. The agent's scratch folder never counts as the user's save. - **Extraction** - Pages are 4K characters with 600 characters of overlap, snapped to a line, sentence or word boundary. Each page gets two passes, a retry on an unusable reply, and a 16K-token output budget. - Cloud models are asked for no reasoning: a reasoning model spent 50–100 s per page and ran past the 30-minute limit on a 74K file. - Quote matching ignores case and spacing, but only on whole words. The stored quote is always the source text at its exact offsets. - An item is placed by the span of its name when the name is copied from the quote, otherwise by its quote. - Merging never fails a run and never drops an item. Differing descriptions are both kept, and uncertain cases keep both entries, marked "(may repeat item N)". - **Exports** - JSON records give each field its own key and CSV gives each field its own column. The framework reads the saved file back in full and requires an exact match, and hand edits to it are refused. **Adversarial coverage (from amd#4145)** - A planted-item oracle (about 20,000 items, repeated names, paraphrased labels, repeats across pages and passes) finds no lost, absorbed or wrongly merged items. - In 60,000 hostile replies, no exception escaped the tool, and every quote matched the source at its offsets. - Live runs on Fireworks `deepseek-v4p1-flash` against real YouTube auto-captions of 13K, 21K and 74K characters; the 74K end-to-end agent run saved and verified 111 items in 122 s. Local Gemma-4-E4B completed the 13K file (63 items). **Conflicts resolved against current `main`** Two, both in `src/gaia/agents/base/agent.py`, plus an additive one in the flagship `CHANGELOG.md`: 1. **Turn-sealing order vs. amd#3707 (mid-turn followups).** `main` added a `_drain_followups` check that re-enters the loop rather than sealing the answer; amd#4145 replaced the same lines with `finalize_answer` + the completion-evidence gate. Kept both, drain first: a late user message still gets folded into the running turn, and the completion gate then runs on the answer that actually seals. 2. **Duplicated `_refresh_active_skill_filter` vs. amd#4369 (a loaded skill brings its tools).** amd#4369 hoisted that call to *before* `_refresh_active_tool_filter`; amd#4145 still carried it in its old position below, so a naive merge called it twice per turn. Dropped the duplicate and kept `main`'s hoisted call — the extraction block that follows reads `_active_skill_filter`, so running it earlier is strictly correct. **Verification of the resolution** - Per-file diff of (merge-base → amd#4145 head) against (current `main` → this branch): byte-identical on every file except the one blank line the de-duplication above removes. That rules out the silent near-identical duplication a large auto-merge can introduce. - `compile()` (not just `ast.parse`, which does not reject repeated keyword arguments) over every `.py` in `src/`, `tests/`, `hub/` and `scripts/`: clean. Repo-wide sweep for stray conflict markers: none. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: f <f@f>
Replicates #3903 (kovtcharov/gaia fork, push access blocked) onto a branch this session can push to.
Loading a skill used to leave the tools it declares out of the prompt, so the model had to spend an extra round trip on
load_toolsbefore doing anything. In a 168-run benchmark,load_skill github-triagewas followed by a manualload_tools shellin almost every run (45 calls), and some runs failed before they got there. Now a skill's declared tools are admitted on every turn its instructions are in the prompt. That includes the shell tool whenever the skill grants a CLI such asgh, even if the skill forgot to list it. A skill whose instructions are hidden this turn, or that was unloaded, holds no tool slots.Admission stays under the loader's existing tool cap. A skill that needs more tools than the free slots keeps the same ones each turn instead of rotating them. Tools from procedures recalled from memory still flow in unchanged, after the active skills' tools.
Fixes #3901
Three things changed during conflict resolution against current main, all forced by #3765 landing first:
tests/unit/test_skill_discovery_integration.py, which is where the original PR's turn-ordering test lived. It is re-homed intotests/unit/test_chat_dynamic_tools.pyand now expects["bodies", "tools"]— feat(skills): show the model every installed skill instead of guessing one #3765 also removed the proactive per-turn skill discovery step the old assertion named.tools_requiredof whichever skills are active this turn. The two calls are swapped.No other content changes.
Test plan
pytest tests/unit/test_chat_dynamic_tools.py tests/unit/test_tool_loader_selection.py tests/unit/test_chat_tool_bundles.py tests/unit/test_skill_loader.py— 105 passed. New tests load the realgithub-triageskill and check the shell tool is admitted, the unload path, a skill hidden by the body filter, a grant-only skill, cap enforcement, and ordering and dedup with recalled procedures.pytest tests/unit/test_skill_sets.py tests/unit/test_starter_skills.py tests/unit/test_skill_binary_grants.py tests/unit/test_agent_lazy_skill_prompt.py tests/unit/test_adaptive_skills.py tests/unit/test_skills_consume.py— 817 passed, 15 skipped.pytest tests/unit/test_memory_mixin.py hub/agents/gaia/python/tests/test_skill_prompt_budget.py— 315 passed._process_query_implmakes it fail.python util/lint.py --black --isortclean.gaia eval agent): this changes which tools reach the prompt, so it needs an eval before merge. Runs in the self-hosted CI job now that the branch is on amd/gaia.