feat(orchestrator): hierarchy view from council offices with a separate agent order
The Agents views gain a Hierarchie view: an org chart of the chair and the line offices read from the council claims. The operator appoints, hands over and recalls an office there; the page signs each change with the passkey and a host unit (client/offices.py, offices path unit) verifies the signature, removes a live holder itself and runs a plain council.py claim for the successor. council.py loses the --operator flag, so no agent can override a live holder. The agent order is now separate from task priority: rasci.py agents order stores it in agent-order.json beside the register through the nofollow helpers and never writes a --prio pin. It only breaks ties of equal task rank, also among the queue grants. The Hierarchie view edits it as a drag list. Host units run the installed skill scripts, so orchestrator.sh keeps the offices unit off while the installed council.py, nofollow.py or rasci.py differ from the tree. Job files, council files and hub records are read with O_NOFOLLOW and O_NONBLOCK and size caps; nofollow.rewrite replaces a claim without creating directories, so a beat never revives a released office. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Cost: 100 % ⏱️ Time: 79 % 🛡️ Security: 100 % 🏆 Score: 100 🚦 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
8e180be256
commit
4540494c30
53 files changed
+1821
-211
No files matched your search
@@ -36,7 +36,8 @@ Args:
|
||||
queue.
|
||||
--kind: a key of slot_need_gb in the config.
|
||||
--task: an open task of the kvb-org-rasci register; its rank orders
|
||||
the queue.
|
||||
the queue, and the operator's agent order (`rasci.py agents
|
||||
order`) of the holding session breaks ties.
|
||||
--need-gb: disk the job takes, in GB; when omitted the need learned
|
||||
for the command's signature, else slot_need_gb[kind].
|
||||
--hotfix: the slug of the register row hotfix/<slug> the job proves;
|
||||
@@ -259,17 +260,19 @@ def store() -> Iterator[dict]:
|
||||
nofollow.replace(watch.ROOT, STORE, json.dumps(data, indent=1, sort_keys=True), 0o600)
|
||||
|
||||
|
||||
def ordered(waiting: list[dict], ranks: dict[str, int], now: float) -> list[dict]:
|
||||
def ordered(waiting: list[dict], ranks: dict[str, int], agents: dict[str, int], now: float) -> list[dict]:
|
||||
def key(entry: dict) -> tuple:
|
||||
hours = int((now - entry["enqueued"]) // HOUR)
|
||||
rank = ranks[entry["task"]] if entry["task"] in ranks else len(ranks)
|
||||
return (not entry["hotfix"], rank - hours, entry["seq"])
|
||||
agent = agents[entry["name"]] if entry["name"] in agents else len(agents)
|
||||
return (not entry["hotfix"], rank - hours, agent, entry["seq"])
|
||||
|
||||
return sorted(waiting, key=key)
|
||||
|
||||
|
||||
def evaluate(entries: list[dict], free_gb: float, floor: float, stage: str, silenced: bool,
|
||||
slot_limits: dict[str, int], ranks: dict[str, int], now: float) -> dict[str, str | None]:
|
||||
slot_limits: dict[str, int], ranks: dict[str, int], agents: dict[str, int],
|
||||
now: float) -> dict[str, str | None]:
|
||||
"""Decide every waiting entry in grant order, without disk or processes.
|
||||
|
||||
Args:
|
||||
@@ -281,6 +284,9 @@ def evaluate(entries: list[dict], free_gb: float, floor: float, stage: str, sile
|
||||
slot_limits: {kind: max concurrent jobs}.
|
||||
ranks: {task: index in the register's ranking}; a task missing there
|
||||
ranks after all of them.
|
||||
agents: {agent name: index in the operator's agent order}; it breaks
|
||||
ties of equal rank only, an entry whose holder is missing there after
|
||||
all of them.
|
||||
now: epoch seconds; each whole hour waited moves an entry one rank up.
|
||||
|
||||
Returns:
|
||||
@@ -293,7 +299,7 @@ def evaluate(entries: list[dict], free_gb: float, floor: float, stage: str, sile
|
||||
counts = Counter(e["kind"] for e in active)
|
||||
busy = {e["workdir"] for e in active}
|
||||
verdicts: dict[str, str | None] = {}
|
||||
for entry in ordered([e for e in entries if e["status"] == "waiting"], ranks, now):
|
||||
for entry in ordered([e for e in entries if e["status"] == "waiting"], ranks, agents, now):
|
||||
kind, need, workdir = entry["kind"], entry["need_gb"], entry["workdir"]
|
||||
reason = None
|
||||
if stage in ("stop", "critical"):
|
||||
@@ -324,6 +330,10 @@ def register_ranks() -> dict[str, int]:
|
||||
return {task: index for index, task in enumerate(rasci.ranked(rasci.merged(False)))}
|
||||
|
||||
|
||||
def agent_ranks() -> dict[str, int]:
|
||||
return {name: index for index, name in enumerate(sibling("rasci").agent_order())}
|
||||
|
||||
|
||||
def stage(cfg: dict, free_gb: float, now: float) -> str:
|
||||
state = watch.read_json(watch.STATE)
|
||||
return state["stage"] if "stage" in state else watch.stage_for(free_gb, [], cfg, now)
|
||||
@@ -338,7 +348,7 @@ def decide(cfg: dict, entries: list[dict], free_gb: float, now: float, kinds: di
|
||||
slots = {kind: limit for kind, (limit, _) in limits(cfg, kinds, entries).items()}
|
||||
return evaluate(
|
||||
entries, free_gb, cfg["thresholds_gb"]["stop"], stage(cfg, free_gb, now), silenced(now),
|
||||
slots, register_ranks(), now,
|
||||
slots, register_ranks(), agent_ranks(), now,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user