Skip to content

fix(queen): name where the server spins, and end a stalled loop in 3 min, not 12 - #505

Merged
gHashTag merged 1 commit into
feat/queen-supervisorfrom
fix/liveness-stack-dump
Sep 21, 2026
Merged

gHashTag merged 1 commit into
feat/queen-supervisorfrom
fix/liveness-stack-dump

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

The swarm stood for twelve minutes today (2026-09-21 14:44-14:56 UTC): the agent server spun one core at 100% (cpu 973 s -> 1512 s over the liveness readings), answered nothing, and was ended only by the twelfth missed /health probe. Nothing said where it spun - pino's asynchronous writes leave the last lines before a spin in an unflushed buffer.

What changes

  • lib/stall-watch.ts + worker. Log lines, tool calls (executeTool) and each compaction step are recorded in a SharedArrayBuffer ring, no I/O. A Worker thread watches the main thread's heartbeat and, after 15 s of silence, writes the last 12 activities to fd 2 as [stall] lines; when the loop turns again it logs how long the stall was (so short stalls under load become visible too).
  • docker-entrypoint.sh. The main thread touches /tmp/trios-loop-heartbeat from a timer, which fires only when the event loop turns. A heartbeat older than LIVENESS_STALL (180 s) ends the server at once. A server busy with twenty bees still turns its loop, so the reason the probe rule needed 12 minutes (it killed busy servers at 4 x 10 s) doesn't apply to this check. The 12-probe rule stays as the backstop and is the only rule when the file is missing.

Verified

  • A 25 s synchronous spin: the worker reports the last activities while it lasts, and the heartbeat goes stale (28 s) then fresh again.
  • run_supervised extracted from the entrypoint, with a server that spins after 6 s: ended on the stale heartbeat after one missed probe (exit 143), with the [stall] report in the same log.
  • The same supervisor with a server 80% busy (800 ms of synchronous work each second) for 30 s: not touched.
  • biome and tsc clean on the changed files; compaction tests 125 pass.

🤖 Generated with Claude Code

…min, not 12

Measured 2026-09-21 14:44: the agent server spun one core at 100% for
twelve minutes (cpu 973 s -> 1512 s), answered nothing, and the swarm stood
until the liveness loop's twelfth missed /health probe ended it. Nothing
recorded where it spun: pino writes asynchronously, so the lines logged just
before a spin sit in a buffer the blocked thread never flushes.

lib/stall-watch.ts: every log line, every tool call and each compaction step
is written into a SharedArrayBuffer ring (no I/O). A Worker thread watches the
main thread's heartbeat; when it stops for 15 s the worker writes the last
twelve activities straight to fd 2 ([stall] lines), and says how long the
stall lasted when the loop turns again.

docker-entrypoint.sh: the main thread touches /tmp/trios-loop-heartbeat from a
timer, which only fires when the event loop turns. A file older than
LIVENESS_STALL (180 s) ends the server at once. Busy is still not dead: a loop
slowed by twenty bees keeps touching the file. The twelve-probe /health rule
stays as the backstop, and is alone in charge when the file is missing.

Verified locally with bun 1.3.11 under the extracted run_supervised: a 25 s
sync spin is reported with its last activities; a spinning server is ended on
the stale heartbeat (exit 143) after one missed probe; a server kept 80% busy
for 30 s is not touched. Compaction tests: 125 pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the fix label Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

✅ Tests passed — 2379/2439

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 272/272 0 0
✅ server-api 1258/1317 0 59
✅ server-browser 6/6 0 0
✅ server-integration 10/11 0 1
✅ server-lib 279/279 0 0
✅ server-pglive 3/3 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

@gHashTag
gHashTag merged commit 269c4dc into feat/queen-supervisor Sep 21, 2026
33 of 36 checks passed
@github-actions
github-actions Bot deleted the fix/liveness-stack-dump branch September 27, 2026 04:43
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