Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix:修复CodeAdapter复写DeepAdapter函数不匹配问题

openJiuwen-bot11a148a75e89
diff --git a/jiuwenclaw/server/runtime/agent_adapter/interface_code.py b/jiuwenclaw/server/runtime/agent_adapter/interface_code.py
index 3542e7a068..1f783e7ca5 100644
--- a/jiuwenclaw/server/runtime/agent_adapter/interface_code.py
+++ b/jiuwenclaw/server/runtime/agent_adapter/interface_code.py
@@ -172,7 +172,8 @@ class JiuwenClawCodeAdapter(JiuWenClawDeepAdapter):
raise RuntimeError("sys_operation is not available, maybe task is not running")
self._sys_operation = sys_operation
- configured_subagents = self._build_configured_subagents(model, config, config_base) or []
+ configured_subagents, _should_add_general = self._build_configured_subagents(model, config, config_base)
+ configured_subagents = configured_subagents or []
self._instance = create_deep_agent(
model=model,
@@ -510,7 +511,7 @@ class JiuwenClawCodeAdapter(JiuWenClawDeepAdapter):
model: Model,
config: dict[str, Any],
config_base: dict[str, Any] | None = None,
- ) -> list[Any] | None:
+ ) -> tuple[list[Any] | None, bool]:
"""Build subagents for code mode: explore_agent + plan_agent + code_agent + browser_agent.
explore_agent / plan_agent 固定挂载(Code 模式核心子代理)。
@@ -607,7 +608,7 @@ class JiuwenClawCodeAdapter(JiuWenClawDeepAdapter):
)
)
- return subagents or None
+ return subagents or None, False
# ─── Rail 生命周期(mode切换) ───────────────────
diff --git a/tests/system_tests/test_project_memory.py b/tests/system_tests/test_project_memory.py
index dd6cef2694..0670e3a99d 100644
--- a/tests/system_tests/test_project_memory.py
+++ b/tests/system_tests/test_project_memory.py
@@ -395,7 +395,7 @@ class TestExploreAgentSubagentIntegration:
)
# Config without subagents key — explore_agent should be default-enabled
- subagents = adapter._build_configured_subagents(model, {"max_iterations": 8}, {})
+ subagents, _should_add_general = adapter._build_configured_subagents(model, {"max_iterations": 8}, {})
assert subagents is not None
names = [s.agent_card.name for s in subagents]
assert any(n.lower() == "explore" or n == "explore_agent" for n in names)
@@ -428,7 +428,7 @@ class TestExploreAgentSubagentIntegration:
)
# explore_agent 的 enabled: False 被忽略,仍然挂载
- subagents = adapter._build_configured_subagents(
+ subagents, _should_add_general = adapter._build_configured_subagents(
model,
{"max_iterations": 8, "subagents": {"explore_agent": {"enabled": False}}},
{},
@@ -464,7 +464,7 @@ class TestExploreAgentSubagentIntegration:
)
# Config with explore_agent having custom max_iterations
- subagents = adapter._build_configured_subagents(
+ subagents, _should_add_general = adapter._build_configured_subagents(
model,
{"max_iterations": 8, "subagents": {"explore_agent": {"max_iterations": 5}}},
{},