Skip to content

Decision record · ADR

ADR-0056: Build the web console as server-rendered HTML with htmx that launches detached CLI jobs

Status: accepted | Date: 2026-10-03

References: RFC-0012, RFC-0010

RFC-0012 adds a browser console that presents several registered workspaces, compares Bench records across them, and launches a bounded set of workflows through the InferLab CLI as detached jobs. Four implementation choices follow and are costly to reverse: the frontend technology, where the code lives, how the console reads workspace state, and how a launched job outlives the service and is cancelled safely. The view-only TUI (RFC-0010) already owns a refreshed read model of operations, records, and definitions; its presentation is text-oriented, while comparison needs numeric loads.

The console is a module of the inferlab crate that serves server-rendered HTML fragments on axum and tokio, with htmx and a small script vendored as embedded static assets and server-sent events for live updates; it has no frontend build step and no per-session client state beyond what the URL and short-lived server-side form state hold. Charts are SVG rendered on the server. The TUI’s collector, presentation, and metrics move to a read-model module that the TUI and the console share: lists and detail reuse the presentation as is, while comparison consumes typed metric points with numeric loads from that module rather than TUI labels. Each registered workspace refreshes on its own background task, off the request path, and requests only read its last published generation, so a slow or unavailable workspace cannot stall another. A launch starts a supervising invocation of the same executable, hidden from help, in a new session; the supervisor starts the CLI invocation in its own process group with stdout and stderr redirected to the job’s logs, records the CLI process’s identity, ignores interrupt and terminate signals so it can still record the exit status after a cancel, waits, writes that status, and exits. Cancel signals the CLI process group only after the recorded identity matches, as RFC-0012:C-ACTIONS requires; a job whose supervisor is gone while its CLI process lives is shown running with an unknown final status. The launcher is Unix-only. Access follows RFC-0012:C-ACCESS.

The console adds a small embedded htmx asset, updated deliberately like a dependency. Moving the read model gives it two consumers, so a change must keep the TUI and the console correct. State that LiveView would keep in components lives in URLs or server-side form state, and each fragment, the dry-run preview, and each job log stream needs an explicit endpoint. A supervisor killed abruptly leaves a job whose final status is unknown. A binary replaced while the service runs means a supervisor started afterward re-executes the new binary; the launched argument vector names the service’s own executable path. A console-free build can be reconsidered if an operator demonstrates the need.

Dioxus LiveView 0.7 components inside the inferlab crate, keeping a virtual DOM per session over a WebSocket (rejected)

Section titled “Dioxus LiveView 0.7 components inside the inferlab crate, keeping a virtual DOM per session over a WebSocket (rejected)”
  • Pros: Component-local state makes forms and comparison selection natural to write in Rust, The LiveView client ships inside the crate, so no build step is needed
  • Cons: A dropped WebSocket, common on a forwarded SSH connection, loses half-filled forms and a shown dry run, LiveView receives far less upstream attention than Dioxus web and fullstack, its API changes between minor releases, and 0.8 is already in alpha, Each session keeps a virtual DOM pinned to a worker, so memory and diff cost grow with sessions, and a large dependency tree enlarges every install

Server-rendered HTML fragments from the inferlab crate on axum, with vendored htmx and server-sent events, reading a read model shared with the TUI, and jobs detached under a supervising process (accepted)

Section titled “Server-rendered HTML fragments from the inferlab crate on axum, with vendored htmx and server-sent events, reading a read model shared with the TUI, and jobs detached under a supervising process (accepted)”
  • Pros: Renders from the same Rust read model with no client API layer and no frontend build step; htmx and a small script ship embedded in the binary, Stateless requests: a reconnect after an SSH hiccup loses nothing, and pages and selections are addressable by URL, A small, stable dependency on top of axum and tokio, which the workspace already has
  • Cons: Form and selection state must live explicitly in URLs or server-side session state, and the dry-run preview and job-log streaming need their own fragment and event-stream endpoints

A TypeScript single-page application over a JSON API (rejected)

Section titled “A TypeScript single-page application over a JSON API (rejected)”
  • Pros: Richest client-side interaction and charting libraries
  • Cons: Adds a second language, a frontend build pipeline, and built assets that every crate and release publication must ship

Dioxus web or fullstack mode, compiling components to WebAssembly (rejected)

Section titled “Dioxus web or fullstack mode, compiling components to WebAssembly (rejected)”
  • Pros: Interaction without a server round trip
  • Cons: Requires the WebAssembly target and the Dioxus bundler in every build and release, and a client-server API in place of direct read-model calls

A separate crate, or a cargo feature of the inferlab crate, that installs can leave out (rejected)

Section titled “A separate crate, or a cargo feature of the inferlab crate, that installs can leave out (rejected)”
  • Pros: Installs without the console stay smaller
  • Cons: A separate crate first needs the read model extracted into its own crate and two published binary flavors; a feature in the same crate still doubles the build combinations to test; with a small htmx dependency neither has a demonstrated need

Run launched jobs as children of the service (rejected)

Section titled “Run launched jobs as children of the service (rejected)”
  • Pros: Simplest lifecycle: stopping the service interrupts its jobs through CLI cleanup
  • Cons: Ties an hour-long sweep to the browser service, so restarting the service ends the run