Merge branch 'master' into dependabot/pip/pyyaml-6.0.4

This commit is contained in:
Kevin Veen-Birkenbach authored and GitHub committed 2026-11-26 09:02:35 +01:00
commit 97ae413f6e
8 files changed
+79 -8

No files matched your search

+3 -2
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
import time import time
from .asking import ask_state from .asking import ask_state
from .choosing import decision_status from .choosing import answered, decision_status
from .council import MAYDAY_ACTIVE, NEWS, message_rows, read_claims, sessions from .council import MAYDAY_ACTIVE, NEWS, message_rows, read_claims, sessions
from .crons import cron_event from .crons import cron_event
from .errors import Missing, ToolError from .errors import Missing, ToolError
@@ -86,7 +86,8 @@ class Timeline:
for row in operator_rows(tasks): for row in operator_rows(tasks):
first = self.watch.first(row["task"], now) first = self.watch.first(row["task"], now)
if first <= end: if first <= end:
ref = {**{key: row[key] for key in ("task", "directory", "check", "status")}, "blocked": row_blocked(row, reasons)} answer = self.answers.get(row["task"])
ref = {**{key: row[key] for key in ("task", "directory", "check", "status")}, "blocked": row_blocked(row, reasons), "answered": answer["label"] if answered(answer, row) else ""}
rows.append(event({"id": f"operator:{row['task']}", "ts": first, "kind": "operator", "title": row["command"], "text": row["why"], "waiting": True, "ref": ref})) rows.append(event({"id": f"operator:{row['task']}", "ts": first, "kind": "operator", "title": row["command"], "text": row["why"], "waiting": True, "ref": ref}))
rows += [change for change in self.watch.listed() if begin <= change["ts"] <= end] rows += [change for change in self.watch.listed() if begin <= change["ts"] <= end]
rows += [cron_event(cron, directory) for cron in self.schedules(claims, now) if cron["created"] <= end and (cron["active"] or cron["created"] >= begin)] rows += [cron_event(cron, directory) for cron in self.schedules(claims, now) if cron["created"] <= end and (cron["active"] or cron["created"] >= begin)]
+7 -3
View File
@@ -98,6 +98,9 @@
if (entry.kind === "cron") { if (entry.kind === "cron") {
return [pill(ref.active ? "active" : "inactive", ref.active ? "ok" : "neutral")]; return [pill(ref.active ? "active" : "inactive", ref.active ? "ok" : "neutral")];
} }
if (entry.kind === "operator" && ref.answered) {
return [status("decided"), pill(ref.answered, "ok")];
}
if (entry.kind === "run" || entry.kind === "operator" || entry.kind === "register") { if (entry.kind === "run" || entry.kind === "operator" || entry.kind === "register") {
return [ref.status ? status(ref.status) : null]; return [ref.status ? status(ref.status) : null];
} }
@@ -135,15 +138,16 @@
} }
function eventRow(entry) { function eventRow(entry) {
const item = entry.waiting ? inboxOf(entry) : null; const answered = entry.kind === "operator" && entry.ref.answered;
const item = entry.waiting && !answered ? inboxOf(entry) : null;
const choice = item ? choiceOf(item, () => {}) : null; const choice = item ? choiceOf(item, () => {}) : null;
const alarm = entry.kind === "radio" && (entry.part === "mayday" || entry.part === "pan-pan"); const alarm = entry.kind === "radio" && (entry.part === "mayday" || entry.part === "pan-pan");
const renamed = entry.now && entry.now !== entry.agent ? h("span", {title: `now: ${entry.now}`}, person(entry.agent)) : person(entry.agent); const renamed = entry.now && entry.now !== entry.agent ? h("span", {title: `now: ${entry.now}`}, person(entry.agent)) : person(entry.agent);
const who = entry.agent ? [face(entry.agent, false), renamed] : entry.session ? h("strong", {title: entry.session}, entry.session.slice(0, 8)) : null; const who = entry.agent ? [face(entry.agent, false), renamed] : entry.session ? h("strong", {title: entry.session}, entry.session.slice(0, 8)) : null;
const headline = entry.kind === "transcript" || entry.kind === "ask" || entry.kind === "operator" ? null : h("span", {class: "headline"}, Receipts.headline(entry)); const headline = entry.kind === "transcript" || entry.kind === "ask" || entry.kind === "operator" ? null : h("span", {class: "headline"}, Receipts.headline(entry));
const blocked = (item && item.blocked) || (entry.kind === "operator" && entry.ref.blocked) || ""; const blocked = (item && item.blocked) || (entry.kind === "operator" && entry.ref.blocked) || "";
return h("li", {class: `entry k-${entry.kind}${entry.waiting ? " waiting" : ""}${alarm ? " alarm" : ""}`, "data-ref": item ? keyOf(item) : null, "data-item": `message:${entry.ts}/${entry.id}`, "data-to": item && item.to ? item.to : null, return h("li", {class: `entry k-${entry.kind}${entry.waiting && !answered ? " waiting" : ""}${alarm ? " alarm" : ""}`, "data-ref": item ? keyOf(item) : null, "data-item": `message:${entry.ts}/${entry.id}`, "data-to": item && item.to ? item.to : null,
"data-blocked": blocked ? "" : null, title: blocked || null}, "data-blocked": blocked ? "" : null, "data-answered": answered ? "" : null, title: blocked || null},
h("div", {class: "msg-meta"}, when(entry.ts), kindPill(entry), extras(entry)), h("div", {class: "msg-meta"}, when(entry.ts), kindPill(entry), extras(entry)),
h("div", {}, h("div", {},
h("div", {class: "route", "data-star-slot": ""}, who, entry.sub ? h("button", {type: "button", class: "linkish muted", on: {click: () => focusSub(entry.session, entry.sub)}}, `› Subagent ${entry.sub.slice(0, 12)}`) : null, entry.kind === "ask" ? h("strong", {}, entry.title) : null, headline), h("div", {class: "route", "data-star-slot": ""}, who, entry.sub ? h("button", {type: "button", class: "linkish muted", on: {click: () => focusSub(entry.session, entry.sub)}}, `› Subagent ${entry.sub.slice(0, 12)}`) : null, entry.kind === "ask" ? h("strong", {}, entry.title) : null, headline),
+1 -1
View File
@@ -97,7 +97,7 @@ svg .forecast-label { fill: var(--ok); font-size: var(--fs-2xs); font-weight: 65
.burn-forecast { display: inline-flex; align-items: center; gap: 6px; } .burn-forecast { display: inline-flex; align-items: center; gap: 6px; }
svg .node.a-worktree.open circle { stroke: var(--warn); stroke-width: 2.6; stroke-dasharray: 3 2; } svg .node.a-worktree.open circle { stroke: var(--warn); stroke-width: 2.6; stroke-dasharray: 3 2; }
svg .edge.flow { stroke-dasharray: 2 5; } svg .edge.flow { stroke-dasharray: 2 5; }
.inbox-list > li[data-blocked], .feed > li[data-blocked], .operator-list > li { filter: grayscale(1); opacity: 0.72; } .inbox-list > li[data-blocked], .feed > li[data-blocked], .feed > li[data-answered], .operator-list > li { filter: grayscale(1); opacity: 0.72; }
.item-blocked { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0 0; color: var(--muted); font-size: var(--fs-sm); } .item-blocked { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.operator-rows { display: grid; gap: 6px; margin-top: var(--sp-3); } .operator-rows { display: grid; gap: 6px; margin-top: var(--sp-3); }
.operator-rows > h3 { display: flex; align-items: center; gap: 8px; margin: 0; } .operator-rows > h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
+1 -1
View File
@@ -1,6 +1,6 @@
[dependency-groups] [dependency-groups]
lint = ["ruff==0.17.3"]
test = ["PyYAML==6.0.4"] test = ["PyYAML==6.0.4"]
lint = ["ruff==0.17.6"]
[tool.ruff] [tool.ruff]
target-version = "py312" target-version = "py312"
+1 -1
View File
@@ -193,7 +193,7 @@ META = re.compile(r"[\s|&;()<>$`\\\"'*?\[\]{}~!#]")
NAME = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._+-]*$") NAME = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._+-]*$")
COMMIT = re.compile(r"\bcommit\b") COMMIT = re.compile(r"\bcommit\b")
ASSIGNMENT = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*=") ASSIGNMENT = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*=")
SLOT = re.compile(r"<[A-Za-z][^<>]*>") SLOT = re.compile(r"<[A-Za-z][^<>@:/]*>")
TEE = re.compile(r"\|&?\s*(?:\S*/)?tee\b") TEE = re.compile(r"\|&?\s*(?:\S*/)?tee\b")
QUEUE_HOLD = re.compile(r"\bqueue\.py\s+hold\b") QUEUE_HOLD = re.compile(r"\bqueue\.py\s+hold\b")
SENT = re.compile(r"^sent (call|post) to (.+)$") SENT = re.compile(r"^sent (call|post) to (.+)$")
+51
View File
@@ -0,0 +1,51 @@
from __future__ import annotations
import json
import os
import shutil
import sys
import unittest
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path[:0] = [str(HERE.parent), str(HERE)]
import hub_e2e_kit as base
from hub_e2e_kit import OUT
from hub_support import OPTIONS
from kvb_orchestrator.records import digest
ROW = {"workdir": "/repo", "description": "the gate is green", "check": "decision", "options": OPTIONS, "recommended": "Merge now", "status": "queued", "roles": {"Operator": "R", "Skills session": "A"}}
PICKED = "Merge the hub now?"
OPEN = "Merge the radio now?"
PROBE = """(async () => {@HELPERS@
const rowOf = (task) => all("#main .feed > li.k-operator").find((li) => (li.dataset.item || "").endsWith(`/operator:${task}`));
const rows = await until(() => (rowOf("operator/picked") && rowOf("operator/open") ? [rowOf("operator/picked"), rowOf("operator/open")] : null), 10000);
if (!rows) {
return {error: text(document.getElementById("main"))};
}
const seen = (li) => ({answered: li.hasAttribute("data-answered"), grey: getComputedStyle(li).filter, options: all(".options button.option", li).length, pills: all(".msg-meta .pill", li).map(text), actions: all(".line-actions button", li).length});
return {picked: seen(rows[0]), open: seen(rows[1])};
})()"""
@unittest.skipUnless(shutil.which(os.environ.get("CHROMIUM", "chromium")), "no Chromium")
class TestAnsweredCards(base.OrchestratorE2ECase):
def test_chromium_greys_an_answered_decision_row_without_options_or_actions_and_keeps_an_open_one(self):
self.write_council({"rasci.json": {"operator/picked": {**ROW, "title": PICKED}, "operator/open": {**ROW, "title": OPEN}}})
self.httpd.hub.answers.insert("operator/picked", {"sha256": digest(PICKED), "label": "Wait", "message": "m-1"})
step = {"width": 1366, "height": 768, "url": f"http://localhost:{self.port}/#stream", "wait": 1200, "probe": PROBE.replace("@HELPERS@", base.HELPERS), "shot": self.shot("1366-answered-cards")}
data = self.drive([step], None)
(OUT / "chromium-answered-cards.json").write_text(json.dumps(data, indent=1), encoding="utf-8")
self.assertEqual([error for error in data["errors"] if "(style-src-elem)" not in error and "/favicon.ico" not in error], [])
found = data["results"][0]
self.assertNotIn("error", found, found)
picked, opened = found["picked"], found["open"]
self.assertEqual((picked["answered"], picked["options"], picked["actions"], picked["pills"][-2:]), (True, 0, 0, ["decided", "Wait"]), picked)
self.assertIn("grayscale(1)", picked["grey"])
self.assertEqual((opened["answered"], opened["options"], opened["grey"]), (False, 2, "none"), opened)
self.assertGreater(opened["actions"], 0, opened)
if __name__ == "__main__":
unittest.main()
+6
View File
@@ -485,6 +485,10 @@ class TestWaitingCards(MatchCase):
def answered(self, task: str) -> str: def answered(self, task: str) -> str:
return next(item["answered"] for item in self.snapshot()["inbox"] if item["id"] == task) return next(item["answered"] for item in self.snapshot()["inbox"] if item["id"] == task)
def streamed(self, task: str) -> tuple[bool, str]:
row = next(row for row in self.events("kinds=operator&waiting=1")["events"] if row["id"] == f"operator:{task}")
return row["waiting"], row["ref"]["answered"]
def waiting(self) -> dict[str, str]: def waiting(self) -> dict[str, str]:
self.claim("s1", "Skills session") self.claim("s1", "Skills session")
self.add(staged_repo(self.work)) self.add(staged_repo(self.work))
@@ -533,8 +537,10 @@ class TestWaitingCards(MatchCase):
self.assertEqual({card["kind"] for card in self.cards()}, {"commit", "command", "rule"}) self.assertEqual({card["kind"] for card in self.cards()}, {"commit", "command", "rule"})
self.assertEqual(self.post_json("/api/sign", {"items": [entries[0]]}, self.guard(self.host))[0], 409) self.assertEqual(self.post_json("/api/sign", {"items": [entries[0]]}, self.guard(self.host))[0], 409)
self.assertEqual(self.answered("operator/pick"), "Wait") self.assertEqual(self.answered("operator/pick"), "Wait")
self.assertEqual(self.streamed("operator/pick"), (True, "Wait"))
self.write_council({"rasci.json": {"operator/pick": {**PICK, "title": "Merge the hub tonight?"}}}) self.write_council({"rasci.json": {"operator/pick": {**PICK, "title": "Merge the hub tonight?"}}})
self.assertEqual((self.card("operator:operator/pick")["title"], self.answered("operator/pick")), ("Merge the hub tonight?", "")) self.assertEqual((self.card("operator:operator/pick")["title"], self.answered("operator/pick")), ("Merge the hub tonight?", ""))
self.assertEqual(self.streamed("operator/pick"), (True, ""))
def test_a_decision_row_takes_one_line_of_other_text_and_no_forged_line(self): def test_a_decision_row_takes_one_line_of_other_text_and_no_forged_line(self):
self.waiting() self.waiting()
+9
View File
@@ -687,6 +687,15 @@ class TestOperator(unittest.TestCase):
self.assertIn(" M one", result.stdout) self.assertIn(" M one", result.stdout)
self.assertNotIn("(nothing to compare)", result.stdout) self.assertNotIn("(nothing to compare)", result.stdout)
def test_a_slot_to_fill_in_refuses_a_row_and_a_mail_address_or_link_in_angle_brackets_does_not(self):
for command in ("git push origin <branch>", "make -C <register task> test"):
self.assertEqual(operator_script.unrunnable(command, "/"), "holds a <...> slot to fill in", command)
for command in (
"git commit --no-verify -m 'fix: x' --trailer 'Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>'",
"git commit --no-verify -m 'docs: see <https://s.veen.world/skills>'",
):
self.assertIsNone(operator_script.unrunnable(command, "/"), command)
def test_run_preview_stays_off_when_git_cannot_name_the_scope_of_a_filter(self): def test_run_preview_stays_off_when_git_cannot_name_the_scope_of_a_filter(self):
marker = self.base / "ran" marker = self.base / "ran"
git = self.bin / "git" git = self.bin / "git"