fix(core): ignore agent names without active teams#5115
Conversation
✅ Local Linux verification — author's commands, a real-execution harness, and a live agent-spawn sessionVerified this PR three ways on Linux (the PR table marks 🐧 Linux as ⚠ not tested): reproduced the author's commands, drove the compiled Setup
1) Author's Reviewer Test Plan reproduced — all green
The three new/updated tests pass: 2) Real-execution harness against the compiled
|
|
@qwen-code /triage |
|
Thanks for the PR, @he-yufeng! Template looks good ✓ — all required sections present with bilingual translation. On direction: this is a clear, well-scoped bug fix for #5100. The Agent Team feature (#4844) unconditionally exposed On approach: the scope is tight (2 files, +63/-32) and implements exactly the two highest-leverage suggestions from the issue — (1) gate Moving on to code review. 🔍 中文说明感谢贡献,@he-yufeng! 模板完整 ✓ — 所有必需章节齐全,含双语翻译。 方向:这是对 #5100 的明确、范围合理的 bug 修复。Agent Team 功能(#4844)在 schema 中无条件暴露 方案:范围紧凑(2 个文件,+63/-32),精确实现了 issue 中两个最高杠杆的建议 —(1)将 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
wenshao
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅ — qwen3.7-max via Qwen Code /review
Code ReviewBefore reading the diff, my independent proposal for #5100 was: gate The implementation is clean and correct across all three change sites:
No correctness bugs, security issues, or AGENTS.md violations found. Tests are well-targeted: schema visibility in both modes + fallback path verification (103/103 pass). Real-Scenario TestingRan before/after on Linux (Node v22, teams OFF, Before (installed qwen v0.18.0)Model replied directly — avoided the After (this PR via
|
ReflectionThis is the kind of PR you want to see from a community contributor: a tight, well-motivated fix for a real bug that hurts users, with no scope creep. The core insight is correct — the schema/fallback asymmetry (always-visible My independent proposal matched the PR's approach exactly. The implementation is minimal (2 files, +63/-32), the tests are well-targeted (103/103 pass), and the tmux test on Linux confirmed the fallback works end-to-end — a leaked If I had to maintain this in six months, I'd thank the author for keeping it simple. Approving. ✅ 中文说明反思这是你希望从社区贡献者看到的 PR:针对一个真正影响用户的 bug,提供紧凑、动机明确的修复,没有范围蔓延。 核心洞察是正确的 — schema/降级不对称(始终可见的 我的独立方案与 PR 方案完全一致。实现最小化(2 个文件,+63/-32),测试针对性强(103/103 通过),Linux 上的 tmux 测试确认降级端到端有效 — 泄漏的 如果六个月后需要维护这段代码,我会感谢作者保持了简洁。 批准。 ✅ — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
What this PR does
When agent teams are disabled, the Agent tool no longer advertises the teammate-only
nameparameter in its schema. If an older prompt or bundled workflow still sendsnamewithout an active team, the tool now ignores that name and runs the requested agent as a normal one-shot subagent instead of failing immediately.Why it's needed
Fixes #5100. The current schema always exposes
name, while the guidance that explains team usage is only shown when teams are enabled. That gives the model a parameter it can fill even though there is no active team. The resulting hard error is especially painful for/review, where named review agents can turn into repeated failed spawns. Hiding the parameter when teams are off removes the bad steering, and the fallback keeps existing prompts from aborting the task ifnameleaks through anyway.Reviewer Test Plan
How to verify
With teams disabled, inspect the Agent tool schema and confirm
nameis absent. Then call the Agent tool withnameanyway; it should proceed through the normal one-shot subagent path instead of returning a "no active team" error. With teams enabled,nameshould still be present in the schema for teammate spawning.Evidence (Before & After)
Before: the unit test asserted that
namewithout an active team returned a hard "no active team" error and did not load the requested subagent. After: the updated test asserts thatnameis hidden when teams are disabled, visible when teams are enabled, and a leakednamefalls back to the one-shot subagent path.Tested on
Environment (optional)
Windows 11, Node.js v24.15.0, npm 11.12.1.
Validated locally:
Risk & Scope
nameto fail loudly without a team, it now behaves like a normal one-shot agent. That is intentional becausenameis only meaningful for active teams./reviewskill or add a separate repeated-call circuit breaker.Linked Issues
Fixes #5100
中文说明
这个 PR 做了什么
当 agent team 功能关闭时,Agent tool 不再在 schema 中暴露只属于 teammate 场景的
name参数。如果旧 prompt 或内置流程仍然在没有 active team 的情况下传入name,现在会忽略这个名字,并按普通 one-shot subagent 执行,而不是立刻失败。为什么需要
修复 #5100。当前 schema 始终暴露
name,但解释 team 用法的 guidance 只有在 team 功能启用时才出现。这会让模型看到一个可填的参数,却不知道它需要 active team。对/review这种会命名多个 review agent 的流程来说,这个 hard error 很容易变成重复失败调用。关闭 team 时隐藏参数可以避免错误引导;fallback 则保证历史 prompt 即便传入name也不会直接中止任务。Reviewer Test Plan
如何验证
在 team 功能关闭时,检查 Agent tool schema,确认没有
name。然后即使手动传入name,也应该进入普通 one-shot subagent 路径,而不是返回 “no active team” 错误。team 功能开启时,name仍然应该出现在 schema 中,用于 teammate spawn。前后证据
修改前:单测断言没有 active team 时传入
name会返回 hard error,并且不会加载目标 subagent。修改后:单测断言 team 关闭时name被隐藏,team 开启时name可见,并且泄漏进来的name会降级到 one-shot subagent 路径。本地验证环境
Windows 11,Node.js v24.15.0,npm 11.12.1。已本地运行上方列出的格式、lint、单测、typecheck、build 和 diff check。
风险与范围
name只有在 active team 下才有 teammate 语义。/reviewskill,也没有单独增加重复调用熔断器。