Repository navigation
Description
What happened
A malformed field in one SSH send response can make text rendering throw after all destinations have been dispatched. The command-wide catch then reports operation_failed and “Nothing submitted” for every requested host, including a host whose response was already accepted as successfully posted.
Reproduced against main f6fedfc08c0f374eec1a3b5e2e6bfd09bc98dd71 (0.3.0 source), rechecked unchanged on 2026-10-03.
Minimal fixture reproduction
Use an isolated fake ssh executable on a scratch PATH; do not contact a real host or inbox. It:
- Answers
ssh -Gwithuser fixture. - Answers the version preflight with
session-peer 0.3.0 (typescript). - Reads the JSON request on stdin, records one invocation per destination, and exits 0 with this result:
{"schemaVersion":1,"command":"send","ok":true,"host":"good-fixture","submitted":true,"consumptionConfirmed":false,"status":"posted","target":{"agent":"claude","pid":1234}}For bad-fixture, change host accordingly and set target.agent to {"toString":null}.
Invoke the actual CLI with sender-context variables cleared, update notices disabled, SESSION_PEER_TAILSCALE=off, and a disposable HOME:
node dist/cli.js send --to fixture --message probe \
--host good-fixture --host bad-fixture \
--no-from --no-reply-to --output-format textObserved exit code: 1. The fixture recorded one request for each host, but stdout was:
Host: good-fixture
Error: operation_failed
Nothing submitted.
Host: bad-fixture
Error: operation_failed
Nothing submitted.
The remote envelope/status validator accepts the malformed field. safe() then calls String() on the object and throws. The final catch treats that post-dispatch formatting error as a command-wide pre-dispatch refusal.
This loses the known per-host outcome and can mislead manual recovery. It does not cause an automatic retry. The fixture proves reporting behavior, not native delivery or receiver ACK.
Source evidence
- Remote response validation, src/cli.ts L206–221
- Coercion and array rendering, src/output.ts L4–8
- Send target rendering, src/output.ts L31–36
- Final rendering and catch, src/cli.ts L363–370
- Failure envelope, src/cli.ts L223–229
Related to the per-host isolation contract in #20 / #84. #52 fixes exit-code propagation and #54 escapes display controls; neither covers this post-dispatch rendering failure.
Expected behavior
- Preserve the already-verified result for unaffected destinations.
- Validate command-specific response fields before accepting them.
- Treat an unverifiable response after a non-dry-run send as unknown for that destination.
- Keep rendering nonthrowing for decoded JSON; never turn a formatting failure into a false
submitted:falseclaim.
Suggested regression coverage
- Two-host send: one ordinary success and one malformed target field; preserve the first result.
- Single-host malformed send response reports unknown, with no retry.
- Text renderer handles null/object/array values in display fields safely.
- Cover JSON and text output without changing valid response shapes.
Environment
- session-peer-ts version / commit: 0.3.0 source,
f6fedfc08c0f374eec1a3b5e2e6bfd09bc98dd71 - Installation method: isolated source copy; TypeScript transformed with Node's
stripTypeScriptTypes({mode:"transform"}) - Node, OS and architecture: Node 24.19.0, Linux x86_64
- Claude / Codex versions: none invoked
- Local or SSH: fake SSH fixture only; no network connection or real endpoints
- Validation limits: focused reproduction only, not the full npm suite or native Windows verification
Checks
- I searched existing issues.
- I removed secrets and personal identifiers; names, PID and message above are synthetic fixtures.
- I distinguished discovery, dry-run, submission and actual ACK.
- I did not retry an unknown outcome or weaken inbound permissions.
Activity