Merge "Report queue window in status JSON."
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index 3b7b9f0..a74ad17 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -2879,8 +2879,13 @@
         status_jobs = set()
         for p in data['pipelines']:
             for q in p['change_queues']:
+                if q['dependent']:
+                    self.assertEqual(q['window'], 20)
+                else:
+                    self.assertEqual(q['window'], 0)
                 for head in q['heads']:
                     for change in head:
+                        self.assertTrue(change['active'])
                         self.assertEqual(change['id'], '1,1')
                         for job in change['jobs']:
                             status_jobs.add(job['name'])
diff --git a/zuul/model.py b/zuul/model.py
index 8b76ff4..2ae2e2f 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -254,6 +254,8 @@
             j_queue = dict(name=queue.name)
             j_queues.append(j_queue)
             j_queue['heads'] = []
+            j_queue['window'] = queue.window
+            j_queue['dependent'] = queue.dependent
 
             j_changes = []
             for e in queue.queue:
@@ -313,6 +315,7 @@
     def formatItemJSON(self, item):
         changeish = item.change
         ret = {}
+        ret['active'] = item.active
         if hasattr(changeish, 'url') and changeish.url is not None:
             ret['url'] = changeish.url
         else:
@@ -686,6 +689,7 @@
         self.enqueue_time = None
         self.dequeue_time = None
         self.reported = False
+        self.active = False
 
     def __repr__(self):
         if self.pipeline:
diff --git a/zuul/scheduler.py b/zuul/scheduler.py
index 213c23a..2c8ed4c 100644
--- a/zuul/scheduler.py
+++ b/zuul/scheduler.py
@@ -1135,6 +1135,8 @@
                 pass
             return (True, nnfi)
         dep_item = self.getFailingDependentItem(item)
+        actionable = change_queue.isActionable(item)
+        item.active = actionable
         if dep_item:
             failing_reasons.append('a needed change is failing')
             self.cancelJobs(item, prime=False)
@@ -1153,11 +1155,11 @@
                 change_queue.moveItem(item, nnfi)
                 changed = True
                 self.cancelJobs(item)
-            if change_queue.isActionable(item):
+            if actionable:
                 self.prepareRef(item)
                 if item.current_build_set.unable_to_merge:
                     failing_reasons.append("it has a merge conflict")
-        if change_queue.isActionable(item) and self.launchJobs(item):
+        if actionable and self.launchJobs(item):
             changed = True
         if self.pipeline.didAnyJobFail(item):
             failing_reasons.append("at least one job failed")