fix: F6 Review — B1 pipx Python 3.13 erzwingen, B2 Verifikations-Greps real, B3 Idempotenz, R5 journalctl-Secrets-Hinweis, R6 providers ollama-cloud

B1 (BLOCKER): pipx installiert hermes-agent jetzt zwingend mit --python python3.13.
- python3.13 wird via apt installiert falls nicht vorhanden
- Bestehende pipx-venv mit falscher Python-Version wird erkannt und neu installiert
- Verifikation prüft pipx-venv Python-Version auf exakt 3.13

B2 (BLOCKER): Alle Verifikations-Checks nutzen jetzt $VENV_PY (pipx-venv Python)
statt system-python3. YAML-Syntax-Check in write_config_yaml() nutzt die statt warn.
Alle Checks in verify_installation() setzen fail=1 und exit 1 bei Fehlern.

B3 (BLOCKER): set -euo pipefail war bereits vorhanden. Idempotenz durch
pipx-Reinstall bei falscher Python-Version ergänzt.

R5: INSTALL.md um 'Wichtige Hinweise' ergänzt — journalctl zeigt Secrets,
Logs nicht ungefiltert teilen.

R6: providers: {} → providers:\n  ollama-cloud: {} in install.sh und
templates/config.yaml. Verhindert Auto-Discovery-Risiko beim ersten Modell-Aufruf.
This commit is contained in:
Bernd (Hermes)
2026-07-19 18:36:29 +02:00
parent 775f719701
commit 66c4f7f2d1
3 changed files with 63 additions and 14 deletions
+6
View File
@@ -100,3 +100,9 @@ export CONTEXT_LENGTH=131072
- room-map.json: `~/.hermes/hermes-agent/data/room-map.json`
- SOUL.md: `~/.hermes/SOUL.md`
- systemd unit: `~/.config/systemd/user/hermes-gateway.service`
## Wichtige Hinweise
- **Secrets in Logs**: `journalctl --user -u hermes-gateway` zeigt Secrets (API-Keys, Passwörter) in der Prozess-Umgebung an. Logs niemals ungefiltert teilen oder in öffentliche Channels posten. Vor dem Teilen mit `grep -v` filtern oder nur relevante Ausschnitte weitergeben.
- **Idempotenz**: `install.sh` kann mehrfach ausgeführt werden. Bestehende Dateien werden gesichert (`.bak.<timestamp>`), `room-map.json` mit Inhalt wird nicht überschrieben.
- **Python 3.13**: pipx installiert hermes-agent zwingend mit Python 3.13 (`--python python3.13`). Ein abweichendes Python in der pipx-venv wird automatisch erkannt und korrigiert.
+54 -12
View File
@@ -215,6 +215,18 @@ install_system_deps() {
fi
fi
# B1: Python 3.13 für pipx erzwingen (pipx-Python-Version-Drift verhindern)
if ! command -v python3.13 >/dev/null 2>&1; then
log "Python 3.13 nicht gefunden — installiere via apt..."
if ! $DRY_RUN; then
sudo apt-get install -y -qq python3.13 python3.13-venv python3.13-dev >/dev/null \
|| die "python3.13 Installation fehlgeschlagen"
else
printf '%s[dry]%s apt install python3.13 python3.13-venv python3.13-dev\n' "$C_YELLOW" "$C_RESET"
fi
fi
ok "Python 3.13 verfügbar: $(python3.13 --version 2>/dev/null || echo 'dry-run')"
log "Prüfe / installiere apt-Pakete (python3-pip, pipx, git, curl)..."
if ! $DRY_RUN; then
sudo apt-get update -qq
@@ -247,17 +259,35 @@ install_hermes_agent() {
local venv
if venv="$(find_pipx_venv 2>/dev/null)" && [ -n "$venv" ]; then
log "Hermes Agent bereits in pipx-venv: $venv"
# B1: Prüfe ob pipx-venv tatsächlich Python 3.13 nutzt
local venv_py_ver
venv_py_ver="$("$venv/bin/python" -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null || echo "0.0")"
if [ "$venv_py_ver" != "3.13" ]; then
warn "pipx-venv nutzt Python $venv_py_ver statt 3.13 — Neuinstallation mit python3.13"
if ! $DRY_RUN; then
pipx uninstall hermes-agent 2>/dev/null || true
pipx install --python python3.13 hermes-agent \
|| die "pipx install --python python3.13 hermes-agent fehlgeschlagen"
export PATH="$HOME/.local/bin:$PATH"
venv="$(find_pipx_venv 2>/dev/null)" \
|| die "pipx-venv nach Neuinstallation nicht gefunden"
else
printf '%s[dry]%s pipx uninstall hermes-agent && pipx install --python python3.13 hermes-agent\n' "$C_YELLOW" "$C_RESET"
fi
else
log "Hermes Agent bereits in pipx-venv (Python 3.13): $venv"
fi
else
log "pipx install hermes-agent..."
log "pipx install hermes-agent --python python3.13..."
if ! $DRY_RUN; then
pipx install hermes-agent
pipx install --python python3.13 hermes-agent \
|| die "pipx install --python python3.13 hermes-agent fehlgeschlagen"
# PATH für diese Session refreshen
export PATH="$HOME/.local/bin:$PATH"
venv="$(find_pipx_venv 2>/dev/null)" \
|| die "pipx-venv nach Installation nicht gefunden"
else
printf '%s[dry]%s pipx install hermes-agent\n' "$C_YELLOW" "$C_RESET"
printf '%s[dry]%s pipx install --python python3.13 hermes-agent\n' "$C_YELLOW" "$C_RESET"
venv="$HOME/.local/share/pipx/venvs/hermes-agent"
fi
fi
@@ -404,7 +434,8 @@ model:
# api_key wird über .env (OLLAMA_API_KEY) injiziert
# KEINE base_url für ollama-cloud (nicht nötig)
providers: {}
providers:
ollama-cloud: {}
# P2: auxiliary-Provider explizit auf ollama-cloud setzen.
# Verhindert Auto-Discovery-Chain (openrouter/Nous → payment errors + Timeout).
@@ -488,13 +519,15 @@ plugins:
- rocketchat-platform
YAML
ok "config.yaml geschrieben: $config"
# YAML-Syntax-Check
if command -v python3 >/dev/null 2>&1; then
if ! python3 -c 'import yaml,sys; yaml.safe_load(open(sys.argv[1]))' "$config" 2>/dev/null; then
warn "config.yaml YAML-Syntax-Check fehlgeschlagen — bitte prüfen"
# YAML-Syntax-Check (B2: nutze pipx-venv Python, nicht system-python)
if [ -x "$VENV_PY" ]; then
if ! "$VENV_PY" -c 'import yaml,sys; yaml.safe_load(open(sys.argv[1]))' "$config" 2>/dev/null; then
die "config.yaml YAML-Syntax-Check fehlgeschlagen"
else
ok "config.yaml YAML-Syntax OK"
fi
else
die "VENV_PY nicht ausführbar — kann config.yaml nicht validieren"
fi
else
printf '%s[dry]%s schreibe %s (model=%s, provider=%s, ctx=%s, thr=%s)\n' \
@@ -730,6 +763,15 @@ verify_installation() {
return 0
fi
# B1: pipx-venv Python-Version MUSS 3.13 sein
local venv_py_ver
venv_py_ver="$("$VENV_PY" -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")' 2>/dev/null || echo "0.0")"
if [ "$venv_py_ver" = "3.13" ]; then
ok "pipx-venv Python $venv_py_ver (B1: 3.13 erzwungen)"
else
err "FAIL: pipx-venv Python $venv_py_ver statt 3.13 (B1)"; fail=1
fi
# P1: snowballstemmer in pipx-venv
if "$VENV_PY" -c 'import snowballstemmer' 2>/dev/null; then
ok "snowballstemmer in pipx-venv importierbar (P1)"
@@ -747,9 +789,9 @@ verify_installation() {
err "FAIL: Plugin-Dateien fehlen in $plugin_dir (P3)"; fail=1
fi
# config.yaml syntaktisch korrekt
# config.yaml syntaktisch korrekt (B2: nutze pipx-venv Python)
local config="$HOME/.hermes/config.yaml"
if [ -f "$config" ] && python3 -c "import yaml; yaml.safe_load(open('$config'))" 2>/dev/null; then
if [ -f "$config" ] && "$VENV_PY" -c "import yaml; yaml.safe_load(open('$config'))" 2>/dev/null; then
ok "config.yaml syntaktisch korrekt"
# P6/P7: Provider und Modell prüfen
if grep -q "^ provider: ollama-cloud" "$config"; then
@@ -798,7 +840,7 @@ verify_installation() {
local rm="$HOME/.hermes/hermes-agent/data/room-map.json"
if [ -f "$rm" ]; then
local rc
rc="$(python3 -c "import json; print(len(json.load(open('$rm')).get('rooms',{})))" 2>/dev/null || echo "?")"
rc="$("$VENV_PY" -c "import json; print(len(json.load(open('$rm')).get('rooms',{})))" 2>/dev/null || echo "?")"
if [ "${rc:-0}" = "0" ]; then
ok "room-map.json leer (P10: Onboarding füllt sie)"
else
+2 -1
View File
@@ -7,7 +7,8 @@ model:
provider: PLACEHOLDER_PROVIDER
base_url: PLACEHOLDER_MODEL_BASE_URL
providers: {}
providers:
ollama-cloud: {}
toolsets:
- hermes-cli