diff --git a/nix/templates/harness-base.nix b/nix/templates/harness-base.nix index dfc9bde..359adc3 100644 --- a/nix/templates/harness-base.nix +++ b/nix/templates/harness-base.nix @@ -525,15 +525,11 @@ }; environment.LINKS_JSON = builtins.toJSON config.hyperhive.dashboardLinks; script = '' - STATE_DIR="" - for d in /state /agents/*/state; do - if [ -d "$d" ]; then - STATE_DIR="$d" - break - fi - done - if [ -z "$STATE_DIR" ]; then - echo "hive-dashboard-links: no state dir found; skipping" + # Sub-agents have their state dir bind-mounted at /agents//state. + # Use a glob — exactly one match per container at runtime. + STATE_DIR=$(echo /agents/*/state) + if [ ! -d "$STATE_DIR" ]; then + echo "hive-dashboard-links: no state dir found at /agents/*/state; skipping" exit 0 fi printf '%s' "$LINKS_JSON" > "$STATE_DIR/hyperhive-dashboard-links.json"