relay: a run orders its own end, and a turn start names its turn (martha#19 part two) #78

Manually merged
terra merged 0 commits from ceres/19-relay-end-written into main 2026-11-23 06:25:48 +00:00
Member

Purpose (bug): the ci.yml job "the relay loads in the recorded host" gives the same answer for the same tree on the forge runners, so a red on a PR names a fault of that PR. Its case at an_end_on_the_recorded_host.node-test.ts waited on a beat to order its end; on task 3081 the chain (a take-up, a one-minute ceiling, two beats) slipped and the case failed by name at 184 s on a tree that changed nothing about it.

What changes (martha#19 part two, option A as ruled)

  1. A run can name the running turn. The host stamps a turn id on turn.start and nothing a run reads carries it. The mod's report of every main turn's start reaches the launcher as a core-tool call (a_turn_started, martha#440), which the launcher answers without journalling an event — so the line that names the turn is the one the launcher notes itself, now for every main turn start where before only a turn of unnamed source had a line, and it carries turn_id: one optional field on a line that already exists, no new kind of line (src/hear_every_turn_the_model_runs/hear_every_turn_the_model_runs.ts, src/keep_the_relays_journal/keep_the_relays_journal.ts). The launcher notes every main turn start, with the record's own words for what it added (a turn of unnamed source, a turn that took the crew message in, a turn the record already held).
  2. A flow-written end is carried. The hold lives only in the launcher's memory and anEndIsDue refuses a flow that already carries an ending, so an end written into the flow by anything but a beat was never picked up. holdTheEndTheFlowCarries reads the member's flow just before a call's answer is taken and holds what it carries, once; the answer then hands it out (src/a_crews_tools/a_crews_tools.ts, src/answer_what_a_host_reports/answer_what_a_host_reports.ts, hold_the_end.ts +holds). martha#311's conclude rule (question.turn_id === flow.ending.turn_id) is untouched.
  3. The case orders its own end. While the long call is in flight, the run reads the turn id from the journal and writes the pending end with keepTheFlow + theFlowEnding — the writers an announcement uses — then ends the tool. Nothing in the case waits on a timer to order the end; the take-up it does wait for still rides the mod's beat, sized from the chain (one beat, and one more as margin), and the silence budget is above that so the take-up can never read as a silent host. A red says which of the three things the write needs was missing: the long call open in the journal, the flow readable, or a line naming the turn.
  4. N1: requestsCarrying refuses an empty needle. Every request carries "", so a run given no turns to wait for completed at once; the helper moved to drive_the_recorded_host.ts and is pinned by a test.
  5. N2: a run given no ceiling prints "the run's own end at the model", never model request Infinity.

The second case option A proposed is dropped by the ruling: :232 no longer exercises the beat chain, and the chain stays proved by the flow's own unit cases (an_end_is_due.node-test.ts, the_refresh_flow_ends_a_running_turn.node-test.ts, hold_the_end.node-test.ts), not end to end at the recorded host. Recorded as comment 985 on #19. No new check.

The first run on the recorded host, and what it caught

Run 2233's relay job was red on 005bfdf4 (task 4322, 243 s): "no end was written into the flow while the long tool ran", with the flow present. The turn id had never reached any line — the field was on received(), a route no turn start takes, and the launcher's own note for a turn start existed only for a turn of unnamed source, so an owner's turn had no line at all. The test that passed for it drove received() with a body no turn start carries. Both are fixed above: the field is on the line the launcher notes, for every main turn start, and the test drives the route the host really takes.

Proof on the exact tip

  • Red first. The new cases fail by name on 005bfdf4's code — six failures, among them "the line the launcher noted for the turn start does not name the turn" — ~/.claude/sessions/ceres-19-relay/red-3.log. The earlier pass's red (crew.tools.ends.holds is not a function, holdTheEndTheFlowCarries is not a function) is in red.log.
  • Green: 15/15 across the affected files here, and the relay job's own steps replayed on msi00 in a node:24-bookworm container against the recorded host 2.1.330: prove_the_relay_loads.sh exit 0, every one of its recorded-host runs whole, this case among them ("the host ends a running turn on the launcher's order and the handover queued behind it runs", martha#311), and the other seven files green with the extra journal line in place (~/.claude/sessions/ceres-19-relay/proof-msi00.log).
  • tsc --noEmit: 0 errors. npm run lint (the structural floor): 0 problems. check:restated-values, check:marthas-names, check:recorded-host-runs, check:no-import-cycle, check:every-check-runs-in-a-job: pass.
  • check:private and check:posted-text reach GitHub and were not run under the stop.

Refs #19

r=2 (review r=1, N2 — Jupiter's finder, folded in)

The pickup refused only an end it already held, so an end whose turn had ended could be taken up again from the flow that still named it: aTurnEnded dropped the hold, the flow kept its ending until concludeTheEnd wrote the outcome (several awaits later, and never where that write is refused), and a result arriving in that gap re-held the dead turn — every call denied until the flow's ceiling expired, the answer carrying an end for a turn already over. The same window sat on the expiry path, where anEndExpired also drops the hold before the flow is rewritten.
The hold now remembers the turns an end was spent on (aTurnEnded, and anEndExpired, which takes the turn from the flow at its call site) and the pickup refuses a flow that still names one; a hold for a turn makes it live again, so the same turn tried again after an expiry is a new end. Red first: two cases of the_refresh_flow_ends_a_running_turn.node-test.ts and two assertions of hold_the_end.node-test.ts fail by name on 7b93dfbb; four mutants (the pickup's guard gone, aTurnEnded not remembering, anEndExpired not remembering, hold not clearing) each die by name. N5's stale words are fixed in answer_the_relay.ts's event table and in item 1 above. N1 is Jupiter's fix at 7b93dfbb, read and passed.

Purpose (bug): the ci.yml job "the relay loads in the recorded host" gives the same answer for the same tree on the forge runners, so a red on a PR names a fault of that PR. Its case at `an_end_on_the_recorded_host.node-test.ts` waited on a beat to order its end; on task 3081 the chain (a take-up, a one-minute ceiling, two beats) slipped and the case failed by name at 184 s on a tree that changed nothing about it. ## What changes (martha#19 part two, option A as ruled) 1. **A run can name the running turn.** The host stamps a turn id on `turn.start` and nothing a run reads carries it. The mod's report of every main turn's start reaches the launcher as a core-tool call (`a_turn_started`, martha#440), which the launcher answers without journalling an event — so the line that names the turn is the one the launcher notes itself, now for every main turn start where before only a turn of unnamed source had a line, and it carries `turn_id`: one optional field on a line that already exists, no new kind of line (`src/hear_every_turn_the_model_runs/hear_every_turn_the_model_runs.ts`, `src/keep_the_relays_journal/keep_the_relays_journal.ts`). The launcher notes every main turn start, with the record's own words for what it added (a turn of unnamed source, a turn that took the crew message in, a turn the record already held). 2. **A flow-written end is carried.** The hold lives only in the launcher's memory and `anEndIsDue` refuses a flow that already carries an ending, so an end written into the flow by anything but a beat was never picked up. `holdTheEndTheFlowCarries` reads the member's flow just before a call's answer is taken and holds what it carries, once; the answer then hands it out (`src/a_crews_tools/a_crews_tools.ts`, `src/answer_what_a_host_reports/answer_what_a_host_reports.ts`, `hold_the_end.ts` +`holds`). martha#311's conclude rule (`question.turn_id === flow.ending.turn_id`) is untouched. 3. **The case orders its own end.** While the long call is in flight, the run reads the turn id from the journal and writes the pending end with `keepTheFlow` + `theFlowEnding` — the writers an announcement uses — then ends the tool. Nothing in the case waits on a timer to order the end; the take-up it does wait for still rides the mod's beat, sized from the chain (one beat, and one more as margin), and the silence budget is above that so the take-up can never read as a silent host. A red says which of the three things the write needs was missing: the long call open in the journal, the flow readable, or a line naming the turn. 4. **N1**: `requestsCarrying` refuses an empty needle. Every request carries `""`, so a run given no turns to wait for completed at once; the helper moved to `drive_the_recorded_host.ts` and is pinned by a test. 5. **N2**: a run given no ceiling prints "the run's own end at the model", never `model request Infinity`. The second case option A proposed is dropped by the ruling: :232 no longer exercises the beat chain, and the chain stays proved by the flow's own unit cases (`an_end_is_due.node-test.ts`, `the_refresh_flow_ends_a_running_turn.node-test.ts`, `hold_the_end.node-test.ts`), not end to end at the recorded host. Recorded as comment 985 on #19. No new check. ## The first run on the recorded host, and what it caught Run 2233's relay job was red on `005bfdf4` (task 4322, 243 s): "no end was written into the flow while the long tool ran", with the flow present. The turn id had never reached any line — the field was on `received()`, a route no turn start takes, and the launcher's own note for a turn start existed only for a turn of unnamed source, so an owner's turn had no line at all. The test that passed for it drove `received()` with a body no turn start carries. Both are fixed above: the field is on the line the launcher notes, for every main turn start, and the test drives the route the host really takes. ## Proof on the exact tip - **Red first.** The new cases fail by name on `005bfdf4`'s code — six failures, among them "the line the launcher noted for the turn start does not name the turn" — `~/.claude/sessions/ceres-19-relay/red-3.log`. The earlier pass's red (`crew.tools.ends.holds is not a function`, `holdTheEndTheFlowCarries is not a function`) is in `red.log`. - **Green**: 15/15 across the affected files here, and the relay job's own steps replayed on msi00 in a node:24-bookworm container against the recorded host 2.1.330: `prove_the_relay_loads.sh` exit 0, every one of its recorded-host runs whole, **this case among them** ("the host ends a running turn on the launcher's order and the handover queued behind it runs", martha#311), and the other seven files green with the extra journal line in place (`~/.claude/sessions/ceres-19-relay/proof-msi00.log`). - `tsc --noEmit`: 0 errors. `npm run lint` (the structural floor): 0 problems. `check:restated-values`, `check:marthas-names`, `check:recorded-host-runs`, `check:no-import-cycle`, `check:every-check-runs-in-a-job`: pass. - `check:private` and `check:posted-text` reach GitHub and were not run under the stop. Refs #19 ## r=2 (review r=1, N2 — Jupiter's finder, folded in) The pickup refused only an end it already held, so an end whose turn had ended could be taken up again from the flow that still named it: `aTurnEnded` dropped the hold, the flow kept its `ending` until `concludeTheEnd` wrote the outcome (several awaits later, and never where that write is refused), and a result arriving in that gap re-held the dead turn — every call denied until the flow's ceiling expired, the answer carrying an end for a turn already over. The same window sat on the expiry path, where `anEndExpired` also drops the hold before the flow is rewritten. The hold now remembers the turns an end was spent on (`aTurnEnded`, and `anEndExpired`, which takes the turn from the flow at its call site) and the pickup refuses a flow that still names one; a hold for a turn makes it live again, so the same turn tried again after an expiry is a new end. Red first: two cases of `the_refresh_flow_ends_a_running_turn.node-test.ts` and two assertions of `hold_the_end.node-test.ts` fail by name on `7b93dfbb`; four mutants (the pickup's guard gone, `aTurnEnded` not remembering, `anEndExpired` not remembering, `hold` not clearing) each die by name. N5's stale words are fixed in `answer_the_relay.ts`'s event table and in item 1 above. N1 is Jupiter's fix at `7b93dfbb`, read and passed.
The hold lives only in the launcher's memory and anEndIsDue refuses a flow that already
carries an ending, so an end written into the flow by anything but a beat is never carried.
holdTheEndTheFlowCarries reads the flow before a call's answer is taken and holds what it
carries, once, so the end rides that answer. N1: requestsCarrying refuses an empty needle,
which every request carries; N2: a run given no ceiling prints the run's own end, never
'model request Infinity'. Red first: the two new cases fail by name on main's code.
relay end: a run orders its own end, and a turn start names its turn (martha#19 part two)
Some checks failed
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
c4 model / c4-model-1 (pull_request) Successful in 4s
c4 model / c4-model (pull_request) Successful in 0s
dependency advisories / node in . (pull_request) Successful in 10s
dependency advisories / node in installer (pull_request) Successful in 10s
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 10s
dependency advisories / advisories (pull_request) Successful in 0s
CI / the posted text check bites (pull_request) Successful in 14s
CI / links resolve (pull_request) Successful in 24s
CI / structural floor (pull_request) Successful in 26s
CI / Martha's names are its own (pull_request) Successful in 35s
CI / no import cycle (pull_request) Successful in 35s
CI / the engine drift check bites (pull_request) Successful in 32s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 22s
CI / workflows are valid (pull_request) Successful in 27s
CI / nothing private (pull_request) Failing after 26s
CI / the pictures change only with the version (pull_request) Successful in 24s
CI / no test the base passed goes missing (pull_request) Successful in 33s
CI / every check runs in a job (pull_request) Successful in 22s
CI / the host drift check bites (pull_request) Successful in 1m16s
CI / every job has a timeout (pull_request) Successful in 14s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 18s
CI / no literal restates a defined value (pull_request) Successful in 51s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 40s
CI / installer (pull_request) Successful in 2m17s
CI / the relay loads in the recorded host (pull_request) Failing after 10m30s
CI / gate coverage (pull_request) Failing after 12m57s
CI / the clean-install proof removes its container (pull_request) Successful in 16m30s
005bfdf4ff
The journal's line for the mod's turn-start ask carries the host's turn id, one optional field
on a line that already exists. The recorded-host case at :232 reads it and writes its end into
the member's flow through keepTheFlow + theFlowEnding while the long call is in flight, so
nothing waits on a beat, the ceiling or the runner's speed, and the end rides that call's own
answer. The second case is dropped: the beat chain stays proved by the flow's own unit cases,
not end to end at the recorded host (comment 985 on #19).
relay end: the turn start the launcher notes names its turn (martha#19 part two)
Some checks failed
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
c4 model / c4-model-1 (pull_request) Successful in 4s
c4 model / c4-model (pull_request) Successful in 0s
dependency advisories / node in installer (pull_request) Successful in 9s
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 9s
dependency advisories / node in . (pull_request) Successful in 17s
dependency advisories / advisories (pull_request) Successful in 0s
CI / links resolve (pull_request) Successful in 18s
CI / structural floor (pull_request) Successful in 27s
CI / the posted text check bites (pull_request) Successful in 14s
CI / Martha's names are its own (pull_request) Successful in 34s
CI / no import cycle (pull_request) Successful in 31s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 16s
CI / workflows are valid (pull_request) Successful in 33s
CI / the engine drift check bites (pull_request) Successful in 59s
CI / no test the base passed goes missing (pull_request) Successful in 32s
CI / the host drift check bites (pull_request) Successful in 1m16s
CI / every check runs in a job (pull_request) Successful in 14s
CI / every job has a timeout (pull_request) Successful in 13s
CI / nothing private (pull_request) Failing after 58s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 11s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 26s
CI / the pictures change only with the version (pull_request) Successful in 1m1s
CI / no literal restates a defined value (pull_request) Successful in 1m37s
CI / installer (pull_request) Successful in 2m26s
CI / gate coverage (pull_request) Failing after 14m38s
CI / the relay loads in the recorded host (pull_request) Successful in 14m28s
CI / the clean-install proof removes its container (pull_request) Successful in 16m33s
3c397c5743
The first run on the recorded host was red at THE_END_NEVER_CAME: the flow existed, and no
end was written into it, because nothing named the running turn. The field was on the wrong
line. The mod's turn-start ask reaches the launcher as a core-tool call, which the launcher
answers without journalling an event, and the only line a turn start has is the one the
launcher notes itself — which #440 wrote for a turn of unnamed source only, so an owner's
turn (the one the recorded-host case runs its long tool in) had no line at all.

So: aMainTurnStartIn keeps the host's turnId, and every main turn start is noted with it.
The words stay the record's — a turn of unnamed source, a turn that took the crew message
in, a turn the record already held — and the last two are the lines the launcher did not
write before. The dead hook on received(), which no turn start ever passed through, is gone.

The case's red now names which of the three its write needed was missing: the long call open
in the journal, the flow readable, or a journal line naming the turn.
relay end: the flow's end rides only the last call's answer, once (martha#19 part two, review r=1 N1)
Some checks failed
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 8s
dependency advisories / node in . (pull_request) Successful in 15s
dependency advisories / node in . (container) (pull_request) Has been skipped
dependency advisories / node in installer (pull_request) Successful in 8s
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 / advisories (pull_request) Successful in 0s
c4 model / c4-model-1 (pull_request) Successful in 2s
c4 model / c4-model (pull_request) Successful in 0s
CI / structural floor (pull_request) Successful in 24s
CI / links resolve (pull_request) Successful in 36s
CI / Martha's names are its own (pull_request) Successful in 36s
CI / no import cycle (pull_request) Successful in 25s
CI / the engine drift check bites (pull_request) Successful in 28s
CI / the posted text check bites (pull_request) Successful in 12s
CI / the host drift check bites (pull_request) Successful in 1m30s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 13s
CI / workflows are valid (pull_request) Successful in 31s
CI / nothing private (pull_request) Failing after 25s
CI / the pictures change only with the version (pull_request) Has been cancelled
CI / no literal restates a defined value (pull_request) Has been cancelled
CI / every check runs in a job (pull_request) Has been cancelled
CI / every job has a timeout (pull_request) Has been cancelled
CI / no test the base passed goes missing (pull_request) Has been cancelled
CI / gate coverage (pull_request) Has been cancelled
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Has been cancelled
standalone / the pinned Node is nodejs.org's (pull_request) Has been cancelled
CI / the clean-install proof removes its container (pull_request) Has been cancelled
CI / installer (pull_request) Has been cancelled
CI / the relay loads in the recorded host (pull_request) Has been cancelled
7b93dfbba0
The pickup handed out the end it held even when hold() said 'held': with two
calls in flight the first answer carried the end and the last carried it
again, which #311 ruling D forbids. The pickup now hands it out only at 'now';
otherwise the yes to the last call in flight carries it. Red first: the new
two-call case fails on 3c397c57's pickup.
relay end: a spent end is never taken up again from a flow that still names it (martha#19 part two, review r=1 N2)
Some checks failed
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 20s
CI / installer (pull_request) Successful in 1m59s
CI / the clean-install proof removes its container (pull_request) Successful in 16m48s
CI / every check runs in a job (pull_request) Successful in 15s
CI / every job has a timeout (pull_request) Successful in 16s
CI / no literal restates a defined value (pull_request) Successful in 1m4s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 28s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 22s
CI / the relay loads in the recorded host (pull_request) Successful in 14m30s
CI / gate coverage (pull_request) Failing after 3m41s
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 8s
dependency advisories / node in . (container) (pull_request) Has been skipped
dependency advisories / node in . (pull_request) Successful in 14s
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 7s
dependency advisories / advisories (pull_request) Successful in 0s
c4 model / c4-model-1 (pull_request) Successful in 3s
c4 model / c4-model (pull_request) Successful in 0s
CI / structural floor (pull_request) Successful in 25s
CI / Martha's names are its own (pull_request) Successful in 26s
CI / no import cycle (pull_request) Successful in 24s
CI / links resolve (pull_request) Successful in 59s
CI / the posted text check bites (pull_request) Successful in 19s
CI / the host drift check bites (pull_request) Successful in 1m8s
CI / the engine drift check bites (pull_request) Successful in 1m10s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 18s
CI / workflows are valid (pull_request) Successful in 29s
CI / nothing private (pull_request) Failing after 21s
34a7d01e65
The pickup refused only an end it already held. After the turn an end
named ended, aTurnEnded dropped the hold, and the flow went on naming
that turn until its outcome was written -- and a flow write the store
refuses leaves it named. A result arriving in that gap (a straggler tool,
the gap between aTurnEnded and concludeTheEnd) took the dead turn up
again: every call was denied until the flow's ceiling expired, and the
answer could carry an end for a turn already over. The expiry path had
the same window, since anEndExpired also dropped the hold before the flow
was rewritten.

The hold now remembers the turns an end was spent on -- aTurnEnded, and
anEndExpired, which takes the turn from the flow at its call site -- and
the pickup refuses a flow that still names one. A hold for a turn makes
it live again, so the same turn tried again after an expiry is a new end.

Red first: two cases of the_refresh_flow_ends_a_running_turn.node-test.ts
and two assertions of hold_the_end.node-test.ts fail on 7b93dfbb.
terra manually merged commit ea64dfa65c into main 2026-11-23 06:25:48 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
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!78
No description provided.