Skip to content

A Main Bot created after the server starts has no create_team / create_child_bot until dsh web restarts #594

Closed

Description

@Birfy

What happened? / 发生了什么?

On a fresh home, the Main Bot (Chief) that onboarding creates after dsh web has started does not get the tree's team-building tools (create_team, create_child_bot, and with them the other gated tree tools). Asking Chief to build a team does nothing: the model never sees the tools, so it just answers in text. After restarting the web server for that home (nothing else changed), the same Chief Session has the tools and create_team / create_child_bot work at once.

Evidence from the mock model's request log (core/dev/mock-llm.mjs logs a hash of the tool list per request; a local demo scenario calls create_team for "组队 …" and create_child_bot for "加子 …" only when the tool is in the list):

  • Home C, Chief Session session-c045…: Chief created 10:49:27 (UTC+8). Requests at 10:49:32 (组队 研发: Backend: 后端工程师; Frontend: 前端工程师) and 10:49:38 (加子 QA: 测试) carry tool-list hash 378cb52c60a4 and fall through to the generic reply 收到:组队 研发: … / 收到:加子 QA: 测试 — i.e. neither tool was offered. Still the same at 10:51:03 and 10:51:31.
  • dsh web for that home restarted at 10:52:02 (UTC+8). The next request in the same Session at 10:52:11 carries hash a4bdb388c0a0 and calls create_team → the team appears in the tree.
  • Home D reproduced the same: Chief's first request at 11:00:27 (UTC+8) has 378cb52c60a4; after a web restart at 11:00:35 its next request (11:00:46) has a4bdb388c0a0 and create_team / create_child_bot work.

Expected: a Main Bot created while the server is running gets the tree tools (and every other tool its role allows) from its first turn, with no restart.

Likely cause (code reading, origin/main 645a291 — hypothesis, not yet confirmed with a test)

  • The tree tools are gated by visibleTo: inTree = tree.isMember(botId) (plugins/tree/src/tools.js:63-70), which is true only once the Bot has treeRole/parent fields (plugins/tree/src/tree.js:207). Chief gets them when adoptChief() runs (tree.js:109-125), triggered from plugins/tree/index.js:57-63 (startup timers 0/1/5/15 s and fb.onBotCreated).
  • The host turns visibleTo into a per-Agent deny mask in hidePluginTools (core/src/host/hooks.js:743-762). It is recomputed only on agent/created (hooks.js:764) and when FlyBot itself resolves an Agent for Bot-to-Bot delivery (core/src/host/delivery.js:63-67, rt.flybotHideTools).
  • So if Chief's Agent is created before the tree has adopted it (onboarding creates the Bot and its Session at once), the mask denies the tree tools, and nothing recomputes it when the tree later sets Chief's fields or when the user chats with Chief directly through DSH. A restart re-runs agent/created with Chief already in the tree, which matches the log above.

Not verified: whether core Main-only tools (e.g. group creation) were also missing; the log only proves the tree tools.

Change scope (suggested)

Recompute the plugin-tool mask when a Bot's tree membership/role changes (e.g. on the tree's field change for treeRole/parent, or on every Agent resolve, not only delivery), so a newly adopted Chief gets the tools on its next turn. Add a test: create the Main Bot after startup, resolve its Agent before adoption, then adopt — the next turn's tools must include create_team and create_child_bot.

Screenshot / 截图

None useful (the symptom is a missing tool call). Evidence is the mock request log on the recording box: /workspace/slides/flybot-intro-834wrk/run/home-c/mock.jsonl and run/home-d/mock.jsonl (fields t, session, tools, out).

Steps to reproduce / 复现步骤

  1. Start dsh web on a fresh home (no Bots yet) with the FlyBot core and @flybot/tree.
  2. Finish onboarding so Chief is created while the server runs.
  3. Ask Chief to create a team or a child Bot (e.g. "建一个研发小组:Backend 和 Frontend"). With the mock, inspect the tool list of the request: no create_team / create_child_bot.
  4. Restart dsh web for that home, send the same message in the same chat: the tools are there and work.

Diagnostics / 诊断信息

FlyBot main @ 4f6a53d (these code paths unchanged on 645a291), @deepseek-ai/dsh 0.2.0-rc.2 (dsh web), @flybot/tree linked from the checkout, mock model core/dev/mock-llm.mjs (with a local, uncommitted demo-scenario patch that only maps "组队"/"加子" to the tools when they are offered). Found while recording demos, not by the self-test routine.

Privacy / 隐私

  • This report has no API keys, tokens or personal data.

Activity

  1. added
    bugSomething isn't working
    area:automationScheduled tasks and automation
    on Oct 21, 2026
  2. Birfy commented on Oct 21, 2026

    @Birfy
    CollaboratorAuthor

    Triaged (maintenance round, 2026-10-21): reproducible from the mock-model tool-list hash — a Main Bot onboarding creates after dsh web starts keeps the older tool list (378cb52c60a4, no create_team/create_child_bot) and the same Session gets them after a restart (a4bdb388c0a0).

    Expected: a Bot created while the server runs sees every tool its role allows from its first turn, with no restart.

    Scope: the tree tools' visibility gate (visibleTo upstream) and wherever the per-turn tool list is built/cached; I will pin the exact seam with a failing test before touching it. agent-ready — queued behind #593.

  3. added
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 21, 2026
  4. removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 21, 2026
  5. added a commit that references this issue on Oct 23, 2026
    2a063f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:automationScheduled tasks and automationbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions