Skip to content

serve: a start screen for people, a view over the start's record lines on a terminal - #80

Merged
midagedev merged 1 commit into
midagedev:mainfrom
avlp12:serve-start-screen
Oct 12, 2026
Merged

midagedev merged 1 commit into
midagedev:mainfrom
avlp12:serve-start-screen

Conversation

@avlp12

@avlp12 avlp12 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Requested by Alis

What and why

At start, bloomery-serve prints many key=value record lines. Tools read them, but a person who just ran the command has to dig through them to learn whether the model fit, where it went and where to send a request.

This adds a start screen for people: a small furnace beside a box that shows the seat, the URL, the placement, the card, host and NVMe shares, the slots and their context, the prompt cache and the load's wall time, then a curl to try. As agreed on the issue:

  • A view, not a source. serve::screen reads only the record lines the seat printed while it started. Every value is the record's own text, with two exceptions: a byte count is shown in GiB to one decimal, and in ASCII mode a non-ASCII character in a value is shown as ?. A record the start did not print leaves its row off, and a plan or load of another place than the listening line's is not joined. A row is read from the last line of its record's head, so the order of lines of different heads does not move it.
  • NVMe. With an nvtier record, the row shows what was paged and the RAM arena the load granted, and the planned arena beside it when the two differ. With only the plan, the arena is labelled as planned.
  • Only on a terminal. It is drawn once, after the server listens, and only when BLOOMERY_SCREEN is on (the default) and stderr is a TTY. Piped stderr is byte-for-byte unchanged.
  • Plain terminals. NO_COLOR or TERM=dumb draws it without colour. TERM=dumb or a locale that names no UTF-8 (the first set of LC_ALL, LC_CTYPE, LANG) draws it in plain ASCII. Control characters in record values are dropped, and the box is padded by display width (Hangul and CJK count two columns).
  • No load-time cost beyond formatting. Unarmed, a printed record line pays one OnceLock read. After the screen is drawn, it pays that read and one atomic load.

Closes #47.

UTF-8 (the golden from a fixed V4.1 start):


      (   )      ╭──────────────────────────────────────────────────────────────╮
     (  )  )     │ bloomery-serve-ds41 is ready                                 │
      )  (       │                                                              │
    .-'--'-.     │ url      http://127.0.0.1:8080                               │
   /  ____  \    │ place    a (one card)                                        │
  |  /▓▓▓▓\  |   │ card     A6000 · 2668 experts (41.7 GiB) · 45.0 GiB resident │
  |  \▓▓▓▓/  |== │ host     12692 experts (199.3 GiB)                           │
  |__________|   │ nvme     nothing paged                                       │
 ~~~~~~~~~~~~~~  │ context  2 slots × 16384 positions (32768 in all)            │
                 │ cache    8.0 GiB of prompt cache in RAM                      │
                 │ loaded   in 41.2 s                                           │
                 ╰──────────────────────────────────────────────────────────────╯

  try:
    curl http://127.0.0.1:8080/v1/chat/completions \
      -H 'Content-Type: application/json' \
      -d '{"messages":[{"role":"user","content":"Hello!"}]}'

  Ctrl+C stops the server · BLOOMERY_SCREEN=off hides this screen

ASCII (LANG=C):


      (   )      +--------------------------------------------------------------+
     (  )  )     | bloomery-serve-ds41 is ready                                 |
      )  (       |                                                              |
    .-'--'-.     | url      http://127.0.0.1:8080                               |
   /  ____  \    | place    a (one card)                                        |
  |  /####\  |   | card     A6000 - 2668 experts (41.7 GiB) - 45.0 GiB resident |
  |  \####/  |== | host     12692 experts (199.3 GiB)                           |
  |__________|   | nvme     nothing paged                                       |
 ~~~~~~~~~~~~~~  | context  2 slots x 16384 positions (32768 in all)            |
                 | cache    8.0 GiB of prompt cache in RAM                      |
                 | loaded   in 41.2 s                                           |
                 +--------------------------------------------------------------+

  try:
    curl http://127.0.0.1:8080/v1/chat/completions \
      -H 'Content-Type: application/json' \
      -d '{"messages":[{"role":"user","content":"Hello!"}]}'

  Ctrl+C stops the server - BLOOMERY_SCREEN=off hides this screen

A Qwen3.8-shaped start with a paged NVMe tier whose granted arena is smaller than planned:


      (   )      ╭──────────────────────────────────────────────────────────────────────────╮
     (  )  )     │ bloomery-serve-qwen38 is ready                                           │
      )  (       │                                                                          │
    .-'--'-.     │ url      http://127.0.0.1:8080                                           │
   /  ____  \    │ place    a (one card)                                                    │
  |  /▓▓▓▓\  |   │ card     3090 · 4813 experts · 22.0 GiB resident                         │
  |  \▓▓▓▓/  |== │ host     5427 experts                                                    │
  |__________|   │ nvme     100.0 GiB paged through a 24.0 GiB RAM arena (32.0 GiB planned) │
 ~~~~~~~~~~~~~~  │ context  1 slot · 8192 positions                                         │
                 │ cache    4.0 GiB of prompt cache in RAM                                  │
                 │ loaded   in 23.7 s                                                       │
                 ╰──────────────────────────────────────────────────────────────────────────╯

Code shape

  • No second copy. The screen reads the records and computes no number of its own. The record tee follows the existing leak-sink pattern in record.rs.
  • Model code holds only architecture facts. Each seat gains one arm_screen(levers.screen()) call after record::at_main, and SCREEN in its levers list.
  • Dead code is gone.
  • No silent failure. A missing or unparsable record drops its row; it is never filled in.
  • Comments state what is true now.
  • No relaxed gate.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line): none.

What changed:

  • crates/serve/src/screen.rs (new): render (pure, from record text) and draw (once armed). Server::run and DecideServer::run call it once they listen.
  • crates/levers: BLOOMERY_SCREEN (on/off, default on) with its accessor. tools/levers-direct.txt lists the screen's reads of NO_COLOR, TERM, LC_ALL, LC_CTYPE and LANG.
  • crates/gpu-gates: Record::eprint hands each line to a tee set once. bind::arm_screen arms the screen and sets the tee. bind::eprint_noted prints a plain eprintln record line unchanged and notes it; parallel_line, the glm and qwen38 cache lines and the qwen38 load line use it. Every seat acts on BLOOMERY_SCREEN.
  • Tests (10 for the screen): the V4.1 start in UTF-8, ASCII and colour (escapes removed equals UTF-8); the same start with its plan, load and place unset lines missing, and reversed; the Qwen3.8-shaped start with and without its nvtier line; records of another place; a load without parsable seconds; a value with Hangul, a combining mark and an ESC; and Style from given terminal variables.

What I ran

On a Mac with the pinned toolchain (rustc 1.100.0-nightly (e457a7b0d 2026-08-27)), on this branch (one commit on main at e659f4fe):

$ cargo test --release -p bloomery-serve
test result: ok. 216 passed; 0 failed   (lib; the integration files are #[ignore] box gates)
$ cargo test --release -p bloomery-levers
test result: ok. 37 passed; 0 failed
$ just mac-check
mac-check: check rc 0
mac-check: combos rc 0; 40 shapes run, 0 red
$ just mac-lint
mac-check: lint ^warning: 41 = the ratchet 41 in tools/lint-ratchet.txt

just mac-check's workspace check builds bloomery-gpu-gates with gpu, deepseek41, vision, glm5next, mimo2 and clef, so the seat edits compile for Linux. Also clean: cargo fmt --check, cargo clippy --release -p bloomery-serve -p bloomery-levers --all-targets --no-deps -- -D warnings, bash tools/check-comments.sh, tools/check-levers.sh and python3 tools/recipes.py --self-test.

Not run here: bloomery-serve-qwen38's the_levers_list_is_the_levers_the_seat_reads test (which I updated) builds on the box only, and I have not seen the screen from a real seat on a terminal.

Open questions for you:

  1. Is GiB to one decimal fine as "the record's value", or would you rather show the record's bytes?
  2. The decide seat used to act on no lever; it now acts on BLOOMERY_SCREEN, so setting it in the shell is no longer refused there. Is that the intended use of ACTS_ON?
  3. Both fixtures are written from the record schemas. Only the V4.1 plan line comes from tools/flow/plans/ds41-p1536-ced-on.rec; the other values, including the Qwen3.8 nvtier and load lines, are invented to cover each row. Real seat stderr can replace them.

Hardware (if the change is for a machine)

Not hardware-specific. Mac Studio, Apple M3 Ultra, 512 GB, macOS 26.

🤖 Generated with Claude Code

…es on a terminal, BLOOMERY_SCREEN=off hides it

serve::screen reads the record lines a seat printed while it started and
draws, once the server listens, a small furnace beside a box: the seat,
the URL, the placement and why, the card (experts, resident bytes), every
plan card when there are several, the host's experts, the NVMe tier, the
slots and their context, the prompt cache and the load's wall, then a curl
to try. Every value is a record's text (a byte count in GiB to one
decimal). A record the start did not print leaves its row off; records
that name another placement than the listening line (place unset, plan,
load) are not joined to it; the NVMe arena is the one the nvtier record
says the load was granted, beside the planned one, and a plan's arena
alone is labelled planned; a load wall that does not parse as a number is
left off. Each row is read from the last line of its record's head, so
the order of lines of different heads does not move it.

It is armed only when BLOOMERY_SCREEN is on (default) and stderr is a
terminal; piped stderr is unchanged, byte for byte. NO_COLOR or TERM=dumb
draw it without colour, and TERM=dumb or a locale that names no UTF-8 draw
it in plain ASCII. Control characters in a value are not drawn, and the
box pads by terminal columns (wide CJK/Hangul 2, combining marks 0).
After the draw, note() returns on one atomic load and takes no lock.

- levers: BLOOMERY_SCREEN, on/off, default on; every seat of
  bloomery-serve acts on it (ACTS_ON lists, gate_glm5next_serve's copy,
  bloomery-serve-qwen38's READS test).
- record: Record::eprint hands each line to a tee a seat sets once;
  bind::arm_screen arms the screen and sets the tee. bind::eprint_noted
  prints a start line that is no record and notes it: the parallel line,
  the glm and qwen38 cache lines and the qwen38 load line, their stderr
  text unchanged.
- Server::run and DecideServer::run draw the screen once they listen.
- tools/levers-direct.txt lists screen.rs's reads of NO_COLOR, TERM,
  LC_ALL, LC_CTYPE and LANG.
- Tests: goldens of a V4.1 start (UTF-8, ASCII, colour without its
  escapes) and of a paged Qwen3.8 start whose arena was granted smaller
  than planned; the V4.1 start with its plan, load and place lines missing
  (golden) and reversed; records of another place; a wall that is no
  number; several plan cards; Hangul, a combining mark and an escape in a
  value; Style::of over its terminal variables.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@midagedev

Copy link
Copy Markdown
Owner

감사합니다. 검토를 시작합니다. 오늘 main에 serve seat 파일이 여럿 바뀐 train이 들어가서, 충돌은 우리 쪽에서 풀고 필요한 보완도 우리가 이어 붙인 뒤 머지하겠습니다. 저자만 아는 사실이 필요할 때만 여쭙겠습니다.

@midagedev

Copy link
Copy Markdown
Owner

이쁘네요!! ㅎㅎ

midagedev added a commit that referenced this pull request Oct 12, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	crates/gpu-gates/src/bin/shared/serve_seats/decide.rs
#	crates/gpu-gates/src/bin/shared/serve_seats/ds41.rs
#	crates/gpu-gates/src/bin/shared/serve_seats/qwen38.rs
@midagedev
midagedev merged commit cd110c2 into midagedev:main Oct 12, 2026
1 check passed
@juliankang4 juliankang4 added gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset serve The HTTP server: crates/serve labels Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset serve The HTTP server: crates/serve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

serve: a start screen for people

3 participants