Skip to content

armgit / Soup

Public Imported from GitHub
0

Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.

fix(serve): the --tool-auth-token help names /v1/tools/bash; regenerate the reference pages (#1879)

Alpamys Makazhana59b8fe47037
diff --git a/changelog.d/0.76.0/1879.fixed.md b/changelog.d/0.76.0/1879.fixed.md
new file mode 100644
index 00000000..14204413
--- /dev/null
+++ b/changelog.d/0.76.0/1879.fixed.md
@@ -0,0 +1 @@
+- `soup serve --help` names `/v1/tools/bash` among the endpoints `--tool-auth-token` protects, next to `/v1/tools/python` and `/v1/tools/web_search`, and a test checks every registered `/v1/tools/*` route against the help text. The generated reference pages are regenerated after #1795 and #1783 left them stale (#1879).
diff --git a/docs/cli-reference.md b/docs/cli-reference.md
index a11ea60f..29c6f6ac 100644
--- a/docs/cli-reference.md
+++ b/docs/cli-reference.md
@@ -502,7 +502,7 @@ Usage: `soup agent train [OPTIONS]`
| `--base`, `-b` | text | | yes | Base model HF repo id to fine-tune. |
| `--dataset-out` | text | `agent_dataset.jsonl` | | Where the synth step writes its dataset (under cwd). |
| `--output-dir` | text | `./agent_train_output` | | Where the planned soup train run will store checkpoints. |
-| `--examples-per-endpoint`, `-n` | integer, 1 to 32 | `4` | | |
+| `--examples-per-endpoint`, `-n` | integer, 1 to 32 | `4` | | Number of synthetic examples to create per API endpoint. |
## `soup airgap-bundle`
@@ -751,7 +751,7 @@ Usage: `soup can fork [OPTIONS] SOURCE`
| `SOURCE` | text | | yes | Source .can path |
| `--out`, `-o` | text | | yes | Output forked .can path |
| `--modify` | text, repeatable | | | Modification like 'training.lr=5e-5' (repeatable) |
-| `--author` | text | `unknown` | | |
+| `--author` | text | `unknown` | | Author name recorded in the forked manifest. |
### `soup can inspect`
@@ -787,7 +787,7 @@ Usage: `soup can publish [OPTIONS] CAN_PATH`
|---|---|---|---|---|
| `CAN_PATH` | text | | yes | Path to .can file |
| `--hf-hub` | text | | yes | HF Hub dataset repo (e.g. 'me/my-recipe-can') |
-| `--private` | flag | off | | |
+| `--private` | flag | off | | Create a private HF Hub dataset repository. |
| `--message`, `-m` | text | | | Commit message (first line only, capped at 200 chars) |
### `soup can run`
@@ -1131,12 +1131,12 @@ Usage: `soup data decontaminate [OPTIONS]`
| Name | Type | Default | Required | Help |
|---|---|---|---|---|
-| `--input`, `-i` | text | | yes | |
+| `--input`, `-i` | text | | yes | Input JSONL file to decontaminate. |
| `--benchmarks`, `-b` | text | | | Comma-separated benchmark names (label only; corpora not bundled). |
| `--benchmark-file` | text | | | v0.53.7: operator-supplied benchmark JSONL (under cwd). Each row's ``text``/``prompt``/``content`` field contributes to the n-gram contamination set. Compatible with --benchmarks (extends). |
| `--output`, `-o` | text | `clean.jsonl` | | Output JSONL of rows that survived decontamination. |
-| `--threshold` | float, 0.0 to 1.0 | `0.8` | | |
-| `--n` | integer, 1 to 32 | `8` | | |
+| `--threshold` | float, 0.0 to 1.0 | `0.8` | | Minimum n-gram overlap ratio for removing a row. |
+| `--n` | integer, 1 to 32 | `8` | | N-gram size used for overlap detection. |
### `soup data dedup`
@@ -1210,8 +1210,8 @@ Usage: `soup data educational [OPTIONS]`
| Name | Type | Default | Required | Help |
|---|---|---|---|---|
-| `--input`, `-i` | text | | yes | |
-| `--output`, `-o` | text | `educational.jsonl` | | |
+| `--input`, `-i` | text | | yes | Input JSONL file to score. |
+| `--output`, `-o` | text | `educational.jsonl` | | Output JSONL file with educational-value scores. |
### `soup data evolve`
@@ -1371,8 +1371,8 @@ Usage: `soup data langdetect [OPTIONS]`
| Name | Type | Default | Required | Help |
|---|---|---|---|---|
-| `--input`, `-i` | text | | yes | |
-| `--output`, `-o` | text | `langdetect.jsonl` | | |
+| `--input`, `-i` | text | | yes | Input JSONL file to tag. |
+| `--output`, `-o` | text | `langdetect.jsonl` | | Output JSONL file with language tags. |
### `soup data lint`
@@ -1443,8 +1443,8 @@ Usage: `soup data pii [OPTIONS]`
| Name | Type | Default | Required | Help |
|---|---|---|---|---|
-| `--input`, `-i` | text | | yes | |
-| `--output`, `-o` | text | `pii.jsonl` | | |
+| `--input`, `-i` | text | | yes | Input JSONL file to scan. |
+| `--output`, `-o` | text | `pii.jsonl` | | Output JSONL file containing rows with detected PII. |
### `soup data preprocess`
@@ -1622,8 +1622,8 @@ Usage: `soup data toxicity [OPTIONS]`
| Name | Type | Default | Required | Help |
|---|---|---|---|---|
-| `--input`, `-i` | text | | yes | |
-| `--output`, `-o` | text | `toxicity.jsonl` | | |
+| `--input`, `-i` | text | | yes | Input JSONL file to score. |
+| `--output`, `-o` | text | `toxicity.jsonl` | | Output JSONL file for rows meeting the threshold. |
| `--threshold` | float, 0.0 to 1.0 | `0.05` | | Rows meeting the abuse-keyword threshold are kept. |
### `soup data unregister`
@@ -2870,6 +2870,8 @@ Subcommands:
### `soup plugins disable`
+Disable a registered Soup plugin.
+
Usage: `soup plugins disable NAME`
| Name | Type | Default | Required | Help |
@@ -2878,6 +2880,8 @@ Usage: `soup plugins disable NAME`
### `soup plugins enable`
+Enable a registered Soup plugin.
+
Usage: `soup plugins enable NAME`
| Name | Type | Default | Required | Help |
@@ -3195,11 +3199,11 @@ Usage: `soup registry list [OPTIONS]`
| Name | Type | Default | Required | Help |
|---|---|---|---|---|
-| `--name`, `-n` | text | | | |
-| `--tag`, `-t` | text | | | |
-| `--base`, `-b` | text | | | |
-| `--task` | text | | | |
-| `--limit`, `-l` | integer | `100` | | |
+| `--name`, `-n` | text | | | Filter by registry entry name. |
+| `--tag`, `-t` | text | | | Filter by tag. |
+| `--base`, `-b` | text | | | Filter by base model. |
+| `--task` | text | | | Filter by training task. |
+| `--limit`, `-l` | integer | `100` | | Maximum number of entries to show. |
### `soup registry promote`
@@ -3234,7 +3238,7 @@ Usage: `soup registry search [OPTIONS] QUERY`
| Name | Type | Default | Required | Help |
|---|---|---|---|---|
| `QUERY` | text | | yes | Keyword to search for |
-| `--limit`, `-l` | integer | `50` | | |
+| `--limit`, `-l` | integer | `50` | | Maximum number of matching entries to show. |
### `soup registry show`
@@ -3439,7 +3443,7 @@ Usage: `soup serve [OPTIONS]`
| `--bank-strength` | float | `1.0` | | Vector-bank delta strength multiplier. Ignored when --bank is unset. |
| `--mole` | text | | | Path to a MoLE training output dir (mole_gate.pt + mole_manifest.json). Serves the base + N frozen task LoRAs with per-token gate blending at decode time. Requires --backend transformers; not combinable with --bank / --steer / --adapters. (v0.71.17 #259) |
| `--kv-cache-type` | text | | | KV-cache type for decoding: q8_0 (8-bit quantized, needs hqq) / bf16 / f16 (cache dtype) / fp8 (vLLM+Hopper only). Transformers backend only — vLLM / SGLang routing is in the blocked tail. v0.71.14 (#140). |
-| `--tool-auth-token` | text | | | Require 'Authorization: Bearer <token>' on the code-exec tool endpoints (/v1/tools/python, /v1/tools/web_search). Strongly recommended whenever --host is not loopback, since those endpoints run caller-supplied Python in a best-effort sandbox. |
+| `--tool-auth-token` | text | | | Require 'Authorization: Bearer <token>' on the code-exec tool endpoints (/v1/tools/python, /v1/tools/bash, /v1/tools/web_search). Strongly recommended whenever --host is not loopback, since those endpoints run caller-supplied Python in a best-effort sandbox. |
## `soup ship`
diff --git a/docs/config-reference.md b/docs/config-reference.md
index dcf52c5f..8ea9b186 100644
--- a/docs/config-reference.md
+++ b/docs/config-reference.md
@@ -119,7 +119,7 @@ Sections:
| `training.fp8_recipe` | `str` | `"tensorwise"` | one of `"tensorwise"`, `"rowwise"`, `"rowwise_with_gw_hp"` | FP8 scaling recipe (only used when quantization_aware='fp8'). 'tensorwise' (fastest, default), 'rowwise' (more accurate, CUTLASS rowwise), 'rowwise_with_gw_hp' (most accurate, grad_weight in high precision). (v0.28.1). |
| `training.optimizer` | `str` | `"adamw_torch"` | | Optimizer name (v0.41.0 expanded the allowlist: HF-native, bnb-8bit, lomo/adalomo, apollo_adamw, grokadamw, schedule_free). Note: ten names transformers 5.x rejects in TrainingArguments (e.g. badam, adam_mini, muon, dion, came_pytorch, ao_adamw\_{fp8,4bit,8bit}) are refused at config load (#1269); adamw_hf and muon still work on backend: mlx. See soup_cli.utils.optimizer_zoo.SUPPORTED_OPTIMIZERS for the full list. |
| `training.lr_groups` | `list[dict[str, str \| float]] \| null` | `null` | | Staged, not applied: a per-module LR override (list of {pattern, lr} entries or a {pattern: lr} dict, capped at 32) that no optimizer reads; setting it warns at load, then is refused (#761). (v0.41.0) |
-| `training.expand_layers` | `int \| null` | `null` | `>= 1`, `<= 64` | LLaMA Pro: append N zero-init transformer blocks and freeze the original ones before SFT or pre-training. |
+| `training.expand_layers` | `int \| null` | `null` | `>= 1`, `<= 64` | LLaMA Pro: append N zero-init transformer blocks and freeze the original ones, so only the new blocks train. A LoRA rank is refused with it, since get_peft_model would freeze the new blocks again (#1326): set lora.r: 0 and quantization: none on task: sft. |
| `training.freeze_trainable_layers` | `int \| null` | `null` | | LLaMA Pro: applies only together with expand_layers, must equal it, and is refused otherwise. It freezes every parameter of the original model so only the appended blocks train; it does not select top-N or bottom-N layers. Magnitude capped at 1000. (v0.41.0) |
| `training.use_mod` | `bool` | `false` | | Enable Mixture-of-Depths selective-token routing (arXiv:2404.02258). Live in v0.71.12 #84 for SFT + Pretrain on Llama / Qwen / Mistral; each decoder layer gets a router that passes only the top-k tokens (k = floor(seq_len \* mod_capacity_factor)) through the block. |
| `training.mod_capacity_factor` | `float` | `0.125` | `> 0.0`, `<= 1.0` | Fraction of tokens routed through each block when use_mod=True. Bounded (0, 1]; default 0.125 (per the MoD paper). (v0.71.12 #84) |
diff --git a/src/soup_cli/commands/serve.py b/src/soup_cli/commands/serve.py
index 31299433..a4a59d2f 100644
--- a/src/soup_cli/commands/serve.py
+++ b/src/soup_cli/commands/serve.py
@@ -311,8 +311,8 @@ def serve(
"--tool-auth-token",
help=(
"Require 'Authorization: Bearer <token>' on the code-exec tool "
- "endpoints (/v1/tools/python, /v1/tools/web_search). Strongly "
- "recommended whenever --host is not loopback, since those "
+ "endpoints (/v1/tools/python, /v1/tools/bash, /v1/tools/web_search). "
+ "Strongly recommended whenever --host is not loopback, since those "
"endpoints run caller-supplied Python in a best-effort sandbox."
),
),
@@ -1723,7 +1723,8 @@ def _create_app(
Args:
auth_token: optional Bearer-token gate for the v0.53.7 tool
- endpoints (``/v1/tools/python`` + ``/v1/tools/web_search``).
+ endpoints (``/v1/tools/python``, ``/v1/tools/bash`` and
+ ``/v1/tools/web_search``).
When ``None`` (default), endpoints inherit the server's
loopback-only CORS trust boundary. When set, callers must
supply ``Authorization: Bearer <token>``.
diff --git a/tests/test_serve_non_loopback_notice.py b/tests/test_serve_non_loopback_notice.py
index a4e21d1f..7a2c526a 100644
--- a/tests/test_serve_non_loopback_notice.py
+++ b/tests/test_serve_non_loopback_notice.py
@@ -16,6 +16,8 @@ None of that changes here. The command now prints it at startup, and the
from __future__ import annotations
+import inspect
+import re
from io import StringIO
import pytest
@@ -188,3 +190,20 @@ class TestHostHelp:
assert "Any other host needs --tool-auth-token" in out
assert "checked on the tool, thumbs and adapter routes only" in out
assert "should be paired with" not in out
+
+
+class TestToolAuthTokenHelp:
+ def test_help_names_every_tool_route_the_token_gates(self, monkeypatch):
+ monkeypatch.setenv("COLUMNS", "200")
+ # Read the routes off the source so a fourth tool route cannot slip past; the
+ # floor keeps a changed decorator spelling from turning the loop into a no-op.
+ routes = re.findall(r'@app\.post\("(/v1/tools/[a-z_]+)"', inspect.getsource(serve_cmd))
+ assert {"/v1/tools/python", "/v1/tools/bash", "/v1/tools/web_search"} <= set(routes)
+
+ result = runner.invoke(app, ["serve", "--help"])
+
+ assert result.exit_code == 0, (result.output, repr(result.exception))
+ out = _plain(result.output.replace("│", " "))
+ for route in routes:
+ assert route in out, f"{route} is gated by --tool-auth-token but not in --help"
+ assert "(/v1/tools/python, /v1/tools/bash, /v1/tools/web_search)" in out