Address review comments: dynamic config path in warning, fix --ctx-size docs, remove dead service-args code

Agent-Logs-Url: https://github.com/michaelneale/mesh-llm/sessions/2edc2366-a8ef-4876-b950-5c4074df8a67

Co-authored-by: i386 <50156+i386@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-06 00:18:37 +00:00 committed by GitHub
parent 16b916b35e
commit 100a649ddf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 13 additions and 81 deletions

View file

@ -234,7 +234,7 @@ mesh-llm serve --config /path/to/config.toml
Precedence rules:
- Explicit `--model` or `--gguf` ignores configured `[[models]]`.
- Explicit `--context-size` overrides configured `ctx_size` for the selected startup models.
- Explicit `--ctx-size` overrides configured `ctx_size` for the selected startup models.
- Plugin entries still live in the same file.
### No-arg behavior

View file

@ -183,7 +183,7 @@ mesh-llm serve --config /path/to/config.toml
Config precedence:
- Explicit `--model` or `--gguf` ignores configured `[[models]]`.
- Explicit `--context-size` overrides configured `ctx_size` for the selected startup models.
- Explicit `--ctx-size` overrides configured `ctx_size` for the selected startup models.
- `mmproj` is optional and only used when that startup model needs a projector sidecar.
- Plugin entries stay in the same file.

View file

@ -323,81 +323,6 @@ install_bundle() {
done
}
write_service_args_file() {
local path="$1"
local raw_args="$2"
mkdir -p "$(dirname "$path")"
if ! eval "set -- $raw_args"; then
echo "error: failed to parse service args: $raw_args" >&2
exit 1
fi
{
echo "# One mesh-llm CLI argument per line."
echo "# Blank lines and lines beginning with # are ignored."
echo "# Examples:"
echo "# --auto"
echo "# --model"
echo "# Qwen2.5-3B"
local arg
for arg in "$@"; do
printf '%s\n' "$arg"
done
} > "$path"
}
serialize_shell_args() {
local out=""
local escaped
local arg
for arg in "$@"; do
printf -v escaped '%q' "$arg"
out+="${out:+ }$escaped"
done
printf '%s' "$out"
}
parse_service_args() {
local raw_args="$1"
if ! eval "set -- $raw_args"; then
echo "error: failed to parse service args: $raw_args" >&2
exit 1
fi
SERVICE_ARGS_VALUES=("$@")
SERVICE_ARGS_SERIALIZED="$(serialize_shell_args "$@")"
}
read_existing_systemd_args() {
if [[ ! -f "$SYSTEMD_UNIT_PATH" ]]; then
return 1
fi
local existing
existing="$(sed -n "s/^${SYSTEMD_ARGS_COMMENT_PREFIX}//p" "$SYSTEMD_UNIT_PATH" | head -n 1)"
[[ -n "$existing" ]] || return 1
printf '%s\n' "$existing"
}
resolve_systemd_service_args() {
local existing
if [[ -n "$INSTALL_SERVICE_ARGS" ]]; then
parse_service_args "$INSTALL_SERVICE_ARGS"
return
fi
if existing="$(read_existing_systemd_args)"; then
parse_service_args "$existing"
return
fi
parse_service_args "--auto"
}
systemd_escape_assignment_value() {
local value="$1"
value="${value//\\/\\\\}"

View file

@ -101,7 +101,7 @@ args = ["--stdio"]
```
`mesh-llm serve` uses `~/.mesh-llm/config.toml` by default, or `--config /path/to/config.toml`.
Explicit `--model` or `--gguf` ignores configured `[[models]]`, and explicit `--context-size`
Explicit `--model` or `--gguf` ignores configured `[[models]]`, and explicit `--ctx-size`
overrides configured `ctx_size` for the selected startup models.
Bare `mesh-llm serve` warns, shows help, and exits if `[[models]]` is empty.

View file

@ -122,7 +122,7 @@ Phase 2 keeps this config intentionally local-node only. There is no authored me
CLI precedence is by concern:
- explicit `--model` or `--gguf` ignores configured `[[models]]`
- explicit `--context-size` overrides configured `ctx_size`
- explicit `--ctx-size` overrides configured `ctx_size`
- plugin config continues to load from the same file
Bare `mesh-llm serve` is the config-owned path. If `[[models]]` is empty, it warns,

View file

@ -38,7 +38,7 @@ mesh-llm serve
- Both configured startup models should be considered for launch
- If `[[models]]` is empty, `mesh-llm serve` should print a `⚠️` warning, show help, and exit cleanly
- Explicit `--model` or `--gguf` should ignore configured `[[models]]`
- Explicit `--context-size` should override configured `ctx_size`
- Explicit `--ctx-size` should override configured `ctx_size`
## Single-model permutations

View file

@ -296,8 +296,15 @@ pub(crate) async fn run() -> Result<()> {
}
let startup_specs = build_startup_model_specs(&cli, &config)?;
if should_show_serve_config_help(normalized_args.explicit_surface, &cli, &startup_specs) {
let config_path = plugin::config_path(cli.config.as_deref()).unwrap_or_else(|_| {
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("~"))
.join(".mesh-llm")
.join("config.toml")
});
eprintln!(
"⚠️ `mesh-llm serve` needs at least one startup model.\n Add `[[models]]` to ~/.mesh-llm/config.toml, or pass `--model` / `--gguf` explicitly."
"⚠️ `mesh-llm serve` needs at least one startup model.\n Add `[[models]]` to {}, or pass `--model` / `--gguf` explicitly.",
config_path.display()
);
Cli::command().print_help().ok();
eprintln!();