fix: placement verification and sidechat policy enforcement
- dm.py: placement-aware verify (verify_placement), checked_uuid logging, placement_mismatch events - main-chat-watchdog.py: P0 alerts on placement_mismatch - box-ctl.py: notify routes to sidechat, box policy command - jobs: ops-audit and pipe-demo use sidechats - response-harvester.py: chain deduplication Session: sidechat/ops-restore
This commit is contained in:
+66
-1
@@ -65,7 +65,7 @@ DEFAULT_AGENT_SIDECHATS = {
|
||||
"646": "646 tasks",
|
||||
"opm": "heartbeat",
|
||||
"pip": "646-pip-coord",
|
||||
"muse": "main",
|
||||
"muse": "muse tasks",
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -2202,6 +2202,71 @@ def cmd_followup_cancel(args):
|
||||
os.replace(tmp_path, FOLLOWUPS_FILE)
|
||||
print(c_green(f"● Cancelled follow-up {match_key}."))
|
||||
|
||||
# Also stand down the VM-side nudge controller (request-sweeper.py),
|
||||
# which tracks dm_followup records independently of bl's local file.
|
||||
# Best-effort: the local cancel already succeeded, so a VM failure
|
||||
# (unreachable, no record, bad response) must not fail the command.
|
||||
_vm_followup_cancel(match_key)
|
||||
|
||||
|
||||
def _vm_followup_cancel(dm_id):
|
||||
"""POST /api/box/followups/cancel so the VM-side sweeper stops nudging.
|
||||
|
||||
Best-effort: never raises. Prints a one-line outcome.
|
||||
"""
|
||||
import json as _json
|
||||
import os as _os
|
||||
import subprocess as _sp
|
||||
import time as _time
|
||||
import urllib.parse as _up
|
||||
import urllib.request as _ur
|
||||
import urllib.error as _ue
|
||||
|
||||
box_api = _os.environ.get("BOX_API_BASE", "https://box.muse-dev.online")
|
||||
key = _os.environ.get("BOX_SIGN_KEY",
|
||||
_os.path.expanduser("~/.ssh/id_ed25519"))
|
||||
endpoint = "followups/cancel"
|
||||
ts_now = str(int(_time.time()))
|
||||
payload = ("%s\n%s" % (ts_now, endpoint)).encode()
|
||||
try:
|
||||
pr = _sp.run(["ssh-keygen", "-Y", "sign", "-f", key, "-n", "box"],
|
||||
input=payload, capture_output=True, timeout=15)
|
||||
sig = pr.stdout.decode().strip()
|
||||
if not sig:
|
||||
raise RuntimeError("empty signature")
|
||||
except Exception as e:
|
||||
print(c_warn(" VM follow-up cancel skipped (signing failed: %s)" % e))
|
||||
return
|
||||
query = _up.urlencode({"identity": "bl", "ts": ts_now, "sig": sig})
|
||||
url = "%s/api/box/followups/cancel?%s" % (box_api, query)
|
||||
try:
|
||||
req = _ur.Request(url,
|
||||
data=_json.dumps({"dm_id": dm_id}).encode(),
|
||||
headers={"Content-Type": "application/json",
|
||||
"User-Agent": "super-cli/1.0 (bl)"},
|
||||
method="POST")
|
||||
with _ur.urlopen(req, timeout=30) as r:
|
||||
resp = _json.load(r)
|
||||
except _ue.HTTPError as e:
|
||||
if e.code == 404:
|
||||
print(c_dim(" VM: no dm_followup record (bl-only follow-up)."))
|
||||
else:
|
||||
try:
|
||||
detail = e.read().decode("utf-8", errors="ignore")[:120]
|
||||
except Exception:
|
||||
detail = ""
|
||||
print(c_warn(" VM cancel failed: HTTP %s %s" % (e.code, detail)))
|
||||
return
|
||||
except Exception as e:
|
||||
print(c_warn(" VM cancel failed: %s" % e))
|
||||
return
|
||||
if resp.get("canceled"):
|
||||
print(c_green(" VM: follow-up canceled (%s)."
|
||||
% resp.get("request_id")))
|
||||
else:
|
||||
print(c_dim(" VM: %s." % resp.get("reason", "not canceled")))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Domain: PIPELINE (Multi-Agent Workflow Pipelines)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user