Allow concurrency 0 to pause a terminal

A paused terminal gets no new runs and is not probed; in-flight runs still finish.
This commit is contained in:
jj.wang
2026-10-21 07:17:29 +00:00
parent b17b1f1587
commit 1ae44eb705
3 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -53,7 +53,7 @@
"repo": {"type": "string"},
"plane_user": {"type": "string"},
"token_key": {"type": "string"},
"concurrency": {"type": "integer", "minimum": 1},
"concurrency": {"type": "integer", "minimum": 0},
"capabilities": {"$ref": "#/definitions/strings"},
"executors": {"type": "array", "items": {"type": "string"}, "minItems": 1},
"bins": {"type": "object", "additionalProperties": {"type": "string"}},
+6
View File
@@ -45,6 +45,12 @@ class ConfigTest(unittest.TestCase):
d["terminals"]["oregon"]["concurrency"] = "two"
self.check_both(d, "concurrency")
def test_concurrency_zero_is_valid(self): # 0 = terminal paused (nothing new is dispatched)
d = config_data()
d["terminals"]["win10"]["concurrency"] = 0
self.assertEqual(config.validate(d), [])
self.assertEqual(config.mini_validate(d, SCHEMA), [])
def test_semantic_routing_to_unknown_terminal(self):
d = config_data()
d["projects"]["GWENT"]["routing"]["by_assignee"]["mac"] = "mac"
+8
View File
@@ -160,6 +160,14 @@ class CoreTest(unittest.TestCase):
self.assertEqual(started, ["GW-1-1", "GW-3-1"]) # 2 slots; GW-2 waits for the game group
self.assertEqual([self.p.state_of(x) for x in (a, b, c, d)], ["In Progress", "Todo", "In Progress", "Todo"])
def test_concurrency_zero_pauses_terminal(self):
self.h.cfg.terminals["win10"]["concurrency"] = 0
w = self.p.add_issue(1)
o = self.p.add_issue(2, assignee="oregon")
self.h.tick()
self.assertNotIn(("win10", "codex"), self.h.execs) # not even probed (busy_processes)
self.assertEqual((self.p.state_of(w), self.p.state_of(o)), ("Todo", "In Progress"))
def test_label_routing(self):
self.p.add_issue(1, labels=["model:astra"])
self.p.add_issue(2, assignee="oregon", labels=["cap:gpu"]) # oregon lacks the capability