Repository navigation
fix(autoplan): treat the SessionStart hook preamble as a null parent - #3008
Closed
laurenbdaniels-coder wants to merge 1 commit into
Closed
laurenbdaniels-coder wants to merge 1 commit into
laurenbdaniels-coder wants to merge 1 commit into
Conversation
Claude Code writes a chain of SessionStart hook attachments from a null root at the top of the session journal and parents the first user message on the last of them. The owned-root anchor required that message to have parentUuid === null, so any session with a SessionStart hook had no owned transcript and the autoplan publication guard refused every phase write and reviewer dispatch. Admit only same-session, same-cwd, non-sidechain, non-agent SessionStart attachments with no message whose chain reaches a null root. A parent in that set stands in for a null parent at the root anchor and in the competing-root check, and nothing else. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Contributor
Author
Contributor
Author
|
/trunk merge |
|
An error occurred while submitting your PR to the queue: |
laurenbdaniels-coder
marked this pull request as ready for review
September 30, 2026 22:21
Contributor
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.

Why (in your own words)
In any Claude Code session that has at least one SessionStart hook (common once a few plugins are installed),
/autoplancan't get past its publication guard: every phase file write and every reviewer dispatch is refused. At startup, Claude Code writes a chain ofattachmentrecords for its SessionStart hooks at the top of the session journal, starting from a null root, and parents the user's first message on the last of those attachments. The ownership check inlib/claude-public-transcript.tsrequires the first conversation record to be a root user message (parentUuid === null), so it never finds an owned root and the hook sees an empty transcript.This change treats that hook preamble as transparent. A new helper,
sessionStartPreamble, returns the UUIDs of same-session, same-cwd, non-sidechain, non-agentSessionStartattachments that carry no message and whose whole chain reaches a null root through other such attachments. In both the owned causal path (ownedCausalLines) and the scan's origin check, a parent in that set stands in forparentUuid === nulland nothing else. The competing-root check counts user messages parented on the preamble as roots too, so a second root can't hide behind it.Live evidence
Reading the real journal of an affected session (one where the guard was blocking) with
readOwnedClaudePublicTranscript, before and after:(The one-call gap is the call that was still in flight while the journal was read.)
New regression test,
test/plan-count-sessionstart-preamble.test.ts, which models the record shape from that journal:Existing guard and transcript suites (
plan-count-cross-cwd-ancestry,plan-count-session-cwd,autoplan-publication-guard,autoplan-publication-hook,autoplan-publication-generation,periodic-fixture-selection) plus the new file, patched: 605 pass, 0 fail on 1.89.0.0, where I hit the bug; 379 pass, 0 fail on this branch's base (main at 1.91.9.0).Full free suite, patched vs unpatched on 1.89.0.0: no failures introduced. The three tests that failed only in the patched run are timeouts; rerun on both copies, they fail identically.
Each condition in the new helper was mutation-checked (hook event, cwd, sidechain, agent, null-root chain, the ancestry-walk stop, the competing-root rule). Every mutant fails at least one test except dropping
message != null, which survives because the root checks already handle a message-bearing record; I kept it as defense in depth. TheagentIdmutant is caught only through the scan's cross-cwd cases, since the owned path filters agent records before the helper runs.Scope
lib/claude-public-transcript.ts(new helper plus two call sites), new test file./autoplanrun on the patched install; paid evals; resumed sessions (SessionStart:resume), which I didn't examine; Windows. I haven't registered the new test intest/helpers/touchfiles-data.ts. Happy to add it wherever you want it tiered.Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is @garrytan (owner exemption)Fixes #3007
🤖 Generated with Claude Code