Skip to content

lane-start's transcript follow counts a holder only when transcript-holders verifies it, not on kill -0 (#56) - #203

Merged
brettheap merged 6 commits into
mainfrom
fix/follow-transcript-verified-holders-56
Oct 18, 2026
Merged

brettheap merged 6 commits into
mainfrom
fix/follow-transcript-verified-holders-56

Conversation

@brettheap

@brettheap brettheap commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What was wrong

lane-start's follow_transcript refuses to move a transcript out of another profile's projects/ when a live process holds it (Amendment 18(h)). It asked live_holders_of_id, which read every profile's sessions/*.json itself and decided "live" with kill -0 alone. That is one of the three tests the estate's liveness contract makes (record_is_live: status not ended, the pid answers, procStart still the one the record wrote). So a record whose status was ended, or whose pid had been recycled onto some other process, counted as a live holder and refused the lane with "a LIVE process there holds it" and the retire act, about a process that is not that session. The read is fail-closed, so the cost was a refusal, never a corruption.

Evidence: on unmodified lane-start, the new cases below fail. The ended record and the recycled-pid record each get rc 2 where 0 is expected, and a transcript-holders that exits 3 is not read as a refusal at the follow (the transcript is moved, and the run then dies at dup_check with rc 1).

What changed

live_holders_of_id now asks lanes-edit.sh transcript-holders <id> (built in #52), the way dup_check already does, and reads its exits the same way:

  • exit 0: rows, one holder each;
  • exit 8: none;
  • exit 2: an old helper, so a note and carry on, as dup_check does;
  • any other nonzero: FOLLOW_WHY is set and it returns 2, failing closed.

Rows are read by their format only (pid US kind US tgt US profile US where US verdict US file). Every row counts, whatever its verdict, so a change to which verdict a row gets cannot change this. It prints the raw tmux target (field 3), and bg where the record names none (transcript-holders writes none), which is what the refusal text said before. It now sets a LIVE_HOLDERS global instead of printing, and follow_transcript calls it without $( ), because a subshell would lose the FOLLOW_WHY it sets. The doc comment, which described the kill -0 scan, is rewritten. PROFILES_HOME stays, because profile_projects_dirs still uses it.

Known limit, shared with dup_check and not fixed here: lanes-edit.sh's session_files walks $HOME/.claude-profiles/profiles and $HOME/.claude/sessions and does not read CLAUDE_PROFILES_HOME or CLAUDE_CONFIG_DIR, which the old scan here honoured (Copilot round 1 on #47). On a workstation that moved the profile store, transcript-holders would see no records, here and in dup_check. That belongs in a change to session_files, not this one.

Functions and regions edited:

  • lane-start: live_holders_of_id (rewritten, plus its doc comment, and the new LIVE_HOLDERS global above it)
  • lane-start: follow_transcript (the one call site, at the live-holder check)
  • tests/test_lane_helpers.sh: new seed_follow_lane helper and four new case groups after the existing LV ("a LIVE process holds it") assertions, before the --dry-run case

Tests

Added to tests/test_lane_helpers.sh, each with its own lane and a transcript in another profile's projects/:

  • repoEN: a record with status ended and a live pid is not a holder, so the transcript is followed (moved) and no refusal is printed.
  • repoPS: a record whose procStart is not the pid's own is not a holder. This runs only where /proc/<pid>/stat is readable (pid_alive skips the third test elsewhere, so macOS gets a skip that says why).
  • repoTF: a transcript-holders that exits 3 refuses with rc 2, names "transcript-holders exited 3", passes the helper's stderr through, and moves nothing.
  • repoTF: the same helper exiting 2 carries on with the "has no transcript-holders (exit 2)" note and follows.
  • The existing LV case (a genuinely live holder is refused, naming the pid and othersess:@99.%99, with the retire act and nothing moved) is unchanged and still passes.

Fail-before and pass-after were proved in isolation, not with the full suite. A scratch slice of tests/test_lane_helpers.sh (its setup, the a17 fakes, the LV block and the new block) ran in a temp $HOME with temp bare repositories, with LANES_EDIT, LANES_WORKSPACE_ROOT, LANES_REPO and LANES_LANE unset:

  • before the fix (new tests, old lane-start): 10 passed, 12 failed; the ended, recycled-pid and exit-3 cases failed as described above.
  • after the fix: 22 passed, 0 failed, 0 skipped.

Also: bash -n lane-start passes, and tests/test_repo_hygiene.py passes (152 tests, run on its own).

Closes #56

🤖 Generated with Claude Code

Summary by Sourcery

Use verified transcript-holder results when deciding whether a transcript can be followed between profiles.

Bug Fixes:

  • Ensure transcript following does not treat ended sessions or recycled PIDs as live holders.
  • Fail closed when the transcript-holder helper returns an unexpected error, while preserving compatibility with older helpers.
  • Keep genuinely verified live holders blocking transcript moves.

Enhancements:

  • Centralize holder determination through the estate's transcript-holder liveness contract and preserve holder details and diagnostics in follow failures.

Tests:

  • Add coverage for ended records, recycled PIDs, helper failures, and legacy helper compatibility during transcript following.

brettheap and others added 2 commits October 11, 2026 16:56
…older only when transcript-holders verifies it (#56); the lane-start fix is not yet made

Adds an ended-record case, a recycled-pid (procStart mismatch, Linux only) case and the transcript-holders exit-3 and exit-2 cases beside the LV fixture. They are written before the fix and not yet run.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…olders verifies it, not on kill -0 (#56)

follow_transcript refuses to move a transcript out of another profile when a live process holds it (Amendment 18(h)). live_holders_of_id decided "live" with `kill -0` alone, one of the three tests the estate's liveness contract (record_is_live) makes, so an ended record or a recycled pid read as a live holder and refused a lane nothing held.

live_holders_of_id now asks `lanes-edit.sh transcript-holders <id>` (#52), the way dup_check already does: exit 8 is none, exit 2 is an old helper (a note, carry on), and any other nonzero sets FOLLOW_WHY and refuses with 2. It sets a LIVE_HOLDERS global and is called without a subshell so the refusal survives. The earlier tests added in the previous commit now pass.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR makes lane-start rely on transcript-holders as the single liveness authority instead of treating any responding PID as a live holder, while preserving compatibility and fail-closed behavior; regression tests cover ended sessions, recycled PIDs, helper failures, legacy exit 2, and genuine live-holder refusal.

File-Level Changes

Change Details Files
Centralize transcript-holder liveness checks through the estate helper and preserve fail-closed behavior for helper failures.
  • Replace the direct session scan and kill -0 decision with lanes-edit.sh transcript-holders.
  • Interpret helper exits 0, 8, and 2 consistently with dup_check; fail closed on other exits and propagate diagnostics.
  • Parse holder rows by format, count every row regardless of verdict, and retain the expected tmux target fallback.
  • Store holder results globally and call the check directly so FOLLOW_WHY survives.
lane-start
Add regression coverage for liveness-contract edge cases and transcript-holder helper exit handling.
  • Verify ended records and recycled PIDs do not block transcript following.
  • Verify unexpected helper failure refuses the move and passes through its error, while exit 2 remains compatible.
  • Retain coverage that genuine live holders refuse the follow and that successful cases move the transcript.
tests/test_lane_helpers.sh

Assessment against linked issues

Issue Objective Addressed Explanation
#56 Use the shared lanes-edit.sh liveness contract to determine whether a transcript has a live holder, excluding ended records and recycled PIDs while still counting genuinely live holders. ✅
#56 Preserve holder discovery across the configured profile stores, including the CLAUDE_PROFILES_HOME override, while moving the scan into the shared helper. ❌ The PR delegates to transcript-holders, but acknowledges that its session_files scan does not honor CLAUDE_PROFILES_HOME (or CLAUDE_CONFIG_DIR). With a relocated profile store, the helper can miss holder records that the old scan could find.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@brettheap
brettheap marked this pull request as ready for review October 17, 2026 21:01
@brettheap brettheap added the ready landing gate: runs tests-macos once before the squash label Oct 17, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 hours and 49 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap brettheap added ready landing gate: runs tests-macos once before the squash and removed ready landing gate: runs tests-macos once before the squash labels Oct 17, 2026
…so CI tests this PR on today's main

GitHub's refs/pull/203/merge stayed on aaa7bc8 after main moved, so a re-labelled run tested the old base. A head that contains main is tested on it whatever base the run merges with.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 18, 2026
…le's (#55) (#201)

Landed on Brett Heap's word "land #200 #201 #203 when green" (2026-10-17), by lane openRepoTools-5. Required Linux CI (guard-launch-mode, tests, tests-no-submodule; run 39079829533) was green on head afe2eb7 with main 2732d59 in its tree. Main has since moved to 83d2690 only through files this PR does not change.

Independent review (lane 5, Opus, of f42b982; the merge of main adds nothing to the PR's diff): LAND, no blocking defect.

Closes #55

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brett Heap and others added 3 commits October 18, 2026 01:17
…so CI tests this PR on today's main

Main moved through files this PR also changes (#199 or #216, and #201) after the last green run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…so CI tests this PR on today's main

Main moved through tests/test_lane_helpers.sh (#215) after the last green run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…so CI tests this PR on today's main

Main moved through the suite's machinery (#229's tests/test_repo_hygiene.py) and the openRepoShape pin (v1.1.0) after the last green run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit cb3a2c7 into main Oct 18, 2026
5 checks passed
brettheap pushed a commit that referenced this pull request Oct 18, 2026
…58, so CI tests this PR on today's main

The branch last merged aaa7bc8; main has since landed #195, #229, the openRepoShape v1.1.0 pin, and #201/#215/#203 in files this PR shares.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 18, 2026
…rename the only act there is (#78, #79) (#200)

Landed on Brett Heap's word "land #200 #201 #203 when green" (2026-10-17), by lane openRepoTools-5. Required Linux CI (guard-launch-mode, tests, tests-no-submodule; run 39089233488) was green on head d745325 with main f595e44 in its tree. Main has since moved to cb3a2c7 only through files this PR does not change.

Independent review (lane 5, Opus, of 28937d2; the merges of main add nothing to the PR's diff): LAND, no blocking defect.

Closes #78
Closes #79

Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 18, 2026
Brings in cb3a2c7 (#203, lane-start's transcript follow counts a holder
only when transcript-holders verifies it) and f5c3bcd (#200, every
shell block in the handoff skill parses) on top of f595e44. Neither
touches a file this branch changes, and git merged with no conflict.
lane-start's seven rung-5 reader lines, which
test_t018_the_legs_reader_is_lane_starts_rung_5_line_for_line holds
equal to lanes-edit.sh's legs reader, are byte-identical at f595e44 and
f5c3bcd. bash -n passes on lane-start and tests/test_lane_helpers.sh,
the two shell files the merge touches.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 18, 2026
… this PR on today's main

The branch was cut from f87fd5a; main has since moved fourteen commits, through
lane-start (#203's verified transcript holders), lanes-edit.sh, the lanes docs and
tests/test_lane_helpers.sh, the same four files this PR edits. The merge is clean,
and it lets the required checks run against the main this PR would land on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready landing gate: runs tests-macos once before the squash

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The cross-profile transcript-holder scan tests only kill -0, so a recycled pid refuses a lane the estate's one liveness contract would let through

1 participant