fix(skills): download roster members' skills, not just the coordinator's - #1874
Open
Chirag6722 wants to merge 1 commit into
Open
fix(skills): download roster members' skills, not just the coordinator's#1874Chirag6722 wants to merge 1 commit into
Chirag6722 wants to merge 1 commit into
Conversation
download_session_skills iterated session.agent.skills only. In a multiagent
session the roster members' skills live at session.agent.multiagent.agents[*]
.skills and were never fetched.
Subagent threads share the coordinator's container filesystem, so on a
self-hosted environment a subagent ran with its skills missing from
{workdir}/skills/. Nothing raised: the thread simply behaved as though the
skill were not attached, and the only symptom was worse output.
Roster entries are a discriminated union and only thread agents carry skills
-- advisors have no such attribute -- so the type is checked rather than the
attribute. Skills shared by several members are yielded once, because each
download rmtree's its destination before extracting.
Sessions without a roster are unaffected.
Closes anthropics#1870
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.
The problem
download_session_skillscollects skills fromsession.agent.skillsonly:In a multiagent session the roster members' skills live at
session.agent.multiagent.agents[*].skills, and were never fetched. Since subagent threads share the coordinator's container filesystem, a self-hosted worker ran subagents with their skills absent from{workdir}/skills/.Nothing raised. The thread behaved as though the skill were not attached, so the only symptom was degraded output — which is what makes it worth fixing rather than merely wrong.
grep -rn multiagent src/anthropic/lib/still returns nothing, so this is the first place the lib layer learns the roster exists.The fix
A
_session_skillshelper yields the coordinator's skills followed by each roster member's, anddownload_session_skillsiterates that instead.Two details drove the shape of it:
Roster entries are a discriminated union.
BetaManagedAgentsSessionMultiagentCoordinator.agentsisList[Agent]whereAgent = Union[BetaManagedAgentsSessionThreadAgent, BetaManagedAgentsAdvisor]. Thread agents carryskills; advisors have onlymodelandtype. So the entries are filtered onagent.type == "agent"rather than by probing for the attribute — the obviousfor a in agents: a.skillsraisesAttributeErroron any roster containing an advisor.Shared skills are yielded once. The download loop
rmtrees each destination before extracting, so a skill attached to both the coordinator and a member would tear down and redo work already completed. Dedupe is keyed on(skill_id, version), so the same skill pinned to two versions is still fetched twice — those are different archives.Sessions with no
multiagent, or with an empty roster, are unchanged.Tests
Six cases in
tests/lib/tools/test_skills.py, matching the file's existing style of exercising the private helpers directly:Full file on this branch:
7 failed, 19 passed. On unmodifiedmainthe same file is7 failed, 13 passed— the seven are pre-existing failures on Windows in the Unix file-mode tests (test_zip_preserves_executable_bitand friends, asserting0o755where Windows reports0o666), unrelated to this change. I ran them with--noconftestbecausetests/conftest.pyimportshttp_snapshot, which I could not install.ruff checkandruff format --checkare clean on both files.Closes #1870