Skip to content

fix(team): stabilize MCP injection pipeline and unify backend whitelists#2152

Merged
zhuqingyv merged 30 commits intomainfrom
fix/team-mcp-injection-stability
Apr 10, 2026
Merged

fix(team): stabilize MCP injection pipeline and unify backend whitelists#2152
zhuqingyv merged 30 commits intomainfrom
fix/team-mcp-injection-stability

Conversation

@zhuqingyv
Copy link
Copy Markdown
Collaborator

@zhuqingyv zhuqingyv commented Apr 7, 2026

Summary

Stabilizes the team MCP injection pipeline and unifies the solo-to-team flow across all three backends (Claude, Gemini, Codex).

MCP Injection Pipeline Stability

  • Add IPC-based mcpStatus events to track TCP server → session injection → load lifecycle phases
  • Fix race conditions where MCP servers were injected before TCP was ready
  • Guard loadSession to pass mcpServers directly instead of relying on stale config state
  • Auto-build MCP server bundles in dev mode (build-mcp-servers.js runs on main process rebuild)

Backend Whitelist Unification

  • Introduce TEAM_SUPPORTED_BACKENDS (Set(['claude', 'codex', 'gemini'])) in teamTypes.ts as the single source of truth
  • Eliminate TEAM_GUIDE_BACKENDS — all references now use TEAM_SUPPORTED_BACKENDS
  • Frontend UI, backend spawn validation, leader prompt available-types, and MCP tool injection all derive from the same set

Extend Solo-to-Team to Gemini & Codex (Claude already supported)

  • System-level agent type injection: AION_MCP_BACKEND env var injected into stdio bridge at spawn time — replaces LLM-dependent agentType parameter for all backends
  • Team guide prompt for Gemini: inject getTeamGuidePrompt('gemini') into GeminiAgentManager.createBootstrap() so Gemini knows when/how to recommend teams
  • Correct conversation type: AionMcpService.handleCreateTeam now uses getConversationTypeForBackend(agentType) instead of hardcoded 'acp' — fixes Gemini leader crash (red status) after team creation
  • Prompt fix for ask_user: changed prompt from "STOP and wait" to "Output text and END YOUR TURN. Do NOT call ask_user or any tool" — prevents Gemini from calling tools to ask for confirmation
  • Remove agentType from MCP tool schema: the system injects backend type via env var, removing LLM's ability to pass wrong type

Team Mode Enhancements

  • Add sessionMode to TTeam for persisting permission mode across agent spawns
  • Add ITeamListChangedEvent IPC event for frontend team list refresh
  • Remove CodeBuddy references and filter custom assistants from team creation
  • Fix WebUI hash navigation to prevent blank screen on WebSocket auth expiry

Testing

  • 3795 tests passing, 0 type errors
  • New test suites: teamGuideWhitelist.test.ts, aionMcpServer.test.ts (backend injection), teamMcpServerEvents.test.ts
  • Updated: AcpAgentManagerSkillInjection.test.ts (Gemini now expects team guide injection)

Test plan

  • Solo Claude agent: receives team guide MCP tools, recommends team for multi-file tasks, creates claude-type team
  • Solo Gemini agent: receives team guide prompt + MCP tools, recommends team, creates gemini-type leader (not claude)
  • Solo Codex agent: same flow, creates codex-type leader
  • Team creation: leader starts with correct conversationType (gemini→gemini, claude→acp)
  • After aion_create_team: agent calls aion_navigate to redirect user
  • Packaged build: aion-mcp-stdio.js unpacked from asar, AION_MCP_BACKEND read at runtime
  • MCP status events visible in team debug panel

zhuqingyv and others added 18 commits April 7, 2026 16:09
- Add ipcBridge import to AcpAgent for MCP status events
- Add team IPC bridge import to TeamMcpServer

Full changes in progress: Codex session/load fix, IPC status events,
whitelist expansion (codebuddy/gemini), TCP error logging.
- Fix Codex session/load hardcoded mcpServers: [] (tools lost on resume)
- Add TeamMcpPhase/ITeamMcpStatusEvent types for injection observability
- Add team.mcpStatus IPC channel for frontend status tracking
- Emit IPC events: tcp_ready/tcp_error, session_injecting/session_ready/degraded/session_error, load_failed
- Expand TEAM_ALLOWED_BACKENDS: add codebuddy, gemini
- Expand MCP_CAPABLE_TYPES: add gemini
- Add codebuddy to frontend TEAM_SUPPORTED_BACKENDS
- Add TCP error stderr logging in team-mcp-stdio bridge
- Add conversation.extra write failure IPC event
…auth expiry

When WebSocket receives auth-expired or 1008 close code, the redirect
to login page used window.location.href = '/login' which triggers a
full page reload. With HashRouter, the reload lands on an empty hash
(#/) and the WebSocket is still disconnected, so status stays
'checking' forever → blank screen.

Fix: use window.location.hash = '/login' to navigate within the SPA
without reloading the page.
- Add team-mcp-stdio bridge as a self-contained ESM bundle for better integration.
- Introduce new Playwright test commands for team-related end-to-end testing.
- Update TEAM_SUPPORTED_BACKENDS to include 'gemini' and remove 'codebuddy'.
- Refactor MCP server handling to ensure team mode agents are properly validated and injected.
- Improve error handling and logging for MCP server initialization and agent communication.
- Update XML fallback instructions to always provide a coordination path for agents.
Add a dev-only Vite plugin that runs build-mcp-servers.js after each
main process bundle, so team-mcp-stdio.js is always available without
a manual build step.
- Remove index.html (Vite build artifact, should not be committed)
- Remove docs/research/ (investigation notes, not production code)
…ion logic

- Choose stash version (options object style) for loadSession signature
- Use doSession inner function pattern for cleaner error handling
- Retain teamId bypass for busy check in AcpSendBox and GeminiSendBox
Restore 9 test files that were deleted and 6 that had cases trimmed,
bringing tests back to parity with the main branch.
These research documents pre-exist on main and were mistakenly removed
in 0921063. Only branch-specific research docs should have been deleted.
loadSession now receives mcpServers as a direct array parameter instead
of wrapped in an object. Update test expectations accordingly.
@zhuqingyv zhuqingyv changed the title fix(team): stabilize MCP injection pipeline with status events fix(team): 稳定 MCP 注入管线,支持三种 Agent 后端 Apr 9, 2026
…n-stability

# Conflicts:
#	src/common/types/teamTypes.ts
#	src/process/team/TeammateManager.ts
#	tests/integration/team-real-components.test.ts
@zhuqingyv zhuqingyv marked this pull request as ready for review April 10, 2026 00:17
@zhuqingyv zhuqingyv changed the title fix(team): 稳定 MCP 注入管线,支持三种 Agent 后端 fix(team): stabilize MCP injection pipeline for all agent backends Apr 10, 2026
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Apr 10, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Apr 10, 2026

Code Review:fix(team): stabilize MCP injection pipeline for all agent backends (#2152)

变更概述

本 PR 修复了 Codex session/load 传参错误导致团队工具在会话恢复时丢失的问题,新增了 MCP 注入生命周期 IPC 事件(tcp_readysession_injectingsession_ready/degraded/session_error),并将 Gemini 纳入团队支持后端白名单。同时整合了三处重复的 TEAM_SUPPORTED_BACKENDS 定义为单一来源,修复了 SPA HashRouter 中 WebSocket 认证失效后的空白页 bug,并将 XML fallback 改为始终启用的防御性设计。


方案评估

结论:✅ 方案合理

核心修复(Codex session/load 直接传 mcpServers 数组而非嵌套对象、单一来源 TEAM_SUPPORTED_BACKENDS、XML fallback 始终启用)思路清晰、与项目架构一致。MCP 状态 IPC 事件链设计合理,前端可观测性提升有据可查。会话注册延迟到 MCP 服务器完全启动后再加入缓存的逻辑修复了竞态问题。Gemini 允许列表扩展与 config.ts 的自动审批保持一致,是完整的实现。


问题清单

🟡 MEDIUM — electron-builder.yml 中 extraResources 条目引用不存在的文件

文件electron-builder.yml,第 117–120 行

问题代码

# Team MCP stdio bridge: bundled self-contained ESM, placed at
# {resourcesPath}/scripts/team-mcp-stdio.mjs to match resolveProjectRoot() path
- from: out/main/team-mcp-stdio.mjs
  to: scripts/team-mcp-stdio.mjs

问题说明

  1. scripts/build-mcp-servers.js 的 esbuild 输出是 out/main/team-mcp-stdio.js(CJS),从未生成 .mjs 文件
  2. TeamMcpServer.ts:148 也是查找 team-mcp-stdio.js(无 .mjs 扩展名),运行时通过已有的 asarUnpack 条目正常工作
  3. 注释中提到的 resolveProjectRoot() 函数在整个代码库中不存在
  4. 若 electron-builder 在打包时遇到缺失的 from 文件会报错,可能导致发版流水线故障

修复建议:删除此无效条目(功能已由预存 asarUnpack 条目正确处理)。


🔵 LOW — TeamMcpServer.ts 中存在未使用的导入

文件src/process/team/TeamMcpServer.ts,第 14 行

问题代码

import { team as teamIpcBridge } from '@/common/adapter/ipcBridge';

问题说明teamIpcBridge 在文件中从未被引用,所有 IPC 调用均通过 ipcBridge.team.* 进行(来自第 13 行的 import { ipcBridge } from '@/common')。

修复建议:删除此行。


🔵 LOW — xmlFallbackAdapter.tsoptions 参数未使用

文件src/process/team/adapters/xmlFallbackAdapter.ts,第 126 行

问题代码

export function createXmlFallbackAdapter(options?: { hasMcpTools?: boolean }): TeamPlatformAdapter {

问题说明:PR 将 XML fallback 改为始终启用(buildPayload 不再检查 options?.hasMcpTools),options 参数已成为死代码。oxlint 将此标记为 no-unused-vars

修复建议:移除 options 参数并同步更新所有调用方。


🔵 LOW — TeamSessionService.ts 新增代码的测试覆盖率为 0%

文件src/process/team/TeamSessionService.ts

问题说明:本 PR 在 getOrStartSession 中新增的延迟会话注册、逐 agent 写入 MCP 配置、config_write_failed 错误路径等逻辑 patch 覆盖率为 0%(14 行未覆盖)。这些是核心错误路径,缺乏测试使回归难以发现。

建议:为以下场景补充单元测试:

  • MCP 服务器启动失败时 session 不被加入缓存
  • 单个 agent 写入失败时不阻塞其他 agent(emit config_write_failed

汇总

# 严重级别 文件 问题
1 🟡 MEDIUM electron-builder.yml:117 extraResources 引用不存在的 .mjs 文件
2 🔵 LOW TeamMcpServer.ts:14 未使用的导入 teamIpcBridge
3 🔵 LOW xmlFallbackAdapter.ts:126 options 参数已无效,未清理
4 🔵 LOW TeamSessionService.ts 新增核心逻辑 patch 覆盖率 0%

结论

⚠️ 有条件批准 — 存在一个需处理的 MEDIUM 问题(electron-builder.yml 无效条目),以及若干 LOW 级清理项,处理后可合并。


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: CONDITIONAL
IS_CRITICAL_PATH: true
CRITICAL_PATH_FILES:

  • electron-builder.yml
  • package.json
    PR_NUMBER: 2152

@piorpua piorpua added bot:ready-to-fix CONDITIONAL review done, waiting for bot fix and removed bot:reviewing Review in progress (mutex) bot:ready-to-fix CONDITIONAL review done, waiting for bot fix labels Apr 10, 2026
@piorpua piorpua added the bot:fixing Fix in progress (mutex) label Apr 10, 2026
The entry referenced out/main/team-mcp-stdio.mjs which does not exist;
the build script outputs team-mcp-stdio.js (CJS). Runtime resolution
already works via the existing asarUnpack entry for the .js file.

Review follow-up for #2152
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Apr 10, 2026

PR Fix 验证报告

原始 PR: #2152
修复方式: 直接推送到 `fix/team-mcp-injection-stability`

修复结果

# 严重级别 文件 问题 修复方式 状态
1 🟡 MEDIUM electron-builder.yml:117 extraResources 引用不存在的 .mjs 文件,可能导致发版流水线故障 删除整个无效条目(4行),运行时已由 asarUnpack 中的 .js 条目正确处理 ✅ 已修复
2 🔵 LOW TeamMcpServer.ts:14 未使用导入 teamIpcBridge ⏭️ 跳过(LOW)
3 🔵 LOW xmlFallbackAdapter.ts:126 options 参数已无效 ⏭️ 跳过(LOW)
4 🔵 LOW TeamSessionService.ts 核心逻辑覆盖率 0% ⏭️ 跳过(LOW)

总结: ✅ 已修复 1 个 | ⏭️ 跳过 3 个(LOW 级别)

🔵 LOW 级别问题已跳过(不阻塞合并,修复优先级低)。

@piorpua piorpua added bot:ready-to-merge Bot done, code is clean — human just needs to confirm and merge and removed bot:fixing Fix in progress (mutex) labels Apr 10, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Apr 10, 2026

✅ 已自动修复,代码无阻塞性问题,请人工确认后合并。

…defaults

Merge latest main (including #2278 team-guide) and resolve conflicts in
ipcBridge.ts and teamTypes.ts, retaining both team-guide IPC channels
(setSessionMode, listChanged) and MCP stability IPC (mcpStatus).

Fix agent type handling discovered during review:
- AionMcpService.handleCreateTeam now accepts agentType from caller and
  validates against TEAM_GUIDE_BACKENDS whitelist instead of hardcoding claude
- team_spawn_agent tool description updated to reference the dynamic
  "Available Agent Types" list instead of a stale hardcoded list
- Leader prompt now guides agent to pass agent_type when spawning
- spawnAgent fallback defaults to leader's own type instead of claude
@zhuqingyv zhuqingyv changed the title fix(team): stabilize MCP injection pipeline for all agent backends fix(team): stabilize MCP injection pipeline and unify backend whitelists Apr 10, 2026
The team guide prompt example table showed "claude" for all role types,
causing LLMs (including codex/GPT agents) to copy it verbatim instead
of using their own backend type. Replace with "(your type)" placeholder
and explicit instruction to use the agent's own type.
Pass the agent's backend (e.g. 'codex') into getTeamGuidePrompt() so
the example team configuration table shows the correct type instead of
a placeholder. This prevents LLMs from copying a hardcoded 'claude'
when they should use their own backend type.
…stem env

- Eliminate TEAM_GUIDE_BACKENDS; use TEAM_SUPPORTED_BACKENDS as single
  source of truth for both team mode and solo-to-team guide injection
- Add gemini to team guide whitelist (was previously excluded)
- Inject AION_MCP_BACKEND env var into stdio bridge so the system
  automatically passes the correct agent type to aion_create_team,
  removing dependency on LLM to specify agentType parameter
- Add aion team-guide MCP server injection for GeminiAgentManager solo mode
- Update tests: gemini now whitelisted, backend via system env not args
@zhuqingyv zhuqingyv merged commit 676e9d8 into main Apr 10, 2026
41 of 43 checks passed
@zhuqingyv zhuqingyv deleted the fix/team-mcp-injection-stability branch April 10, 2026 08:53
ringringlin pushed a commit that referenced this pull request Apr 12, 2026
…sts (#2152)

* fix(team): remove CodeBuddy references and filter out custom assistants from team creation

* fix(team): stabilize MCP injection pipeline [WIP]

- Add ipcBridge import to AcpAgent for MCP status events
- Add team IPC bridge import to TeamMcpServer

Full changes in progress: Codex session/load fix, IPC status events,
whitelist expansion (codebuddy/gemini), TCP error logging.

* fix(team): stabilize MCP injection pipeline with status events

- Fix Codex session/load hardcoded mcpServers: [] (tools lost on resume)
- Add TeamMcpPhase/ITeamMcpStatusEvent types for injection observability
- Add team.mcpStatus IPC channel for frontend status tracking
- Emit IPC events: tcp_ready/tcp_error, session_injecting/session_ready/degraded/session_error, load_failed
- Expand TEAM_ALLOWED_BACKENDS: add codebuddy, gemini
- Expand MCP_CAPABLE_TYPES: add gemini
- Add codebuddy to frontend TEAM_SUPPORTED_BACKENDS
- Add TCP error stderr logging in team-mcp-stdio bridge
- Add conversation.extra write failure IPC event

* fix(team): stabilize MCP injection pipeline with IPC status events

* fix(webui): use hash navigation to prevent blank screen on WebSocket auth expiry

When WebSocket receives auth-expired or 1008 close code, the redirect
to login page used window.location.href = '/login' which triggers a
full page reload. With HashRouter, the reload lands on an empty hash
(#/) and the WebSocket is still disconnected, so status stays
'checking' forever → blank screen.

Fix: use window.location.hash = '/login' to navigate within the SPA
without reloading the page.

* feat(team): enhance MCP server integration and testing capabilities

- Add team-mcp-stdio bridge as a self-contained ESM bundle for better integration.
- Introduce new Playwright test commands for team-related end-to-end testing.
- Update TEAM_SUPPORTED_BACKENDS to include 'gemini' and remove 'codebuddy'.
- Refactor MCP server handling to ensure team mode agents are properly validated and injected.
- Improve error handling and logging for MCP server initialization and agent communication.
- Update XML fallback instructions to always provide a coordination path for agents.

* fix(dev): auto-build MCP server bundles in dev mode

Add a dev-only Vite plugin that runs build-mcp-servers.js after each
main process bundle, so team-mcp-stdio.js is always available without
a manual build step.

* chore: remove build artifact and research docs from PR

- Remove index.html (Vite build artifact, should not be committed)
- Remove docs/research/ (investigation notes, not production code)

* fix(team): resolve merge conflicts in AcpConnection and AcpAgent session logic

- Choose stash version (options object style) for loadSession signature
- Use doSession inner function pattern for cleaner error handling
- Retain teamId bypass for busy check in AcpSendBox and GeminiSendBox

* test: restore deleted/trimmed unit tests from main

Restore 9 test files that were deleted and 6 that had cases trimmed,
bringing tests back to parity with the main branch.

* fix(acp): use direct mcpServers param in loadSession, align caller in index.ts

* fix(gemini): restore stripCodeExecutionBlocks function lost during merge

* fix: restore docs/research files that exist on main

These research documents pre-exist on main and were mistakenly removed
in 0921063. Only branch-specific research docs should have been deleted.

* test(team): update MCP_CAPABLE_TYPES assertion to reflect gemini support

* test(acp): align loadSession assertions with direct mcpServers param

loadSession now receives mcpServers as a direct array parameter instead
of wrapped in an object. Update test expectations accordingly.

* test(integration): add mcpStatus mock to team-real-components ipcBridge

* test(team): update tests to reflect gemini support and always-on XML fallback

* style: auto-format files to pass oxfmt CI check

* fix(build): remove invalid team-mcp-stdio.mjs extraResources entry

The entry referenced out/main/team-mcp-stdio.mjs which does not exist;
the build script outputs team-mcp-stdio.js (CJS). Runtime resolution
already works via the existing asarUnpack entry for the .js file.

Review follow-up for #2152

* fix(team-guide): replace hardcoded claude in prompt example table

The team guide prompt example table showed "claude" for all role types,
causing LLMs (including codex/GPT agents) to copy it verbatim instead
of using their own backend type. Replace with "(your type)" placeholder
and explicit instruction to use the agent's own type.

* fix(team-guide): inject actual backend type into prompt example table

Pass the agent's backend (e.g. 'codex') into getTeamGuidePrompt() so
the example team configuration table shows the correct type instead of
a placeholder. This prevents LLMs from copying a hardcoded 'claude'
when they should use their own backend type.

* fix(team-guide): unify backend whitelist and inject agent type via system env

- Eliminate TEAM_GUIDE_BACKENDS; use TEAM_SUPPORTED_BACKENDS as single
  source of truth for both team mode and solo-to-team guide injection
- Add gemini to team guide whitelist (was previously excluded)
- Inject AION_MCP_BACKEND env var into stdio bridge so the system
  automatically passes the correct agent type to aion_create_team,
  removing dependency on LLM to specify agentType parameter
- Add aion team-guide MCP server injection for GeminiAgentManager solo mode
- Update tests: gemini now whitelisted, backend via system env not args

* fix(team-guide): prevent Gemini from using ask_user tool for team confirmation

* fix(team-guide): inject team guide prompt into Gemini solo agents

* fix(team-guide): use dynamic conversationType for team leader based on backend

---------

Co-authored-by: zhuqingyu <zhuqingyu@bituniverse.org>
Co-authored-by: zynx <>
JAVA-LW pushed a commit to JAVA-LW/AionUi that referenced this pull request Apr 19, 2026
…sts (iOfficeAI#2152)

* fix(team): remove CodeBuddy references and filter out custom assistants from team creation

* fix(team): stabilize MCP injection pipeline [WIP]

- Add ipcBridge import to AcpAgent for MCP status events
- Add team IPC bridge import to TeamMcpServer

Full changes in progress: Codex session/load fix, IPC status events,
whitelist expansion (codebuddy/gemini), TCP error logging.

* fix(team): stabilize MCP injection pipeline with status events

- Fix Codex session/load hardcoded mcpServers: [] (tools lost on resume)
- Add TeamMcpPhase/ITeamMcpStatusEvent types for injection observability
- Add team.mcpStatus IPC channel for frontend status tracking
- Emit IPC events: tcp_ready/tcp_error, session_injecting/session_ready/degraded/session_error, load_failed
- Expand TEAM_ALLOWED_BACKENDS: add codebuddy, gemini
- Expand MCP_CAPABLE_TYPES: add gemini
- Add codebuddy to frontend TEAM_SUPPORTED_BACKENDS
- Add TCP error stderr logging in team-mcp-stdio bridge
- Add conversation.extra write failure IPC event

* fix(team): stabilize MCP injection pipeline with IPC status events

* fix(webui): use hash navigation to prevent blank screen on WebSocket auth expiry

When WebSocket receives auth-expired or 1008 close code, the redirect
to login page used window.location.href = '/login' which triggers a
full page reload. With HashRouter, the reload lands on an empty hash
(#/) and the WebSocket is still disconnected, so status stays
'checking' forever → blank screen.

Fix: use window.location.hash = '/login' to navigate within the SPA
without reloading the page.

* feat(team): enhance MCP server integration and testing capabilities

- Add team-mcp-stdio bridge as a self-contained ESM bundle for better integration.
- Introduce new Playwright test commands for team-related end-to-end testing.
- Update TEAM_SUPPORTED_BACKENDS to include 'gemini' and remove 'codebuddy'.
- Refactor MCP server handling to ensure team mode agents are properly validated and injected.
- Improve error handling and logging for MCP server initialization and agent communication.
- Update XML fallback instructions to always provide a coordination path for agents.

* fix(dev): auto-build MCP server bundles in dev mode

Add a dev-only Vite plugin that runs build-mcp-servers.js after each
main process bundle, so team-mcp-stdio.js is always available without
a manual build step.

* chore: remove build artifact and research docs from PR

- Remove index.html (Vite build artifact, should not be committed)
- Remove docs/research/ (investigation notes, not production code)

* fix(team): resolve merge conflicts in AcpConnection and AcpAgent session logic

- Choose stash version (options object style) for loadSession signature
- Use doSession inner function pattern for cleaner error handling
- Retain teamId bypass for busy check in AcpSendBox and GeminiSendBox

* test: restore deleted/trimmed unit tests from main

Restore 9 test files that were deleted and 6 that had cases trimmed,
bringing tests back to parity with the main branch.

* fix(acp): use direct mcpServers param in loadSession, align caller in index.ts

* fix(gemini): restore stripCodeExecutionBlocks function lost during merge

* fix: restore docs/research files that exist on main

These research documents pre-exist on main and were mistakenly removed
in 0921063. Only branch-specific research docs should have been deleted.

* test(team): update MCP_CAPABLE_TYPES assertion to reflect gemini support

* test(acp): align loadSession assertions with direct mcpServers param

loadSession now receives mcpServers as a direct array parameter instead
of wrapped in an object. Update test expectations accordingly.

* test(integration): add mcpStatus mock to team-real-components ipcBridge

* test(team): update tests to reflect gemini support and always-on XML fallback

* style: auto-format files to pass oxfmt CI check

* fix(build): remove invalid team-mcp-stdio.mjs extraResources entry

The entry referenced out/main/team-mcp-stdio.mjs which does not exist;
the build script outputs team-mcp-stdio.js (CJS). Runtime resolution
already works via the existing asarUnpack entry for the .js file.

Review follow-up for iOfficeAI#2152

* fix(team-guide): replace hardcoded claude in prompt example table

The team guide prompt example table showed "claude" for all role types,
causing LLMs (including codex/GPT agents) to copy it verbatim instead
of using their own backend type. Replace with "(your type)" placeholder
and explicit instruction to use the agent's own type.

* fix(team-guide): inject actual backend type into prompt example table

Pass the agent's backend (e.g. 'codex') into getTeamGuidePrompt() so
the example team configuration table shows the correct type instead of
a placeholder. This prevents LLMs from copying a hardcoded 'claude'
when they should use their own backend type.

* fix(team-guide): unify backend whitelist and inject agent type via system env

- Eliminate TEAM_GUIDE_BACKENDS; use TEAM_SUPPORTED_BACKENDS as single
  source of truth for both team mode and solo-to-team guide injection
- Add gemini to team guide whitelist (was previously excluded)
- Inject AION_MCP_BACKEND env var into stdio bridge so the system
  automatically passes the correct agent type to aion_create_team,
  removing dependency on LLM to specify agentType parameter
- Add aion team-guide MCP server injection for GeminiAgentManager solo mode
- Update tests: gemini now whitelisted, backend via system env not args

* fix(team-guide): prevent Gemini from using ask_user tool for team confirmation

* fix(team-guide): inject team guide prompt into Gemini solo agents

* fix(team-guide): use dynamic conversationType for team leader based on backend

---------

Co-authored-by: zhuqingyu <zhuqingyu@bituniverse.org>
Co-authored-by: zynx <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:ready-to-merge Bot done, code is clean — human just needs to confirm and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants