From 98b232cc0afe754b27291d3a85a59fd8a550da36 Mon Sep 17 00:00:00 2001 From: Sam & Claude Date: Tue, 2 Jun 2026 14:56:41 +0200 Subject: [PATCH] fix(clawdie): set COLIBRI_DB_PATH so the service doesn't crash-loop at boot (Sam & Claude) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clawdie.in exported COLIBRI_DAEMON_DATA_DIR/SOCKET/HOST but not COLIBRI_DB_PATH. On FreeBSD, default_db_path() then falls back to /var/db/colibri/colibri.sqlite — the full Colibri daemon's DB, owned colibri:colibri (0750). clawdie runs as the clawdie user, so Store::open() hits EACCES; DaemonState::new() panics (daemon.rs:35) and daemon(8) -r restart-loops forever. The service would never serve, despite a correct-looking rc.d. Fix: add a clawdie_db_path var (default ${clawdie_data_dir}/clawdie.sqlite) and export COLIBRI_DB_PATH from prestart, keeping clawdie's DB in its own clawdie-owned dir. No collision with the colibri daemon's DB. Reproduced + verified on Linux: - COLIBRI_DB_PATH unwritable → panic "failed to open coordination store … Permission denied", exit 101 - COLIBRI_DB_PATH in data dir → sqlite created, runs clean Co-Authored-By: Claude Opus 4.8 --- packaging/freebsd/clawdie.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packaging/freebsd/clawdie.in b/packaging/freebsd/clawdie.in index 375fc3c..f40abb5 100644 --- a/packaging/freebsd/clawdie.in +++ b/packaging/freebsd/clawdie.in @@ -41,6 +41,7 @@ load_rc_config $name : ${clawdie_data_dir:="/var/db/clawdie"} : ${clawdie_run_dir:="/var/run/clawdie"} : ${clawdie_socket:="${clawdie_run_dir}/clawdie.sock"} +: ${clawdie_db_path:="${clawdie_data_dir}/clawdie.sqlite"} : ${clawdie_logfile:="/var/log/clawdie/clawdie.log"} : ${clawdie_host:="$(/bin/hostname)"} : ${clawdie_env_file:="/usr/local/etc/clawdie/clawdie.env"} @@ -68,8 +69,13 @@ clawdie_prestart() "$(/usr/bin/dirname "${clawdie_logfile}")" # Control-plane config passed to the child via the environment. + # COLIBRI_DB_PATH is REQUIRED: without it the daemon falls back to + # /var/db/colibri/colibri.sqlite (the full Colibri daemon's path, owned by + # the colibri user), which the clawdie user cannot open — Store::open then + # panics and daemon(8) -r restart-loops. Keep clawdie's DB in its own dir. export COLIBRI_DAEMON_DATA_DIR="${clawdie_data_dir}" export COLIBRI_DAEMON_SOCKET="${clawdie_socket}" + export COLIBRI_DB_PATH="${clawdie_db_path}" export COLIBRI_HOST="${clawdie_host}" # Optional per-host credential overrides (binary already has baked defaults). -- 2.45.3