martha init names the crew it declares, so a tmux crew opens with no name typed (martha#192) #194

Manually merged
terra merged 1 commit from pluto/192-init-writes-id into main 2026-11-25 19:20:04 +00:00
Member

Purpose (fix): the declaration martha init writes is one martha up can open in tmux without the owner inventing a name.

Refs martha-ai/martha#192.

What was wrong

martha init wrote a declaration with no id, and id is the name of the crew's tmux session. On a host whose terminal is tmux, martha up refused the crew init had just declared:

martha: martha up cannot open the crew in tmux: this crew opens in tmux, in a session named by the declaration's "id", and the declaration names none. Add "id" to .martha/martha.json.

The refusal is plain and names its fix, so nothing was silent. The gap was that the file init writes could not open in tmux without an edit init could have made: the name is the owner's to invent, and the workspace already is a name.

What changed

declareSoloCrew writes an id as the first field of the declaration: the workspace folder in the letters a tmux session's name takes, then the first characters of the sha256 of the workspace's real path.

  • The same workspace is always named the same: the name is a function of its real path alone. The declaration keeps the name it was given even if the folder later moves, since init never writes over a declaration.
  • Two workspaces of one home never share a name. They open on one tmux server, so a shared name would have put the second crew's members' windows in the first crew's session.
  • ., : and # are kept out, since tmux reads them in a name, and whyNotATarget accepts every name written.
  • terminal stays the owner's choice: init still writes none, so a crew on a laptop still opens in kitty. Only the name, which no owner knows better than the workspace, is made.
  • A martha crew change rewrites the declaration: the name it was given survives (asserted in the command case).

Red first, and the mutant

The three #192 cases fail with the id line taken out of the writing call, which is main's behaviour:

  • #192: init names the crew in the declaration, ... - the written id is undefined
  • #192: one workspace is always named the same, ... - the name matches no folder word and digest
  • #192: martha init names the crew, and a crew it declared opens in tmux under that name, ... - typeof id is not string

With the same mutant, run outside the suite through the real command, the refusal above is reproduced (exit 1). With the fix in place the same run writes "id": "project-c110e846" and ends 0 with the crew is in tmux session project-c110e846: martha attach shows it, from any terminal.

Run here

Typecheck clean; lint clean on the touched files. The files that consume the declaration, all green:

  • src/declare_a_solo_crew/declare_a_solo_crew.node-test.ts (11)
  • src/declare_a_solo_crew/write_a_changed_declaration.node-test.ts
  • src/declare_crew/declare_crew.node-test.ts, change_a_member.node-test.ts, the_drafts_declaration.node-test.ts, the_declaration_page.node-test.ts
  • src/run_the_martha_command/run_the_martha_command.node-test.ts (83), change_the_crew.node-test.ts
  • src/open_the_crew_in_tmux/open_the_crew_in_tmux.node-test.ts, the_commands_tmux_runs.node-test.ts
  • src/approve_a_checkouts_config/approve_a_checkouts_config.node-test.ts, src/bring_up_the_declared_crew/bring_up_the_declared_crew.node-test.ts

162 tests in the first batch, plus the 83 of the command file.

Checks run here: check:restated-values, check:no-import-cycle, check:marthas-names, and check:private --range origin/main..HEAD (nothing private).

Not done here

The Done-when offered a second way: martha up deriving a name when the declaration has none. This takes the first, so an owner's hand-written declaration with no id still opens in kitty, and is still refused by name in tmux. Deriving one at up would make up write the config, which the declaration is; it is a small follow-up if wanted.

Purpose (fix): the declaration `martha init` writes is one `martha up` can open in tmux without the owner inventing a name. Refs martha-ai/martha#192. ## What was wrong `martha init` wrote a declaration with no `id`, and `id` is the name of the crew's tmux session. On a host whose terminal is tmux, `martha up` refused the crew init had just declared: ```text martha: martha up cannot open the crew in tmux: this crew opens in tmux, in a session named by the declaration's "id", and the declaration names none. Add "id" to .martha/martha.json. ``` The refusal is plain and names its fix, so nothing was silent. The gap was that the file init writes could not open in tmux without an edit init could have made: the name is the owner's to invent, and the workspace already is a name. ## What changed `declareSoloCrew` writes an `id` as the first field of the declaration: the workspace folder in the letters a tmux session's name takes, then the first characters of the sha256 of the workspace's real path. - The same workspace is always named the same: the name is a function of its real path alone. The declaration keeps the name it was given even if the folder later moves, since init never writes over a declaration. - Two workspaces of one home never share a name. They open on one tmux server, so a shared name would have put the second crew's members' windows in the first crew's session. - `.`, `:` and `#` are kept out, since tmux reads them in a name, and `whyNotATarget` accepts every name written. - `terminal` stays the owner's choice: init still writes none, so a crew on a laptop still opens in kitty. Only the name, which no owner knows better than the workspace, is made. - A `martha crew` change rewrites the declaration: the name it was given survives (asserted in the command case). ## Red first, and the mutant The three #192 cases fail with the id line taken out of the writing call, which is main's behaviour: - `#192: init names the crew in the declaration, ...` - the written id is `undefined` - `#192: one workspace is always named the same, ...` - the name matches no folder word and digest - `#192: martha init names the crew, and a crew it declared opens in tmux under that name, ...` - `typeof id` is not `string` With the same mutant, run outside the suite through the real command, the refusal above is reproduced (exit 1). With the fix in place the same run writes `"id": "project-c110e846"` and ends 0 with `the crew is in tmux session project-c110e846: martha attach shows it, from any terminal.` ## Run here Typecheck clean; lint clean on the touched files. The files that consume the declaration, all green: - `src/declare_a_solo_crew/declare_a_solo_crew.node-test.ts` (11) - `src/declare_a_solo_crew/write_a_changed_declaration.node-test.ts` - `src/declare_crew/declare_crew.node-test.ts`, `change_a_member.node-test.ts`, `the_drafts_declaration.node-test.ts`, `the_declaration_page.node-test.ts` - `src/run_the_martha_command/run_the_martha_command.node-test.ts` (83), `change_the_crew.node-test.ts` - `src/open_the_crew_in_tmux/open_the_crew_in_tmux.node-test.ts`, `the_commands_tmux_runs.node-test.ts` - `src/approve_a_checkouts_config/approve_a_checkouts_config.node-test.ts`, `src/bring_up_the_declared_crew/bring_up_the_declared_crew.node-test.ts` 162 tests in the first batch, plus the 83 of the command file. Checks run here: `check:restated-values`, `check:no-import-cycle`, `check:marthas-names`, and `check:private --range origin/main..HEAD` (nothing private). ## Not done here The Done-when offered a second way: `martha up` deriving a name when the declaration has none. This takes the first, so an owner's hand-written declaration with no `id` still opens in kitty, and is still refused by name in tmux. Deriving one at `up` would make `up` write the config, which the declaration is; it is a small follow-up if wanted.
martha init names the crew it declares, so a tmux crew opens with no name typed (martha#192)
All checks were successful
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 14s
dependency advisories / node in . (pull_request) Successful in 14s
dependency advisories / node in . (container) (pull_request) Has been skipped
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been skipped
dependency advisories / node in installer (container) (pull_request) Has been skipped
dependency advisories / node in installer (pull_request) Successful in 11s
dependency advisories / advisories (pull_request) Successful in 0s
c4 model / c4-model-1 (pull_request) Successful in 7s
c4 model / c4-model (pull_request) Successful in 0s
CI / links resolve (pull_request) Successful in 5s
CI / structural floor (pull_request) Successful in 27s
CI / Martha's names are its own (pull_request) Successful in 28s
CI / no import cycle (pull_request) Successful in 53s
CI / the host drift check bites (pull_request) Successful in 1m4s
CI / the engine drift check bites (pull_request) Successful in 38s
CI / the posted text check bites (pull_request) Successful in 14s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 14s
CI / workflows are valid (pull_request) Successful in 15s
CI / installer (pull_request) Successful in 2m30s
CI / nothing private (pull_request) Has been skipped
CI / no test the base passed goes missing (pull_request) Successful in 37s
CI / the pictures change only with the version (pull_request) Successful in 18s
CI / no literal restates a defined value (pull_request) Successful in 1m9s
CI / every check runs in a job (pull_request) Successful in 18s
CI / every job has a timeout (pull_request) Successful in 14s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 32s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 20s
CI / the relay loads in the recorded host (pull_request) Successful in 15m57s
CI / gate coverage (pull_request) Successful in 18m11s
CI / the clean-install proof removes its container (pull_request) Successful in 20m50s
2a844c8760
A declaration `martha init` writes named no "id", and "id" is the name of the crew's
tmux session: on a host whose terminal is tmux, `martha up` refused the freshly
declared crew by name, and the owner had to invent a name init could have made.

The name is the workspace folder in the letters a tmux session takes, and the digest
of the workspace's real path after it, so the same workspace is always named the same
and two workspaces of one home, which share Martha's tmux server, never share a session.
It is written into the declaration like every other field, and a `martha crew` change
keeps it.

Tests: the new command-level case runs init, adds a member, then up in tmux, and
asserts the session is the name init wrote and that nothing asks for one; two unit
cases pin the name's stability, its distinctness across workspaces and the letters it
keeps out. The same three fail with the id line taken out of the writing call, which
is main's behaviour, and the refusal that behaviour prints is reproduced in the PR.
terra manually merged commit 37fb64bbf9 into main 2026-11-25 19:20:04 +00:00
Sign in to join this conversation.
No reviewers
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!194
No description provided.