fix(admin): skip task state files with no task data on load

An empty or truncated tasks/*.pb file unmarshals into a TaskStateFile
with a nil Task, and protobufToMaintenanceTask dereferenced it
immediately, panicking the whole admin process on startup. Guard the
nil case so the loader logs a warning and skips the bad file.
This commit is contained in:
Chris Lu
2026-06-26 17:36:42 -07:00
parent f643893891
commit 57ffef8543
+4
View File
@@ -1088,6 +1088,10 @@ func (cp *ConfigPersistence) loadTaskStateLocked(taskID string) (*maintenance.Ma
return nil, fmt.Errorf("failed to unmarshal task state protobuf: %w", err)
}
if taskStateFile.Task == nil {
return nil, fmt.Errorf("task state file %s contains no task data", taskID)
}
// Convert protobuf to maintenance task
task := cp.protobufToMaintenanceTask(taskStateFile.Task)