bots-garden/razorbillpublic Fork
⑂ cb55574
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

memory + ticket #53 closed: /rzb admin routes done

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k33g committed 2026-11-26T22:46:00+01:00 Browse files
cb55574 parent: a6959e4
added .memory/handoffs/2026-11-26-v0-3-tui-admin-routes.md +18 -0
new file mode 100644
@@ -0,0 +1,18 @@
1+# Handoff — 2026-11-26 — v0.3 TUI: #53 admin routes done
2+
3+## State
4+- Branch `feature/v0.3-tui` (from main 7e968c5): #53 done and closed — `/rzb/status`, `/rzb/models/{id}/unload`, `/rzb/config/reload` + SIGHUP, loopback only. Tests Linux 217 / Mac 243, gate PASS (run #36), docs EN+FR, checked by hand on the Mac by the user.
5+- Commits 70660e3, ce6c870, 8eee7f3, cb5a310, a6959e4, plus the memory/ticket commit. Nothing pushed (user pushes from the Mac).
6+
7+## Next steps
8+1. #54 (TUI foundation): read the ticket and #51 (decisions), recover the v0.1 ANSI/termios TUI layer from tag `v0.1-agent` (`RazorbillTUI`), propose a methodical-dev plan, get approval. The TUI is a second `rzb` process: chat through `/v1`, dashboard by polling `/rzb/status`.
9+2. Later: #60 task 1 decisions (decision models) are still open.
10+
11+## Open questions
12+- 409 `model_busy` carries the running/waiting counts in its message only; the user has not said whether they want them as JSON fields.
13+
14+## Watch out for
15+- In tests, a request after a chat completion needs a new connection (`Connection: close`): use `freshRequest` / `fetchStatus` in `LocalRoutesTests.swift` (they connect to `localhost`, the host HummingbirdTesting binds).
16+- A real SIGHUP sent to the Linux test runner never reaches the trap: keep that test Darwin-only and test the reload logic with the injected signal stream.
17+- `pkill -f "rzb serve …"` from a shell whose own command line contains the pattern kills that shell: use the PID.
18+- `ModelManager.release` is now `async` (it may unload a slot a reload left without a declared id).
new file mode 100644
@@ -0,0 +1,18 @@
1+# Handoff — 2026-11-26 — v0.3 TUI: #53 admin routes done
2+
3+## State
4+- Branch `feature/v0.3-tui` (from main 7e968c5): #53 done and closed — `/rzb/status`, `/rzb/models/{id}/unload`, `/rzb/config/reload` + SIGHUP, loopback only. Tests Linux 217 / Mac 243, gate PASS (run #36), docs EN+FR, checked by hand on the Mac by the user.
5+- Commits 70660e3, ce6c870, 8eee7f3, cb5a310, a6959e4, plus the memory/ticket commit. Nothing pushed (user pushes from the Mac).
6+
7+## Next steps
8+1. #54 (TUI foundation): read the ticket and #51 (decisions), recover the v0.1 ANSI/termios TUI layer from tag `v0.1-agent` (`RazorbillTUI`), propose a methodical-dev plan, get approval. The TUI is a second `rzb` process: chat through `/v1`, dashboard by polling `/rzb/status`.
9+2. Later: #60 task 1 decisions (decision models) are still open.
10+
11+## Open questions
12+- 409 `model_busy` carries the running/waiting counts in its message only; the user has not said whether they want them as JSON fields.
13+
14+## Watch out for
15+- In tests, a request after a chat completion needs a new connection (`Connection: close`): use `freshRequest` / `fetchStatus` in `LocalRoutesTests.swift` (they connect to `localhost`, the host HummingbirdTesting binds).
16+- A real SIGHUP sent to the Linux test runner never reaches the trap: keep that test Darwin-only and test the reload logic with the injected signal stream.
17+- `pkill -f "rzb serve …"` from a shell whose own command line contains the pattern kills that shell: use the PID.
18+- `ModelManager.release` is now `async` (it may unload a slot a reload left without a declared id).
modified .memory/history.md +10 -0
@@ -484,3 +484,13 @@ Then: user asked to commit and merge: nothing left uncommitted; main fast-forwar
484484 Then (user): closed milestone v0.1. Its open tickets: #24 closed (Qwen3.5 reasoning verified by the
485485 user through the server), #25 (thinking budget with Qwen3.5) taken out of the milestone and left
486486 open, a comment on each. main fast-forwarded.
487+
488+## 2026-11-26 — #53 local admin routes (/rzb) for the v0.3 TUI
489+
490+- **Goal**: user "attaque la v0.3" → #53 first (then #54), via methodical-dev on branch `feature/v0.3-tui`. User decisions: polling (`GET /rzb/status`, no SSE); unloading a busy model → 409 `model_busy`; reload applies everything except the network (host, port, api_key_env, cors_origin → `restart_required`), invalid config → 400 and old kept. 8-step plan approved ("go"), a checkpoint after each step.
491+- **Changes**: step 1 `LocalOnly.swift` + `ServerContext.remoteAddress` (swift-nio NIOCore as a direct dependency) — 70660e3; step 2 `GET /rzb/status` (`AdminRoutes.swift`, `RequestHistory.swift`, `ModelManager.status`, `ProcessMemory` + `EngineRegistry.memoryReporter`, MLX `Memory.*` in `MLXSupport`) — ce6c870; step 3 `POST /rzb/models/{id}/unload` (`ModelManager.unloadModel`) — 8eee7f3; step 4 `POST /rzb/config/reload` + SIGHUP (`ConfigReloader.swift`, `ModelManager.apply`, `ServerSettings.configFile/commandLine/restartRequired`, UnixSignals product, `ModelManagerTypes.swift` split for file_length) — cb5a310; docs + quality — a6959e4.
492+- **Decisions (mine, reported at checkpoints)**: `/rzb/` requests not kept in the history (polling would push real requests out); `keep_alive_left_seconds` null while a model is held or waited for; `port` is the configured one; uptime from router build; a repository id unloads chat and embedding loads, a declared id its own kind; the 409 keeps the plain OpenAI envelope (counts in the message only — user may want fields); explicit JSON nulls everywhere; reload compares network keys to the file the server started with; newly declared preload models load in the background.
493+- **Tests**: Linux 179 → 217, Mac 243 (host-runner, run from the sandbox). In the Linux test runner a real `kill(getpid(), SIGHUP)` never reached the trap, so the signal source is injectable (`eachSignalReloadsTheFile`) and the real-signal test is `#if canImport(Darwin)` — it passes on the Mac; a real `rzb serve` on Linux does reload on `kill -HUP` (checked by hand). Live tests that call after a chat need a new connection (chat answers `Connection: close`) on `localhost` (HummingbirdTesting binds localhost). User checked on the Mac by hand with Qwen3-0.6B-4bit: status (MLX memory, keep_alive countdown, request history), unload ×2, reload with restart_required ["port"], invalid file 400, SIGHUP — all as expected.
494+- **Quality**: gate PASS run #36 (0/0/0, complexity 548 → 588), no refactoring needed.
495+- **Docs**: EN+FR reference (http-api / api-http /rzb section, errors 403/409 + 4 codes, configuration "Reloading" / "Rechargement", SIGHUP under rzb serve), how-to `watch-and-steer-a-running-server.md` / `surveiller-et-piloter-le-serveur.md`, explanations (openai-compatibility: routes of our own under /rzb; model-lifecycle: unloading on demand and reloading), indexes, `packages.drawio` labels. `test_docs_curl.py` now runs `/health` and `/rzb` examples (22 pass on Linux).
496+- **Tickets**: #53 closed (tasks 1–4, comment 1). Mid-session the user asked for a structured-output ticket, then withdrew it ("au temps pour moi": #39 already covers it). No ticket created.
@@ -484,3 +484,13 @@ Then: user asked to commit and merge: nothing left uncommitted; main fast-forwar
484 Then (user): closed milestone v0.1. Its open tickets: #24 closed (Qwen3.5 reasoning verified by the484 Then (user): closed milestone v0.1. Its open tickets: #24 closed (Qwen3.5 reasoning verified by the
485 user through the server), #25 (thinking budget with Qwen3.5) taken out of the milestone and left485 user through the server), #25 (thinking budget with Qwen3.5) taken out of the milestone and left
486 open, a comment on each. main fast-forwarded.486 open, a comment on each. main fast-forwarded.
487+
488+## 2026-11-26 — #53 local admin routes (/rzb) for the v0.3 TUI
489+
490+- **Goal**: user "attaque la v0.3" → #53 first (then #54), via methodical-dev on branch `feature/v0.3-tui`. User decisions: polling (`GET /rzb/status`, no SSE); unloading a busy model → 409 `model_busy`; reload applies everything except the network (host, port, api_key_env, cors_origin → `restart_required`), invalid config → 400 and old kept. 8-step plan approved ("go"), a checkpoint after each step.
491+- **Changes**: step 1 `LocalOnly.swift` + `ServerContext.remoteAddress` (swift-nio NIOCore as a direct dependency) — 70660e3; step 2 `GET /rzb/status` (`AdminRoutes.swift`, `RequestHistory.swift`, `ModelManager.status`, `ProcessMemory` + `EngineRegistry.memoryReporter`, MLX `Memory.*` in `MLXSupport`) — ce6c870; step 3 `POST /rzb/models/{id}/unload` (`ModelManager.unloadModel`) — 8eee7f3; step 4 `POST /rzb/config/reload` + SIGHUP (`ConfigReloader.swift`, `ModelManager.apply`, `ServerSettings.configFile/commandLine/restartRequired`, UnixSignals product, `ModelManagerTypes.swift` split for file_length) — cb5a310; docs + quality — a6959e4.
492+- **Decisions (mine, reported at checkpoints)**: `/rzb/` requests not kept in the history (polling would push real requests out); `keep_alive_left_seconds` null while a model is held or waited for; `port` is the configured one; uptime from router build; a repository id unloads chat and embedding loads, a declared id its own kind; the 409 keeps the plain OpenAI envelope (counts in the message only — user may want fields); explicit JSON nulls everywhere; reload compares network keys to the file the server started with; newly declared preload models load in the background.
493+- **Tests**: Linux 179 → 217, Mac 243 (host-runner, run from the sandbox). In the Linux test runner a real `kill(getpid(), SIGHUP)` never reached the trap, so the signal source is injectable (`eachSignalReloadsTheFile`) and the real-signal test is `#if canImport(Darwin)` — it passes on the Mac; a real `rzb serve` on Linux does reload on `kill -HUP` (checked by hand). Live tests that call after a chat need a new connection (chat answers `Connection: close`) on `localhost` (HummingbirdTesting binds localhost). User checked on the Mac by hand with Qwen3-0.6B-4bit: status (MLX memory, keep_alive countdown, request history), unload ×2, reload with restart_required ["port"], invalid file 400, SIGHUP — all as expected.
494+- **Quality**: gate PASS run #36 (0/0/0, complexity 548 → 588), no refactoring needed.
495+- **Docs**: EN+FR reference (http-api / api-http /rzb section, errors 403/409 + 4 codes, configuration "Reloading" / "Rechargement", SIGHUP under rzb serve), how-to `watch-and-steer-a-running-server.md` / `surveiller-et-piloter-le-serveur.md`, explanations (openai-compatibility: routes of our own under /rzb; model-lifecycle: unloading on demand and reloading), indexes, `packages.drawio` labels. `test_docs_curl.py` now runs `/health` and `/rzb` examples (22 pass on Linux).
496+- **Tickets**: #53 closed (tasks 1–4, comment 1). Mid-session the user asked for a structured-output ticket, then withdrew it ("au temps pour moi": #39 already covers it). No ticket created.
modified .memory/summary.md +21 -2
@@ -86,7 +86,7 @@ throws WrongModelKind); reuses `CompletionStream`, SSE and `CompletionEnvelope<C
8686 chat chunks); suffix/logprobs/n/best_of/multi-prompt/token arrays → 400; max_tokens defaults to the
8787 config (not OpenAI's 16). Shared field checks in `FieldChecking.swift`. Docs (#45): Diátaxis EN+FR rewritten around the
8888 server (tutorial, 10 how-to, 4 reference incl. `http-api.md` / `api-http.md`, 5 explanation); the
89-`curl` blocks of `docs/*/reference/*.md` that hit `http://127.0.0.1:7920/v1` are run by
89+`curl` blocks of `docs/*/reference/*.md` that hit `http://127.0.0.1:7920/` (`/v1`, `/health`, `/rzb`; since #53) are run by
9090 `Tests/Compatibility/test_docs_curl.py` (doc models `mlx-community/Qwen3-4B-4bit` /
9191 `BAAI/bge-small-en-v1.5` are mapped to `chat` / `embed`): keep reference examples in that form, and
9292 only successful calls in ```bash blocks. v0.2 tickets #31–#45 closed; #47 (KV-cache spike)
@@ -118,6 +118,21 @@ layer: `ChatState`, `ScreenRenderer`, `PosixTerminal`, `TUIApp`), `RazorbillCLI`
118118 parser commands, `CLIEnvironment` task-local for tests), executable `rzb`. Engines registered in
119119 `Sources/rzb/main.swift`: `mlx` (Mac) then `fake`.
120120
121+Local admin routes (#53, v0.3, branch `feature/v0.3-tui`): `AdminRoutes.swift` adds a `/rzb` group
122+behind `LocalOnlyMiddleware` (`LocalOnly.swift`: `ServerContext` is a `RemoteAddressRequestContext`;
123+loopback v4/v6/mapped and unix sockets pass, unknown address refused → 403 `local_only`; API key
124+still applies). `GET /rzb/status` (`ServerStatus`: models from `ModelManager.status(now:)`, last 50
125+requests from `RequestHistory` fed by `RequestLogMiddleware` — `/rzb/` paths not recorded — and
126+`memory` from `EngineRegistry.memoryReporter`, set by `MLXSupport` from MLX `Memory.*`, null on
127+Linux). `POST /rzb/models/{id}/unload` → `ModelManager.unloadModel` (`UnloadOutcome`; busy → 409
128+`model_busy`). `POST /rzb/config/reload` + SIGHUP → `ConfigReloader` (actor; `nil` without
129+`ServerSettings.configFile`) → `ModelManager.apply(_:)`: the catalog sits in a lock box
130+(`nonisolated var catalog`), `limits` is an actor var, slots no declared id points to are unloaded
131+now or in `release` once idle (`unloadWhenIdle`); `ServerSettings.restartRequired(by:)` compares the
132+started file's `server:` keys, ignoring those set on the command line (`ServerSettings.commandLine`).
133+`ConfigReloadSignalService` (UnixSignals, injectable stream) is added to the app's services by
134+`makeApplication(reloader:)`. Types around the manager moved to `ModelManagerTypes.swift`.
135+
121136 ## Decisions in force
122137
123138 - #37 reasoning switches were chosen by Claude after the user's plain "go" (see the ticket's
@@ -132,6 +147,9 @@ parser commands, `CLIEnvironment` task-local for tests), executable `rzb`. Engin
132147 file handled directly; local-only (loopback) `/rzb/*` routes for status, unload, config reload —
133148 this amends the #31 "OpenAI-compatible API only" rule (still no Ollama `/api/*`). Unload in v0.3;
134149 settings = TUI preferences + server config. Tickets #53–#59, #26/#28 moved to that milestone.
150+ #53 (user, 2026-11-26): the TUI polls `GET /rzb/status` (no SSE); unloading a model in use is
151+ refused with 409 (no waiting, no cancelling); a reload applies everything but the network (host,
152+ port, api_key_env, cors_origin → `restart_required`); invalid file → 400, old config kept.
135153 - Default port 7920 (user, 2026-11-26; was 8080, taken by llama-server / mlx_lm.server / Open WebUI).
136154 `/`, `/v1`, `/v1/` answer the usual 404 `unknown_url` plus a hint that `/v1` is the base URL.
137155 - Work stays local: no push to `origin` until the user says so. `origin` is `ssh://git@rickub.com/bots-garden/razorbill.git`:
@@ -233,7 +251,8 @@ Mac (MLX, Qwen3-4B + bge-small + Llama-3.2-3B): 45/46 before the #43 fixes; re-r
233251 Tests 2026-11-25 after #43 fixes: Linux 155, Mac 178. After #44: Linux 161, Mac 185, compat on
234252 Linux 34 pass / 21 skip (Mac compat not re-run after #44). After #48 (prompt cache): Linux 168, Mac 193,
235253 compat on Linux 48 pass / 20 skip. After #49: Linux 172, Mac 198, compat Linux 51 / 20 (Mac compat
236-not re-run since #44).
254+not re-run since #44). After #53: Linux 217, Mac 243 (host-runner; `sighupReloadsTheFile` runs on
255+macOS only), compat on Linux `-k docs_curl` 22 pass (whole compat suite not re-run).
237256
238257 Sampling (#49, user's rule: only what mlx-swift-lm implements): temperature, top_p, max_tokens,
239258 stop, seed, presence/frequency_penalty (mlx window: last 20 tokens incl. prompt), plus extensions
@@ -86,7 +86,7 @@ throws WrongModelKind); reuses `CompletionStream`, SSE and `CompletionEnvelope<C
86 chat chunks); suffix/logprobs/n/best_of/multi-prompt/token arrays → 400; max_tokens defaults to the86 chat chunks); suffix/logprobs/n/best_of/multi-prompt/token arrays → 400; max_tokens defaults to the
87 config (not OpenAI's 16). Shared field checks in `FieldChecking.swift`. Docs (#45): Diátaxis EN+FR rewritten around the87 config (not OpenAI's 16). Shared field checks in `FieldChecking.swift`. Docs (#45): Diátaxis EN+FR rewritten around the
88 server (tutorial, 10 how-to, 4 reference incl. `http-api.md` / `api-http.md`, 5 explanation); the88 server (tutorial, 10 how-to, 4 reference incl. `http-api.md` / `api-http.md`, 5 explanation); the
89-`curl` blocks of `docs/*/reference/*.md` that hit `http://127.0.0.1:7920/v1` are run by89+`curl` blocks of `docs/*/reference/*.md` that hit `http://127.0.0.1:7920/` (`/v1`, `/health`, `/rzb`; since #53) are run by
90 `Tests/Compatibility/test_docs_curl.py` (doc models `mlx-community/Qwen3-4B-4bit` /90 `Tests/Compatibility/test_docs_curl.py` (doc models `mlx-community/Qwen3-4B-4bit` /
91 `BAAI/bge-small-en-v1.5` are mapped to `chat` / `embed`): keep reference examples in that form, and91 `BAAI/bge-small-en-v1.5` are mapped to `chat` / `embed`): keep reference examples in that form, and
92 only successful calls in ```bash blocks. v0.2 tickets #31–#45 closed; #47 (KV-cache spike)92 only successful calls in ```bash blocks. v0.2 tickets #31–#45 closed; #47 (KV-cache spike)
@@ -118,6 +118,21 @@ layer: `ChatState`, `ScreenRenderer`, `PosixTerminal`, `TUIApp`), `RazorbillCLI`
118 parser commands, `CLIEnvironment` task-local for tests), executable `rzb`. Engines registered in118 parser commands, `CLIEnvironment` task-local for tests), executable `rzb`. Engines registered in
119 `Sources/rzb/main.swift`: `mlx` (Mac) then `fake`.119 `Sources/rzb/main.swift`: `mlx` (Mac) then `fake`.
120 120
121+Local admin routes (#53, v0.3, branch `feature/v0.3-tui`): `AdminRoutes.swift` adds a `/rzb` group
122+behind `LocalOnlyMiddleware` (`LocalOnly.swift`: `ServerContext` is a `RemoteAddressRequestContext`;
123+loopback v4/v6/mapped and unix sockets pass, unknown address refused → 403 `local_only`; API key
124+still applies). `GET /rzb/status` (`ServerStatus`: models from `ModelManager.status(now:)`, last 50
125+requests from `RequestHistory` fed by `RequestLogMiddleware` — `/rzb/` paths not recorded — and
126+`memory` from `EngineRegistry.memoryReporter`, set by `MLXSupport` from MLX `Memory.*`, null on
127+Linux). `POST /rzb/models/{id}/unload` → `ModelManager.unloadModel` (`UnloadOutcome`; busy → 409
128+`model_busy`). `POST /rzb/config/reload` + SIGHUP → `ConfigReloader` (actor; `nil` without
129+`ServerSettings.configFile`) → `ModelManager.apply(_:)`: the catalog sits in a lock box
130+(`nonisolated var catalog`), `limits` is an actor var, slots no declared id points to are unloaded
131+now or in `release` once idle (`unloadWhenIdle`); `ServerSettings.restartRequired(by:)` compares the
132+started file's `server:` keys, ignoring those set on the command line (`ServerSettings.commandLine`).
133+`ConfigReloadSignalService` (UnixSignals, injectable stream) is added to the app's services by
134+`makeApplication(reloader:)`. Types around the manager moved to `ModelManagerTypes.swift`.
135+
121 ## Decisions in force136 ## Decisions in force
122 137
123 - #37 reasoning switches were chosen by Claude after the user's plain "go" (see the ticket's138 - #37 reasoning switches were chosen by Claude after the user's plain "go" (see the ticket's
@@ -132,6 +147,9 @@ parser commands, `CLIEnvironment` task-local for tests), executable `rzb`. Engin
132 file handled directly; local-only (loopback) `/rzb/*` routes for status, unload, config reload —147 file handled directly; local-only (loopback) `/rzb/*` routes for status, unload, config reload —
133 this amends the #31 "OpenAI-compatible API only" rule (still no Ollama `/api/*`). Unload in v0.3;148 this amends the #31 "OpenAI-compatible API only" rule (still no Ollama `/api/*`). Unload in v0.3;
134 settings = TUI preferences + server config. Tickets #53–#59, #26/#28 moved to that milestone.149 settings = TUI preferences + server config. Tickets #53–#59, #26/#28 moved to that milestone.
150+ #53 (user, 2026-11-26): the TUI polls `GET /rzb/status` (no SSE); unloading a model in use is
151+ refused with 409 (no waiting, no cancelling); a reload applies everything but the network (host,
152+ port, api_key_env, cors_origin → `restart_required`); invalid file → 400, old config kept.
135 - Default port 7920 (user, 2026-11-26; was 8080, taken by llama-server / mlx_lm.server / Open WebUI).153 - Default port 7920 (user, 2026-11-26; was 8080, taken by llama-server / mlx_lm.server / Open WebUI).
136 `/`, `/v1`, `/v1/` answer the usual 404 `unknown_url` plus a hint that `/v1` is the base URL.154 `/`, `/v1`, `/v1/` answer the usual 404 `unknown_url` plus a hint that `/v1` is the base URL.
137 - Work stays local: no push to `origin` until the user says so. `origin` is `ssh://git@rickub.com/bots-garden/razorbill.git`:155 - Work stays local: no push to `origin` until the user says so. `origin` is `ssh://git@rickub.com/bots-garden/razorbill.git`:
@@ -233,7 +251,8 @@ Mac (MLX, Qwen3-4B + bge-small + Llama-3.2-3B): 45/46 before the #43 fixes; re-r
233 Tests 2026-11-25 after #43 fixes: Linux 155, Mac 178. After #44: Linux 161, Mac 185, compat on251 Tests 2026-11-25 after #43 fixes: Linux 155, Mac 178. After #44: Linux 161, Mac 185, compat on
234 Linux 34 pass / 21 skip (Mac compat not re-run after #44). After #48 (prompt cache): Linux 168, Mac 193,252 Linux 34 pass / 21 skip (Mac compat not re-run after #44). After #48 (prompt cache): Linux 168, Mac 193,
235 compat on Linux 48 pass / 20 skip. After #49: Linux 172, Mac 198, compat Linux 51 / 20 (Mac compat253 compat on Linux 48 pass / 20 skip. After #49: Linux 172, Mac 198, compat Linux 51 / 20 (Mac compat
236-not re-run since #44).254+not re-run since #44). After #53: Linux 217, Mac 243 (host-runner; `sighupReloadsTheFile` runs on
255+macOS only), compat on Linux `-k docs_curl` 22 pass (whole compat suite not re-run).
237 256
238 Sampling (#49, user's rule: only what mlx-swift-lm implements): temperature, top_p, max_tokens,257 Sampling (#49, user's rule: only what mlx-swift-lm implements): temperature, top_p, max_tokens,
239 stop, seed, presence/frequency_penalty (mlx window: last 20 tokens incl. prompt), plus extensions258 stop, seed, presence/frequency_penalty (mlx window: last 20 tokens incl. prompt), plus extensions
modified .tickets/issues/0053-local-admin-routes-status-unload-config-reload.yaml +40 -7
@@ -1,12 +1,13 @@
11 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
22 id: 53
33 title: "Local admin routes on rzb serve: status, unload, config reload"
4-state: open
4+state: closed
55 author:
66 name: k33g
77 email: ph.charriere@gmail.com
88 createdAt: 2026-11-26T08:00:00.000Z
9-updatedAt: 2026-11-26T08:00:00.000Z
9+updatedAt: 2026-11-26T22:30:00.000Z
10+closedAt: 2026-11-26T22:30:00.000Z
1011 labels:
1112 - "kind::feature"
1213 - "area::server"
@@ -32,34 +33,66 @@ body: |
3233 tasks:
3334 - id: 1
3435 title: "Status route (and decide polling or SSE)"
35- state: open
36+ state: closed
3637 priority: high
3738 author:
3839 name: k33g
3940 email: ph.charriere@gmail.com
4041 createdAt: 2026-11-26T08:00:00.000Z
42+ updatedAt: 2026-11-26T22:30:00.000Z
43+ closedAt: 2026-11-26T22:30:00.000Z
4144 - id: 2
4245 title: "Unload route"
43- state: open
46+ state: closed
4447 priority: medium
4548 author:
4649 name: k33g
4750 email: ph.charriere@gmail.com
4851 createdAt: 2026-11-26T08:00:00.000Z
52+ updatedAt: 2026-11-26T22:30:00.000Z
53+ closedAt: 2026-11-26T22:30:00.000Z
4954 - id: 3
5055 title: "Configuration reload (route and SIGHUP), live vs restart keys"
51- state: open
56+ state: closed
5257 priority: high
5358 author:
5459 name: k33g
5560 email: ph.charriere@gmail.com
5661 createdAt: 2026-11-26T08:00:00.000Z
62+ updatedAt: 2026-11-26T22:30:00.000Z
63+ closedAt: 2026-11-26T22:30:00.000Z
5764 - id: 4
5865 title: "Loopback-only access, tests, HTTP API reference EN + FR"
59- state: open
66+ state: closed
6067 priority: high
6168 author:
6269 name: k33g
6370 email: ph.charriere@gmail.com
6471 createdAt: 2026-11-26T08:00:00.000Z
65-comments: []
72+ updatedAt: 2026-11-26T22:30:00.000Z
73+ closedAt: 2026-11-26T22:30:00.000Z
74+comments:
75+ - id: 1
76+ author:
77+ name: k33g
78+ email: ph.charriere@gmail.com
79+ createdAt: 2026-11-26T22:30:00.000Z
80+ body: |
81+ Done on branch feature/v0.3-tui (commits 70660e3..a6959e4). Decisions (user, 2026-11-26): polling,
82+ no SSE; unloading a busy model is refused (409); a reload applies everything but the network.
83+
84+ - Access: LocalOnlyMiddleware on the /rzb group: loopback peers only (127.0.0.0/8, ::1,
85+ ::ffff:127.x, unix socket; unknown address refused) -> 403 local_only, API key still required.
86+ - GET /rzb/status: version, uptime, host/port, models loaded or loading (key, name, kind, state,
87+ size, busy, queued, idle, keep_alive left or null while held), last 50 requests (the /rzb routes
88+ are not recorded), MLX memory (active/cache/peak/limit; null on Linux).
89+ - POST /rzb/models/{id}/unload: unloaded / not_loaded (200), model_busy (409), model_not_found
90+ (404). A repository id frees its chat and embedding loads, a declared id its own kind.
91+ - POST /rzb/config/reload and SIGHUP: models, defaults, locked, limits live; a loaded model no
92+ declared id points to anymore is unloaded now or when idle; host, port, api_key_env and
93+ cors_origin are reported in restart_required (command-line options never count); invalid file
94+ -> 400 invalid_config (old one kept), no --config -> 409 no_config_file.
95+ - Tests: Linux 217, Mac 243 (incl. a real SIGHUP test, macOS only); checked by hand on the Mac
96+ with Qwen3-0.6B-4bit (status, unload, reload, invalid file, kill -HUP). Gate PASS (run #36).
97+ - Docs EN+FR: HTTP API reference /rzb section, error codes, configuration "Reloading", how-to
98+ "watch and steer a running server", explanations (routes of our own; unloading and reloading).
@@ -1,12 +1,13 @@
1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2 id: 532 id: 53
3 title: "Local admin routes on rzb serve: status, unload, config reload"3 title: "Local admin routes on rzb serve: status, unload, config reload"
4-state: open4+state: closed
5 author:5 author:
6 name: k33g6 name: k33g
7 email: ph.charriere@gmail.com7 email: ph.charriere@gmail.com
8 createdAt: 2026-11-26T08:00:00.000Z8 createdAt: 2026-11-26T08:00:00.000Z
9-updatedAt: 2026-11-26T08:00:00.000Z9+updatedAt: 2026-11-26T22:30:00.000Z
10+closedAt: 2026-11-26T22:30:00.000Z
10 labels:11 labels:
11 - "kind::feature"12 - "kind::feature"
12 - "area::server"13 - "area::server"
@@ -32,34 +33,66 @@ body: |
32 tasks:33 tasks:
33 - id: 134 - id: 1
34 title: "Status route (and decide polling or SSE)"35 title: "Status route (and decide polling or SSE)"
35- state: open36+ state: closed
36 priority: high37 priority: high
37 author:38 author:
38 name: k33g39 name: k33g
39 email: ph.charriere@gmail.com40 email: ph.charriere@gmail.com
40 createdAt: 2026-11-26T08:00:00.000Z41 createdAt: 2026-11-26T08:00:00.000Z
42+ updatedAt: 2026-11-26T22:30:00.000Z
43+ closedAt: 2026-11-26T22:30:00.000Z
41 - id: 244 - id: 2
42 title: "Unload route"45 title: "Unload route"
43- state: open46+ state: closed
44 priority: medium47 priority: medium
45 author:48 author:
46 name: k33g49 name: k33g
47 email: ph.charriere@gmail.com50 email: ph.charriere@gmail.com
48 createdAt: 2026-11-26T08:00:00.000Z51 createdAt: 2026-11-26T08:00:00.000Z
52+ updatedAt: 2026-11-26T22:30:00.000Z
53+ closedAt: 2026-11-26T22:30:00.000Z
49 - id: 354 - id: 3
50 title: "Configuration reload (route and SIGHUP), live vs restart keys"55 title: "Configuration reload (route and SIGHUP), live vs restart keys"
51- state: open56+ state: closed
52 priority: high57 priority: high
53 author:58 author:
54 name: k33g59 name: k33g
55 email: ph.charriere@gmail.com60 email: ph.charriere@gmail.com
56 createdAt: 2026-11-26T08:00:00.000Z61 createdAt: 2026-11-26T08:00:00.000Z
62+ updatedAt: 2026-11-26T22:30:00.000Z
63+ closedAt: 2026-11-26T22:30:00.000Z
57 - id: 464 - id: 4
58 title: "Loopback-only access, tests, HTTP API reference EN + FR"65 title: "Loopback-only access, tests, HTTP API reference EN + FR"
59- state: open66+ state: closed
60 priority: high67 priority: high
61 author:68 author:
62 name: k33g69 name: k33g
63 email: ph.charriere@gmail.com70 email: ph.charriere@gmail.com
64 createdAt: 2026-11-26T08:00:00.000Z71 createdAt: 2026-11-26T08:00:00.000Z
65-comments: []72+ updatedAt: 2026-11-26T22:30:00.000Z
73+ closedAt: 2026-11-26T22:30:00.000Z
74+comments:
75+ - id: 1
76+ author:
77+ name: k33g
78+ email: ph.charriere@gmail.com
79+ createdAt: 2026-11-26T22:30:00.000Z
80+ body: |
81+ Done on branch feature/v0.3-tui (commits 70660e3..a6959e4). Decisions (user, 2026-11-26): polling,
82+ no SSE; unloading a busy model is refused (409); a reload applies everything but the network.
83+
84+ - Access: LocalOnlyMiddleware on the /rzb group: loopback peers only (127.0.0.0/8, ::1,
85+ ::ffff:127.x, unix socket; unknown address refused) -> 403 local_only, API key still required.
86+ - GET /rzb/status: version, uptime, host/port, models loaded or loading (key, name, kind, state,
87+ size, busy, queued, idle, keep_alive left or null while held), last 50 requests (the /rzb routes
88+ are not recorded), MLX memory (active/cache/peak/limit; null on Linux).
89+ - POST /rzb/models/{id}/unload: unloaded / not_loaded (200), model_busy (409), model_not_found
90+ (404). A repository id frees its chat and embedding loads, a declared id its own kind.
91+ - POST /rzb/config/reload and SIGHUP: models, defaults, locked, limits live; a loaded model no
92+ declared id points to anymore is unloaded now or when idle; host, port, api_key_env and
93+ cors_origin are reported in restart_required (command-line options never count); invalid file
94+ -> 400 invalid_config (old one kept), no --config -> 409 no_config_file.
95+ - Tests: Linux 217, Mac 243 (incl. a real SIGHUP test, macOS only); checked by hand on the Mac
96+ with Qwen3-0.6B-4bit (status, unload, reload, invalid file, kill -HUP). Gate PASS (run #36).
97+ - Docs EN+FR: HTTP API reference /rzb section, error codes, configuration "Reloading", how-to
98+ "watch and steer a running server", explanations (routes of our own; unloading and reloading).