Bug: foreground one-shot subagents (workflow/ralph/run_in_background:false) fail on any tool call when Agent Teams is mounted #5550
NingYuanLee
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Bug: foreground one-shot subagents (workflow/ralph/
subagentwithrun_in_background: false) fail on any tool call when Agent Teams is mountedSummary
When the experimental Agent Teams layer is mounted (host rows from
dsh-experimental-agent-team-profile), any foreground, one-shot child that calls a tool fails its whole run — includingworkflowagent(),ralphrounds, and plainsubagentwithrun_in_background: false. Pure-text replies succeed; background/continuable children (default backgroundsubagent, Agent Teams teammates) are unaffected.Observed symptoms:
subagentcallingtodo_write/read→ tool resultsubagent run failed(stopReasonerror, empty output)workflowagent()requiring any tool → resolvesnull(child failed)ralphround requiring any tool →Ralph round N child failed before producing a structured reportRoot cause
A window between a one-shot child's creation and the appending of its
subagent/descriptorevent:packages/subagent/subagent-in-process-driver/src/index.ts:81-91,attachDescriptorAppend) appends thesubagent/descriptorevent only at the child's first pre-step, after the prompt assembly has run (agent/pre-step→await next()→ append).agent/createdfires during publication, before that first pre-step. At that moment the roster'stryMembershipfinds no descriptor event in the child's own events, soTeamRoster.tryMembershipfalls through to the "implicit root Team" fallback (packages/experimental/agent-team/src/roster.ts) and classifies the one-shot child as a Team Lead.dsh-experimental-tool-agent-team(maybeInstall,tool-agent-team/src/index.ts:404-409) therefore installs the Team policy section + ten Team tools into that child's scope.team:policysection text callsctx.agentTeams.membership(agent); by then the descriptor event has been appended, sotryMembershipnow correctly returnsundefinedandmembership()throwsTEAM_NOT_MEMBER.kind: 'error'→stopReason: 'error'→ foreground caller seesnull/subagent run failed.Session-log evidence from a failing child (
tool/call→tool/resultok →turn/endreason{"kind":"error","error":{"message":"agent \"…\" is not a member of an active Agent Team","code":"UNKNOWN"}}, no second step, no assistant text).Continuation children (background subagents, teammates) are immune because their descriptor is seeded before publication (
descriptor-seed.tsused bycontinuation.ts), soagent/createdobservers classify them correctly.Proposed fix
Classify provider-owned children by the durable session header (
origin: 'subagent', written at creation bychildSessionMeta) rather than by the deferred log event alone. Minimal change inroster.tssubagentDescriptor():plus a regression test asserting a provider child is not treated as a Team Lead before its descriptor event exists.
Reproduction
Deployment: source checkout,
webprofile with@deepseek-ai/dsh-experimental-agent-team-profile(+-web-profile) bundles; default agent preset. Steps: run the foregroundsubagenttool withrun_in_background: falseand ask it to callreadortodo_write; or run aworkflowscript whoseagent()prompt requires reading a file; or aralphobjective requiring a tool.Environment
All reactions