osbase/supervisor: restart DONE nodes when needed

Nodes in DONE state are normally not restarted. However, if a sibling of
the node dies, then the node in DONE state and all its children are
canceled and need to be restarted. Previously, this did not happen, so
the newly added test got stuck waiting forever for the inner runnable to
start again.

Change-Id: I8c437937d21edb822985ec6fa3f36425e12ff218
Reviewed-on: https://review.monogon.dev/c/monogon/+/3716
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/osbase/supervisor/supervisor_processor.go b/osbase/supervisor/supervisor_processor.go
index 667b2ab..a65a364 100644
--- a/osbase/supervisor/supervisor_processor.go
+++ b/osbase/supervisor/supervisor_processor.go
@@ -468,8 +468,10 @@
 		cur := queue[0]
 		queue = queue[1:]
 
-		// If this node is DEAD or CANCELED it should be restarted.
-		if cur.state == NodeStateDead || cur.state == NodeStateCanceled {
+		// If this node's context is canceled and it has exited, it should be
+		// restarted.
+		exited := cur.state == NodeStateDead || cur.state == NodeStateCanceled || cur.state == NodeStateDone
+		if cur.ctx.Err() != nil && exited {
 			want[cur.dn()] = true
 		}