Attach a running job to a plan node; honour a provider's stated reset for its whole plan

Fault 36: `sisi pick --node ID --started WORKER` records that a job already
running (a worker sent a message, which no delegation hook sees) does the node;
re-recording a plan keeps a running node whose id and branch are unchanged.

Fault 37: `judge WORKER out` keeps the worker off the wheel until the reset its
message states (ISO time or "resets in ..." span; else 6 h), together with every
worker on the same provider in the models table.

Also: tests/test_models_research.py no longer reads the running agent's
CLAUDE_CODE_ENTRYPOINT.

The line-count cap (test_the_product_stays_small) is left for the join: sisi/
is 3330 lines against 3264.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-12-04 07:03:51 -07:00
1 parent fffb97f522
commit 9fb2a61920
7 files changed
+174 -36

No files matched your search

+33 -7
View File
@@ -142,13 +142,39 @@ class Plan(unittest.TestCase):
self.assertEqual(self.nodes(), {"a": "running"})
self.assertEqual(self.record(PLAN.replace("test a passes", "test a2 passes"))[0], 0)
self.assertEqual(self.nodes(), {"a": "running"}) # a running node keeps its state by id
rc, out, _ = self.record(PLAN.replace("| sisi/a.py |", "| sisi/a2.py |"))
self.assertEqual(rc, 1, out)
self.assertIn("node a is running", out)
self.assertIn("a", self.nodes())
rc, out, _ = self.record(PLAN.replace("| a | routine | - |", "| a2 | routine | - |").replace("| a, b |", "| a2, b |"))
self.assertEqual(rc, 1, out)
self.assertIn("node a is running", out)
self.assertEqual(self.record(PLAN.replace("| sisi/a.py |", "| sisi/a.py, sisi/a2.py |"))[0], 0)
self.assertEqual(self.nodes(), {"a": "running"}) # same id and branch: still running
for changed in (PLAN.replace("| p-a |", "| p-a2 |"), PLAN.replace("| a | routine | - |", "| a2 | routine | - |").replace("| a, b |", "| a2, b |")):
rc, out, _ = self.record(changed)
self.assertEqual(rc, 1, out)
self.assertIn("node a is running", out)
self.assertEqual(self.nodes(), {"a": "running"})
def test_a_job_already_running_is_attached_to_a_node_without_a_delegation(self):
"""Fault 36: a node continued on an existing worker by a message stayed "ready and not started"."""
self.ready_plan()
self.assertEqual(self.sisi("plan", "--done", "b", "done by hand and tested", sid="s1")[0], 0)
attach = lambda node, worker: self.sisi("pick", "--node", node, "--started", worker, sid="s1")
rc, out, _ = attach("c", "gamma")
self.assertEqual((rc, "not ready" in out), (1, True), out)
self.assertIn("ready and not started", self.hook("gate")[1])
self.pick("a") # the wheel said alpha, but the lead sent it to a running agent
rc, out, _ = attach("a", "gate-solver")
self.assertEqual(rc, 0, out)
self.assertEqual(self.nodes()["a"], "running")
self.assertEqual(self.state()["picked"], []) # the pick made for this node is withdrawn
self.assertNotIn("ready and not started", self.hook("gate")[1])
rc, out, _ = attach("a", "gate-solver")
self.assertEqual((rc, "already running" in out), (1, True), out)
self.assertEqual(self.record(PLAN.replace("test a passes", "test a2 passes"))[0], 0)
self.assertEqual(self.nodes()["a"], "running")
rc, out, _ = self.sisi("judge", "gate-solver", "good", "did the node in one pass", "--node", "a", sid="s1")
self.assertEqual(rc, 0, out)
self.assertEqual(self.nodes()["a"], "done")
self.pick("c") # a table worker named shortly is stored as the table names it
self.assertEqual(attach("c", "GAMMA")[0], 0)
self.assertEqual((list(self.state()["starts"]).count("gamma"), self.state()["picked"]), (1, []))
self.assertEqual(self.sisi("judge", "gamma", "good", "did the node in one pass", "--node", "c", sid="s1")[0], 0)
def pick_header(self, node, sid="s1"):
st = self.state(sid)