Skip to content

Tree: stop_bot blocked by tree policy, stale prompts after reparent, createChild race (PR #2 review) #15

Closed

Description

@Birfy

Context

The tree send middleware blocks some control messages, and reparenting after a deletion leaves stale state. Both were flagged in the PR #2 review and are still present at 7b806c6. Review items 1–3 (no ensureRoot, flybot.on crash, root reply to a non-tree Bot dropped) are fixed at 7b806c6 and are not tracked here. Related to #6.

Original feedback

  • @hsliuustc0106 review (permalink), item 4: "src/host/tools.js:165 delivers the stop_bot notice with role: 'stopped' … the tree middleware can block a Main Bot from stopping a non-root tree Bot. Control messages (stopped, report) should not be policy-gated."
  • Codex inline comment, Refresh prompts for reparented children (permalink), ds-bot/plugins/tree/src/tree.js L167 (P2), also in the review's P2 Tree list ("…and ignores maxChildren").
  • P2 Tree: "createChild is check-then-act across an awaited create — parallel tool calls … exceed maxChildren/duplicate siblings."

Where (at 7b806c6)

Proposed fix

  • Exempt control roles (stopped, report) from the tree policy, or pass the role to the middleware and allow it.
  • In onBotRemoved, call refreshPrompt(child.id) for each reparented child, and decide how to handle maxChildren overflow.
  • Serialize createChild per parent (a mutex or an in-flight reservation).

Acceptance criteria

  • A Main Bot can stop_bot any tree Bot.
  • After deleting a middle node, each reparented child's prompt trace excludes the deleted node.
  • N parallel create_child_bot calls never exceed maxChildren or create duplicate siblings.

Refs: PR #2 (merged), umbrella #3. Verified against Birfy/FlyBot flybot-plugins tip 7b806c6.

Activity

  1. added a commit that references this issue on Oct 14, 2026
    1e9a9a5
  2. added a commit that references this issue on Oct 14, 2026
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions