Skip to content

Group rooms: stop carrying the composio and schedule tools (8 tools, ≈5.2 k tokens per call) #1237

Closed

Description

@Birfy

读数(#796 评论 6408530441)

一个请求里的工具定义共 113 个 / 115,020 字符,拆开是:

来源 工具数 字符 ≈tokens(3.92 字符/token,本机拟合 R²=0.993)
github MCP(mcp__github__*) 43 47,413 12.1 k
内置(bash / read / track_tasks …) 62 47,138 12.0 k
composio(mcp__composio__*) 4 14,377 3.7 k
schedule 4 5,978 1.5 k

composio + schedule = 8 个工具 / 20,355 字符 ≈ 5.2 k tokens,每次调用都要重发一遍。

  • 群会话 7,906 次调用/天 → ≈41 M/天
  • 全部 13,136 次 → ≈68 M/天(约 −3.5%)

这两个来源在群房间里基本不被用到(composio 连的是外部应用,schedule 是定时任务管理),所以先摘这两个;github 的 43 个工具(12.1 k/次 ≈ 159 M/天)不在本单,因为群里判 PR 要靠它,摘不摘是另一个决定(owner 的,见「不做」)。

现状(代码事实,base 58bd5575)

  • ds-bot/src/host/connectors.js:1-4:GitHub 的工具来自 DSH 的 MCP client,挂在 rt.ctx 上,所以「every Bot and Session gets them」——今天没有按 Session 收窄的能力。
  • DSH 的 MCP client 本身支持按 Agent 作用域注册:node_modules/@deepseek-ai/dsh-mcp-client/lib/index.js:769-772(每个注册作用域各自持有 serverName 预留)、:812(scopeOf(ctx) ?? ctx.root)。注意:全局实例与同名 Agent 实例互斥,所以做法是「把挂载从全局改到按 Agent」,不是「再加一份」。

预期行为

  1. 群房间回合里,成员的请求不再带 mcp__composio__* 与 schedule 的那 4 个工具;其余(内置 62 个、github 43 个)原样保留。
  2. 各自 chat 的回合不变(composio 在私聊里仍然可用)。
  3. 群里的日程相关动作若真的需要,走「去自己的 chat 做」这条明说的退路,并写进群公告一句(一句话,不展开)。

先写机制,再写代码

PR 正文第一段必须点名具体机制 + 文件行号:哪个 API 把 MCP client 挂到 Agent 作用域、FlyBot 在哪儿创建房间成员的 Session(ds-bot/src/host/*)、挂载点怎么随 Agent 建销毁。如果查下来只有改 DSH 才能做到:停手,不要 patch DSH,在本单留一条写明「需要 DSH 侧支持 + 具体缺口」,转 needs-human,不要自己造开关。

验收(每条都能红)

  • ablate 取证:同一回合用 core/dev/llm-tap.mjs dump 请求体,摘掉 composio/schedule 前后各发一次真实请求,provider 报的 prompt 差 ≈5.2 k(包里写样本量,±10% 内)。
  • 群房间请求的工具名列表不含 mcp__composio__* 与 schedule 工具;同时断言内置工具与 mcp__github__* 仍在(防止「一起摘掉」)。
  • 私聊回合的工具列表不变(回归断言)。
  • 刀:把 composio 那一条挂载恢复回群房间 → 第一条断言红。
  • 群里仍能 message_bot / track_tasks / bash / read(用一个真实回合或集成用例证明)。
  • node scripts/ds-bot-patches.mjs check 三行贴原文(这条会动 core/src/host/**,patch 必重出)。

不做

  • 不摘 github 的 43 个工具(12.1 k/次、≈159 M/天):群里判 PR、读 check-runs 都靠它;要不要「群房间判定改去自己 chat」是 owner 的决定,需要时另开单。
  • 不动内置 62 个工具(12.0 k),不给工具换更小的 schema(那是改行为,另算)。
  • 不为省 token 动 authz / READS / 审查路径。

Refs #796

Activity

  1. added
    enhancementNew feature or request
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    area:automationScheduled tasks and automation
    on Oct 26, 2026
  2. Birfy commented on Oct 26, 2026

    @Birfy
    CollaboratorAuthor

    Triage(2026-10-26):查重完成,agent-ready,Owner 待派(建议派给做 host 侧的那位;不要与 #1236 同一人同一时间做,两个都要动 ds-bot)。

    • 不重复:#796 留作总账;这是它名列的第二条杠杆,之前没有单。
    • 我把范围切小了,理由写在正文:只摘 composio + schedule(8 个工具 / 20,355 字符 ≈ 5.2 k tokens/次,≈41–68 M/天);github 的 43 个工具(12.1 k/次、≈159 M/天)明确不在本单——群里判 PR、读 check-runs 靠它,摘不摘是 owner 的决定,需要时另开单,别顺手一起摘。
    • 先写机制再写代码:DSH 的 MCP client 支持按 Agent 作用域注册(dsh-mcp-client/lib/index.js:769-772、:812),但全局与同名 Agent 实例互斥,所以做法是「把挂载从全局改到按 Agent」,不是「再加一份」。查下来若只有改 DSH 才行 → 停手、不 patch DSH、留一条缺口说明转 needs-human。
    • 验收靠 ablate:同一回合 core/dev/llm-tap.mjs dump 请求体,摘前摘后各发一次真实请求,provider 报的 prompt 差 ≈5.2 k;同时断言内置工具与 mcp__github__* 仍在(防止一起摘掉)。

    risk:T* 只由控制器写(不手写、不转录);认领评论里带分支名。

  3. Birfy commented on Oct 26, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev3

    Claimed #1237 — first step: find where the composio MCP server and the four schedule tools are mounted, and whether DSH exposes a per-Agent scope for that mount (dsh-mcp-client scopeOf(ctx) ?? ctx.root).

    Branch (when the mechanism holds): dev3/feat/1237-room-drop-composio.

  4. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 26, 2026
  5. self-assigned this
    on Oct 26, 2026
  6. removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 26, 2026
  7. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:automationScheduled tasks and automationenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions