From 93d6939fe4033426695825005062b1c4593812a3 Mon Sep 17 00:00:00 2001 From: MendixMau Date: Mon, 16 Nov 2026 10:36:43 +0800 Subject: [PATCH 1/3] Cockpit: a judgment stop is a red bar with its items and the rerun command; create-spec select fields Cold test WM1: basewalk stopped with exit 11 and the page said "0 your tasks" and "Upgrade in progress"; the run sat idle overnight. Now each NEEDS-JUDGMENT.md section is a needs-you row, the bar lists them with the rerun command, and the summary panel says the run waits for you. create-spec fields take {"do": "select"} for reference selectors (an Office needs its time zone before Save). Co-Authored-By: Claude Opus 5.5 --- upgrade-toolkit/bin/cockpitmatrix.py | 25 +++++++++++++++++++-- upgrade-toolkit/bin/cockpitpage.py | 19 +++++++++++++++- upgrade-toolkit/bin/gen_journeys.py | 7 ++++-- upgrade-toolkit/controls/cockpit_control.sh | 10 +++++++++ upgrade-toolkit/controls/run-controls.sh | 6 +++++ upgrade-toolkit/steps/journeys.md | 3 ++- 6 files changed, 64 insertions(+), 6 deletions(-) diff --git a/upgrade-toolkit/bin/cockpitmatrix.py b/upgrade-toolkit/bin/cockpitmatrix.py index 72cd67e..6f52801 100644 --- a/upgrade-toolkit/bin/cockpitmatrix.py +++ b/upgrade-toolkit/bin/cockpitmatrix.py @@ -431,6 +431,11 @@ def commit_rows(pred): for it in pending_j: tgt = next((r for r in rows if r["id"] == home.get(it.get("step"), "findings")), None) or rows[0] c = tgt["cells"]["test"] + if c.get("s") == "you" and c.get("dec", "").startswith("stop:") and it["id"].startswith("stop:"): + # several sections of one judgment stop on one row: list them all (the first one kept only its own title) + n = c.get("nstop", 1) + 1 + c.update(nstop=n, l=f"{n} decisions needed", steps=c["steps"] + [it["title"]]) + continue was = c["l"] c.update(s="you", l="Needs your decision", dec=it["id"], steps=[it["title"], it["problem"], f"Before: {was}."][:3] if it["problem"] else [it["title"]]) return rows, ready_chips(work, P, g, heal, inv, ledit, done), P, g, done, per, ledger @@ -1055,7 +1060,11 @@ def band(model, rows, chips, g, tl, kpi=None): st, head, sub = "bad", "The build does not pass yet", "The agent is fixing it." else: st, head, sub = "neutral", (f"Upgrade to Mendix {tgt} in progress" if tgt else "Upgrade in progress"), "The build has not run yet." - closed = closed_items(rows, g, tl) + if model.get("stopped") and st != "ok": # a judgment stop outranks "in progress": nothing moves until a person decides + s = model["stopped"] + st, head = "bad", f"Stopped at {s['step']}, waiting for you" + sub = f"{len(s['titles'])} {'item' if len(s['titles']) == 1 else 'items'} to decide, then rerun (see the red bar)." + closed =closed_items(rows, g, tl) for it in kpi.get("closed") or []: if isinstance(it, dict) and isinstance(it.get("label"), str) and isinstance(it.get("n"), int): hit = next((c for c in closed if c["label"].lower() == it["label"].lower()), None) @@ -1277,6 +1286,8 @@ def band(model, rows, chips, g, tl, kpi=None): #feed,#feed *{overflow-wrap:anywhere} .nowrun{display:flex;align-items:center;gap:12px;margin:0 0 14px;padding:10px 14px;border-radius:12px;background:var(--panel);border:1px solid var(--wait);font-size:14px} .nowrun[hidden]{display:none} +.stopbar{margin:0 0 14px;padding:10px 14px;border-radius:12px;background:var(--badbg);border:1px solid var(--bad);font-size:14px} +.stopbar b{color:var(--bad)}.stopbar ul{margin:6px 0;padding-left:20px}.stopbar small{display:block;color:var(--muted,#6c7a87);overflow-wrap:anywhere} .nowrun .pulse{flex:none;width:10px;height:10px;border-radius:50%;background:var(--wait);animation:nrp 1.4s ease-in-out infinite} @keyframes nrp{0%,100%{opacity:1}50%{opacity:.25}} @media (prefers-reduced-motion:reduce){.nowrun .pulse{animation:none}} @@ -1715,6 +1726,16 @@ def h_running(r): f'{E(what)}') +def h_stopped(s): + """A judgment stop (NEEDS-JUDGMENT.md): a red bar under the header, so a run that waits for a person says so first.""" + if not s: + return "" + li = "".join(f"
  • {E(t)}
  • " for t in s["titles"]) + cmd = f'Then rerun: {E(s["rerun"])}' if s["rerun"] else "" + return (f'') + + def render(model, matrix): data = json.dumps(dict({k: model[k] for k in ("title", "sub", "state", "planHash", "signed", "phases", "items")}, matrix=matrix), ensure_ascii=False) data = data.replace("{e(model['title'])}\n
    {e(model['sub'])}
    \n" " \n" f" {h_ladder(matrix.get('ladder'))}\n \n" - f" {h_running(model.get('running'))}\n" + f" {h_stopped(model.get('stopped'))}{h_running(model.get('running'))}\n" '
    \n
    \n' '
    Counts by kind (tap one to mark its rows)\n' f'
    {head_}
    \n
    {tiles_}
    \n
    \n' diff --git a/upgrade-toolkit/bin/cockpitpage.py b/upgrade-toolkit/bin/cockpitpage.py index 5d39059..e29bb34 100644 --- a/upgrade-toolkit/bin/cockpitpage.py +++ b/upgrade-toolkit/bin/cockpitpage.py @@ -498,6 +498,20 @@ def add(it): "title": j.get("question", j.get("id")), "step": j.get("step", ""), "meta": f"Open since step {j.get('step', '?')}, effort {opts[0].get('effort', '') if opts else ''}".replace(", effort ", ""), "problem": short(j.get("what", ""), 260) + (" " + short(j.get("why_matters", ""), 160) if j.get("why_matters") else ""), "rec": rec, "rec_text": j.get("recommended_why", ""), "options": opts}) + # a judgment stop: each NEEDS-JUDGMENT.md section is a row, unless decisions-open.json already holds that step's items + # (cold test WM1: basewalk stopped with exit 11 and three sections, the page said "0 your tasks" and the run sat overnight) + stopinfo = None + if stopped: + rerun = (re.search(r"then rerun:\n\n {4}(.+)", nj) or [None, ""])[1] + secs = re.findall(r"^## (.+?) \(exit (\d+)\)\n\n(.*?)(?=^## |\Z)", nj, re.M | re.S) + stopinfo = {"step": stopped[0], "code": stopped[1], "titles": [s[0] for s in secs], "rerun": rerun} + if stopped and not any(j.get("step") == stopped[0] for j in djo): + for k, (title, code, body) in enumerate(secs, 1): + add({"id": f"stop:{stopped[0]}:{k}", "kind": "judgment", "dot": "bad", "title": title, "step": stopped[0], + "meta": f"The run stopped at {stopped[0]} (exit {code}) and waits for you", + "problem": short(re.sub(r"```.*?```", "", body, flags=re.S).strip() or body.strip(), 400), + "rec": "rerun", "rec_text": "Decide in writing as the text says, then rerun from this step.", + "options": [{"key": "rerun", "label": "Decided, rerun", "causes": rerun or "Rerun the pipeline from this step."}]}) conf = {} # change id -> {"label","tech","commit"}; from AGENT-DECISIONS rows marked confirm and gate-notes lines that ask for a look for bid, d in AD.items(): if d["confirm"]: @@ -731,6 +745,8 @@ def phase_time(steps): nn = len(open_visible) if nb: state = ("bad", f"Not ready yet. Testing found {pl(nb, 'real problem')}, {pl(nn, 'thing')} {'needs' if nn == 1 else 'need'} you.") + elif stopped: + state = ("bad", f"Stopped at {stopped[0]}. {pl(nn, 'thing')} {'needs' if nn == 1 else 'need'} you before the run goes on.") elif nn: state = ("warn", f"Waiting for you. {pl(nn, 'thing')} {'needs' if nn == 1 else 'need'} you.") elif gate["overall"] == "PASS": @@ -748,7 +764,8 @@ def phase_time(steps): if stopped: sub += f" · stopped at {stopped[0]}" return {"title": f"{app_name(work)} upgrade", "sub": sub, "state": {"dot": state[0], "text": state[1]}, "planHash": P["hash"], - "signed": list(signed) if signed else None, "phases": phases, "items": items, "running": run} + "signed": list(signed) if signed else None, "phases": phases, "items": items, "running": run, + "stopped": stopinfo} # --live: poll the server's status (the "Running now" bar, in place) and stamp, reload on change and keep the scroll place; an open drawer holds the reload until it closes diff --git a/upgrade-toolkit/bin/gen_journeys.py b/upgrade-toolkit/bin/gen_journeys.py index 51ee329..4c8a275 100644 --- a/upgrade-toolkit/bin/gen_journeys.py +++ b/upgrade-toolkit/bin/gen_journeys.py @@ -458,7 +458,10 @@ def create_journey(spec, data_rung=False): acts = [{"do": "nav", "group": spec["nav"].get("group"), "item": spec["nav"]["item"]}] acts += [{"do": "click", "widget": c["widget"], "label": c.get("label") or c["widget"]} for c in spec.get("path", [])] acts += [{"do": "click", "widget": spec["newButton"], "label": "New"}] - acts += [{"do": "fill", "widget": f["widget"], "value": f["value"]} for f in spec.get("fields", [])] + # a field with "do": "select" picks from a reference selector ({"match": caption} or {"first": true}); the rest fill + # (cold test WM1: an Office needs its Time zone, a reference selector, before Save is accepted) + acts += [{"do": "select", "widget": f["widget"], **({"match": f["match"]} if f.get("match") else {"first": True})} + if f.get("do") == "select" else {"do": "fill", "widget": f["widget"], "value": f["value"]} for f in spec.get("fields", [])] acts += [{"do": "click", "widget": spec["saveButton"], "label": "Save"}] ui = {"ready": spec.get("ready") or ".mx-page"} for k in ("textPresent", "textAbsent"): @@ -470,7 +473,7 @@ def create_journey(spec, data_rung=False): # E2E-9: +1 says some row arrived; the own-row check says it is THIS run's row with the typed value own = [{"label": f"the run's own row: {f['attr']} = {f['value']}", "expect": 1, "sql": f"SELECT COUNT(*) AS n FROM {spec['entity']} WHERE {f['attr']} = '{f['value']}'"} - for f in spec.get("fields", []) if f.get("attr")] + for f in spec.get("fields", []) if f.get("attr") and f.get("do") != "select"] if own: step["data"]["oql"] = own j = journey("create-save", f"Core create-and-save: {spec['entity']}", spec["role"], diff --git a/upgrade-toolkit/controls/cockpit_control.sh b/upgrade-toolkit/controls/cockpit_control.sh index cab4a8d..734faa1 100755 --- a/upgrade-toolkit/controls/cockpit_control.sh +++ b/upgrade-toolkit/controls/cockpit_control.sh @@ -111,6 +111,16 @@ PY printf 'basewalk\t%s\t999999\n' "$(date +%s)" > "$W/state/running"; ck > /dev/null echo "dead pid: hidden $(grep -c '
    /dev/null; echo "no file: hidden $(grep -c '
    "$W/NEEDS-JUDGMENT.md"; ck > /dev/null + echo "bar: $(grep -o '