Spaces:
Paused
Paused
fix: make kanban patch and Docker build fully failure-safe
Browse files- Wrap entire kanban patch in try/except so any error (encoding, permissions,
changed upstream file structure) skips silently instead of exiting 1
- Use errors='replace' when reading kanban_db.py to handle non-UTF-8 bytes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Files changed (2)
- CHANGELOG.md+1
- Dockerfile+40-33
7 unmodified lines89101112137 unmodified lines- **Unpinned jupyterlab breaks venv** β `uv pip install jupyterlab` without a version constraint could pull a release incompatible with existing Hermes venv packages. Pinned to `>=4.0,<5` range to bound resolution.- **`uv` not in PATH during Docker build** β switched from bare `uv` to explicit `/opt/hermes/.venv/bin/uv` so the install works regardless of base image PATH configuration.- **`visudo` not in PATH during Docker build** β switched to explicit `/usr/sbin/visudo` path.## 0.2.0 - 2026-05-197 unmodified lines8910111213147 unmodified lines- **Unpinned jupyterlab breaks venv** β `uv pip install jupyterlab` without a version constraint could pull a release incompatible with existing Hermes venv packages. Pinned to `>=4.0,<5` range to bound resolution.- **`uv` not in PATH during Docker build** β switched from bare `uv` to explicit `/opt/hermes/.venv/bin/uv` so the install works regardless of base image PATH configuration.- **`visudo` not in PATH during Docker build** β switched to explicit `/usr/sbin/visudo` path.- **Kanban patch exits with code 1** β entire kanban migration patch now wrapped in `try/except`; any unexpected error (file encoding, permission, changed upstream structure) skips silently instead of failing the Docker build.## 0.2.0 - 2026-05-19
58 unmodified lines596061626364656667686970717273747576777879808182838485868788899091929394959697989958 unmodified lines# Patch kanban migration: wrap ALTER TABLE ADD COLUMN in try/except so a# persisted DB with the column already present doesn't crash the gateway.RUN python3 - <<'PY'from pathlib import Pathimport sysp = Path("/opt/hermes/hermes_cli/kanban_db.py")if not p.exists():sys.exit(0)src = p.read_text(encoding="utf-8")sentinel = "# huggingmes: idempotent-alter"if sentinel in src:sys.exit(0)old = (' conn.execute(\n'' "ALTER TABLE tasks ADD COLUMN consecutive_failures "\n'' "INTEGER NOT NULL DEFAULT 0"\n'' )')new = (f' try: {sentinel}\n'' conn.execute(\n'' "ALTER TABLE tasks ADD COLUMN consecutive_failures "\n'' "INTEGER NOT NULL DEFAULT 0"\n'' )\n'' except Exception:\n'' pass')if old not in src:print("kanban patch: pattern not found β may be fixed upstream, skipping")sys.exit(0)p.write_text(src.replace(old, new), encoding="utf-8")print("kanban patch: applied")PY# Ensure hermes CLI is discoverable in ALL shell types (login, interactive,58 unmodified lines596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510658 unmodified lines# Patch kanban migration: wrap ALTER TABLE ADD COLUMN in try/except so a# persisted DB with the column already present doesn't crash the gateway.# Entire block wrapped in try/except β skips silently if Hermes fixes this# upstream or the file structure changes.RUN python3 - <<'PY'import systry:from pathlib import Pathp = Path("/opt/hermes/hermes_cli/kanban_db.py")if not p.exists():print("kanban patch: file not found, skipping")sys.exit(0)src = p.read_text(encoding="utf-8", errors="replace")sentinel = "# huggingmes: idempotent-alter"if sentinel in src:print("kanban patch: already applied, skipping")sys.exit(0)old = (' conn.execute(\n'' "ALTER TABLE tasks ADD COLUMN consecutive_failures "\n'' "INTEGER NOT NULL DEFAULT 0"\n'' )')new = (f' try: {sentinel}\n'' conn.execute(\n'' "ALTER TABLE tasks ADD COLUMN consecutive_failures "\n'' "INTEGER NOT NULL DEFAULT 0"\n'' )\n'' except Exception:\n'' pass')if old not in src:print("kanban patch: pattern not found, may be fixed upstream, skipping")sys.exit(0)p.write_text(src.replace(old, new), encoding="utf-8")print("kanban patch: applied")except Exception as e:print(f"kanban patch: error ({e}), skipping", file=sys.stderr)PY# Ensure hermes CLI is discoverable in ALL shell types (login, interactive,
CHANGELOG.md+1
Dockerfile+40-33