fix(kvb-org-queue): restart holders on stale queue code; link host skills into projects
Every holder judges the shared queue.json with its own loaded code, so the project copies from 2026-11-07 (no RAM/CPU budget) granted heavy jobs on the slot limit alone and overloaded the host at 18:24. Each entry now stamps a hash of queue.py and the sibling scripts it loads; a poll that finds other code installed in ~/.agents/skills leaves the queue ungranted and re-execs the same hold with the installed queue.py, on the realpath interpreter, with signals reset and a caught signal ending the hold instead. queue.py list prefixes entries on other or unstamped code. A project install now symlinks every skill the global install holds instead of copying it, so the project hooks and ../ references stay valid and one host runs one version. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Cost: 100 % ⏱️ Time: 100 % 🛡️ Security: 100 % 🏆 Score: 88 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e805b07c27
commit
ca54420f4d
4 files changed
+135
-21
No files matched your search
+30
-12
@@ -14,29 +14,47 @@ NPX = "#!/bin/sh\nmkdir -p .agents/skills/locked\necho locked > .agents/skills/l
|
||||
|
||||
|
||||
class TestInstall(unittest.TestCase):
|
||||
def install(self, root: Path, target: Path) -> None:
|
||||
repo, stubs = root / "repo", root / "bin"
|
||||
(repo / "scripts").mkdir(parents=True)
|
||||
shutil.copy(INSTALL, repo / "scripts" / "install.sh")
|
||||
(repo / "scripts" / "enable-plugins.js").write_text("", encoding="utf-8")
|
||||
(repo / "skills" / "own").mkdir(parents=True)
|
||||
(repo / "skills" / "own" / "SKILL.md").write_text("own", encoding="utf-8")
|
||||
stubs.mkdir()
|
||||
(stubs / "npx").write_text(NPX, encoding="utf-8")
|
||||
(stubs / "npx").chmod(0o755)
|
||||
env = {**os.environ, "PATH": f"{stubs}:/usr/bin:/bin", "TARGET": str(target), "HOME": str(root / "home")}
|
||||
done = subprocess.run(["bash", str(repo / "scripts" / "install.sh")], env=env, capture_output=True, text=True, check=False)
|
||||
self.assertEqual(done.returncode, 0, done.stderr)
|
||||
|
||||
def test_reinstall_empties_the_skill_directories_in_place(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
repo, target, stubs = root / "repo", root / "target", root / "bin"
|
||||
(repo / "scripts").mkdir(parents=True)
|
||||
shutil.copy(INSTALL, repo / "scripts" / "install.sh")
|
||||
(repo / "scripts" / "enable-plugins.js").write_text("", encoding="utf-8")
|
||||
(repo / "skills" / "own").mkdir(parents=True)
|
||||
(repo / "skills" / "own" / "SKILL.md").write_text("own", encoding="utf-8")
|
||||
stubs.mkdir()
|
||||
(stubs / "npx").write_text(NPX, encoding="utf-8")
|
||||
(stubs / "npx").chmod(0o755)
|
||||
target = root / "target"
|
||||
installed = [target / ".agents" / "skills", target / ".claude" / "skills"]
|
||||
for folder in installed:
|
||||
(folder / "stale").mkdir(parents=True)
|
||||
before = [folder.stat().st_ino for folder in installed]
|
||||
env = {**os.environ, "PATH": f"{stubs}:/usr/bin:/bin", "TARGET": str(target)}
|
||||
done = subprocess.run(["bash", str(repo / "scripts" / "install.sh")], env=env, capture_output=True, text=True, check=False)
|
||||
self.assertEqual(done.returncode, 0, done.stderr)
|
||||
self.install(root, target)
|
||||
self.assertEqual([folder.stat().st_ino for folder in installed], before)
|
||||
for folder in installed:
|
||||
self.assertEqual(sorted(path.name for path in folder.iterdir()), ["locked", "own"])
|
||||
|
||||
def test_a_project_install_links_every_skill_the_global_install_holds(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
target = root / "target"
|
||||
target.mkdir()
|
||||
linked = (".agents/skills/locked", ".claude/skills/own")
|
||||
for folder in linked:
|
||||
(root / "home" / folder).mkdir(parents=True)
|
||||
self.install(root, target)
|
||||
for folder in (".agents/skills", ".claude/skills"):
|
||||
installed = {path.name: path.readlink() if path.is_symlink() else None for path in (target / folder).iterdir()}
|
||||
expected = {name: root / "home" / folder / name if f"{folder}/{name}" in linked else None for name in ("locked", "own")}
|
||||
self.assertEqual(installed, expected)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user