Skip to content

fix(queen): bees keep their context and survive a release - #526

Merged
dmitrii-f-t27 merged 1 commit into
fix/queen-worker-provider-and-prompt-sizefrom
fix/bee-compaction-summarizer
Oct 3, 2026
Merged

dmitrii-f-t27 merged 1 commit into
fix/queen-worker-provider-and-prompt-sizefrom
fix/bee-compaction-summarizer

Conversation

@dmitrii-f-t27

@dmitrii-f-t27 dmitrii-f-t27 commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Why

  • Compaction aborted. Measured on the runners on 2026-10-03: of 245 context compactions in fifty minutes, 194 returned an empty summary.
    • 158 of them ended 59–64 s after they began, which is the fixed 60 s abort.
    • The slow bee models (z-ai/glm-5.3 under load, the free glm-4.5-flash) cannot summarize 7–30k tokens in a minute.
    • When that happens the bee falls back to the sliding window and loses the start of its own work.
  • Releases killed bees. The server exits about 2 s after SIGTERM, so every release killed every bee in flight.

What

  • TRIOS_COMPACTION_SUMMARIZER_MODELS, e.g. openai-compatible=nvidia/nemotron-3-super-120b-a12b.
    • A fast model on the bee's own key writes the summary first.
    • The bee's own model is still tried if it fails, so a summary can only be gained, never lost.
  • TRIOS_COMPACTION_SUMMARIZATION_TIMEOUT_MS: 10 s..10 min. The default stays 60 s.
  • TRIOS_BEE_RUNNER_DRAIN_SECONDS: 0..3600. The default 0 keeps the old behaviour.
    • On SIGTERM the runner takes no new orders and waits for its bees.
    • At the deadline it salvages and stores the branch of every bee still running.
  • docker-entrypoint.sh now waits for a draining server. A trapped TERM used to end wait at once and take the container down.

Tests

  • bun test tests/api/queen-*.test.ts tests/agent: 1007 pass, 0 fail.
  • New tests cover summarizer first, fallback to the bee model, both failing, env parsing, and drain wait / deadline salvage / per-bee failure isolation.
  • The entrypoint change was checked with a shell harness: the wrapper outlives a server that drains for 3 s.

Dmitrii Fedorov (@dmitrii-f-t27)

Summaries: of 245 compactions on the runners in fifty minutes 194 came back
empty, 158 of them at the fixed 60 s abort. TRIOS_COMPACTION_SUMMARIZER_MODELS
lets a fast model on the bee's own key write the summary first (the bee's own
model still gets its turn), and TRIOS_COMPACTION_SUMMARIZATION_TIMEOUT_MS names
a longer wait (10 s..10 min, default 60 s).

Drain: the server left ~2 s after SIGTERM and took every bee with it. With
TRIOS_BEE_RUNNER_DRAIN_SECONDS a runner takes no new orders and waits for its
bees; at the deadline it salvages and stores the branch of each one still
running. The entrypoint now waits for a draining server instead of leaving at
the first TERM.
@github-actions github-actions Bot added the fix label Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

✅ Tests passed — 2496/2556

Suite Passed Failed Skipped
✅ agent 87/87 0 0
✅ build 9/9 0 0
✅ cdp-protocol 5/5 0 0
✅ eval 93/93 0 0
✅ server-agent 280/280 0 0
✅ server-api 1345/1404 0 59
✅ server-browser 6/6 0 0
✅ server-integration 10/11 0 1
✅ server-lib 279/279 0 0
✅ server-pglive 25/25 0 0
✅ server-root 68/68 0 0
✅ server-skills 31/31 0 0
✅ server-tools 244/244 0 0
✅ shared 14/14 0 0

View workflow run

@dmitrii-f-t27
dmitrii-f-t27 merged commit a61ed7c into fix/queen-worker-provider-and-prompt-size Oct 3, 2026
20 of 21 checks passed
@github-actions
github-actions Bot deleted the fix/bee-compaction-summarizer branch October 4, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant