Repository navigation
Keep /autoplan working after a Claude Code 2.1.317 compaction - #4226
Merged
Merged
Conversation
On 2.1.317 a compact boundary's logicalParentUuid names a record the session file never receives, and the preserved list ends with the last record kept in place. The journal reader required that tail to equal the logical parent, so the boundary became an orphan, every later record was dropped, and each phase entry was refused on every retry. The reader now accepts a preserved list whose last entry is the segment's tail, and continues a boundary whose logical parent is absent from the file from that tail. The 2.1.300 path is unchanged: when the tail is the logical parent it still needs the boundary cycle, so an unflushed tail supplies no ownership. A boundary that opens the file stays a resumed fork's root, and lists naming no node of this session still continue nothing. Co-authored-by: vilano93 <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
…1.317 Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
5 tasks done
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.
/autoplan no longer gets stuck between phases after Claude Code 2.1.317 compacts a long session. This keeps the planning workflow usable on the current Claude Code release.
What changed
The three 2.1.317 compaction tests fail on main (119ed92) and pass on this branch, and the hold cases pass on both. The before counts cover the preserved-segment file only (20 tests). The after counts also include the 2.1.293 copies file (31 tests).
Before/after as text: The three 2.1.317 compaction tests fail on main (119ed92) and pass on this branch; the hold cases pass on both
On 2.1.317, a compaction's boundary names a parent record (
logicalParentUuid) that is never written to the session file. ItscompactMetadata.preservedMessages.uuidslist ends with the last record kept in place (preservedSegment.tailUuid). The journal reader inlib/claude-journal-records.tsrequired that tail to equal the logical parent, so it ignored the list. The boundary became an orphan and every record after the compaction was dropped without a word. The guard then judged each phase entry against stale history and refused it on every retry. The fixture showsclose_incomplete, and the reporter's real session showedcross_phase_batch.preservedUuidsnow reads a list of native uuids whose last entry ispreservedSegment.tailUuid. It no longer requires that tail to be the logical parent.ownedCausalOrdercontinues such a boundary from the last listed record that belongs to this file and does not descend from the boundary. It does this only when the logical parent is missing from the file and the boundary is not the file's first record.docs/autoplan-guard-troubleshooting.mdnow says the guard reads the preserved segments of both 2.1.300 and 2.1.317. This came from /ship's documentation audit.Why
"/autoplan gets stuck after compaction on Claude Code 2.1.317" (@vilano93, #4200). After a long session compacted, every later phase entry was refused, and retrying didn't help. Now the reader picks up from the record the compaction kept, so phase entries pass as they did on 2.1.300.
Blast radius
The change only touches the owned journal reader behind the /autoplan publication guard (
lib/claude-journal-records.ts, read throughlib/claude-owned-journal.ts). The 2.1.300 path is unchanged: when the list's tail is the logical parent, the boundary still continues only if it cycles back through itself. The anchor search now scans the whole list, but in that case the tail descends from the boundary and is excluded, so it picks the same record as before (file:line read, and the hold tests ran). The new branch fires only for lists that main used to reject. Hold tests pin today's outcome for an unflushed 2.1.300 tail, a list whose last entry is not the tail, a list naming no record of this file, a subagent tail, a boundary with nocompactMetadata, a 2.1.300 cycle whose list omits its logical parent, and a resumed fork that opens with such a boundary. The change adds no network calls, secrets, permissions, workflows, install scripts or dependencies.Known limit, kept from #4200: a logical parent that is missing but only late, and not the list's tail, is treated as never written until it lands. When it lands, the boundary reattaches to it.
Summary
People on Claude Code 2.1.317 hit a stuck /autoplan after any compaction. This PR fixes the journal reader so it follows the 2.1.317 compaction layout. It also updates one sentence in the troubleshooting guide to match. The fix is a rewrite on current main of @vilano93's report and fix in #4200, with credit.
Test Coverage
Every new code path has test coverage. The one changed runtime file has a changed test that names it (deterministic coverage audit; no audit reader).
Tests ran: focused 31
Pre-Landing Review
No issues found. The specialist (testing, security, state machines and the Red Team prompt, batched) found nothing. The native adversarial reader raised 3 Low notes, none blocking, listed under Review notes. The outside voice was skipped by the review plan (code class, no numeric claims).
REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen ledgers_read=2 dispatches=4
Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
lib/claude-journal-records.ts:339A 2.1.317-style boundary with no qualifying anchor is still dropped without a reason (pre-existing; no shipped shape produces it)lib/claude-journal-records.ts:338An absent logical parent is treated as never written; a build that wrote it later could flip a read from owned to cycle (2.1.317 never writes it)lib/claude-journal-records.ts:325descends follows raw parents, not remapped ones, so multiple boundaries could in theory form a cycle (pre-existing on 2.1.300; reported as cycle, not silent)Exploratory QA
Functional smoke over repository-native tests, 2 probes within the 300 s bound, verdict pass. Probe 001 ran the 2.1.317 cases: 10 pass, 0 fail. Probe 002 ran the 2.1.300 regression edge in the preserved-segment and copies files: 12 pass, 0 fail. Limit: no live Claude Code 2.1.317 session was driven, and eval selection defers the autoplan guard E2E cases to release coverage.
Design Review
No frontend files changed, so design review was skipped.
Eval Results
The PR profile selected no behavioral probes or quality judges. Fourteen autoplan and plan-review E2E cases that read this file stay with scheduled and release coverage.
Review bot comments
No review bot comments.
Scope Drift
Scope Check: CLEAN
Intent: keep /autoplan's guard reading the session after a Claude Code 2.1.317 compaction (#4200).
Delivered: the journal reader follows the 2.1.317 preserved segment, plus hold tests, a changelog fragment and one troubleshooting sentence.
Plan Completion
Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). This is a bug fix with a failing-first test, so it is exempt from plan review.
Issues
Refs #4200
Verification Results
No plan verification items exist for this branch, so the result is skipped.
TODOS
No TODO items completed in this PR.
Documentation
Status: updated. One factual correction, no blockers.
Scope: base 119ed92..ce26cc1 (one commit, #4200), which changes lib/claude-journal-records.ts, adds a test and adds a changelog.d fragment. There were no staged, unstaged or new files. The banned-terms check found no list.
Documentation health:
Coverage debt: none. The change is an internal journal-reader fix with no new public surface.
Diagram drift: none.
Test plan
bun test test/autoplan-compaction-preserved-segment.test.ts test/autoplan-compaction-copies.test.ts: 31 pass, 0 fail (tests_ran=31)🤖 Generated with Claude Code
Agent notes
Lane GSTA-453 (GST-2150) under GStack Minder. The outside PR #4200 was read as a text diff only, never checked out, run or pushed to. Review per R51: the plan gstack-review-plan printed (light depth: one batched specialist plus the native adversarial voice), one round, no fix round needed. The 3 Step 11 notes are listed under Review notes; REVIEW_LOOP counts only Step 9 rows, so it shows noted=0.
Approvals
No approvals recorded for branch fix-autoplan-after-2-1-317-compaction.
Plan: exempt: bug fix
Plan check: exempt bug fix
REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen ledgers_read=2 dispatches=4
Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Refs GSTA-453 GST-2150