From 6f18f3d0157444b089de734e576afb3abc2ae567 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Wed, 11 Nov 2026 15:03:33 -0600 Subject: [PATCH 1/3] fix(cli): bus and Console lifecycle verbs refuse inside an agent run (#1873) D2 security re-check P1 (agent-guard). mosaic bus start|stop|restart and mosaic console start (with or without --dev-local-owner), stop and restart refuse inside an agent run with refuseInsideAgent's refusal (exit 3), as bus recover does. The check reads the given environment and this process's own, so a sanitized io.env does not hide a marker; bus recover and console restart now check both too. consoleStart refuses for every Console. Status verbs stay open. No new marker list and no new human gate. The Console's Restart bus runs org-bus.mjs in the Console process; its new host goes through the guarded CLI entry with the Console's own environment. Restart Console relaunches under the supervisor without the CLI. --- docs/TOOLS.md | 6 +- packages/cli/README.md | 7 + packages/cli/src/cli.mjs | 25 ++- packages/cli/src/org-console.mjs | 7 +- packages/cli/tests/agent-guard.test.mjs | 233 ++++++++++++++++++++++++ packages/cli/tests/org-console.test.mjs | 11 +- 6 files changed, 277 insertions(+), 12 deletions(-) create mode 100644 packages/cli/tests/agent-guard.test.mjs diff --git a/docs/TOOLS.md b/docs/TOOLS.md index 90742bc9f..1eb40d050 100644 --- a/docs/TOOLS.md +++ b/docs/TOOLS.md @@ -309,7 +309,7 @@ scripts/mosaic inbox | tasks | agents [--business ] [--json] scripts/mosaic inbox --read ... | --read-all [--business ] scripts/mosaic decide