From a6f5889d6a7a5e7de4282b4f6b8dffd44f2a7ac3 Mon Sep 17 00:00:00 2001 From: Keaton Hoskins Date: Mon, 2 Nov 2026 19:44:03 -0800 Subject: [PATCH] fix(T769): every repeated --to is a recipient; release v0.5.58 parseArgs kept only the last of a repeated single-value option, so send --to a --to b exited 0 and silently dropped a. --to is now a multiple option joined into the comma list the CLI already reads. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 4 ++++ dist/cli.js | 6 +++++- package-lock.json | 4 ++-- package.json | 2 +- plugins/claude/.claude-plugin/plugin.json | 2 +- src/cli.ts | 5 ++++- test/cli-repeated-to.test.ts | 22 ++++++++++++++++++++++ 7 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 test/cli-repeated-to.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fa79d4f..1aa40f62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 0.5.58 (2026-11-03) + +- **`agentmbx send --to a --to b` delivers to everyone (T769).** A repeated `--to` kept only the last value: the send exited 0, printed one delivery and silently dropped the other recipients. axiom-lead lost five owner-priority tasks this way on 2026-11-02. Every `--to` now counts, alone or mixed with comma lists. + ## 0.5.57 (2026-11-02) - **Unanswered mail reaches someone even without a project lead (T768, owner decision 2026-11-02).** The 2-hour alert from 0.5.56 went only to a project lead, and most projects have none, so it told nobody. Now, when an agent has no other lead (its project has none, or it is the lead), each sender gets one alert naming only its own unanswered messages. A backlog longer than 20 messages is reported across sweeps, and each message is named exactly once (0.5.56 named only the first 10 of each alert). diff --git a/dist/cli.js b/dist/cli.js index 8ee5d8a1..b579da2c 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -388,7 +388,7 @@ async function run(argv) { return launchClaude(rest); // every argument belongs to Claude Code: parse nothing here const { values: o, positionals: pos } = parseArgs({ args: rest, allowPositionals: true, strict: cmd !== "hook" && cmd !== "mcp", options: { help: { type: "boolean", short: "h" }, force: { type: "boolean" }, - as: { type: "string" }, to: { type: "string" }, subject: { type: "string" }, m: { type: "string", short: "m" }, + as: { type: "string" }, to: { type: "string", multiple: true }, subject: { type: "string" }, m: { type: "string", short: "m" }, "body-file": { type: "string" }, "idempotency-key": { type: "string" }, kind: { type: "string" }, origin: { type: "string" }, schema: { type: "string" }, "reply-to": { type: "string" }, "needs-reply": { type: "boolean" }, urgent: { type: "boolean" }, "on-behalf-of": { type: "string" }, "new-mailbox": { type: "boolean" }, ref: { type: "string", multiple: true }, all: { type: "boolean" }, json: { type: "boolean" }, note: { type: "string" }, context: { type: "string" }, payload: { type: "string" }, source: { type: "string", multiple: true }, @@ -404,6 +404,10 @@ async function run(argv) { } }); if (o.help) return console.log(commandHelp(cmd)); + // T769: a repeated --to used to keep only the last value (exit 0, other recipients silently dropped). Every --to + // counts: they join into the documented comma list that the rest of the CLI reads. + if (Array.isArray(o.to)) + o.to = o.to.join(","); const str = (k) => (typeof o[k] === "string" ? o[k] : undefined); if (cmd === "mcp") return runMcp(); diff --git a/package-lock.json b/package-lock.json index 9168f577..12e805b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "agentmbx", - "version": "0.5.57", + "version": "0.5.58", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "agentmbx", - "version": "0.5.57", + "version": "0.5.58", "license": "BUSL-1.1", "dependencies": { "@modelcontextprotocol/sdk": "^1.30.1", diff --git a/package.json b/package.json index afe1a0cf..65e4dcdd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "agentmbx", - "version": "0.5.57", + "version": "0.5.58", "description": "AgentMBX: signed messages between AI coding agents (Claude, Codex, Kimi, OpenCode, Hermes, Antigravity) on one machine and across a LAN, with wake-up adapters and an owner-authority master agent.", "type": "module", "bin": { diff --git a/plugins/claude/.claude-plugin/plugin.json b/plugins/claude/.claude-plugin/plugin.json index 2732050c..2ca220f4 100644 --- a/plugins/claude/.claude-plugin/plugin.json +++ b/plugins/claude/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "agentmbx", - "version": "0.5.57", + "version": "0.5.58", "description": "Renders this Claude Code session's AgentMBX status. It does not compute status itself.", "author": { "name": "AgentMBX" diff --git a/src/cli.ts b/src/cli.ts index ccb7426c..936f74aa 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -350,7 +350,7 @@ async function run(argv: string[]) { if (cmd === "claude") return launchClaude(rest); // every argument belongs to Claude Code: parse nothing here const { values: o, positionals: pos } = parseArgs({ args: rest, allowPositionals: true, strict: cmd !== "hook" && cmd !== "mcp", options: { help: { type: "boolean", short: "h" }, force: { type: "boolean" }, - as: { type: "string" }, to: { type: "string" }, subject: { type: "string" }, m: { type: "string", short: "m" }, + as: { type: "string" }, to: { type: "string", multiple: true }, subject: { type: "string" }, m: { type: "string", short: "m" }, "body-file": { type: "string" }, "idempotency-key": { type: "string" }, kind: { type: "string" }, origin: { type: "string" }, schema: { type: "string" }, "reply-to": { type: "string" }, "needs-reply": { type: "boolean" }, urgent: { type: "boolean" }, "on-behalf-of": { type: "string" }, "new-mailbox": { type: "boolean" }, ref: { type: "string", multiple: true }, all: { type: "boolean" }, json: { type: "boolean" }, note: { type: "string" }, context: { type: "string" }, payload: { type: "string" }, source: { type: "string", multiple: true }, @@ -364,6 +364,9 @@ async function run(argv: string[]) { deadline: { type: "string" }, "require-idle-wake": { type: "boolean" }, "exclude": { type: "string" }, plan: { type: "boolean" }, "base-url": { type: "string" }, "no-browser": { type: "boolean" } } }); if (o.help) return console.log(commandHelp(cmd)); + // T769: a repeated --to used to keep only the last value (exit 0, other recipients silently dropped). Every --to + // counts: they join into the documented comma list that the rest of the CLI reads. + if (Array.isArray(o.to)) (o as Record).to = (o.to as string[]).join(","); const str = (k: string) => (typeof (o as Record)[k] === "string" ? (o as Record)[k] as string : undefined); if (cmd === "mcp") return runMcp(); diff --git a/test/cli-repeated-to.test.ts b/test/cli-repeated-to.test.ts new file mode 100644 index 00000000..47eadde2 --- /dev/null +++ b/test/cli-repeated-to.test.ts @@ -0,0 +1,22 @@ +// T769: `agentmbx send --to a --to b` kept only the last --to (exit 0, one delivery, the others silently dropped). +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { spawnSync } from "node:child_process"; +import { mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { MbxNode } from "../src/node.ts"; + +test("T769: every repeated --to is a recipient, alone or mixed with comma lists", (t) => { + const home = mkdtempSync(join(tmpdir(), "mbx-t769-")), n = new MbxNode(home, { host: "alpha" }); + t.after(() => { n.close(); rmSync(home, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }); }); + for (const a of ["sender", "fixer", "accountant", "optimizer", "secretary"]) n.registerAgent(a); + const bin = join(import.meta.dirname, "../bin/agentmbx.js"); + const env = { ...process.env, AGENTMBX_DEV: "1", MBX_HOME: home, MBX_NO_DESKTOP: "1" } as Record; + const r = spawnSync(process.execPath, [bin, "send", "--as", "sender", "--to", "fixer", "--to", "accountant,optimizer", "--to", "secretary", + "--kind", "task", "--subject", "x", "-m", "y"], { env, encoding: "utf8" }); + assert.equal(r.status, 0, r.stderr); + const id = (n.store.db.prepare("SELECT id FROM messages WHERE from_addr LIKE 'sender@%'").get() as { id: string }).id; + const got = (n.store.db.prepare("SELECT agent FROM deliveries WHERE msg_id=? ORDER BY agent").all(id) as { agent: string }[]).map((d) => d.agent); + assert.deepEqual(got, ["accountant", "fixer", "optimizer", "secretary"]); +});