Progress for builds, copies and deploys, in slop and the web app #21

Open
opened 2026-11-28 18:49:22 +00:00 by slop-cannon · 2 comments

Show build, copy and deploy progress instead of streaming every build log line, in slop and in the web app.

Why

  • The builder runs nix build --print-build-logs, and every line streams to the requester. Copies print one line per path.
  • The 0.3.0 rollout deploy of palace, slop-cannon and castle printed 6,938 lines, nearly all compiler and man-cache output. For an agent that's context spent on noise. For a person it's hard to see how far along a deploy is.
  • Approvers who approve a deploy in the web app can't see how it's going at all.

Proposal

Events from Nix

  • The builder runs nix build, and the broker runs nix copy, with --log-format internal-json.
  • Nix then reports activities: builds and substitutions starting and finishing, with expected totals, and bytes for downloads and copies.
  • The builder and broker turn these into progress for each phase:
    • derivations built out of the total
    • paths fetched or copied out of the total, and bytes where known
    • the derivation building now
  • Phases: builder (evaluate and build), copy to <node> (one per node), activate <node>.

Protocol

  • ServerMessage::Progress { phase, done, total, bytes, current }, sent at most about once a second for each phase. That's protocol 4, so a minor bump.
  • Activation output still streams in full: when a switch fails, that's what the requester needs.
  • Build logs stop streaming by default. When a derivation fails, the broker sends the last 100 lines or so of its log.
  • slop deploy / slop build --logs asks for the full stream, as today.

slop

  • On a terminal: a one-line bar on stderr for each phase, redrawn in place, for example building 37/120 ▕████▌ ▏ firefox-unwrapped-147.0.
  • Without a terminal (agents): a summary line every 30 s or so, for example slop: building 37/120 derivations (firefox-unwrapped-147.0), plus a final count for each phase. No control characters.

Web app

  • A request's page gets a live progress panel while it's building, copying or activating, for the requester's own requests and for approvers.
    • A bar for each phase, showing done out of total, the derivation building now, and bytes copied.
    • A row for each node when copying and activating, with its state: waiting, copying, comparing, approved, activating, done, failed.
    • The phases' elapsed times.
  • Updates are pushed to open pages over Server-Sent Events or a WebSocket, so the page doesn't poll. It works without JavaScript: the page renders the current state on load.
  • The pending list shows a compact bar for running requests.
  • Once a request finishes, its page and the audit history keep the final summary, for example built 12/12 in 4m10s; copied 1.2 GiB to 3 nodes; activated in 40s.
  • Build in the existing style (templates/, the detail macros), on phones and desktops.

Audit log

  • Phase timings and totals go in the existing events, not one event per progress message.

To check

  • How reliable internal-json's expected totals are. "N of M" for derivations and paths is solid. Byte totals only exist for downloads and copies.
  • Whether nix copy over ssh:// and ssh-ng:// reports progress the same way.
  • How the builder (a separate process, reached over SSH) passes progress to the broker. Probably progress frames alongside the build log frames it sends now.

Tests

  • Unit tests for parsing internal-json (recorded samples) and for the summary lines.
  • The VM test builds something small and checks that progress messages arrive and that logs only stream with --logs.
Show build, copy and deploy progress instead of streaming every build log line, in `slop` and in the web app. ## Why - The builder runs `nix build --print-build-logs`, and every line streams to the requester. Copies print one line per path. - The 0.3.0 rollout deploy of `palace`, `slop-cannon` and `castle` printed 6,938 lines, nearly all compiler and `man-cache` output. For an agent that's context spent on noise. For a person it's hard to see how far along a deploy is. - Approvers who approve a deploy in the web app can't see how it's going at all. ## Proposal ### Events from Nix - The builder runs `nix build`, and the broker runs `nix copy`, with `--log-format internal-json`. - Nix then reports activities: builds and substitutions starting and finishing, with expected totals, and bytes for downloads and copies. - The builder and broker turn these into progress for each phase: - derivations built out of the total - paths fetched or copied out of the total, and bytes where known - the derivation building now - Phases: `builder` (evaluate and build), `copy to <node>` (one per node), `activate <node>`. ### Protocol - `ServerMessage::Progress { phase, done, total, bytes, current }`, sent at most about once a second for each phase. That's protocol 4, so a minor bump. - Activation output still streams in full: when a switch fails, that's what the requester needs. - Build logs stop streaming by default. When a derivation fails, the broker sends the last 100 lines or so of its log. - `slop deploy` / `slop build` `--logs` asks for the full stream, as today. ### `slop` - **On a terminal:** a one-line bar on stderr for each phase, redrawn in place, for example `building 37/120 ▕████▌ ▏ firefox-unwrapped-147.0`. - **Without a terminal** (agents): a summary line every 30 s or so, for example `slop: building 37/120 derivations (firefox-unwrapped-147.0)`, plus a final count for each phase. No control characters. ### Web app - A request's page gets a live progress panel while it's building, copying or activating, for the requester's own requests and for approvers. - A bar for each phase, showing done out of total, the derivation building now, and bytes copied. - A row for each node when copying and activating, with its state: waiting, copying, comparing, approved, activating, done, failed. - The phases' elapsed times. - Updates are pushed to open pages over Server-Sent Events or a WebSocket, so the page doesn't poll. It works without JavaScript: the page renders the current state on load. - The pending list shows a compact bar for running requests. - Once a request finishes, its page and the audit history keep the final summary, for example `built 12/12 in 4m10s; copied 1.2 GiB to 3 nodes; activated in 40s`. - Build in the existing style (`templates/`, the detail macros), on phones and desktops. ### Audit log - Phase timings and totals go in the existing events, not one event per progress message. ## To check - How reliable `internal-json`'s expected totals are. "N of M" for derivations and paths is solid. Byte totals only exist for downloads and copies. - Whether `nix copy` over `ssh://` and `ssh-ng://` reports progress the same way. - How the builder (a separate process, reached over SSH) passes progress to the broker. Probably progress frames alongside the build log frames it sends now. ## Tests - Unit tests for parsing `internal-json` (recorded samples) and for the summary lines. - The VM test builds something small and checks that progress messages arrive and that logs only stream with `--logs`.
slop-cannon Bot referenced this issue from a commit 2026-11-28 21:33:28 +00:00

Started in #22: progress from Nix's internal-json (protocol 4), bars in slop, and the web app's live panel and running list, with final phases in the audit log. Findings: Nix's activity totals for builds wobble (2 builds showed expected 1–4), so the derivation total comes from the 'these N derivations will be built' message; copy paths and bytes are reliable. Nix already ends a failed build's error with its log tail, so log-lines=100 covers that. Still open: the VM test has no builder, so there's no end-to-end progress test; check on a real deploy after merging.

Started in #22: progress from Nix's internal-json (protocol 4), bars in slop, and the web app's live panel and running list, with final phases in the audit log. Findings: Nix's activity totals for builds wobble (2 builds showed expected 1–4), so the derivation total comes from the 'these N derivations will be built' message; copy paths and bytes are reliable. Nix already ends a failed build's error with its log tail, so log-lines=100 covers that. Still open: the VM test has no builder, so there's no end-to-end progress test; check on a real deploy after merging.
slop-cannon Bot referenced this issue from a commit 2026-11-28 22:03:25 +00:00
slop-cannon Bot referenced this issue from a commit 2026-11-29 01:16:47 +00:00
slop-cannon Bot referenced this issue from a commit 2026-11-29 13:54:16 +00:00

Split the work into three PRs: #23 (builder fixes, deploy and binary cache VM tests, demo fixes and tidying; no protocol change), #24 (pages kept current with Server-Sent Events: HTML regions morphed in with idiomorph, replacing polling), and #22 (progress itself, protocol 4, now stacked on both: indicatif bars in slop, web progress as more SSE regions). Merge order: #23 and #24 in either order, then #22, which I'll rebase as they land.

Split the work into three PRs: #23 (builder fixes, deploy and binary cache VM tests, demo fixes and tidying; no protocol change), #24 (pages kept current with Server-Sent Events: HTML regions morphed in with idiomorph, replacing polling), and #22 (progress itself, protocol 4, now stacked on both: `indicatif` bars in `slop`, web progress as more SSE regions). Merge order: #23 and #24 in either order, then #22, which I'll rebase as they land.
slop-cannon Bot referenced this issue from a commit 2026-11-29 14:47:38 +00:00
dev referenced this issue from a commit 2026-11-29 18:47:55 +00:00
slop-cannon Bot referenced this issue from a commit 2026-11-29 19:26:02 +00:00
slop-cannon Bot referenced this issue from a commit 2026-11-29 19:26:36 +00:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dev/slop-broker#21