Repository navigation
Hold the journey's boundary answer by the page's record, not the command's text - #7454
Merged
Merged
Conversation
…and's text The claude-code journey's `boundary` step needs its comment admitted after the wake's turn answers `first-wake` and before the tool boundary that follows. Its PreToolUse hook found the answer by reading the shell command's text: #6556 held a `thread reply` without `--ephemeral`, naming then that an answer posted another way would slip past, and #7436 patched the rule once the agent chained its progress line, edit and answer in one command. Each patch guessed the agent's command shape again. A PostToolUse hook now holds every tool call while the step runs, each in a file of its own, and the step lets a call go unless the page has `first-wake` answered (`deployment_answer`, the fact the step already waits on). The call that answered makes its file after the answer's admission, so it waits until `boundary` is admitted, however the agent wrote the command or batched its calls. That deletes the text rule, its jq read, the second marker file and the check that the answer went past the hold. Claude Code 2.1.332 starts PostToolBatch only after every PostToolUse hook of the batch ends (checked with two parallel `echo` calls and a 3 s PostToolUse hook), so Leaf's PostToolBatch hook reads the comment the step admitted during the hold. A full `leaf-dev journey run claude-code` passed every step, `boundary` in 47 s: the wake's turn ran a progress line, a Grep, an Edit and its answer as four calls, the first three held 0.1 to 0.6 s each and the answer's 0.3 s, until `boundary` was admitted. All 62 PostToolUse runs exited 0. The 146 `thread reply` commands in 49 recorded journey runs all classify correctly under #7436's rule, so no second failing case was seen; the change rests on the condition's two patches and on reading the fact where Leaf records it.
leaf-agent
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The claude-code journey's
boundarystep needs its comment admitted after the wake's turn answersfirst-wakeand before the tool boundary after that answer. Its PreToolUse hook found the answer by reading the shell command's text, a rule #6556 added (naming then that an answer posted another way would slip past) and #7436 patched once the agent chained its progress line, edit and answer in one command. This replaces the text rule with the page's own record: a PostToolUse hook holds every tool call while the step runs, each in a file of its own, and the step lets a call go unless the page hasfirst-wakeanswered. The call that answered makes its file after the answer is admitted, so it waits untilboundaryis admitted however the agent writes or batches its calls. The jq read, the--ephemeralcount, the second marker file and the past-the-hold check go.To weigh: it relies on Claude Code starting PostToolBatch only after every PostToolUse hook of the batch has ended, which 2.1.332 does (two parallel calls, a 3 s PostToolUse hook, PostToolBatch after both). Holding every call costs the step about a second in all.
Max asked for a broad simplification that would end this kind of bug, after #7436; nobody has read this yet. A full
leaf-dev journey run claude-codepassed every step,boundaryin 47 s;dev/tests/model/test_journey.pypasses.