martha start gates on standard input alone, so a start whose output is a pipe starts a member that dies at once on the host print-mode complaint #155

Open
opened 2026-11-24 19:43:44 +00:00 by pluto · 0 comments
Member

Purpose (fix): a member's start whose standard output is not a terminal is refused before anything is started, naming the stream that is not one, instead of starting the member and having it end at once on the host's print-mode complaint.

What happens. martha start <member> gates on the owner's terminal with io.terminal.is_terminal, which is isatty(0) alone (run_the_martha_command.ts:1085), and the refusal it can give speaks only of input: martha start runs a member on your own terminal, and its input is not one. Run it yourself, in a terminal. (start_a_member.ts:72). A start whose standard input and standard error are a terminal but whose standard output is a pipe passes that gate. The host answers interactively or not on standard output, so it runs print mode with no input and ends at once:

$ script -qec 'claude < /dev/tty | cat' /dev/null
Error: Input must be provided either through stdin or as a prompt argument when using --print

Verified on host00, 2026-11-24 19:44Z: stdin and stderr on the pty, stdout into cat, no member and no martha in the run.

Instance. 2026-11-24 ~19:38Z, restarting the pilot's Neptunus member in its own tmux pane with the start's output piped to tee (~/work/martha-pilot-ws): the start passed its terminal check, because the pane's stdin was a terminal, and the member ended at once with the line above. Typed again without the pipe into the same pane, the same launcher started the same member and martha ls read it running. The pipe is invisible to martha and costs the member its terminal.

Where it is read. Three tests of "is a terminal" disagree, and only the host's matches what makes a member interactive:

  • terminalOfThisProcess (run_the_martha_command.ts:1085): isatty(0) alone. It is the gate for start (start_a_member.ts:151), up (run_the_martha_command.ts:429), the kitty open (:376) and attach (:407).
  • isOnTheOwnersTerminal (member_on_the_owners_terminal.ts:146-148): isatty(0) && isatty(2), never fd 1. It decides that the member becomes the terminal's foreground job (end_a_launch.ts:156) instead of a detached child.
  • ownerCanAnswerTheHost (host_runs_the_relay.ts:75): isatty(0).
  • The host: standard output. A pipe there is print mode, whatever stdin and stderr are.

So the start thinks it is on the owner's terminal on every measure martha has, and the member's own host disagrees.

The stand-in cannot catch it as it stands. The recorded-host stand-in writes that print-mode complaint only when --print is among its arguments (host_stand_in.ts:155), and martha never passes --print to a member. A fix is only proved if the stand-in models the host's own decision (print mode when its standard output is not a terminal), or if the test asserts the refusal directly, before any host is run.

What a refusal should say. One line, naming the stream that is not a terminal and what to do instead, e.g.:

martha: a member is not started: its start needs your terminal on standard output, and standard output is a pipe. A host started that way runs in print mode with no input and ends at once. Start the member with nothing redirected, in its own tmux pane, and read its screen with `tmux capture-pane -p`.

An engine member started the same way loses only the pipe today and its engine still runs, so whoever fixes this should say in the issue or the diff whether the refusal covers both hosts or the host that is its own interactive process.

Done when. A start whose standard output is not a terminal starts no member, exits non-zero before any host is run, and says in one line which stream is not a terminal and how to start the member instead; a start whose three streams are the terminal is unchanged. Test plus the mutant that drops the standard-output check and dies.

Refs macula-io/martha#102 (the pilot this was found on), macula-io/martha#147.

Purpose (fix): a member's start whose standard output is not a terminal is refused before anything is started, naming the stream that is not one, instead of starting the member and having it end at once on the host's print-mode complaint. **What happens.** `martha start <member>` gates on the owner's terminal with `io.terminal.is_terminal`, which is `isatty(0)` alone (`run_the_martha_command.ts:1085`), and the refusal it can give speaks only of input: `martha start runs a member on your own terminal, and its input is not one. Run it yourself, in a terminal.` (`start_a_member.ts:72`). A start whose standard input and standard error are a terminal but whose standard output is a pipe passes that gate. The host answers interactively or not on standard output, so it runs print mode with no input and ends at once: ``` $ script -qec 'claude < /dev/tty | cat' /dev/null Error: Input must be provided either through stdin or as a prompt argument when using --print ``` Verified on host00, 2026-11-24 19:44Z: stdin and stderr on the pty, stdout into `cat`, no member and no martha in the run. **Instance.** 2026-11-24 ~19:38Z, restarting the pilot's Neptunus member in its own tmux pane with the start's output piped to `tee` (`~/work/martha-pilot-ws`): the start passed its terminal check, because the pane's stdin was a terminal, and the member ended at once with the line above. Typed again without the pipe into the same pane, the same launcher started the same member and `martha ls` read it `running`. The pipe is invisible to martha and costs the member its terminal. **Where it is read.** Three tests of "is a terminal" disagree, and only the host's matches what makes a member interactive: - `terminalOfThisProcess` (`run_the_martha_command.ts:1085`): `isatty(0)` alone. It is the gate for `start` (`start_a_member.ts:151`), `up` (`run_the_martha_command.ts:429`), the kitty open (`:376`) and `attach` (`:407`). - `isOnTheOwnersTerminal` (`member_on_the_owners_terminal.ts:146-148`): `isatty(0) && isatty(2)`, never fd 1. It decides that the member becomes the terminal's foreground job (`end_a_launch.ts:156`) instead of a detached child. - `ownerCanAnswerTheHost` (`host_runs_the_relay.ts:75`): `isatty(0)`. - The host: standard output. A pipe there is print mode, whatever stdin and stderr are. So the start thinks it is on the owner's terminal on every measure martha has, and the member's own host disagrees. **The stand-in cannot catch it as it stands.** The recorded-host stand-in writes that print-mode complaint only when `--print` is among its arguments (`host_stand_in.ts:155`), and martha never passes `--print` to a member. A fix is only proved if the stand-in models the host's own decision (print mode when its standard output is not a terminal), or if the test asserts the refusal directly, before any host is run. **What a refusal should say.** One line, naming the stream that is not a terminal and what to do instead, e.g.: ``` martha: a member is not started: its start needs your terminal on standard output, and standard output is a pipe. A host started that way runs in print mode with no input and ends at once. Start the member with nothing redirected, in its own tmux pane, and read its screen with `tmux capture-pane -p`. ``` An engine member started the same way loses only the pipe today and its engine still runs, so whoever fixes this should say in the issue or the diff whether the refusal covers both hosts or the host that is its own interactive process. **Done when.** A start whose standard output is not a terminal starts no member, exits non-zero before any host is run, and says in one line which stream is not a terminal and how to start the member instead; a start whose three streams are the terminal is unchanged. Test plus the mutant that drops the standard-output check and dies. Refs macula-io/martha#102 (the pilot this was found on), macula-io/martha#147.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha#155
No description provided.