feat(team): team enhancements, subagentModel, parallel tool exec#3250
feat(team): team enhancements, subagentModel, parallel tool exec#3250TheArchitectit wants to merge 1 commit into
Conversation
4f5e558 to
42002e5
Compare
|
发现并修复: preflight_skips_unknown_models 测试失败 根因: 修复: catch-all 应返回 修改: 验证: ✅ 建议直接 rebase 到最新 main (main 上已经是 |
42002e5 to
9574dcc
Compare
|
感谢发现这个问题!你说得对,catch-all 应该返回 |
|
Nice work on the subagentModel fix — that was a real gap where /setup saved the model but RuntimeConfig never surfaced it. The team coordination layer looks clean. One thing: cargo fmt is failing, you'll want to run cargo fmt --all and push before this can land. |
Port the agent-team enhancement layer onto upstream/main so the model can spin up coordinated sub-agent teams for parallel work. subagentModel config wiring (fix): - Add subagent_model field to RuntimeFeatureConfig + RuntimeConfig::subagent_model() accessor so the subagentModel setting (already validated by config_validate.rs) is now actually read and stored. - Agent tool's resolve_agent_model falls back to subagentModel from config when no explicit model is passed. Provider namespace separation: - New 'custom-openai' provider kind with dedicated env vars (CLAWCUSTOMOPENAI_API_KEY / CLAWCUSTOMOPENAI_BASE_URL) - /setup wizard saves kind: 'custom-openai' for option 5 - Bare model name normalized to 'custom/' prefix to avoid proxy 404s - Sub-agents inherit /setup-saved provider config via inject_config_as_env_fallbacks Parallel tool execution: - Override execute_batch to classify read-only tools as parallel-safe and run them concurrently via std::thread::scope - Results return in original model order Team coordination layer: - AgentMessage, TaskClaim, TeamStatus tools + shared mailbox directory - Mode presets (tiny/1x ... mega/6x) + enriched TeamCreate/Agent descriptions - Background team watcher - /team slash command: on/off/status/toggle Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
45a1851 to
d500c65
Compare
Summary
Ports the agent-team enhancement layer onto main so the model can spin up
coordinated sub-agent teams for parallel work. 2,095 lines added across 11 files
— zero deletions of existing upstream functionality.
Single clean commit built from
upstream/main. No TUI, LSP, or setup-wizardcontamination from other in-flight work.
Motivation
The
TeamCreate,TeamDelete, andAgenttools already existed, but theydidn't work end-to-end because:
subagentModelwas silently dropped —/setupsaved the sub-agent modelinto
settings.jsonbutRuntimeConfignever stored or exposed it, soagents always fell back to a hard-coded default.
inject_config_as_env_fallbacks()to setCLAWCUSTOMOPENAI_API_KEY/CLAWCUSTOMOPENAI_BASE_URLfrom/setup-saved config, but the sub-agentspawn path in
toolsnever did, so custom providers were invisible.providerFallbacks.primarysilently overrode the agent's model — theconfigured fallback primary replaced whatever model
resolve_agent_modelpicked, routing agents to a dead model instead of the session's provider.
so the fallback chain never advanced to working models.
This PR fixes all four and adds the team coordination tools the model needs
to orchestrate multi-agent work.
What's included
1.
subagentModelconfig wiring (bug fix)The
subagentModelfield was validated byconfig_validate.rsbut neverstored or read — the setting from
/setupwas silently dropped.RuntimeFeatureConfig.subagent_modelfieldruntime/src/config.rsRuntimeConfig::subagent_model()accessorruntime/src/config.rsparse_optional_subagent_model()(readssubagentModel/subagent_model, blank →None)runtime/src/config.rsruntime::inject_config_as_env_fallbacks()— moved from privatemain.rsfn topub fnin runtime so sub-agents can call itruntime/src/config.rs+runtime/src/lib.rsresolve_agent_modelfallback chain: explicit model →subagentModel→ session provider model →DEFAULT_AGENT_MODELtools/src/lib.rs2. Parallel tool execution (perf)
When the model emits multiple
tool_useblocks in one response, read-onlytools now run concurrently via
std::thread::scopeinstead ofsequentially.
Parallel-safe tools:
read_file,glob_search,grep_search,WebFetch,WebSearch,ToolSearch,Skill,LSP,GitStatus,GitDiff,GitLog,GitShow,Agent,AgentMessage,AgentSuggestion,TeamStatus,TeamInfo,TaskGet,TaskList,TaskOutputSequential tools: everything else (writes, side-effects)
ToolCall,ToolResult,TurnProgressReporterre-exported from runtimeruntime/src/conversation.rs+runtime/src/lib.rsToolExecutor::execute_batchdefault impl on traitruntime/src/conversation.rsCliToolExecutor::execute_batchoverride with parallel-safe classificationrusty-claude-cli/src/main.rs3. Team coordination layer (feature)
New tools and capabilities for multi-agent work:
TeamCreateTeamDeleteTeamStatusAgentMessageTaskClaimAgentSuggestionSupporting infrastructure:
~/.clawd-agents/mailbox/team/{team_id}/.jsonfiles every 2s,prints
[team]progress to stderr, writes events to-events.jsonltiny/1xthroughmega/6xcontrolling agent countand role distribution (Explore, Plan, Verification, Reviewer)
/teamslash command —on|off|statusto toggleCLAWD_AGENT_TEAMS(required by
TeamCreate)TeamCreateandAgentsteering themodel toward correct usage
4. Model-resolution robustness fixes (bug fix)
qualify_for_provider()claude-haiku-4-5-20251001) getcustom/prefix when the active provider iscustom-openai, so sub-agents route through the same endpoint as the main sessionproviderFallbacks.primaryprecedenceproviderFallbacks.primary+fallbacksare appended as recovery entries, deduped. Previously the config primary silently replaced the caller's modelfallback_chain_eligible()that treats 404/400 "not found" as chain-eligible, so a dead configured primary advances tokimi/qwen/etc. AddedApiError::status_code()andresponse_body()accessors for the detection/setupcredentialsrun_agent_job()callsruntime::inject_config_as_env_fallbacks()before building the agent runtime, so custom providers set up via/setupwork for spawned agents5. Also fixed
lane_completion.rstest helper set staleteam_id/task_idfieldstools/src/lane_completion.rs/teamslash command had novalidate_slash_command_inputmatch arm (parsed asUnknown)commands/src/lib.rsApiErrorgainsstatus_code()andresponse_body()public accessorsapi/src/error.rsmodel_token_limitcatch-all:_ => Some(...)→_ => None— unknown models skip preflight, let API enforce limits (caught by @Offwhite-Del)api/src/providers/mod.rsLspvariant added to match armscommands/src/lib.rs+rusty-claude-cli/src/main.rsDEFAULT_CUSTOM_OPENAI_BASE_URLconstant addedapi/src/providers/openai_compat.rstools/src/lib.rsVerification
Build
Tests
Live testing (IdleDefense repo, Godot 4.6 game)
/team on→ TeamCreate with 4 agents → all agents spawned, claimed tasks, read filescustom/openclawprovider (viaqualify_for_provider)TeamStatusshowed live progress, inbox messages, task claimsmax_iterationsor simplify prompts for large repos)Diff stats
Key files
tools/src/lib.rsruntime/src/conversation.rsruntime/src/config.rsapi/src/error.rsapi/src/providers/mod.rsWhat this does NOT include
This PR is purely additive on top of upstream/main. It does not include:
🤖 Generated with Claude Code