Skip to content

Remove the fork flags, so line and working forks run in every Claude Code session - #6463

Merged
max-sixty merged 4 commits into
mainfrom
agent-a34864372d9e0557a
Nov 19, 2026
Merged

max-sixty merged 4 commits into
mainfrom
agent-a34864372d9e0557a

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Max asked to remove the two environment flags for Leaf's Claude Code forks, since with them every fork path ran two ways: LEAF_FORK_REPLIES=off turned line forks off, and LEAF_FORK_WORK=on turned working forks on. With both gone, the hooks module reads neither, the pages follower always holds the session's forks lane, and a line fork's take always gives the thread to a working fork. Working forks therefore run in every Claude Code session, where until now they ran only in journeys. Every option, branch, test and line of prose that only set, read or described a flag goes with them, including leaf-dev journey run's --forks and --fork-work; the flags are easy to add back from history.

To weigh: the claude-code journey ran its delivery steps with forks off, since a working fork would answer their questions in the session's place. It now runs one sequence: release, the fork steps --fork-work ran, then the delivery steps. Each delivery comment now asks to reword one phrase of the page, which the line fork hands to the session, so the steps still test the session's own delivery, now behind a line fork; a comment that added a sentence gave the turn-end check something to wake the session for. The fork steps come first because after the delivery steps' edits the line fork judged fork-lookup's count in the page's source the session's own. mid-turn and escape share their comments with the Codex and Pi journeys, which now ask for the same rewording, and the fork-work step folds into mid-turn.

Tests: focused pytest on forks, the hooks module, the follower, the timeline and the journey; pnpm run check:hooks; four line-fork eval cases; and leaf-dev journey run claude-code, which passed all 17 steps both plain and with --sandbox. The live line fork still sometimes judges fork-lookup's count in the page's source hand_over, failing fork-follow-up (one of the two sandboxed runs), though the eval's source-edited case passes 6 of 6.

This was written by Claude Code on behalf of max-sixty

…Code session

Max asked to remove the feature flags for the forks: they are easy to add back
from history, and with two flags in play every fork path ran two ways.
`LEAF_FORK_REPLIES=off` turned line forks off and `LEAF_FORK_WORK=on` turned
working forks on, so working forks had run only in journeys. Now the hooks
module reads neither: the pages follower always holds the session's forks lane,
and a line fork's `take` always gives the thread to a working fork. Working
forks therefore run in every Claude Code session from this commit on.

What goes with the flags:

- The module's `lineForks`/`workForks`, the follower payload's `forks` and the
  line fork's `work_forks`, with `forks.route`'s parameter and the follower's
  branch that held no lane.
- The `forks` field of the follower's diagnostics note, and the timeline's
  "forks off" reading of it; a missing lane now reads as no follower noted or
  the follower gone.
- `leaf-dev journey run`'s `--forks` and `--fork-work`, and the chart's
  "with forks" label.
- The prose that described either flag, in How it works' Forks tab, the fork
  note, the eval case, the agent-journey reference and the module headers.

The claude-code journey ran its delivery steps with line forks off, since a
fork would take their questions from the session. It now runs one sequence:
release, the delivery steps, then the steps `--fork-work` ran, and quit. Each
delivery step's comment now asks for a small change to the page, which the line
fork hands to the session (the line-fork eval's `work-request` label), so the
steps still test the session's own delivery, now after a line fork has handed
the comment over. `mid-turn` and `escape` share their comments with the Codex
and Pi journeys, which therefore ask for the same small changes.

Tests that changed behavior:

- A line fork that judges `take` no longer posts its line and hands the thread
  over; the tests of that path judge `hand_over` instead.
- The follower test that held no lane now checks only that the page list
  follows claims on its timer, since every follower holds the lane.
- The module's title-completion test no longer turns forks off: its comment's
  line fork hands it to the session meanwhile.
…ery step

Journey runs with every fork on showed three things the first version missed.
A delivery comment that added a sentence put a new claim on the page: one
contradicted the lede, and Claude Code's turn-end check woke the session for it,
so `mid-turn` read a turn of its own; in another run the session asked whether to
merge the one-line paragraphs, and the check's wake for that question landed in
`fork-idle`. Each delivery comment now asks to reword one phrase, which keeps the
page's meaning and shape. And after the delivery steps' page edits, the line fork
judged `fork-lookup`'s count in the page's source the session's own in both runs
that reached it, as the eval's `source-editing` label says it should while the
session is changing that file, so the fork steps now run right after `release`.

The `fork-work` step sent a page change during the user's command, which every
delivery step now does, so it folds into `mid-turn`, which also checks the line
fork's working line came first. `fork-idle` is named in its step, so every later
step holds it answered once, by its fork. `boundary` now requires the comment to
reach the turn at a tool boundary, which a line fork's delay could otherwise skip
while the step still passed.

Review fixes: prose that still said a thread is always handed to the session
(the fork note, `forks.py`'s header, the fork eval's labels), the journey header's
exception for `withdrawn`, and a docstring left unwrapped.
…s step, and fix the journey's prose

The journey header cited the eval label for a session part way through an edit;
fork-lookup is asked once the session's edits are done (`source-edited`, labelled
take), so the line fork's hand_over there is a miss. A to-do the woken session
starts and leaves open would hold the page at stalled for the delivery steps, so
fork-todo now fails at the source. deferred's Stop check read every Stop context
since setup, which the fork steps now come before. fork-idle's helper sends its own
comment, as fork-todo's does, under a name that no longer echoes the removed flag.
@max-sixty
max-sixty merged commit be80bf9 into main Nov 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the agent-a34864372d9e0557a branch November 19, 2026 02:46
max-sixty added a commit that referenced this pull request Nov 19, 2026
Main removed both fork flags (#6463), so the carrier's Python no longer reads
LEAF_FORK_REPLIES or LEAF_FORK_WORK: forks.replies_on, forks.work_on and the
tests' clearing of them go, and a line fork's take always spawns or resumes a
working fork.
max-sixty added a commit that referenced this pull request Nov 19, 2026
…s Python lists (#6438)

Leaf's Claude Code hooks module now only runs the model calls and agents
Leaf's Python lists, and reports what each came to. The Python lists
instructions (`report`, `fork`, `complete`, `spawn`, `send`), each with
the `request` the module passes as it stands to the matching Claude Code
call, in the pages follower's listing and in its answer to each report.
`src/leaf/carrier.py`'s header holds the contract. The module keeps the
band, the follower's lifecycle and what only it sees: the main thread's
running tool calls, its last request, a main-loop turn's end, and each
spawned fork's run ending.

Claude Code keeps the module it loaded until `/reload-plugins`, so most
sessions run a module older than their Python. With this, a new kind of
fork, or a change to a fork's prompt, effort or outcome, changes only
the Python, and an instruction an older module doesn't know comes back
failed at once. Max chose this on the forks review page.

Worth weighing:

- Line forks and working forks always run, as on main since #6463, so a
line fork's `take` always spawns or resumes a working fork.
- A failed report is reported once more as `failed` for every kind, so a
completion fails at once rather than at its page server's deadline.
- A session whose module predates this change can't read the new
listing: it logs `the pages follower failed` in its conversation and
draws no band until `/reload-plugins`.

Checks: the focused fork, clerk, hooks, thread-title, LLM, hook-gate,
module and timeline tests, with a new one for an unknown instruction;
`pnpm run check:hooks`; and `leaf-dev journey run claude-code` on the
branch merged with main, which passed all 16 steps, its working forks'
lines coming 2.2 s and 2.8 s after the message.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 20, 2026
… ask for the release on the page (#6556)

Two steps of the claude-code journey stopped on what the agent chose
rather than on what Leaf did.

**`boundary`** stopped in 2 of the 9 runs recorded since #6463 made each
delivery comment a rewording, which the wake's turn answers with an Edit
and then a `leaf thread reply`. Where the light fork handed `boundary`
over between the Edit and the reply, Escape left `first-wake` edited but
unanswered, and the woken agent asked whether to finish both rather than
finishing. The session's settings now add a PreToolUse hook beside the
slow one, which holds a `leaf thread reply` that isn't `--ephemeral`
while the step asks. The step holds the wake's answer, sends `boundary`,
waits for its line fork's `hand_over`, then releases the answer with the
slow hooks armed, so the handover lands after the answer however the
agent batches its calls and however long the fork takes. The step also
checks directly that a prompt after Escape names `boundary` as owed.

**`release`** asked the agent to record a release "on the board", whose
columns hold only defects. Agents put it in a status tile beside the
board in 73 of the 74 earlier runs on this machine, but two sandboxed
runs of this branch in a row asked where it belonged, which the step
counts as a failure. The ask now says "on the page"; where the page
shows it stays the agent's call.

To weigh: the hook matches `thread reply` in the command text, so an
answer posted some other way wouldn't be held and the old race would
return for it.

Found in #6554's journey runs; nobody has read it yet beyond Leaf's
review of the first commit. `leaf-dev journey run claude-code` passed
all 17 steps, once plain (answer held 3.8 s while the fork handed
`boundary` over) and once with `--sandbox` after the release change;
`dev/tests/model/test_journey.py` and pre-commit pass.

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants