A job's systemd unit is castle-<name>-job.service and its EnvironmentFile points at castle-<name>-job.service.env, but _write_secret_env_file wrote castle-<name>.service.env (kind defaulted to 'service'). Every secret-using job failed to start (Failed to load environment files). Thread the deployment kind through to secret_env_path so the filename matches the unit.