Merge pull request 'Restore auto-update lock writes and orchestrator session model' (#45) from fix/auto-update-lock-orchestrator-20261123 into main

This commit was merged in pull request #45.
This commit is contained in:
2026-11-23 18:16:57 +00:00
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ log_dir = "/srv/cc-ci/.cc-ci-logs"
name = "orchestrator" # tmux session: cc-ci-orchestrator name = "orchestrator" # tmux session: cc-ci-orchestrator
kind = "persistent" kind = "persistent"
backend = "opencode" # operator 2026-09-07 (evening): NO Claude on the cc-ci host — the backend = "opencode" # operator 2026-09-07 (evening): NO Claude on the cc-ci host — the
model = "opencode-go/glm-5.2" # orchestrator is an opencode agent, steered via the opencode web UI model = "opencode-go/glm-5.3-flash" # orchestrator is an opencode agent, steered via the opencode web UI
# (https://oc.ci.commoninternet.net). Claude sessions live on notplants-orchestrator. # (https://oc.ci.commoninternet.net). Claude sessions live on notplants-orchestrator.
resume = false # opencode backend has no --resume equivalent (fresh session each launch) resume = false # opencode backend has no --resume equivalent (fresh session each launch)
watch = "heal" # restart if dead / FATAL / backend-mismatch; never stall-reboot watch = "heal" # restart if dead / FATAL / backend-mismatch; never stall-reboot
+10 -2
View File
@@ -35,7 +35,7 @@ let
&& busy "the weekly report is being written (tmux cc-ci-report)" && busy "the weekly report is being written (tmux cc-ci-report)"
if [ -r /run/secrets/bridge_drone_token ]; then if [ -r /run/secrets/bridge_drone_token ]; then
running=$(${curl} -s -m 20 -H "Authorization: Bearer $(cat /run/secrets/bridge_drone_token)" \ running=$(${curl} -s -m 20 -H "Authorization: Bearer $(cat /run/secrets/bridge_drone_token)" \
"https://drone.${cfg.ciDomain}/api/repos/recipe-maintainers/cc-ci/builds?per_page=10" \ "https://${cfg.droneHost}/api/repos/recipe-maintainers/cc-ci/builds?per_page=10" \
| ${pkgs.gnugrep}/bin/grep -o '"status":"running"' | ${pkgs.coreutils}/bin/wc -l) | ${pkgs.gnugrep}/bin/grep -o '"status":"running"' | ${pkgs.coreutils}/bin/wc -l)
[ "''${running:-0}" -eq 0 ] || busy "$running Drone build(s) running" [ "''${running:-0}" -eq 0 ] || busy "$running Drone build(s) running"
fi fi
@@ -64,7 +64,7 @@ let
code() { ${curl} -s -m 20 -o /dev/null -w '%{http_code}' --resolve "$1:443:127.0.0.1" "https://$1/$2"; } code() { ${curl} -s -m 20 -o /dev/null -w '%{http_code}' --resolve "$1:443:127.0.0.1" "https://$1/$2"; }
[ "$(code ${cfg.ciDomain} "")" = 200 ] || fail "dashboard not 200" [ "$(code ${cfg.ciDomain} "")" = 200 ] || fail "dashboard not 200"
[ "$(code report.${cfg.ciDomain} "")" = 200 ] || fail "reports not 200" [ "$(code report.${cfg.ciDomain} "")" = 200 ] || fail "reports not 200"
[ "$(code drone.${cfg.ciDomain} version)" = 200 ] || fail "drone /version not 200" [ "$(code ${cfg.droneHost} version)" = 200 ] || fail "drone /version not 200"
[ "$(code ${cfg.opencodeUiHost} "")" = 401 ] || fail "opencode UI not answering with its auth challenge" [ "$(code ${cfg.opencodeUiHost} "")" = 401 ] || fail "opencode UI not answering with its auth challenge"
echo "HEALTH OK" echo "HEALTH OK"
''; '';
@@ -103,6 +103,11 @@ in
default = "ci.commoninternet.net"; default = "ci.commoninternet.net";
description = "The CI apex; report./drone. are checked under it."; description = "The CI apex; report./drone. are checked under it.";
}; };
droneHost = lib.mkOption {
type = lib.types.str;
default = "drone.ci.autonomic.zone";
description = "The live Drone host used by the busy gate and health check.";
};
opencodeUiHost = lib.mkOption { opencodeUiHost = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = config.cc-ci-orchestrator.opencodeUiHost; default = config.cc-ci-orchestrator.opencodeUiHost;
@@ -128,6 +133,9 @@ in
state() { printf '%s result=%s generation=%s note=%s\n' "$(date -u +%FT%TZ)" "$1" "$2" "$3" > ${stateFile}; chown ${cfg.buildUser} ${stateFile} || true; } state() { printf '%s result=%s generation=%s note=%s\n' "$(date -u +%FT%TZ)" "$1" "$2" "$3" > ${stateFile}; chown ${cfg.buildUser} ${stateFile} || true; }
PREV=$(readlink -f /run/current-system) PREV=$(readlink -f /run/current-system)
LOCK_BAK=${cfg.flakePath}/.flake.lock.auto-update-prev LOCK_BAK=${cfg.flakePath}/.flake.lock.auto-update-prev
# A manual root-side flake operation can leave the lock root-owned. The
# updater runs nix as buildUser, so restore its write access first.
chown ${cfg.buildUser} flake.lock
if ! ${busyGate}; then if ! ${busyGate}; then
state skipped "$PREV" busy state skipped "$PREV" busy