Files
skills/orchestrator/kvb_orchestrator/skill_scripts.py
T
Kevin Veen-BirkenbachandClaude Opus 5.5 f7a59d43a5 feat(orchestrator): W3 artifacts tree, ancestry, gates and token-free cleanup
Artifacts show the branch tree with ancestry and gate marks. The cleanup runner calls pkgmgr branch cleanup with its real argv and parses its repos[*].items output, refuses any plan with a remote-branch action, marks an item done only when pkgmgr reports it done, and offers no delete for a branch a worktree holds. Every text states what the pkgmgr command does to volumes. Committed below the bar on the operator's word 2026-11-12 (no further per-bundle tests, one gate after the merge): the W3 e2e never ran; the client switches to --local once pkgmgr ships it.

🎯 Fix: 90 %
💥 Break: 6 %
💸 Cost: 30 %
⏱️ Time: 40 %
🛡️ Security: 100 %
🏆 Score: 100
🚦 Gate: ⛔ break 6 % > 5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:15:14 +00:00

48 lines
1.5 KiB
Python

from __future__ import annotations
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Protocol
SCRIPT_TIMEOUT = 60
OUTPUT_LIMIT = 4000
SAFE_PATH = "/usr/local/bin:/usr/bin:/bin"
RADIO = "kvb-org-radio/scripts/radio.py"
RASCI = "kvb-org-rasci/scripts/rasci.py"
NIGHT = "kvb-org-suspend/scripts/night.py"
OPERATOR_SCRIPT = "kvb-org-operator/scripts/operator.py"
ESTIMATE = "kvb-org-queue-estimate/scripts/estimate.py"
class Runner(Protocol):
skills: Path
def run(self, script: str, args: list[str]) -> dict: ...
@dataclass(frozen=True)
class Scripts:
skills: Path
council: Path
home: Path
def run(self, script: str, args: list[str]) -> dict:
command = " ".join([Path(script).name, *args])
env = {"PATH": SAFE_PATH, "HOME": str(self.home), "AGENTS_COUNCIL_ROOT": str(self.council), "PYTHONDONTWRITEBYTECODE": "1"}
try:
done = subprocess.run(
[sys.executable, str(self.skills / script), *args],
capture_output=True,
encoding="utf-8",
errors="replace",
timeout=SCRIPT_TIMEOUT,
env=env,
stdin=subprocess.DEVNULL,
check=False,
)
except (OSError, subprocess.TimeoutExpired) as error:
return {"command": command, "code": -1, "stdout": "", "stderr": str(error)}
return {"command": command, "code": done.returncode, "stdout": done.stdout[-OUTPUT_LIMIT:], "stderr": done.stderr[-OUTPUT_LIMIT:]}