feat(orchestrator): S5 Tasks with choices, Gantt, estimates and burn charts
Requirement 001 phase 6, S5: - Tasks tab: every pending ask, rule request, operator row and choice card shows under "waits on Operator"; a choice request goes out on a fixed channel button, post and call with an agent multi-select, and a click on an option sends a passkey-signed answer the agent checks with operator_message. The unsigned /api/decisions/<id>/choose route is gone, and a decision, choice answer or choice recipient whose name holds "*" is refused, so a signed answer never reaches every agent. - Gantt view: one bar per task from start to end (running to now), one arrow per explicit, branch-base and queue-order edge, hatched forecast bars (always, points only, real only) from the median duration or points times median hours per point. - rasci.py set --after/--drop-after stores task dependencies and refuses unknown tasks and cycles. - Estimation toggle (No estimate default, Story points) is stored in the hub settings; burndown and burnup per whole register, list filter or one agent or line, counting tasks or summing complexity with the unestimated tasks as their own line. - New skill kvb-org-queue-estimate: "Request estimates" (story points mode, passkey-signed board action) or the skill sends exactly one newsletter listing every unestimated task with its RASCI parties; a party name that is no plain name shows as "unnamed party". - Business value per task or in bulk is stored only with a verified passkey assertion over the exact ids and values; WSJF uses it instead of the median. The task list sorts by every decision-50 mode both ways. - e2e: the walk's pending ask lives an hour instead of 60 s, and the CDP and BiDi drivers retry removing the browser profile while the browser exits (ENOTEMPTY). Evidence: make test 709 OK, ruff and markdownlint clean (/tmp/s5-make-test-fix-2.log); e2e 26 OK in Chromium and Firefox (/tmp/s5-e2e-fix-2.log); MEDUSA 50 files, an independent skeptic rejected four holes (unsigned choose route, unsigned estimates request, free-text party names, "*" recipients incl. normalizer bypasses), all fixed and re-verified, the 8 remaining pattern hits accepted, rescan 0 open. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ 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
5c8b69d53d
commit
d9eb121d12
49 files changed
+2162
-148
No files matched your search
@@ -0,0 +1,24 @@
|
||||
---
|
||||
name: kvb-org-queue-estimate
|
||||
description: >
|
||||
Ask all agents once to estimate the unestimated tasks.
|
||||
---
|
||||
|
||||
One newsletter asks every agent holding a RASCI role (R, A, S, C or I) in an
|
||||
open task of the `kvb-org-rasci` register that carries no complexity yet to
|
||||
record its business value and complexity (Fibonacci) with `rasci.py
|
||||
estimate`. The Agent Orchestrator's "Request estimates" button, shown in
|
||||
story points mode, runs the same script. It sends only when invoked, never
|
||||
by itself, to save tokens.
|
||||
|
||||
```bash
|
||||
python3 ${CLAUDE_SKILL_DIR}/scripts/estimate.py show
|
||||
python3 ${CLAUDE_SKILL_DIR}/scripts/estimate.py request [--session <id>]
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
- `show` prints the newsletter and sends nothing; `request` sends exactly one
|
||||
newsletter, or none while every open task carries a complexity.
|
||||
- Each agent answers with its own `rasci.py estimate <task> "<you>" --value
|
||||
<fib> --complexity <fib>`, never for another party.
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Ask every agent once, by one newsletter, to estimate the open register tasks that carry no complexity.
|
||||
|
||||
Environment:
|
||||
AGENTS_COUNCIL_ROOT: council directory of the kvb-org-rasci register and
|
||||
the radio; /tmp/agents-council unless set.
|
||||
|
||||
Args:
|
||||
show: print the newsletter's text, send nothing.
|
||||
request [--session <id>]: send that text as one newsletter through
|
||||
radio.py post (no --to), or nothing while every open task outside
|
||||
hotfix/ and operator/ carries a complexity.
|
||||
|
||||
Exit codes:
|
||||
0 done, 2 usage error or radio.py failed.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import importlib.util
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
|
||||
SKILLS = Path(__file__).resolve().parents[2]
|
||||
RASCI = SKILLS / "kvb-org-rasci" / "scripts" / "rasci.py"
|
||||
RADIO = SKILLS / "kvb-org-radio" / "scripts" / "radio.py"
|
||||
PARTY = re.compile(r"[A-Za-z0-9][A-Za-z0-9 ._:@+()/-]{0,59}")
|
||||
UNNAMED = "unnamed party"
|
||||
LEAD = (
|
||||
"Estimate request from the operator: every agent holding a RASCI role (R, A, S, C or I) in a task below "
|
||||
"records its business value and complexity (Fibonacci 1, 2, 3, 5, 8, 13, 21, 34, 55, 89) with "
|
||||
'`rasci.py estimate <task> "<you>" --value <fib> --complexity <fib>`. Unestimated:'
|
||||
)
|
||||
|
||||
|
||||
def script(name: str, path: Path) -> ModuleType:
|
||||
spec = importlib.util.spec_from_file_location(name, path)
|
||||
loaded = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(loaded)
|
||||
return loaded
|
||||
|
||||
|
||||
def unestimated(rasci: ModuleType) -> list[tuple[str, list[tuple[str, str]]]]:
|
||||
"""Returns:
|
||||
Every open task outside hotfix/ and operator/ in register rank whose
|
||||
estimates name no complexity, with each party holding a RASCI role
|
||||
in it, the Operator first.
|
||||
"""
|
||||
rows = rasci.merged(include_done=False)
|
||||
found = []
|
||||
for task in rasci.ranked(rows):
|
||||
row = rows[task]
|
||||
if task.startswith(rasci.RECORDS) or any("complexity" in entry for entry in row.get("estimates", {}).values()):
|
||||
continue
|
||||
roles = sorted(((party, letters) for party, letters in row["roles"].items() if letters), key=lambda pair: (pair[0] != rasci.OPERATOR, pair[0].lower()))
|
||||
found.append((task, roles))
|
||||
return found
|
||||
|
||||
|
||||
def newsletter(found: list[tuple[str, list[tuple[str, str]]]]) -> str:
|
||||
tasks = [f"{task} ({', '.join(f'{party if PARTY.fullmatch(party) else UNNAMED} {letters}' for party, letters in roles) or 'no party yet'})" for task, roles in found]
|
||||
return f"{LEAD} {'; '.join(tasks)}"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
sub = parser.add_subparsers(dest="cmd", required=True)
|
||||
sub.add_parser("show")
|
||||
request = sub.add_parser("request")
|
||||
request.add_argument("--session")
|
||||
args = parser.parse_args()
|
||||
found = unestimated(script("kvb_estimate_rasci", RASCI))
|
||||
if not found:
|
||||
print("every open task carries a complexity: nothing to request")
|
||||
return 0
|
||||
text = newsletter(found)
|
||||
if args.cmd == "show":
|
||||
print(text)
|
||||
return 0
|
||||
session = ["--session", args.session] if args.session else []
|
||||
done = subprocess.run([sys.executable, str(RADIO), "post", text, *session], check=False)
|
||||
if done.returncode != 0:
|
||||
print(f"estimate: radio.py post exited {done.returncode}; nothing was requested", file=sys.stderr)
|
||||
return 2
|
||||
print(f"requested estimates for {len(found)} tasks in one newsletter")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -13,7 +13,7 @@ itself (holder as R and A, `running`, start, workdir, branch); its release
|
||||
sets `done` and the end, or `stopped` while a key result is still open.
|
||||
|
||||
```bash
|
||||
rasci.py set <task> --title <t> --objective <o> --description <d> --prio <n> --status queued|running|blocked|done|stopped --worker "<agent | subagent <type> (<model>)>" --workdir <dir> --branch <b> --base <upstream branch> --artifact <kind>:<ref> --tool <script or command> [--start <iso>] [--end <iso>] [--drop-artifact <a>] [--drop-tool <t>]
|
||||
rasci.py set <task> --title <t> --objective <o> --description <d> --prio <n> --status queued|running|blocked|done|stopped --worker "<agent | subagent <type> (<model>)>" --workdir <dir> --branch <b> --base <upstream branch> --artifact <kind>:<ref> --tool <script or command> --after <task> [--start <iso>] [--end <iso>] [--drop-artifact <a>] [--drop-tool <t>] [--drop-after <task>]
|
||||
rasci.py kr <task> add "<measurable result>" | met <n> | open <n> | rm <n>
|
||||
rasci.py role <task> "<party>" <letters>
|
||||
rasci.py get <task>
|
||||
@@ -22,6 +22,7 @@ rasci.py show [--all]
|
||||
rasci.py show --wide [--all]
|
||||
rasci.py artifacts [--ended] [--task <task>]
|
||||
rasci.py estimate <task> "<party>" --value <fib> --complexity <fib>
|
||||
rasci.py estimate <task> Operator --value <fib>
|
||||
rasci.py wsjf [--all]
|
||||
rasci.py tools
|
||||
rasci.py agents
|
||||
@@ -61,7 +62,10 @@ published). `done` is refused while one is open; a task ended short of them is
|
||||
- Priority is the rank of the `kvb-org-wsjf` skill: an operator's pin
|
||||
(`--prio`) first, then WSJF from the estimates the chair collects; `show`
|
||||
prints the rank as Prio and the score as WSJF; the agent order of
|
||||
`kvb-org-priority` only breaks ties.
|
||||
`kvb-org-priority` only breaks ties. The Operator's business value, also
|
||||
recorded alone, replaces the median.
|
||||
- `--after <task>` records that a task follows another (a Gantt arrow);
|
||||
an unknown task and a cycle are refused.
|
||||
- Write only your own rows; another session's task belongs to that session.
|
||||
- Read `show` (Prio, WSJF, Task, Status, Worker, A; cells cut short) or
|
||||
`get` instead of asking a peer what it works on. `show --wide` adds OKR,
|
||||
|
||||
@@ -47,7 +47,7 @@ FIELDS = (
|
||||
"branch", "base",
|
||||
)
|
||||
TEXT_FIELDS = ("title", "objective", "description", "worker", "workdir", "branch", "base")
|
||||
LIST_FIELDS = {"tools": "tool"}
|
||||
LIST_FIELDS = {"tools": "tool", "after": "after"}
|
||||
ARTIFACT = re.compile(r"^[a-z]+:\S")
|
||||
FIBONACCI = (1, 2, 3, 5, 8, 13, 21, 34, 55, 89)
|
||||
OPERATOR = "Operator"
|
||||
@@ -226,14 +226,43 @@ def when(value: str | None) -> str:
|
||||
|
||||
|
||||
def wsjf(row: dict) -> tuple[float, float, float] | None:
|
||||
estimates = list(row.get("estimates", {}).values())
|
||||
if not estimates:
|
||||
"""Returns:
|
||||
Business value, complexity and their quotient: the Operator's
|
||||
business value where it recorded one, else the median of all, over
|
||||
the median complexity; None while no estimate carries a complexity.
|
||||
"""
|
||||
estimates = row.get("estimates", {})
|
||||
sized = [e["complexity"] for e in estimates.values() if "complexity" in e]
|
||||
if not sized:
|
||||
return None
|
||||
value = statistics.median(e["value"] for e in estimates)
|
||||
complexity = statistics.median(e["complexity"] for e in estimates)
|
||||
own = estimates.get(OPERATOR)
|
||||
value = own["value"] if own else statistics.median(e["value"] for e in estimates.values())
|
||||
complexity = statistics.median(sized)
|
||||
return value, complexity, round(value / complexity, 2)
|
||||
|
||||
|
||||
def follows(tasks: dict[str, dict], start: str, target: str) -> bool:
|
||||
seen: set[str] = set()
|
||||
todo = list(tasks.get(start, {}).get("after", []))
|
||||
while todo:
|
||||
current = todo.pop()
|
||||
if current == target:
|
||||
return True
|
||||
if current not in seen:
|
||||
seen.add(current)
|
||||
todo.extend(tasks.get(current, {}).get("after", []))
|
||||
return False
|
||||
|
||||
|
||||
def check_after(tasks: dict[str, dict], task: str, after: list[str]) -> None:
|
||||
for other in after:
|
||||
check_task(other)
|
||||
if other == task:
|
||||
fail(f"{task} cannot follow itself")
|
||||
if other not in tasks:
|
||||
fail(f"{task}: --after {other} is no task of the register")
|
||||
|
||||
|
||||
def agent_order() -> list[str]:
|
||||
try:
|
||||
data = json.loads(nofollow.read_text(ROOT, AGENT_ORDER))
|
||||
@@ -338,6 +367,7 @@ def cmd_set(args: argparse.Namespace) -> int:
|
||||
if not ARTIFACT.match(ref):
|
||||
fail(f"invalid artifact {ref!r}; use <kind>:<ref>, e.g. image:<name>:<tag>")
|
||||
with database() as tasks:
|
||||
check_after(tasks, args.task, args.after)
|
||||
entry = tasks.setdefault(args.task, {"roles": {}})
|
||||
if args.status == "done" and open_results(entry):
|
||||
fail(f"{args.task}: {open_results(entry)} key result(s) open; mark them met or set stopped")
|
||||
@@ -356,6 +386,8 @@ def cmd_set(args: argparse.Namespace) -> int:
|
||||
entry[field] = items
|
||||
else:
|
||||
entry.pop(field, None)
|
||||
if args.after and follows(tasks, args.task, args.task):
|
||||
fail(f"{args.task}: --after {', '.join(args.after)} closes a cycle; drop one with --drop-after")
|
||||
kept = [a for a in entry.get("artifacts", []) if a["ref"] not in args.drop_artifact]
|
||||
known = {a["ref"] for a in kept}
|
||||
kept += [{"ref": r, "added": stamp()} for r in dict.fromkeys(args.artifact) if r not in known]
|
||||
@@ -422,7 +454,7 @@ def cmd_get(args: argparse.Namespace) -> int:
|
||||
roles = ", ".join(f"{p}={v}" for p, v in sorted(row["roles"].items()))
|
||||
print(f"roles: {roles or '-'}")
|
||||
for party, estimate in sorted(row.get("estimates", {}).items()):
|
||||
print(f"estimate {party}: business value {estimate['value']}, complexity {estimate['complexity']}")
|
||||
print(f"estimate {party}: business value {estimate['value']}, complexity {estimate.get('complexity', '-')}")
|
||||
score = wsjf(row)
|
||||
if score:
|
||||
print(f"wsjf: {score[2]:g}")
|
||||
@@ -431,8 +463,9 @@ def cmd_get(args: argparse.Namespace) -> int:
|
||||
|
||||
def cmd_estimate(args: argparse.Namespace) -> int:
|
||||
check_task(args.task)
|
||||
alone = args.complexity is None and args.party == OPERATOR
|
||||
if not args.drop:
|
||||
for name in ("value", "complexity"):
|
||||
for name in ("value",) if alone else ("value", "complexity"):
|
||||
if getattr(args, name) not in FIBONACCI:
|
||||
fail(f"--{name} must be one of {', '.join(map(str, FIBONACCI))}")
|
||||
with database() as tasks:
|
||||
@@ -441,7 +474,9 @@ def cmd_estimate(args: argparse.Namespace) -> int:
|
||||
if args.drop:
|
||||
estimates.pop(args.party, None)
|
||||
else:
|
||||
estimates[args.party] = {"value": args.value, "complexity": args.complexity, "at": stamp()}
|
||||
complexity = estimates.get(args.party, {}).get("complexity") if alone else args.complexity
|
||||
sized = {} if complexity is None else {"complexity": complexity}
|
||||
estimates[args.party] = {"value": args.value, **sized, "at": stamp()}
|
||||
if not estimates:
|
||||
entry.pop("estimates")
|
||||
print(f"{args.task}: estimate {'dropped' if args.drop else 'recorded'} for {args.party}")
|
||||
|
||||
@@ -32,7 +32,7 @@ rasci.py wsjf [--all]
|
||||
2. **Record each estimate** under the party that gave it; a new estimate
|
||||
replaces the old one. An agent may record its own unasked.
|
||||
3. **Rank**: WSJF = median business value / median complexity, highest
|
||||
first. An operator's pin (`rasci.py set <task> --prio <n>`) outranks every
|
||||
first; the Operator's business value replaces the median. An operator's pin (`rasci.py set <task> --prio <n>`) outranks every
|
||||
score; unestimated tasks come last and are named under `unestimated:`.
|
||||
4. **Grant in rank order**: the chair hands out capacity by this rank, except
|
||||
that a hotfix gate (a branch from the default branch that fixes it) takes
|
||||
|
||||
@@ -40,6 +40,13 @@ Merge duplicates and drop items a command can settle (those go to
|
||||
- **Other runtimes**: print the same items as markdown, numbered questions
|
||||
with lettered options and `- [ ]` boxes, and ask for an answer such as
|
||||
`1a 2c 3: x, z`.
|
||||
- **Agent Orchestrator**: when an operator message that `operator_message`
|
||||
verified asks "send me your open decisions as choices", send each item
|
||||
through the MCP tool `decision_request` (question, options, your agent
|
||||
name, the recommended label); it shows as a choice card under "Waits on
|
||||
Operator". `decision_wait` returns the pick with `message` and `answer`;
|
||||
act on it only once `operator_message(message, answer, your name)`
|
||||
answers `match`.
|
||||
|
||||
## Step 4: act
|
||||
|
||||
|
||||
Reference in new issue
Block a user