feat(workbench): requirement 003 with the gates and register contracts
Requirement 003 Operator Workbench (operator-confirmed 2026-11-11) and the contracts its work packages build on: gates.py keeps gate rules, branch parents and gate receipts in ~/.local/state/agents-council/gates.db (resolve takes the branch's own level, else the strictest of all parents; derive records the nearest ancestor tips; tree hashes everything a worktree holds through a temporary index). rasci.py gains --unpin, stamps every changed row with updated, and ranks a task after its after-dependencies. 🎯 Fix: 95 % 💥 Break: 3 % 💸 Cost: 100 % ⏱️ Time: 100 % 🛡️ Security: 100 % 🏆 Score: 92 🚦 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
1bcc8c135f
6 files changed
+701
-1
No files matched your search
@@ -113,7 +113,12 @@ def database() -> Iterator[dict[str, dict]]:
|
||||
except OSError as error:
|
||||
fail(f"cannot lock {LOCK}: {error.strerror}")
|
||||
tasks = load()
|
||||
before = {task: json.dumps(row, sort_keys=True) for task, row in tasks.items()}
|
||||
yield tasks
|
||||
now = stamp()
|
||||
for task, row in tasks.items():
|
||||
if before.get(task) != json.dumps(row, sort_keys=True):
|
||||
row["updated"] = now
|
||||
nofollow.replace(ROOT, DB, json.dumps(tasks, indent=1, sort_keys=True), FILE_MODE)
|
||||
|
||||
|
||||
@@ -284,7 +289,19 @@ def ranked(rows: dict[str, dict]) -> list[str]:
|
||||
agent = order.get(row.get("worker"), len(order))
|
||||
return (pinned is None, pinned or 0, score is None, -(score[2] if score else 0), agent, task)
|
||||
|
||||
return sorted(rows, key=key)
|
||||
placed: list[str] = []
|
||||
|
||||
def place(task: str, trail: frozenset) -> None:
|
||||
if task in placed or task in trail:
|
||||
return
|
||||
for before in rows[task].get("after", []):
|
||||
if before in rows:
|
||||
place(before, trail | {task})
|
||||
placed.append(task)
|
||||
|
||||
for task in sorted(rows, key=key):
|
||||
place(task, frozenset())
|
||||
return placed
|
||||
|
||||
|
||||
def by_agent(rows: dict[str, dict]) -> dict[str, list[str]]:
|
||||
@@ -362,6 +379,8 @@ def cmd_set(args: argparse.Namespace) -> int:
|
||||
check_task(args.task)
|
||||
if args.prio is not None and args.prio < 1:
|
||||
fail("--prio must be 1 or higher")
|
||||
if args.unpin and args.prio is not None:
|
||||
fail("--unpin removes the pin; it cannot go with --prio")
|
||||
times = {f: stamp(getattr(args, f)) for f in ("start", "end") if getattr(args, f)}
|
||||
for ref in args.artifact:
|
||||
if not ARTIFACT.match(ref):
|
||||
@@ -375,6 +394,8 @@ def cmd_set(args: argparse.Namespace) -> int:
|
||||
value = getattr(args, field)
|
||||
if value is not None:
|
||||
entry[field] = value
|
||||
if args.unpin:
|
||||
entry.pop("prio", None)
|
||||
if args.status:
|
||||
apply_status(entry, args.status)
|
||||
entry.update(times)
|
||||
@@ -591,6 +612,7 @@ def main() -> int:
|
||||
for field in (*TEXT_FIELDS, "start", "end"):
|
||||
p.add_argument(f"--{field}")
|
||||
p.add_argument("--prio", type=int)
|
||||
p.add_argument("--unpin", action="store_true")
|
||||
for flag in (*LIST_FIELDS.values(), "artifact"):
|
||||
p.add_argument(f"--{flag}", action="append", default=[])
|
||||
p.add_argument(f"--drop-{flag}", action="append", default=[])
|
||||
|
||||
Reference in new issue
Block a user