Skip to content

Tree coordinator's system prompt changes at every child turn boundary (load line), so DSH re-sends it whole #895

Closed

Description

@Birfy

Written-by: Dev

Part of #796 (token spend per Bot turn).

Defect

A tree coordinator's system prompt changes at every turn boundary of any of its children, so DSH re-sends the whole system prompt.

  • plugins/tree/index.js:59-60: on every turn.start / turn.end of a tree Bot the plugin calls refreshPrompts, which rewrites the parent's tree block.
  • plugins/tree/src/tree.js:53,73 (loadNotes) puts Child load right now — Dev: working, Test: idle … (47 min, no turn ended) into that block (Tree: show a coordinator its children's runtime load #507, A Bot session stops reading its queue while still reporting load: 1 (Dev: 11 unread, zero progress) #624), so the block — and with it the Bot's system prompt (core/src/host/prompt.js renders bot.systemPrompt live) — differs after every child turn start and end, and the stalled form changes every minute.
  • DSH (@deepseek-ai/dsh-agent-loop SystemPromptProjection.project): on DeepSeek (systemPromptUpdate: "in-history") a changed system prompt is appended in full as a new system message after the history at the coordinator's next step; on a route without that capability it replaces the head, so the whole cached history misses.

Measured (main c90af02, plugin test harness)

  • 3 children each running one turn (start + end): the root's prompt changed 6 times; after the fix 0.
  • FlyBot's own identity section for a root Chief with 5 children is ~11,500 chars (MAIN_RULES + TEAM_RULES + the 3,100-char tree block), before DSH's own sections and the memory section. Each change the coordinator steps over appends at least that much to its history on DeepSeek (≥ ~2.9k tokens), so one delegation round to 3 children can add up to 6 × ≥ 11.5k ≈ ≥ 69k chars to the coordinator's history.

Expected

The system prompt stays byte-stable while load changes; the coordinator still sees each child's load when it routes work.

Fix

Drop the load line from the prompt. list_children already returns each child's load, openForMs and stalled live (#507, #624, #733), so the coordinator rule says once, in fixed words: before you send a new part, call list_children and prefer an idle or working child to a busy one. Renames and role edits still refresh the block (writeBlock skips an unchanged block).

Activity

  1. self-assigned this
    on Oct 23, 2026
  2. added
    bug
    area:automation
    agent-working
    on Oct 23, 2026
  3. Birfy commented on Oct 23, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev

    Claimed. Branch fix/895-tree-load-line (pushed to the fork Birfy/FlyBot).

  4. removed
    agent-working
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:automationbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions