From 6ad1f30d42c02bfa159c60c1857ca4c74355e31f Mon Sep 17 00:00:00 2001 From: marcie Date: Fri, 28 Aug 2026 22:25:20 -0500 Subject: [PATCH] mosaic comms: socket resolution is tool-owned (B2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --socket forwards -L verbatim when given; when OMITTED the CLI sends no -L at all and agent-send.sh's own resolution governs (explicit -L > MOSAIC_TMUX_SOCKET > unique hit > ambiguity refusal, B1/PR #1466). Measured design note: comms.ts was already correct by construction after B1 — this change pins it with a spec arm (no -L forwarded when --socket omitted) and makes the contract explicit in the option help, so a future default-guess here cannot silently reintroduce the stale-twin defect. Specs 7/7. --- packages/mosaic/src/commands/comms.spec.ts | 11 +++++++++++ packages/mosaic/src/commands/comms.ts | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/mosaic/src/commands/comms.spec.ts b/packages/mosaic/src/commands/comms.spec.ts index a20a85aa..633ede7c 100644 --- a/packages/mosaic/src/commands/comms.spec.ts +++ b/packages/mosaic/src/commands/comms.spec.ts @@ -15,6 +15,17 @@ import { afterEach, describe, expect, it } from 'vitest'; import { fleetCommsSendArgs, registerCommsCommand, tmuxSendArgs } from './comms.js'; describe('arg translation', () => { + // B2 (2026-08-29): when --socket is omitted, the CLI forwards NO -L and + // agent-send.sh's own resolution governs (explicit -L > MOSAIC_TMUX_SOCKET + // > unique hit > ambiguity refusal). Forwarding a guessed default here + // would defeat that resolution and reintroduce the stale-twin defect. + it('omits -L entirely when --socket is not given (tool-owned resolution)', () => { + const args = tmuxSendArgs('orch-01', 'hello', {}); + expect(args).toEqual(['-s', 'orch-01', '-m', 'hello']); + expect(args).not.toContain('-L'); + expect(args.join(' ')).not.toContain('-L'); + }); + it('tmux path: -s/-C/-L/-f/-m per agent-send.sh getopts', () => { expect(tmuxSendArgs('orch-01', 'hello', {})).toEqual(['-s', 'orch-01', '-m', 'hello']); expect( diff --git a/packages/mosaic/src/commands/comms.ts b/packages/mosaic/src/commands/comms.ts index cb6cada7..eaa8474d 100644 --- a/packages/mosaic/src/commands/comms.ts +++ b/packages/mosaic/src/commands/comms.ts @@ -62,7 +62,10 @@ export function registerCommsCommand(program: Command): void { .description('send [message...] — same-host tmux unless --site is given') .option('--class ', 'terminal-log | actionable | human | reaction | digest') .option('--file ', 'message body from file (same-host path only)') - .option('--socket ', 'tmux socket for the same-host send (e.g. mosaic-fleet)') + .option( + '--socket ', + 'tmux socket for the same-host send (e.g. mosaic-fleet). OMIT it to let agent-send.sh resolve the socket (explicit -L > MOSAIC_TMUX_SOCKET > unique hit; ambiguity refuses with its exit 4).', + ) .option('--site ', 'route via fleet-comms to /') .option('--comms-repo ', 'fleet-comms checkout', defaultCommsRepo()) .argument('', 'destination seat (session name)')