feat(orchestrator): radio receipts inline (005 phase B)
Requirement 005: every radio message in the Stream and the radio log shows the avatars of the agents that read it, with read time and an ack badge where a receipt exists; receipt rows no longer appear as entries of their own, and the sender shows once. Read times come from seen marks, stamped only after a fresh presence pass no older than two sighting intervals; a stored time before its row is refused. An operator message links to its relay row through the ts radio.py prints first on stdout right after store(), checked against an exact row (sender Operator, relay text, targets, no to_sessions); a ts shared by two rows shows no readers. radio.py clips printed addresses; the hub keeps the first stdout line whole. Accepted MEDUSA false positives: MM-SCAN-058 at server.py:73, JB-SCAN-641 and JB-SCAN-616 at radio.py:389 (clip, the output sanitizer), FLA-SCAN-055 at radio.py:109. Committed below the 90/5 bar on the operator's word; the receipts e2e runs through the queue. 🎯 Fix: 89 % 💥 Break: 6 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 84 🚦 Gate: ⛔ fix 89 % < 90, break 6 % > 5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92f5087eed
commit
30b2a32095
25 files changed
+1432
-87
No files matched your search
@@ -11,6 +11,8 @@ from typing import Protocol
|
||||
|
||||
SCRIPT_TIMEOUT = 60
|
||||
OUTPUT_LIMIT = 4000
|
||||
FIRST_LINE_LIMIT = 200
|
||||
ELIDED = "..."
|
||||
SAFE_PATH = "/usr/local/bin:/usr/bin:/bin"
|
||||
RADIO = "kvb-org-radio/scripts/radio.py"
|
||||
RASCI = "kvb-org-rasci/scripts/rasci.py"
|
||||
@@ -19,6 +21,19 @@ OPERATOR_SCRIPT = "kvb-org-operator/scripts/operator.py"
|
||||
ESTIMATE = "kvb-org-queue-estimate/scripts/estimate.py"
|
||||
|
||||
|
||||
def bounded(stdout: str) -> str:
|
||||
"""Returns:
|
||||
stdout when it fits OUTPUT_LIMIT, else its first line, whole or not
|
||||
at all once over FIRST_LINE_LIMIT, ELIDED and the last OUTPUT_LIMIT
|
||||
characters of the rest: the first line a caller parses, like the ts
|
||||
radio.py prints, outlives a long output.
|
||||
"""
|
||||
if len(stdout) <= OUTPUT_LIMIT:
|
||||
return stdout
|
||||
first, _, rest = stdout.partition("\n")
|
||||
return "\n".join([first if len(first) <= FIRST_LINE_LIMIT else "", ELIDED, rest[-OUTPUT_LIMIT:]])
|
||||
|
||||
|
||||
def script_module(script: Path) -> ModuleType | None:
|
||||
"""Returns:
|
||||
The installed script as a module, loaded again after an install
|
||||
@@ -70,6 +85,9 @@ class Scripts:
|
||||
stdin=subprocess.DEVNULL,
|
||||
check=False,
|
||||
)
|
||||
except (OSError, subprocess.TimeoutExpired) as error:
|
||||
except subprocess.TimeoutExpired as error:
|
||||
partial = error.stdout.decode("utf-8", errors="replace") if isinstance(error.stdout, bytes) else error.stdout or ""
|
||||
return {"command": command, "code": -1, "stdout": bounded(partial), "stderr": str(error)}
|
||||
except OSError as error:
|
||||
return {"command": command, "code": -1, "stdout": "", "stderr": str(error)}
|
||||
return {"command": command, "code": done.returncode, "stdout": done.stdout[-OUTPUT_LIMIT:], "stderr": done.stderr[-OUTPUT_LIMIT:]}
|
||||
return {"command": command, "code": done.returncode, "stdout": bounded(done.stdout), "stderr": done.stderr[-OUTPUT_LIMIT:]}
|
||||
Reference in new issue
Block a user