Skip to content

fix(skills): download roster members' skills, not just the coordinator's - #1874

Open
Chirag6722 wants to merge 1 commit into
anthropics:mainfrom
Chirag6722:fix/1870-roster-skills
Open

fix(skills): download roster members' skills, not just the coordinator's#1874
Chirag6722 wants to merge 1 commit into
anthropics:mainfrom
Chirag6722:fix/1870-roster-skills

Conversation

@Chirag6722

Copy link
Copy Markdown

The problem

download_session_skills collects skills from session.agent.skills only:

for skill in session.agent.skills:

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_skills helper yields the coordinator's skills followed by each roster member's, and download_session_skills iterates that instead.

Two details drove the shape of it:

Roster entries are a discriminated union. BetaManagedAgentsSessionMultiagentCoordinator.agents is List[Agent] where Agent = Union[BetaManagedAgentsSessionThreadAgent, BetaManagedAgentsAdvisor]. Thread agents carry skills; advisors have only model and type. So the entries are filtered on agent.type == "agent" rather than by probing for the attribute — the obvious for a in agents: a.skills raises AttributeError on 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:

  • no roster — unchanged single-agent behaviour
  • roster members' skills are included
  • an advisor in the roster is skipped rather than raising
  • a skill shared by coordinator and member is yielded once
  • the same skill at two versions is not collapsed
  • an empty roster behaves like no roster
tests/lib/tools/test_skills.py -k session_skills   ->  6 passed

Full file on this branch: 7 failed, 19 passed. On unmodified main the same file is 7 failed, 13 passed — the seven are pre-existing failures on Windows in the Unix file-mode tests (test_zip_preserves_executable_bit and friends, asserting 0o755 where Windows reports 0o666), unrelated to this change. I ran them with --noconftest because tests/conftest.py imports http_snapshot, which I could not install.

ruff check and ruff format --check are clean on both files.

Closes #1870

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Managed Agents self-hosted worker: download_session_skills skips roster agents' skills, so subagent threads run without them

1 participant