fix(orchestrator): keep installs off a running hub row and fail orphaned jobs

The runner records the hub row it runs in runner-job.json of the hub
state directory (new --state flag, set by the runner unit) and drops it
when the row ends. orchestrator.sh idle exits 1 with the row's task and
job id while that file names a live pid; install, stop, runner and the
home install.sh check it first, because stopping the runner would kill
the row. A starting runner posts /api/runner/restart, and the hub fails
every job an earlier runner left running, closing its row like a failed
run with the reason that the runner restarted.

🎯 Fix: 92 %
💥 Break: 4 %
💸 Tokens: 100 %
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 88
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-27 10:44:15 +00:00
1 parent 0f8cb32198
commit 30862411f3
15 files changed
+411 -56

No files matched your search

+3 -3
View File
@@ -107,7 +107,7 @@ class TestHubExecutors(HubCase):
self.approvers.unlink()
job = {"task": "operator/greet", "command": command, "directory": str(self.outside), "proof": proof}
self.assertIn("no key is pinned", runner.refusal(job, self.trust("other"), time.time()))
reports, host = [], runner.Host(shell=str(self.shell), operator=None, council=None)
reports, host = [], runner.Host(shell=str(self.shell), operator=None, council=None, marker=self.state / runner.MARKER)
self.assertEqual(runner.execute({"command": "exit 3", "directory": str(self.outside)}, host, reports.append), 3)
self.assertEqual(reports[-1], {"output": "", "code": 3, "refused": False})
self.assertEqual(runner.execute({"command": "true", "directory": str(self.outside)}, host, reports.append), 0)
@@ -128,7 +128,7 @@ class TestHubExecutors(HubCase):
job = self.snapshot()["jobs"][-1]
self.assertEqual((job["status"], job["code"], job["output"]), ("done", 0, "pushed\n"))
self.assertEqual(self.scripts.calls[-1], (skill_scripts.OPERATOR_SCRIPT, ["ran", "push", f"--command={command}", f"--dir={self.outside}", "--check-failed"]))
host = runner.Host(shell=str(self.shell), operator=hub_support.OPERATOR, council=self.council)
host = runner.Host(shell=str(self.shell), operator=hub_support.OPERATOR, council=self.council, marker=self.state / runner.MARKER)
self.assertIs(runner.checked({"task": "operator/push"}, host), False)
self.assertIsNone(runner.checked({"task": "operator/missing"}, host))
self.assertIsNone(runner.checked({"task": "operator/push"}, host._replace(shell=str(self.outside / "no-shell"))))
@@ -145,7 +145,7 @@ class TestHubExecutors(HubCase):
def test_the_runner_closes_the_output_pipe_on_every_path(self):
popen, spawned = subprocess.Popen, []
job = {"command": "echo hi; sleep 0.3", "directory": str(self.outside)}
host = runner.Host(shell=str(self.shell), operator=None, council=None)
host = runner.Host(shell=str(self.shell), operator=None, council=None, marker=self.state / runner.MARKER)
def spawn(*args: object, **kwargs: object) -> subprocess.Popen:
spawned.append(popen(*args, **kwargs))