Skip to content

claim --force takes over a dead lane's hold; lane-end --retire ends a duplicate holder - #61

Merged
brettheap merged 31 commits into
mainfrom
fix/claim-takeover-and-retire-fork
Oct 3, 2026
Merged

brettheap merged 31 commits into
mainfrom
fix/claim-takeover-and-retire-fork

Conversation

@brettheap

@brettheap brettheap commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #30
Closes #39

The two acts

#30 — claim --force takes over a dead lane's hold, whatever its verb.
Neither existing gate (h_verb != CLAIMED, claim_is_stale) was ever about
the lane being gone — one refuses any non-CLAIMED verb outright, the
other deliberately never calls a PR stale and never calls a CLAIMED stale
once the lane has OPENED a PR naming it. A lane that went silent and was
retired left an OPENED PR and a fresh CLAIMED issue behind that neither
gate would ever release. holder_is_dead adds a third path: the holder's own
object log ends its lane-kind lines (STARTED/PAUSED/RESUMED/ENDED/
RETIRED) on ENDED or RETIRED — PAUSED (a swap) is deliberately not
dead — and live_holder (the one liveness implementation this file has,
over the same published-union-local id set live-holder already builds)
confirms no live session on this workstation backs it up. Only then does
--force take the object over on any verb, writing the same TAKEOVER ← lane:<dead lane> line a live holder's stale CLAIMED already would. A live
holder — even one whose log says RETIRED — is still refused.

#39 — lane-end --retire finds and ends a duplicate holder of the lane's
own transcript.
A cross-profile resume leaves a bg-pty-host running
claude --fork-session --resume <path>/<uuid>.jsonl behind; the moment a
later lane-start --no-launch binds that forked id as the row's own session,
forks (decision 8(e), keyed on "an id the row does NOT record") is
designed to go blind to it — which is the gap Amendment 18(h) names. Two live
processes then hold one transcript, and retiring the duplicate had been a
bare kill -TERM, by hand, outside every tool this estate has.
lanes-edit.sh duplicate-holder <lane> finds it in the process table
instead (pgrep -f for a live --fork-session, then ps -o pid=,ppid=,args= -p per candidate — portable across GNU and BSD/macOS),
matched against every id this lane's row has ever carried (a chained cell's
earlier link is still this lane's transcript), and excludes the lane's own
live holder over the same live_holder call forks already uses. lane-end <lane> --retire <pid> tries forks first and duplicate-holder second —
whichever the target matches — and on a duplicate-holder match it TERMs the
pair
(the bg-pty-host parent and its child) and reports the pids it
signalled, rather than only naming them as the (unchanged) title-based fork
path still does. It refuses, naming the reason, when given the lane's own
live pid instead — the one process Amendment 18(h) says a lane's binding
actually is.

Docs: docs/README-lanes.md gains a paragraph for each, beside the existing
claim --force/stale-claim prose and the existing fork-retire prose.

Suite

tests/test_lane_helpers.sh: 1678 → 1703 assertions (+25), 0 failed, 0
skipped, 0 pending — one run, everything green:

python3 -m pytest tests -q (full suite, under the workstation's
serialization lock): run queued alongside this PR; result to follow.

Not in scope here

Clause (h)'s other three adoption seats — lane-start's own holder-count
refusal before binding, the prompt guard's duplicate check, and the
launcher's declined-take path — are #45/#47's and workBenches', not this PR's;
this PR is lane-end's retire path and claim's force path only, kept small
and local so whichever of the three lands second still merges cleanly.

🤖 Generated with Claude Code

https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m

Summary by Sourcery

Enable safe recovery of abandoned lane holds and controlled retirement of duplicate transcript holders.

New Features:

  • Allow claim --force to take over any open hold left by a confirmed-dead lane, including PRs and fresh claims.
  • Add duplicate-holder discovery and retirement for fork-session processes holding a lane’s own transcript.
  • Have lane-end --retire terminate duplicate holder process pairs while protecting the lane’s own live session.

Bug Fixes:

  • Prevent takeovers when a terminal lane still has a live session, an unreadable liveness state, or an unverifiable remote binding.
  • Revalidate dead-lane status during claim races and distinguish dead-lane takeover failures from rival-claim races.
  • Correct holder and supersession reporting for the expanded set of takeoverable open verbs.

Enhancements:

  • Use process-table and session-record checks to identify and exclude legitimate lane holders and harness companions.
  • Add explicit takeover reasons, failure diagnostics, and exit-code handling for dead-lane operations.

Documentation:

  • Document dead-lane force takeovers, duplicate transcript holders, retirement behavior, and related safety rules.

Tests:

  • Expand the lane helper suite with coverage for dead-lane takeovers, liveness and binding safety, takeover races, duplicate-holder detection, and process termination.

…n duplicate cannot hide from the door that retires it

Two gaps in the boundary between a lane and what it holds, both closed the
same way: by proving the fact before acting on it, never by guessing.

#30 — `claim --force` refused a dead lane's OPENED PR
(wrong verb) and its fresh CLAIMED issue (not yet 4h stale) alike, because
neither gate it had was ever about the LANE being gone. `holder_is_dead`
answers that question directly: the holder's own object log ends its
lane-kind lines on ENDED or RETIRED, and — checked, never assumed, since
Amendment 6(d) writes no signal and kills no process — no live session on
this workstation backs it up either (`live_holder`, the one liveness
implementation this file has). A dead holder's hold is taken over on any
verb, writing the same TAKEOVER line a live holder's stale CLAIMED already
would; a live holder is refused exactly as today.

#39 — a cross-profile resume leaves a `--fork-session`
process behind whose id becomes the row's own the moment `lane-start
--no-launch` binds it, which is exactly when `forks` (decision 8(e), keyed on
"an id the row does NOT record") is designed to go blind to it. Two live
processes then hold one transcript, and retiring the duplicate had been a
bare `kill -TERM`. `lanes-edit.sh duplicate-holder <lane>` finds it in the
process table instead (`pgrep -f`, then `ps -o pid=,ppid=,args= -p` per
candidate — portable across GNU and BSD/macOS), matched against every id the
lane's row has ever carried, excluding the lane's own live holder over the
same `live_holder` call. `lane-end <lane> --retire <pid>` tries `forks`
first and this second, and on a match here TERMs the pair — the bg-pty-host
parent and its child — rather than only naming it, because Amendment 18(h)
says the duplicate may not coexist with the lane's own session in the first
place; it refuses, naming the reason, when given the lane's own live pid
instead.

Suite: 1703/1703 local (`tests/test_lane_helpers.sh`), full run queued under
the workstation's serialization lock.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m
Copilot AI lite review requested due to automatic review settings September 14, 2026 21:54

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 1 day and 7 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds two narrowly scoped recovery paths: claim --force can take over objects held by a lane proven ended or retired and lacking a live local session, while lane-end --retire can identify and TERM duplicate --fork-session holders of the lane’s own transcript without touching the lane’s legitimate live holder. Documentation and isolated shell-test coverage are updated for both behaviors.

Sequence diagram for forced takeover of a dead lane hold

sequenceDiagram
    participant User
    participant Claim as claim --force
    participant Helper as holder_is_dead
    participant Log as Lane object log
    participant Live as live_holder
    participant Object as Held object

    User->>Claim: claim --force <object>
    Claim->>Helper: holder_is_dead(lane)
    Helper->>Log: lane_log_events(lane)
    Log-->>Helper: last lane-kind verb
    alt verb is ENDED or RETIRED
        Helper->>Live: live_holder(lane, session ids)
        Live-->>Helper: no live local session
        Helper-->>Claim: dead holder confirmed
        Claim->>Object: append TAKEOVER ← lane:dead-lane
    else holder is live or verb is not terminal
        Helper-->>Claim: refuse dead-lane path
        Claim->>Claim: apply existing stale CLAIMED checks
    end
Loading

File-Level Changes

Change Details Files
Allow forced takeover when the holding lane is conclusively dead, independent of the held object's verb.
  • Add holder-death detection from the lane log's final lane-kind event.
  • Confirm no live workstation session backs the retired or ended lane via the existing liveness implementation.
  • Bypass normal verb and claim-age gates only for dead holders, while preserving existing stale-claim behavior otherwise.
  • Record the takeover as a lane-based TAKEOVER and retain refusal for live holders.
lanes-edit.sh
tests/test_lane_helpers.sh
docs/README-lanes.md
Detect and retire duplicate fork-session processes holding a lane's own transcript.
  • Add a process-table-based duplicate-holder read using portable pgrep and ps calls.
  • Match fork-session resume arguments against every transcript ID historically associated with the lane.
  • Exclude the lane's own live holder using the shared live_holder check and distinguish read failures from no matches.
  • Expose duplicate-holder as a lanes-edit subcommand with documented exit contracts.
lanes-edit.sh
tests/test_lane_helpers.sh
docs/README-lanes.md
Integrate duplicate-holder detection into lane retirement with safe paired termination.
  • Make lane-end --retire try the existing fork path and then duplicate-holder detection.
  • TERM the duplicate bg-pty-host parent and child, reporting both signalled PIDs.
  • Refuse attempts to retire the lane's own live PID or unrelated PIDs with explicit reasons and status codes.
lane-end
tests/test_lane_helpers.sh
docs/README-lanes.md
Expand helper-test isolation and coverage for dead-lane takeovers and duplicate holders.
  • Fake pgrep and ps across the suite to prevent access to the runner's real process table.
  • Add scenarios for dead OPENED and fresh CLAIMED objects, live retired holders, duplicate detection, paired termination, and invalid retire targets.
  • Increase the helper suite by 25 assertions with all reported cases passing.
tests/test_lane_helpers.sh

Assessment against linked issues

Issue Objective Addressed Explanation
#30 Allow claim --force to take over any open hold, including OPENED PRs and fresh CLAIMED issues, when the holding lane has ended or been retired and no live session on the workstation still backs it. ✅
#30 Provide a sanctioned lane-end --retire path that verifies the lane has no live holder and releases every open hold belonging to the retired lane with a RETIRED reason, making those objects re-claimable. ❌ The PR adds the dead-lane logic to claim --force, but its lane-end --retire work concerns finding and terminating duplicate fork-session processes. The supplied changes and tests do not show lane-end --retire enumerating and releasing all open holds of a retired lane.
#30 Ensure retirement refuses to act when a live session still holds the lane, and provide tests covering live-holder refusal and takeover of a retired lane's OPENED object. ✅
#39 Extend lane-end <lane> --retire <pid> to detect and retire a live duplicate process holding the lane's own transcript, even when the duplicate uses the same session ID recorded by the lane; terminate the duplicate process pair while refusing to terminate the lane's own live session. ✅
#39 Use process-table and liveness evidence to distinguish the duplicate holder from the lane's legitimate live holder, including matching all session IDs historically recorded by the lane and providing appropriate refusal behavior for unrelated or legitimate processes. ✅
#39 Update lane-start step 3b to detect and report that another live process already carries the session ID before binding that transcript to the lane, preventing a two-process transcript binding. ❌ The PR explicitly limits its scope to the lane-end retirement path and does not modify lane-start or add the requested pre-binding duplicate warning. It states that this adoption-seat behavior is deferred to other issues.

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

…iene guard against a host-absolute path

The fake --fork-session --resume argv used /home/x/<uuid>.jsonl to look like
a real transcript path; /nonexistent/projects/<uuid>.jsonl reads the same to
duplicate_holder_pids's argv match without matching HOST_ABSOLUTE_PATH's
/home/[a-z][a-z0-9_-]*/ alternative (tests-windows caught it: openRepoTools#61).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical and moderate safety and error-handling findings require changes before approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds dead-lane claim recovery and duplicate transcript-holder retirement.

Changes:

  • Enables claim --force takeover for confirmed-dead lanes.
  • Detects and terminates duplicate fork-session holders.
  • Adds tests and documentation for both workflows.
File summaries
File Review notes
tests/test_lane_helpers.sh Moderate: Tests use arbitrary PIDs and do not verify that both processes were signalled.
lanes-edit.sh Critical: live_holder read failures can be treated as proof of death at both call sites. Moderate: Incorrect stale-claim metadata, collapsed pgrep status, and collapsed ps failures.
lane-end Critical: Liveness read failures may allow termination of an unverified process. Moderate: Signal failures are reported as successful. Nits: Help text is contradictory and grammatically incorrect.
docs/README-lanes.md Documents dead-lane takeover and duplicate-holder retirement.
Review details

Suppressed comments (8)

lane-end:734

  • Both kill failures are swallowed and the success report is unconditional. A permission error, invalid/reused pid, or other signal failure is therefore reported as “TERM sent” with exit 0 even though the duplicate may still be holding the transcript; distinguish the already-gone race from a failed signal and refuse/report the latter instead of claiming retirement.
    [ -n "$dh_child" ] && { kill -TERM "$dh_child" 2>/dev/null || :; }
    kill -TERM "$dh_parent" 2>/dev/null || :
    step "RETIRED lane $LANE's duplicate holder of transcript $dh_uuid (Amendment 18(h)) — TERM sent to pid $dh_parent (bg-pty-host)${dh_child:+ and pid $dh_child (child)}"

lane-end:39

  • The command's earlier usage synopsis still says lane-end <lane> --retire <pid|uuid> “retire[s] a live FORK; ends nothing.” This new form also handles duplicate holders by sending TERM, so lane-end --help now contradicts this behavior and can lead users to expect a non-destructive action. Update the synopsis to distinguish title-based forks from duplicate holders.
#   --retire <pid|uuid> A DIFFERENT ACT, and it ends the LANE'S ROW nothing:
#                       the DOOR to Amendment 6(d)'s retire act for a live

lane-end:38

  • The new help text says “it ends the LANE'S ROW nothing”, which is ungrammatical and obscures that this fork/duplicate form leaves the lane row untouched. Change the phrase to “it ends nothing”.
#   --retire <pid|uuid> A DIFFERENT ACT, and it ends the LANE'S ROW nothing:

lanes-edit.sh:4493

  • The status from pgrep -f is discarded here. A real pgrep error therefore produces empty output and is returned as rc 8 (no duplicate), despite this read's contract saying failures must be rc 1; lane-end can consequently report that no duplicate exists and refuse to retire it as if the process table were clean. Capture the status and map only the normal no-match status to 8.
  dhp_cand="$(pgrep -f 'fork-session' 2>/dev/null)"
  [ -n "$dhp_cand" ] || return 8

lanes-edit.sh:5886

  • This now sets takeover_from for dead-lane recoveries as well as stale claims, but the later GitHub path uses any non-empty takeover_from to fetch a stale-claim URL and append “takeover of the stale claim” to the comment. An OPENED PR or fresh CLAIMED issue left by a retired lane will therefore receive false stale-claim metadata. Carry a separate dead-lane reason/payload through the GitHub comment path and cover it with GitHub-enabled tests.
      if holder_is_dead "$h_lane"; then
        takeover_from="$h_lane"
        takeover_note="lane $h_lane is dead (log ends $HOLDER_DEAD_VERB, no live session on this workstation, issue #30)"

lanes-edit.sh:4509

  • The child lookup has the same status-loss problem: piping pgrep -P through head makes the pipeline look successful even when pgrep fails. The helper then emits a parent with an empty child and lane-end TERM's only the parent while reporting the pair; distinguish exit 1 (no child) from a real lookup error and return 1 for the latter.
          dhp_child="$(pgrep -P "$dhp_pid" 2>/dev/null | head -n1)"

lanes-edit.sh:4499

  • ps failures are also collapsed into “candidate disappeared” here. A permission or process-table error can therefore make every candidate get skipped and produce exit 8 (“no duplicate”) instead of the documented read failure exit 1; preserve the status, treating only the normal no-such-process result as a skip.
    dhp_line="$(ps -o pid=,ppid=,args= -p "$dhp_pid" 2>/dev/null)"
    [ -n "$dhp_line" ] || continue

tests/test_lane_helpers.sh:4284

  • This test fakes pgrep/ps and supplies arbitrary PIDs 88101/88102 rather than controlled processes. Because the implementation suppresses kill failures with || :, the assertions can pass even if neither TERM command ran (or, on a PID collision, signal an unrelated process); they only verify the report, not that both processes were signalled. Add a fake kill logger or controlled child processes and assert both PIDs were signalled.
run env FAKE_PGREP_F_PIDS="$FAKE_PGREP_F_M" FAKE_PS_RECORDS="$FAKE_PS_M" FAKE_PGREP_CHILDREN="$FAKE_PGREP_CHILDREN_M" \
  "$END" repoM-1 --retire "$DUP_PARENT"
is   "lane-end --retire TERMS a duplicate holder's pid pair" "$rc" 0
has  "…and reports RETIRED naming both pids" "$err" "RETIRED lane repoM-1's duplicate holder"
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lane-end Resolved
Comment thread lanes-edit.sh Resolved
Copilot AI review requested due to automatic review settings September 14, 2026 21:59
…s own read failure protects nothing

Two spots treated any non-zero live_holder as confirmed-not-live instead of
requiring exactly 8 (records read, nothing live) — a permissions/IO failure
(any other nonzero) would have granted claim --force's dead-lane takeover
and lane-end --retire's TERM alike on liveness that was never established.
holder_is_dead now requires hid_lrc = 8; the retire-path's window-pid guard
now dies (exit 1) on anything but 0 or 8 instead of falling through to kill.

Neither test exercises a live_holder read failure (this sandbox never makes
one fail), so behavior is unchanged for every existing and new assertion;
the fix closes an untested edge the review named correctly.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical and moderate findings affect holder safety, process identification, error handling, and retirement success reporting.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (7)

Previously missed (1) — in code that hasn't changed since the last review.

lanes-edit.sh:4494

  • This flattens every pgrep failure into the normal no-match result. pgrep uses rc 1 for no matches, but other nonzero statuses indicate a process-table/read error; returning 8 for those lets duplicate-holder and lane-end --retire claim that no duplicate exists when the read actually failed.

lane-end:734

  • Both kill failures are discarded, but the next line unconditionally reports that TERM was sent and exits successfully. Permission errors and other signal failures are not distinguishable from the intended process-gone race here, so a duplicate can remain alive while the command claims it was retired; surface a failed signal or verify the target disappeared before reporting success.
    if (( dry_run )); then
      note "--dry-run: would send TERM to pid $dh_parent (bg-pty-host)${dh_child:+ and pid $dh_child (child)} — lane $LANE's duplicate holder of transcript $dh_uuid. Nothing sent."
      exit 0

lane-end:675

  • If the supplied pid is the lane's own live session and there is no separate fork or duplicate, forks returns 8 and duplicate-holder intentionally excludes that pid, so this branch exits 8 with the generic “no fork and no duplicate holder” message. That refuses the action but does not name the protected own-session reason required by Amendment 18(h) and the new documentation. Check the live-holder result against the target before this no-record branch and emit the own-holder refusal.
  if [ "$fk_rc" = 8 ] && [ "$dh_rc" = 8 ]; then
    die "no fork and no duplicate holder of lane $LANE's transcript is live on this workstation, so there is nothing to retire. A fork is found by its transcript's TITLE under an id the row does not record (ratified decision 8(e)); a duplicate holder is found in the process table under an id the row DOES record (Amendment 18(h), opensoft/openRepoTools#39); \`$LANES_EDIT forks $LANE\` and \`$LANES_EDIT duplicate-holder $LANE\` are the reads that name them." 8

lanes-edit.sh:2299

  • live_holder returns 1 when the session-record tree cannot be read, but this condition treats every nonzero result as proof that the lane is dead. That allows claim --force to take over while it has not established that no live holder exists; only rc 8 means the records were read and no holder matched, so other failures should remain a refusal.
  # THREE ANSWERS, NEVER TWO CONFLATED (Copilot round 1, opensoft/openRepoTools#61):
  # `live_holder` is 0 live, 8 read-and-confirmed-nothing, or any other code a

lanes-edit.sh:4490

  • The live_holder call is inside command substitution, but it communicates SESSION_FILES_ERR by setting a variable in its caller's shell. When the session tree is unreadable this returns 1, yet the diagnostic is lost and the dispatcher at line 6386 can only report unknown error; preserve the error status and message without invoking the liveness read in a subshell.
duplicate_holder_pids() {   # <lane>
  dhp_l="${1-}"; [ -n "$dhp_l" ] || return 64
  command -v pgrep >/dev/null 2>&1 || return 1
  dhp_ids="$( { session_ids_of_lane "$dhp_l" 2>/dev/null || :
                session_ids_local_of_lane "$dhp_l" 2>/dev/null || :; } | awk 'NF && !seen[$0]++')"
  [ -n "$dhp_ids" ] || return 8

lanes-edit.sh:4484

  • The same || : pattern hides failures while building the row's transcript-id set. If either register source cannot be read, an empty dhp_ids produces return 8 (“no duplicate”) rather than return 1 (“read failed”), so lane-end can report that there is nothing to retire when its process-table scope was never established. Preserve the ID-read status here as well.
# <the matched uuid>`. 0 with rows, 8 with none, 1 where `pgrep` is missing or
# this workstation's session records could not be read — a read that failed is
# never "nothing is a duplicate".

tests/test_lane_helpers.sh:1226

  • hasnt performs fixed-string containment (see its definition at lines 193-194), so .* here is treated literally. The assertion therefore cannot detect a separate CLAIMED line in the takeover log; remove the regex fragment or assert the exact fixed prefix.
hasnt "…and no separate CLAIMED line: TAKEOVER is itself an open verb" "$K2" "CLAIMED — lane repoK-2, session .*opensoft/repoK#5"
  • Files reviewed: 4/4 changed files
  • Comments generated: 4
  • Review effort level: Lite

Comment thread lane-end Resolved
Comment thread lanes-edit.sh Resolved
Comment thread lanes-edit.sh Resolved
Comment thread tests/test_lane_helpers.sh Resolved
Copilot AI review requested due to automatic review settings September 14, 2026 22:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical process-safety findings and moderate fail-open, retirement, liveness, and test-coverage issues remain.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (10)

Previously missed (1) — in code that hasn't changed since the last review.

lanes-edit.sh:4499

  • pgrep returns 1 for no matches, but other nonzero statuses indicate that the process-table read failed. This assignment discards that status and maps every empty result to rc 8, so a pgrep error makes duplicate-holder report no duplicate and lets lane-end proceed instead of refusing on an unreadable process table. Capture the status and treat only rc 1 as the no-candidate result.

lane-end:665

  • These are separate lanes-edit.sh processes, and both dispatch arms call log_sync; one lane-end --retire therefore fetches origin twice and can evaluate the two reads against different register snapshots. Reuse the first synchronized snapshot or disable fetching for the second read after the first succeeds, so this path avoids a redundant network round trip and keeps the two verdicts consistent.
  dh_rc=0
  dh_rows="$("$LANES_EDIT" duplicate-holder "$LANE" 2>/dev/null)" || dh_rc=$?

lane-end:668

  • forks may already have matched $retire_target and set fk_sid, but this unconditional second read still treats any duplicate-holder failure (for example, pgrep being unavailable) as fatal. The later selection only consults duplicate rows when fk_sid is empty, so a valid fork retirement now regresses to exit 1 instead of using the fork result. Run the duplicate-holder read only when no fork target matched.
  dh_rc=0
  dh_rows="$("$LANES_EDIT" duplicate-holder "$LANE" 2>/dev/null)" || dh_rc=$?
  case "$dh_rc" in
    0 | 8) : ;;
    *) die "$LANES_EDIT duplicate-holder $LANE failed (exit $dh_rc). That is NOT 'no duplicate holder is live', and this script will not name an act against a process it could not prove is one. Run it by hand to see what it says, then re-run." 1 ;;

lane-end:38

  • This updated usage comment is ungrammatical and obscures the key distinction that --retire does not modify the lane row. Replace “it ends the LANE'S ROW nothing” with “it ends nothing in the LANE'S ROW”.
#   --retire <pid|uuid> A DIFFERENT ACT, and it ends the LANE'S ROW nothing:

lanes-edit.sh:4505

  • The second required process-table read has the same fail-open behavior: any ps failure, including a permissions/IO error or a missing command, is converted into an empty line and skipped. If this is the only candidate, the helper returns 8 and lane-end reports that nothing is live instead of refusing because it could not prove the target; preserve the ps status and fail closed on nonzero.
    dhp_line="$(ps -o pid=,ppid=,args= -p "$dhp_pid" 2>/dev/null)"
    [ -n "$dhp_line" ] || continue

lanes-edit.sh:2294

  • The new terminal-state branch explicitly accepts both ENDED and RETIRED, but the added takeover cases only seed and exercise a RETIRED log. Normal lane-end without --retire writes ENDED, so add an ENDED dead-lane hold case to cover the other supported state and prevent it from regressing unnoticed.
  case "$hid_verb" in
    ENDED|RETIRED) : ;;
    *) return 1 ;;

lanes-edit.sh:2297

  • Both row-ID lookups are forced through || :, so a register/read failure yields an empty hid_ids; live_holder then returns 8 immediately for the empty ID set and this function treats that as confirmed death. In that failure mode claim --force can take over without establishing that the holder's recorded session is absent. Preserve a distinct error from the ID-set read and refuse unless the liveness input was successfully read and live_holder returns 8.
  hid_ids="$( { session_ids_of_lane "$hid_l" 2>/dev/null || :
                session_ids_local_of_lane "$hid_l" 2>/dev/null || :; } | awk 'NF && !seen[$0]++')"

lanes-edit.sh:4515

  • pgrep -f returns every matching process, so the actual claude child can also be a candidate; this code always treats the candidate as the parent and calls pgrep -P on it. The parent PID captured in dhp_ppid is never used, so if the wrapper is not itself matched (or the child is encountered first), the emitted pair can contain only the child and lane-end leaves the bg-pty-host running. Normalize candidates through their ppid and deduplicate the pair before reporting or signalling.
          dhp_child="$(pgrep -P "$dhp_pid" 2>/dev/null | head -n1)"

lanes-edit.sh:5892

  • When GitHub is enabled, takeover_from is later interpolated into the comment body as a takeover of a “stale claim” (the formatter at lanes-edit.sh:5950-5952). This new branch also sets it for a dead lane's OPENED PR and fresh CLAIMED issue, so the external audit comment misstates the reason for the takeover. Carry a distinct dead-lane reason into that formatter, or use the already-correct takeover_note there.
      if holder_is_dead "$h_lane"; then
        takeover_from="$h_lane"
        takeover_note="lane $h_lane is dead (log ends $HOLDER_DEAD_VERB, no live session on this workstation, issue #30)"

tests/test_lane_helpers.sh:4287

  • These tests use synthetic PIDs and leave the real kill builtin in place; lane-end suppresses kill failures with || :, so the assertions can pass even if neither TERM is sent. Add a kill-spy seam (or source a fake kill function) and assert that both $DUP_CHILD and $DUP_PARENT are signalled, otherwise the PR's core retirement behavior is not covered.
run env FAKE_PGREP_F_PIDS="$FAKE_PGREP_F_M" FAKE_PS_RECORDS="$FAKE_PS_M" FAKE_PGREP_CHILDREN="$FAKE_PGREP_CHILDREN_M" \
  "$END" repoM-1 --retire "$DUP_PARENT"
is   "lane-end --retire TERMS a duplicate holder's pid pair" "$rc" 0
has  "…and reports RETIRED naming both pids" "$err" "RETIRED lane repoM-1's duplicate holder"
has  "…the parent" "$err" "pid $DUP_PARENT (bg-pty-host)"
has  "…and the child" "$err" "pid $DUP_CHILD (child)"
has  "…the lane's own row and session are said to be untouched" "$err" "lane itself is untouched"
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread lane-end Resolved
Comment thread tests/test_lane_helpers.sh Resolved
…hild, a kill nobody checked, and a refusal that needed something else to be live first

Six findings, six real gaps in the two acts this PR adds — none of them
safety-reversing on their own, all of them worth closing before this lands.

duplicate_holder_pids: `--fork-session`'s argv is inherited by the child
`claude` process as often as the bg-pty-host wrapper that starts it, so
`pgrep -f 'fork-session'` routinely returns BOTH — and reading the child on
its own turn, with no ppid fence, reported it as a headless parent of its
own, doubling one duplicate into two rows. A candidate whose ppid is ALSO a
candidate is now never treated as a second parent, and the child slot
prefers a `pgrep -P` result that is itself a match over whichever the
process table lists first. `pgrep -f`'s own exit code is now three-way (0
found, 1 none, anything else a read failure returning 1, not 8). And
`live_holder` is called directly into a temp file rather than inside `$( … )`,
so `SESSION_FILES_ERR` — set as a side effect in the caller's shell — survives
the call instead of dying with the subshell that used to swallow it.

lane-end's retire path: the window-pid guard now dies (not falls through) on
a `live-holder` read failure, computed ONCE per invocation and reused for
both the standalone "you named the lane's own pid with nothing else around"
refusal (previously invisible — that case fell into the generic "nothing
found" 8, naming no reason) and the "genuine duplicate pair, but you named
the wrong one of it" refusal, which no longer shells out to `live-holder` a
second time to ask the same question. And the kill itself: each signal's own
exit status is now kept and reported per pid — "delivered" or "NOT delivered
(already gone, or no permission)" — rather than a blanket "TERM sent" printed
regardless of what `kill` actually returned, so a permission failure is a
report that says so instead of one that claims a retirement never made.

Tests: `duplicate_holder_pids`'s pair fixture is two REAL `sleep 3000`
processes now, not arbitrary numbers — `kill -TERM` is not stubbed and
should not be, so the fixture that proves it fired has to be something it
can actually signal, with `kill -0` checked after to prove both are really
gone. And a `hasnt` assertion this PR's own diff added tested a literal
`.*` (`has`/`hasnt` are fixed-string, never regex) and so passed no matter
what the log held; it is `grep -E` now, over the real pattern.

The 2299/710 lines Copilot's round-2 pass re-flagged are the round-1 fix
already in place, restated against a diff-position anchor that had drifted —
declined in the PR thread with the current line numbers and content quoted;
nothing further changed for either.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m
…ead's failure, and a signal is re-checked at the moment it is sent, not at the moment it was read

Six more findings against the round-2 push, before it had even landed:

lane-end's own regression, the most serious of them — `duplicate-holder` and
its `live-holder` companion ran unconditionally, even when `forks` had
ALREADY matched `$retire_target`. A working fork retirement could regress to
a hard exit 1 because `pgrep` happened to be missing or the process table
happened to be unreadable at that moment, for an answer the fork path never
needed. Both reads (and their fetches — `LANES_NO_FETCH=1` on the second and
third, since `forks` already fetched for this checkout) now run only when
`fk_sid` is still empty, mirroring the fork search's own gate exactly.

The kill itself is re-checked at the moment it is sent, not trusted from the
read a few lines above: a pid can be reaped and reused by an unrelated
process in that gap, and each target's CURRENT argv is confirmed to still
show `--fork-session --resume …<the matched transcript>.jsonl` immediately
before `kill -TERM`, never after.

`duplicate_holder_pids` gains a `command -v ps` guard beside its `pgrep`
one, and the GitHub comment `claim --force` posts under a dead-lane takeover
no longer says "takeover of the stale claim" — a phrase that was simply
false for an OPENED PR that was never a CLAIMED issue at all — carrying its
own `takeover_reason_phrase` instead.

`holder_is_dead`'s ENDED branch (accepted since round 1, never seeded) now
has a fixture: repoN-1's log ends ENDED, not RETIRED, and repoN-2 takes over
its held issue the same way.

Declining a fix, filed as #67 instead: `session_ids_of_lane`
and `session_ids_local_of_lane` don't distinguish "no row" from "register
unreadable" (unlike `live_holder`/`lane_log_events`, which do), so neither
`holder_is_dead` nor `duplicate_holder_pids` can tell those apart from the
empty id set either read leaves behind on failure. Fixing it means changing
what those two shared functions return, with roughly eight other call sites
in this file depending on the current one — real blast radius for hunks this
PR is trying to keep small and local.

Grammar fix to lane-end's own --retire usage text while in the area.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m
Copilot AI review requested due to automatic review settings September 14, 2026 22:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical process-matching issues remain unresolved, along with documentation nits.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (4)

docs/README-lanes.md:729

  • The new exception is documented below, but the preceding claim section still says claim --force takes over a stale claim “and nothing else” (and the nearby explanation says the staleness test is the only legitimacy check). That now contradicts the dead-lane path described here, and the same absolute wording also remains in the earlier takeover summary. Update the surrounding stale-claim prose to distinguish the normal stale path from dead-lane takeovers.
**Or the holder's LANE is dead, whatever the verb** (opensoft/openRepoTools#30).
Staleness answers Rule 1's own question about one claim; it says nothing about
a lane that went silent and was retired, leaving an `OPENED` PR or a fresh
`CLAIMED` issue behind that neither gate above will ever call takeable — the
verb-check refuses the PR outright, and a `CLAIMED` lane that later `OPENED` a

lane-end:798

  • When either TERM is not delivered (including the explicit permission-failure case described above), this branch still exits 0. Callers therefore cannot distinguish a successfully retired pair from a duplicate process that may still be running. Preserve 0 for an already-gone race, but return a nonzero result when a matched process remains or signalling failed.
    if [ "$dh_p_ok" = 1 ] && [ "$dh_c_ok" = 1 ]; then
      step "RETIRED lane $LANE's duplicate holder of transcript $dh_uuid (Amendment 18(h))"
    else
      note "lane $LANE's duplicate holder of transcript $dh_uuid was only partly signalled — see above. A pid already gone before this ran needed no signal to begin with and is not itself a failure of this act; one that did not deliver for want of permission is, and \`kill -0 <pid>\` by hand tells the two apart."
    fi

lane-end:42

  • The usage synopsis still describes --retire <pid|uuid> as a live-FORK action that “ends nothing,” but the newly documented duplicate-holder branch accepts the same form and sends TERM to the process pair. Because this comment block generates lane-end --help, update the synopsis to mention both target types and the different fork/duplicate effects.
#   --retire <pid|uuid> A DIFFERENT ACT, and it ends nothing in the LANE'S ROW:
#                       the DOOR to Amendment 6(d)'s retire act for a live
#                       FORK of this lane's transcript (Amendment 11 clause
#                       (k) rule (e) — "both print the one act: retire it,
#                       under Amendment 6(d) … Neither kills a process … and

lanes-edit.sh:4556

  • pgrep -P is a separate process-table read, but its status is discarded by the command substitution in this loop. If it returns an error (for example, a usage or process-table failure rather than the normal 1 for “no children”), the helper silently emits a duplicate with an empty child; lane-end can then TERM only the parent and report success even though the required pair was not established. Capture the status, treat only rc 1 as no child, and return the read-failure code for other results.
          dhp_child=""
          for dhp_c in $(pgrep -P "$dhp_pid" 2>/dev/null); do
            case "$dhp_cand_fence" in *" $dhp_c "*) dhp_child="$dhp_c"; break ;; esac
            [ -n "$dhp_child" ] || dhp_child="$dhp_c"
          done
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread lane-end Resolved
Comment thread lanes-edit.sh Resolved
…nt, and a signal is not called a retirement until the pid is verified gone

Two more findings, both about proving rather than assuming:

The uuid match (both in duplicate_holder_pids's discovery and lane-end's
pre-kill re-validation) accepted the uuid as a bare substring of the argv,
so `other-<uuid>.jsonl` (no leading /, not this transcript's basename) or
`<uuid>.jsonl.bak` (more argv after it) would have matched. /<uuid>.jsonl
must now be an exact path component: preceded by / and followed by the end
of the argument or a space. pgrep -P's own status gets the same three-way
treatment its sibling pgrep -f already had (1 = no children, honestly
empty; anything else = a read that failed, and the candidate is dropped).

The kill report no longer trusts kill's own exit status for the final
verdict: it conflates 'already gone' (fine) with 'no permission' (a real
failure), and always exiting 0 meant a caller could not tell a genuine
retirement from a duplicate still running. kill -0, after a brief settle,
answers the only question that matters -- exit 0 only when both pids are
verified gone, exit 1 naming which one is not.

Also: the usage synopsis now says --retire takes one of two kinds of
target instead of describing only the fork case, and the claim --force
prose no longer says 'stale claim and nothing else' unconditionally next
to the dead-lane exception that follows it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m
Copilot AI review requested due to automatic review settings September 14, 2026 22:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical and moderate findings remain in the process handling and test expectations.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (3)

lane-end:782

  • lane-end runs with set -euo pipefail. If this candidate exits between discovery and revalidation, ps -o ... -p returns nonzero and the pipeline makes this assignment fail, so the shell exits before the following case can treat it as the documented “already gone”/no-signal race. Capture and handle the probe status explicitly; the child probe at line 791 has the same issue.
    dh_p_args="$(ps -o args= -p "$dh_parent" 2>/dev/null | tr 'A-F' 'a-f')"

lane-end:787

  • Because this script has set -euo pipefail, a failed kill -TERM here is the final command in an && list and exits lane-end immediately. That bypasses the kill -0 verification and the controlled per-pid report; the identical child signal at line 796 has the same failure mode. Guard the signal result and let the existing verification decide the outcome.
    [ "$dh_p_sent" = 1 ] && kill -TERM "$dh_parent" 2>/dev/null

lanes-edit.sh:4538

  • ps is part of the process-table read, but a nonzero status is discarded by this empty-output check. If ps -p fails for a candidate (rather than the process simply disappearing), this function can return 8 and make lane-end report “no duplicate holder” instead of the documented fail-closed read error. Capture the status and propagate read failures rather than treating every failed probe as absence.
    dhp_line="$(ps -o pid=,ppid=,args= -p "$dhp_pid" 2>/dev/null)"
    [ -n "$dhp_line" ] || continue
  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread lane-end Resolved
Comment thread lanes-edit.sh Resolved
Comment thread tests/test_lane_helpers.sh Resolved
brettheap and others added 2 commits September 14, 2026 23:09
…ng from 'TERM to pid ... delivered' to 'pid ... gone', and this assertion still checked the old text

tests/test_lane_helpers_suite.py::test_the_lane_helper_suite_passes went red
on 7f2c03e (1711 passed, 1 failed) for exactly this reason -- caught by CI's
Linux tests job, not by the local run that shipped with 7f2c03e, because
that run had started before this specific edit and I judged the diff small
enough to push on a trace. It was not: the message format changed data this
same PR's own test read back.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m
Copilot AI review requested due to automatic review settings September 14, 2026 23:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

A critical liveness-safety issue remains for lanes bound to remote hosts or containers.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread lanes-edit.sh Resolved
…18(b))

Copilot on 8ce6c9d, against the Amendment 18 that #83 landed on main:
holder_is_dead confirmed a terminal log with live_holder's 8 -- no
session record on THIS workstation holds the lane -- which proves nothing
about a lane whose last STARTED/RESUMED was written on another host or in
another container. Clause (b): liveness is pronounced only from inside
the binding's own host and container; from anywhere else it is UNKNOWN,
never dead. So claim --force could take over the open holds of a lane
still running somewhere this workstation cannot see.

The last binding is read off the last STARTED/RESUMED before the
terminal line, with clause (a)'s cutover rule (no host/container/os is a
pre-amendment line, matched on its own workstation), and judged by
binding_is_here, the file's one locality rule. Not here, clause (b)'s
one exception still applies -- a shared tmux server on which the
binding's window is gone is a dead binding (binding_window_state).
Anything else sets HOLDER_BOUND_ELSEWHERE: claim --force refuses it
naming the binding, ahead of the verb and age tests, as it refuses
HOLDER_TERMINAL_UNKNOWN; the takeover recheck abandons on it in
could-not-reconfirm words.

Suite: repoKr-1 ends RETIRED with no record here and its last STARTED on
elsewhere-host -- --force refuses with 2 naming elsewhere-host/none, and
the same takeover run with that host and container is granted.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 3, 2026 08:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Unresolved safety issues remain in live-holder validation and duplicate-process matching.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread lanes-edit.sh Resolved
…eption

Copilot on a52abc6: where a terminal lane's last binding was another
container on this host and its window is gone from the shared tmux
server, holder_is_dead returned dead at once and skipped live_holder. A
dead pane says the binding is dead, not that nothing on this workstation
still carries the lane -- an orphaned background duplicate outlives its
pane -- and the contract is that a live or unreadable local read is a
refusal even when the log is terminal. The exception now only admits the
binding to the same live_holder read a local binding gets; only its
confirmed-empty 8 answers dead.

Suite: repoKg-1, RETIRED and last bound in container other-bench with
window @77 gone, is refused while a session record here carries its id,
and taken over once that record is gone, the TAKEOVER naming why.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 3, 2026 09:18
@sonarqubecloud

sonarqubecloud Bot commented Oct 3, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Resolve ambiguous child fallback handling and update the stale takeover contract documentation.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread lanes-edit.sh Resolved
@brettheap brettheap added the ready landing gate: runs tests-macos once before the squash label Oct 3, 2026
@brettheap
brettheap merged commit 14641fd into main Oct 3, 2026
30 of 39 checks passed
@brettheap
brettheap deleted the fix/claim-takeover-and-retire-fork branch October 3, 2026 17:55
brettheap added a commit that referenced this pull request Oct 4, 2026
Bring #97 onto a current base before the seam rework Brett Heap ruled on
2026-10-04 ("managed ledger owns enrolled lanes; #97 owns legacy — rework
both"). Main moved 14 commits past 957a26f, to daed209: #81 lane-rename,
#83 Amendment 18, #93 Amendment 19, #61 claim --force takeover, #146,
#119, #101-#103, #129, #131, #133, #135, #136, #139 and #134.

Four files conflicted, and in every one both intents survive:

- lanes-edit.sh, the function sections: both sides appended after
  migrate_state_cells. Main's Amendment 19(c)/(d) sweep and archive stay
  directly under it, because its header says "the shape
  `migrate-state-cells` has one screen up"; #97's lifecycle and
  inventory section follows them.
- lanes-edit.sh, the unknown-subcommand refusal: the union of both lists,
  56 names, the same set as the dispatcher's 56 arms.
- lanes-edit.sh, the exit-code table, and the manual's copy of it: #97's
  7 row ("another act got there first", in three verbs) is kept, and exit
  9 now has two meanings, one per verb. #61 spent 9 on `claim --force`'s
  abandoned takeover and #97 spent it on `lane-state`'s unreadable
  snapshot, and each PR took it as unused. Neither verb can return the
  other's 9, so the table names both and nothing is renumbered in a
  merge. The manual's 9 row said "(`claim` only)", which the merge would
  have made false; its 7 row now names #97's two fenced writers too, as
  the code table already did. The next commit moves #97's 9 to 10.
- lane-handoff, the late-record restart line: #129's
  `$lane_profile_word` (lclaude) with #97's lifecycle line under it.
- docs/README-lanes.md: Amendment 19's section, then #97's #91 section,
  so the amendment sections stay in number order.
- tests/test_lane_helpers.sh: main's Amendment 19 and Amendment 18
  sections run first, in main's order (A18's restores its fixtures), and
  #97's self-contained #91 section follows them, before the
  workstation-seam section, as it did on #97's branch.

lane-start auto-merged around #134's rewrite. #97's section 4a still
prints the reconciliation after Amendment 18's binding gate and before
section 5 and the STARTED/RESUMED write in 5b. AGENTS.md, README.md,
tests/test_repo_hygiene.py and skills/ are byte-identical to main, so
the 316- and 486-line caps already match the merged counts.

Locally, tests/run.sh -k 'lane_helpers_suite or repo_hygiene or
lane_start_claude_current or guard_launch_mode or install_skill_and_hook':
274 passed, 600 deselected, in 1560 s.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 4, 2026
Main's #61 landed with exit 9 as `claim --force`'s abandoned takeover,
and #97 had independently taken 9 for a lifecycle snapshot that exists
and cannot be read. Each PR took 9 as unused. The one that has not
landed moves: 10 is spent nowhere in the shipped scripts.

The code table and the manual get #61's 9 row back verbatim and a row
of their own for 10, which says it used to be 9. `lane_state_read`, the
`lane-state` arm, the #91 section of the manual, design.md, tasks.md
and the one suite assertion that names the number all move with it.
No caller branches on the number: `lane_reconcile` maps any non-0/8
read to UNREADABLE, and `lane-handoff`'s lifecycle_begin treats any
non-0/8 as unreadable.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 4, 2026
…ssion stopped — RUNNING → SWAPPING → SWAPPED with a generation/operation fence, a machine-readable worktree inventory taken at every handoff, and a resume reconciliation that reports and resets nothing (#97)

* WIP (openRepoTools#91): a lane that dies mid-handoff can say so — the RUNNING → SWAPPING → SWAPPED snapshot, its generation/operation fence, and the machine-readable worktree inventory taken at the poll

A session can run out of tokens BEFORE the handoff, AFTER it began and before
it finished, or after it finished, and until now all three left the same
evidence: a last lane-kind line that is a `STARTED`/`RESUMED` (which is also
what a running lane looks like) or a `PAUSED` (which is also what a clean swap
looks like). The two crash kinds had no word, and the WRITERS section a handoff
leaves is prose — a person can read it, a recovery cannot.

This is the work so far, committed at a handoff and not finished:

* `lanes-edit.sh` gains a LOCAL lifecycle snapshot beside each lane — not in
  the register (every write of it is a commit, a pull and a push) and not
  inside a git worktree (metadata there dirties a checkout and disappears with
  the directory whose loss it explains), but under a control root derived from
  the lane's own recorded `dir`, else `$PROJECTS_ROOT`. Five subcommands:
  `lane-state`, `set-lane-state`, `lane-trees`, `set-lane-tree` and
  `lane-reconcile`. NO SIXTH LANE VERB IS ADDED to the append-only log —
  Amendment 7's five stand and every reader of them is untouched.
* The fence: every transition carries a monotonic `generation` and a unique
  `operation`, `--expect*` is the compare-and-swap, and exit 7 is the refusal
  of a stale finalizer (one meaning on the number this file already spends on
  `claim`'s CLAIM-LOST: you lost the race).
* `write_event` follows the line it wrote — a `STARTED`/`RESUMED` is the
  confirming act of a new owner and takes the lane to `RUNNING`, an `ENDED` or
  `RETIRED` to `CLOSED` — so the SessionStart hook keeps all three properties
  that make it safe in front of every session (it never writes, never touches
  the network, always exits 0; Amendment 8, R-A8-1).
* `lane-handoff` takes `SWAPPING` before it polls anything, records every
  polled worktree's path, checkout, branch, HEAD, upstream, dirty and unpushed
  counts and writer against that operation, and lands `SWAPPED` only after the
  record, the row and the handoff file have all been written. The lifecycle
  never refuses the swap (`R-A11-11`): a root it cannot derive or a fence
  another act moved costs the lifecycle and never the record.
* Brett Heap's ideation packet and the OpenSpec change are committed with the
  implementation, as he asked.

Still owed on this branch: `lane-reconcile`'s reporting surfaced on resume,
`docs/README-lanes.md`, the suite cases for each transition, each fence and
each crash kind, the review's deviations written into the design, and a rerun
of `openspec validate --strict`.

Part of #91

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m

* openRepoTools#91: a resume can now say WHERE the last session stopped — the reconciliation report, the manual, the suite cases, and every deviation written into the design rather than taken silently

The snapshot, the fence and the inventory landed in the commit before this one.
This is the half that makes them usable and honest.

* `lane-reconcile` is printed by `lane-start` BEFORE it writes anything, for
  every verdict that is not `running`, `resumable` or `closed` — above section
  5, because the `STARTED`/`RESUMED` line that run is about to write takes the
  lane to `RUNNING`, so a report printed after it would describe this launch
  rather than the crash it is recovering from. It is a REPORT and not a gate:
  `resume` RESETS NOTHING and `park` CREATES NOTHING (AGENTS.md rule 1), and
  every refusal this command makes is the one it already made.
* `docs/README-lanes.md` gains the four words, the two crash kinds as a table
  (with `indeterminate` for a holder read nobody got), the fence, the three
  rungs of the control root, the inventory and what a resumed session does.
* `tests/test_lane_helpers.sh` gains a section of its own: the cutover answer
  of 8 with nothing backfilled; the confirming act writing RUNNING while the
  SessionStart hook writes nothing (proved by the snapshot's bytes before and
  after); both crash kinds with and without a live holder; the fence refusing
  `--expect` that no longer matches and refusing a stale finalizer; a competing
  resume advancing the generation so the interrupted swap's own finalizer is
  refused when it returns; the handoff taking SWAPPING BEFORE the poll and
  SWAPPED after; the inventory's full head and upstream; a lane left SWAPPING
  when one of the three mandatory writes did not land; possible-loss against
  missing, unmanaged, stale-registration and detached HEAD; that the read reset,
  deleted and recreated nothing; an unknown schema failing closed; and the
  report printed by a real `lane-start`.

THE DEVIATIONS ARE WRITTEN INTO THE CHANGE, as decisions 9 to 15 of design.md,
never taken silently:

  9  `RUNNING` is written by the act that CONFIRMS the binding and never by the
     SessionStart hook, which never writes, never touches the network and always
     exits 0 (Amendment 8, `R-A8-1`). The spec is reworded to match.
 10  The snapshot is local and is written where `R-A11-14` stops the register:
     it is filed under NOTHING, so a container with no workstation still keeps a
     lifecycle it can recover itself from.
 11  The control root comes from the lane's own recorded `dir`, not from a
     shape-governed Speckit worktree root — a lane's writers are not under one.
 12  No sixth lane verb: Amendment 7's five stand and every reader is untouched.
 13  `SWAPPED` needs three landed writes, and the swap still completes without
     them (`R-A11-11`); the state stays SWAPPING and names the missing step.
 14  The estate's `resume` is NAMED, never invoked, by a read.
 15  An unreadable holder is `indeterminate` and never a crash (Amendment 7(d)).

`openspec validate add-crash-consistent-lane-worktree-recovery --strict` passes;
`openspec list` reads 20/28 tasks, and tasks.md's new section 7 names each of
the eight that are left and what stands in its place today.

Part of #91

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m

* openRepoTools#91: the two deviations a reader would otherwise have to find for themselves — the control root is still a recorded path, and the report takes no lock — and the spec cites the issue at its head

Decision 11 said where the control root comes from and not what that still
leaves open. The brainstorm's "derivable lane root" asks for a root resolved
*without relying on a historical absolute path*, and rung 2 is exactly such a
path: Amendment 11(c)'s recorded `dir`. It is a RECORDED fact rather than a
guess or the caller's current directory, which is what makes it safe to act on,
but resolving the root from `home owner/repo` and the estate with no recorded
path at all is the coordinator-base work of tasks 1.2 and 5.3 and is not here.

Decision 14 said the estate's `resume` is named and not invoked, and left out
the other half: the brainstorm has resume ACQUIRE THE LANE LOCK before it
reconciles, and `lane-reconcile` does not. The lock here is the register's own
mutex, and taking it for a READ would serialize every launch on the workstation
behind every register write for the length of a `git worktree list` in each of a
lane's checkouts. It is taken where it decides something — around the read of
the fence and the replacement of the snapshot together, in `set-lane-state`.

And the capability specification cites `#91` at its head,
beside the sentence that sends a reader to the numbered decision wherever a
requirement is narrower than the brainstorm that proposed it.

Part of #91

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m

* openRepoTools#91: a report that called the lane's own checkout an unmanaged tree, and fifteen assertions that would have passed on the wrong field

Two defects the first suite run and a reading of its output found.

`lane-reconcile` skipped the lane's own checkout from `git worktree list
--porcelain` by comparing the recorded `dir` to what git printed — and git
prints the PHYSICAL path, while a recorded `dir` is reached through the
estate's `projects` symlink on every workstation that has one. The lane's own
checkout was then a tree no sidecar names, reported as UNMANAGED at the head of
every report. `cd -P` is the portable resolver here for the reason
`lane-start`'s `real_of` gives: `readlink -f` is not in the stock macOS
userland.

And the suite's own reads: a TREE row is `TREE<US><id><US><class><US><path><US>
<detail>`, so the path is the FOURTH field and the case that counts a
discovered tree was matching the fifth. It went red, which is how it was found;
fifteen of its neighbours were `has …` against the whole report, where
`unmanaged`, `dirty` and `resumable` each appear in prose as well as in the
field that means them — green whatever the classification actually was. Each is
now an exact read of the field it is about: the `VERDICT` token, or the tree's
own class.

Part of #91

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m

* openRepoTools#91: the six fences this capability exists for, each of them a hole in the first implementation — and the tree every symlinked workstation was reporting twice

A review round on #97 found six, and not one of them is cosmetic: they are the
compare-and-swap, the fail-closed schema and the single observation this change
is FOR, in the places the first implementation did not apply them.

* **The lifecycle follow-up wrote outside the mutex and outside any fence.**
  `write_event` appends its line, commits it and pushes it BEFORE the snapshot
  is moved, and a lane can be recovered by somebody else inside that window: a
  `RUNNING` written out of an event that landed minutes ago then overwrote a
  `SWAPPING` that began since — precisely the overwrite the generation exists to
  refuse. The follow-up now reads the snapshot under the same mutex
  `set-lane-state` takes and compares it with the PRE-IMAGE `write_event` took
  before its own line existed. Equal is this write being the newest act; unequal
  is another act having got there first, and NOTHING is written. The mutex is
  taken without dying for it (`lock_try`, the non-fatal half of `acquire_lock`,
  so the two are one implementation): the event is already on disk, so a lock
  nobody could take costs the snapshot and says so, never the event.

* **Two writers walked past the fail-closed schema check the reader keeps.**
  `lane_state_read` refuses a schema it does not know, and `set-lane-state`,
  `set-lane-tree` and the follow-up each read the raw fields and renamed their
  own file over the top — so an older helper meeting a newer tooling's record
  destroyed what it could not read, which no later reader can undo. All three
  ask `lane_sidecar_schema_ok` first and refuse with 1. It is 1 and not 7: 7
  says a race was lost and invites a retry, and no retry makes an unknown schema
  readable.

* **The inventory's own fence was written and compared with nothing.** Every
  tree sidecar carried the generation and operation it was recorded under from
  the first commit here, and no code read them, so a handoff that stalled while
  a recovery advanced the lane filed its superseded poll straight over the
  current one. `set-lane-tree` compares both with the lane's snapshot under the
  mutex and refuses with 7, writing inside that mutex so nothing lands between
  the compare and the record; and `lane-reconcile` now SAYS, on the tree's own
  line, when an observation was taken under an earlier generation.

* **The handoff made a second observation of its own.** It computed branch,
  head, upstream, dirty and unpushed for every writer it polled — a second
  implementation of `lane_tree_now` with its own error handling, so the WRITERS
  section a person reads and the sidecar a recovery reads could disagree about
  what git said. `lanes-edit.sh lane-tree-now <path>` is that observation as one
  read verb, and the handoff records what it answers; where it refuses, every
  field is `?`, no sidecar is filed, and the section says so.

* **The inventory reader took every `*.yaml` at face value.** A sidecar written
  by newer tooling was read field by field and reported as an ordinary
  observation. `lane-trees` now prints such a record's id, path and schema and
  not one other field of it, and `lane-reconcile` classes it `unknown-schema`
  rather than recomputing git against fields it is guessing at. The row gained
  its `generation`, `operation` and `schema` at the END, so a reader written
  against the ten fields that were there first still reads those ten.

* **Every git read after the first became a clean-looking value.** `|| printf
  'unknown'`, `|| printf 'none'` and a count that fell back to `0` meant a
  partially unreadable repository produced a record that said CLEAN AND
  PUBLISHED — and a later reconciliation comparing against it would call a tree
  holding work `missing` rather than `possible-loss`. A failed read is now an
  incomplete observation that prints nothing (exit 3 in the function, 1 in the
  verb), which `set-lane-tree` refuses to file and `lane-reconcile` reports as
  `unreadable`. Two states are answers rather than failures and are spelled:
  `unborn` for a branch with no commit yet — `rev-parse --abbrev-ref` refuses
  that exactly as it refuses a corrupt HEAD, so `symbolic-ref` is what tells
  them apart — and, for a branch whose upstream is configured while its
  remote-tracking ref is not in this checkout (the ordinary state after a merged
  branch is deleted), that configured upstream with `unknown` unpushed, never
  the `0` that reads as *everything here is published*.

AND THE FOUR RED CASES ON `tests-macos` AT `612ba5c`, WHICH WERE ONE DEFECT.
`expected [dirty], got [dirty unmanaged]`: the report reads three sources that
do not agree about spelling — a sidecar holds the path its poll was given,
`git worktree list --porcelain` answers with the PHYSICAL path, and the on-disk
sweep walks the recorded `dir`. On that runner `$TMPDIR` and `$HOME` are under
`/var`, which IS a symlink to `/private/var`, so EVERY tree was reported twice,
once as the tree it is and once as a tree nobody manages — and so it would be on
every estate that reaches its checkouts through a `projects` link. `612ba5c`
resolved the lane's own checkout for this very reason and left the trees under
it unresolved; `lane_real_path` is now applied on both sides of every
comparison, and a lane whose recorded directory goes through a link has a case
of its own so the defect is reproducible on every platform.

The suite gains a section for the round — the delayed follow-up (scheduled with
a `post-commit` hook, so it is a schedule and not a race), the schema refusals
against a file whose bytes are asserted unchanged, the inventory fence in both
directions, the handoff and the sidecar agreeing on a value only the shared
helper produces, the unknown-schema sidecar, the unreadable tree, the unborn
branch, and the linked path named once. `--expect`, `--expect-generation` and
`--expect-operation` also refuse an empty value in BOTH spellings, which is the
hygiene row that was red on all four jobs, and every other value-taking arm of
the two new writers with it.

Part of #91

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EaHzfTLW4u9ukpWuw8Dt6r

* openRepoTools#91: the two safety holes of the sixth round — a snapshot nobody could read was answered as a lane that has none, and an unfenced inventory write took no mutex at all

Automated review rounds are capped at TWO per pull request (Brett Heap's ruling
of 2026-09-16) and #97 is at round six, so that round is TRIAGED rather than
taken: these two are the findings this capability could not land with, and the
other twelve are filed as #113, #114, #115, #116, #117 and
#118, claimed by this lane, and named one by one — with what each costs and what
decides it — in the change's `tasks.md` section 7.

* **A snapshot that IS THERE and cannot be read was answered as a lane that has
  none.** `lane_state_read`'s `[ -r ] || return 8` put a permission error, an
  I/O error and a lane that never started under this capability behind one
  number, and `lane_reconcile` mapped every non-zero read to `NONE` — whose
  verdict is `no-state`, the cutover answer that tells a launcher there is
  nothing here to recover. So the one report built to say WHERE a session
  stopped answered *it never ran* about the lane nobody could look at, which is
  fail-OPEN on a crash pronouncement — the class this change exists to close.
  The read answers **9** now for a record that is there and could not be opened
  (`[ -L ]` beside `[ -e ]`, because a dangling symlink is `-e` false and is
  exactly the name-without-bytes case), `lane-state` exits 9 rather than the 8 a
  launcher goes past, and `lane-reconcile` reports the state word `UNREADABLE`
  with the verdict `indeterminate` — the same answer decision 15 already gives
  an unreadable HOLDER, under the same rule (R22, Amendment 7(d)).

* **`set-lane-tree` took the lane mutex only when the caller named a fence.**
  The atomic temp-file rename underneath it stops a reader seeing half a sidecar
  and stops nothing else, so an UNFENCED observation — a person's, or any caller
  that names no transition — could land after a newer fenced one and replace it,
  leaving the inventory holding a reading older than the transition recorded
  beside it. Every write of these files is serialized now, and the
  generation/operation comparison is unchanged for the callers that name one.
  The lock is taken AFTER the observation and not before it, for the reason
  decision 14 keeps `lane-reconcile` out of it altogether: `lane_tree_now` runs
  `git status` and `git rev-list` in somebody's checkout, and what must be
  serialized is the compare and the write, not the reading of a repository.

Ten new assertions in the suite's own `#91` section, as its section 12 (four
more that need `timeout(1)` are skipped and named where there is none): the
unreadable snapshot is 9, `UNREADABLE` and `indeterminate` and never
`no-state`; the SAME lane with no snapshot at all is still 8 and still
`no-state`, so the two answers differ in nothing but whether the file is there;
and an unfenced `set-lane-tree` run while another process holds the mutex is
still waiting when `timeout` kills it (124) and has written nothing, then lands
the moment the lock is free. The fixture for an unreadable file is a DANGLING
SYMLINK and not a `chmod 000`: a suite run as root reads a mode-000 file, and
the case would go red on the one host shape it was written to be harmless on.

Exit **9** joins this file's own exit-code table and the five arms' table; the
manual's crash-kind table gains the row; the spec gains the two scenarios; and
design decisions 19 and 20 record both fixes, beside the twelve deferrals.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01EaHzfTLW4u9ukpWuw8Dt6r

* Move lane-state's unreadable-snapshot exit from 9 to 10

Main's #61 landed with exit 9 as `claim --force`'s abandoned takeover,
and #97 had independently taken 9 for a lifecycle snapshot that exists
and cannot be read. Each PR took 9 as unused. The one that has not
landed moves: 10 is spent nowhere in the shipped scripts.

The code table and the manual get #61's 9 row back verbatim and a row
of their own for 10, which says it used to be 9. `lane_state_read`, the
`lane-state` arm, the #91 section of the manual, design.md, tasks.md
and the one suite assertion that names the number all move with it.
No caller branches on the number: `lane_reconcile` maps any non-0/8
read to UNREADABLE, and `lane-handoff`'s lifecycle_begin treats any
non-0/8 as unreadable.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Close a swept lane's lifecycle snapshot in the Amendment 19 sweep

`retire_rows` appends each RETIRED line itself, through `event_line`
and `append_text_block`, and never through `write_event`. So the
follow-up that takes a lane to CLOSED on every other RETIRED never ran
for a lane the sweep retired, and its snapshot kept whatever it said
last. #97 claims the snapshot follows the line "from any caller", and
main's sweep is a caller that line did not reach.

The sweep now takes each lane's pre-image inside its scan, under the
lock it already holds, and after `release_lock` calls
`lane_state_follow` for each lane with that pre-image. This is the same
order `write_event` uses, so the follow-up still takes the mutex for
itself and never fails a sweep whose lines have landed.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Stop claiming #97 keeps the log at five lane-kind verbs

#97 said in four places that no sixth lane-kind verb is added to the
append-only log, and design decision 12 rested on the claim that a
sixth would change what every last-line reader means by a lane's last
lane-kind line. Main's Amendment 18(g) has since added one,
HANDOFF-REQUESTED. It changes no state, and every state reader
enumerates the five state verbs by name and skips it, so the argument
no longer holds as written.

The four places now say what is still true: this change adds no
lane-kind verb. Decision 12 is reworded to rest on the reasons that
remain. A transition is taken three times per handoff and must work
offline, while every log line is a commit, a pull and a push. And
SWAPPING is a state, which HANDOFF-REQUESTED is not.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Never pronounce a crash from outside a lane's binding

Amendment 18(b): liveness is pronounced only from inside the binding's
own host and container, and from anywhere else a binding is UNKNOWN,
never dead. `lane_reconcile` decided its verdict from this
workstation's snapshot and this workstation's `live_holder` alone.
So a lane bound on another host, with an old RUNNING snapshot here,
read as an ungraceful stop, and a SWAPPED one read as resumable.
Neither is a fact this place can establish.

The reconcile now reads the binding through the same `lane_binding_scan`
and `binding_is_here` rule that `binding` and `holder_is_dead` use,
including clause (b)'s one exception: a window gone from this host's
tmux is a dead binding, and the local read decides. It prints a
BINDING row (here, free, gone, elsewhere, unknown). Bound elsewhere, or
a log that could not be read, turns every verdict into indeterminate,
and the message names where the lane is bound.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Carry a renamed lane's lifecycle snapshot to its new name

#97's control root is keyed by the lane's name on every rung:
`<parent>/.lane-state/<lane>`. Main's Amendment 16 `rename-lane` moves
the row, the log, the handoff and the alias table, and knew nothing of
that directory. After a rename the snapshot and the inventory sat under
a name every reader now resolves away from. The lane's next
reconciliation read `no-state`, which is the answer a launcher goes
straight past.

`rename-lane` now reads the old name's control root while the old name
still has its log. Once the commit has returned 0, it moves that
directory to the same parent under the new name, inside the rename's
own lock. The move never goes over something already at the new name;
that case is reported for a person, because two records of one lane
are not merged here. A rename by case alone goes through a temporary
name so it also lands on a case-insensitive file system. A failed move
is named and never fails a rename that has already landed.

The lane's `.lane-worktrees/<old>` root is not moved. It holds real
git worktrees, and moving them is `git worktree move`, which is a
person's act.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Refuse every legacy lane act on a lane the managed ledger owns

Brett Heap's ruling of 2026-10-04, verbatim: "managed ledger owns
enrolled lanes; #97 owns legacy — rework both". A lane the managed
ledger has enrolled carries a managed-owner marker in its register
row's state cell. Every lane without one is legacy, and this tooling
now answers for legacy lanes only.

The reader is ported verbatim from 3c26041:lanes-edit.sh:776-898, the
projection reader of branch 001-separate-swap-ctx-handoff (its T019).
Not a byte differs, so when that branch's T024 lands the merge is
"keep either". The header comment above the block gives the command
whose diff is empty. Its four dependencies (row_split_state_cell,
rstrip_spaces, lc, row_of_lane) are byte-identical here and there.

One wrapper, `lane_is_managed_owned <lane>`, answers 0 with the owner,
8 for a legacy lane and 1 for unknown. It closes one gap the ported
reader leaves: `row_of_lane` reads an unrendered published register as
an empty one, so the reader would call every lane legacy, and the
wrapper reads that as unknown. A read verb,
`managed-projection <lane>`, gives the scripts the same answer.

The rule is the reader's own ("no malformed marker may be downgraded
to absence"). A valid marker refuses with 2 and names the owner.
Unparseable vocabulary or an unreadable register refuses with 1. No
vocabulary means legacy, exactly as before. Every refusal comes before
the act's first write:

- write_event, before its lock, for STARTED, RESUMED, ENDED and
  RETIRED. The verdict is handed to the lifecycle follow-up.
- set-lane-state and set-lane-tree, before the control root and the
  lock.
- retire-rows, in its scan. One managed or unknown lane refuses the
  whole one-commit sweep.
- lane-reconcile, read-only. It prints MANAGED and
  `VERDICT managed-owned`, or `indeterminate` for unknown, and
  pronounces nothing else.
- row_state_check, add-row and replace-in-row's new text refuse the
  marker's vocabulary, so no legacy writer can forge a marker.
- set-row-state, replace-in-row and rename-lane refuse a managed lane.
  Each would replace the marker or orphan its bound-lane. These three
  are the row writers 001 itself guards (b001:9064, 9096, 9613).
- lane-handoff, right after its canonical `lane=` step and before the
  window rename. Every mode (--late, --restart, --exit) is behind it,
  so SWAPPING and SWAPPED never run for a managed lane.
- lane-start, at the head of section 3, before Amendment 18's binding
  gate and its request-handoff.
- lane-end, once canon-lane has named the lane. That covers the
  ending, --retire and --retire <pid>.

The scripts treat any status but 0 and 8 from `managed-projection` as
unknown, including a helper that predates the verb.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Move a lane's lifecycle only on a legacy verdict and an unchanged pre-image

The follow-up that moves a snapshot on a lane-kind line now writes
only when three things hold. The verb is STARTED or RESUMED (giving
RUNNING) or ENDED or RETIRED (giving CLOSED). The caller's seam read
said 8, meaning a legacy lane with no managed-owner marker and no
vocabulary of one. And a pre-image was taken before the line was
written, and the snapshot still matches it under the mutex.

Until now an empty pre-image skipped the comparison, so a caller that
took none could overwrite a newer state. It now writes nothing, and so
does a missing verdict: a caller that did not ask is not a caller that
was told "legacy". Both callers, write_event and the Amendment 19
sweep, pass both. So a marked or unknown row is never written over,
and RUNNING is never the legacy tooling's to write for a lane the
managed ledger owns. Design decision 21 leaves room for a later change
to own RUNNING for an operation it holds; no stub ships here.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Document the managed-owner seam and the four merge fixes

The manual gains a "Managed-owned lanes" section. It gives Brett
Heap's ruling of 2026-10-04 verbatim, the two marker forms, the
`managed-projection` read and its four exits with what every legacy
act does on each, the acts that ask and where, and the statement that
branch 001's governance review is PROPOSED, NOT APPROVED, and that no
supersession of Amendment 17 is asserted.

The #91 section's verdict table gains the bound-elsewhere row
(Amendment 18(b)) and the managed-owned row. Its reconciliation
paragraph names the new BINDING line, and says a renamed or swept lane
keeps or closes its snapshot.

In the OpenSpec change:
- the proposal scopes it to legacy lanes by the ruling, verbatim;
- design decision 21 records the seam, the ported lines, the codes,
  the provenance and what is not asserted;
- decisions 22 to 24 record exit 10, Amendment 18(b), the sweep and
  the rename;
- two risks are added, the hint's over-match (measured 0 of the 57
  published rows at brett-wip 225b9f90a) and a marker missed under
  LANES_NO_FETCH;
- the spec gains the requirement "Legacy lifecycle refuses a
  managed-owned lane" with its three scenarios, and a bound-elsewhere
  scenario;
- tasks gain section 8, whose test task stays open until the suite
  proves it.

`openspec validate add-crash-consistent-lane-worktree-recovery
--strict` reports the change valid.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Prove the managed-owner seam on every fixture class and every act

A new suite section, after #91's. Its fixtures are written straight
into the sandbox register and pushed, as the managed ledger's own
writer would land them, because no legacy writer may now write that
vocabulary at all:

- VALID-LONG (`managed-owner mode=managed daemon=ledger-1
  generation=3 bound-lane=repoMG-1`)
- VALID-SHORT (`MANAGED OWNER · ledger-2`)
- LEGACY
- five MALFORMED: generation=0, an empty daemon, a bound-lane that is
  another lane, the shorthand with an empty token, and `managed: x` in
  the objects cell
- a dormant legacy row for the sweep

Every act runs against both valid rows and all five malformed ones:
`log` with each of STARTED, RESUMED, ENDED and RETIRED, set-lane-state,
set-lane-tree, retire-rows, set-row-state, replace-in-row, rename-lane,
lane-handoff (plain, --late and --restart), lane-start (--no-launch and
a launch) and lane-end. A valid marker exits 2 naming the owner, and a
malformed one exits 1 saying ownership is UNKNOWN. Every refusal is
proved zero-change by one fingerprint: the register's commit here and
on origin, the checkout's status, the register's bytes, every fixture
log's bytes, the lifecycle control roots' names and contents, and the
tmux, claude and pclaude logs the fakes keep. lane-reconcile answers
`managed-owned` (or `indeterminate`) and reads and writes nothing. One
managed lane refuses a whole sweep. set-row-state, add-row and
replace-in-row refuse the marker's vocabulary. The legacy lane still
transitions, moves its snapshot on a RESUMED, reconciles without a
MANAGED line and is swept. managed-projection's codes (0, 8, 1, 64)
are asserted on every fixture.

410 assertions in the section. Run alone in a harness of the suite's
own setup it is 410 passed. Against a copy whose
`lane_is_managed_owned` always answers legacy it is 339 failed,
including 91 zero-change assertions. Of #91's own section, the one
removed line is the assertion of exit 9 that the move to 10 replaced.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Assert a lifecycle snapshot never reaches the listing's binding column

Amendment 18 gives `lanes` a 13th column, the binding, and it must
print `none` for a lane whose log carries no binding line. A lifecycle
snapshot is this workstation's alone and is never a binding, so a lane
with a RUNNING snapshot and no binding line must still read `none`
there. The lane is given a log with only a NOTED line, so Amendment 19
does not hide it as dormant, and its column 13 is asserted directly.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Tick task 8.11: the seam is proved on every fixture class

The suite section "the managed-owner seam" runs every act against both
valid markers and all five malformed ones, proves each refusal
zero-change, and keeps the legacy lane's behaviour. Run alone with the
suite's setup and #91's section it is 573 passed, 0 failed. Of #91's
section, the one assertion whose line changed is the exit 9 that the
move to 10 replaced.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Let lane-end's own pair refusal speak before the seam

Main's Amendment 15 suite proves that lane-end, driven by a helper that
predates `canon-lane`, still refuses a register that spells the lane
two ways. It exits 2 with 15(d)'s words, out of its OWN read of the
register in "the row". Such a helper predates `managed-projection` as
well. The seam, placed right after the canon-lane block, rightly called
that UNKNOWN and exited 1 first, so the person lost the words that say
what to do. The full suite caught it: 3 of 3931 failed.

Both are refusals that write nothing, so the fix is ordering, not
weakening either one. The seam now runs in two places, each before the
first thing its path does:
- at the head of the --retire <pid> door, before any process is looked
  for or signalled;
- right after "the row"'s own refusals on the ending path (the ending
  and --retire), before the state cell, the in-flight guard and every
  write.

The seam section now also runs `lane-end --retire` and
`lane-end --retire <pid>` against every managed and malformed fixture:
453 passed, 0 failed, run alone with the suite's setup.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Say where lane-end's seam actually runs

Decision 21 and the lanes-edit.sh header said the seam ran at
lane-end's "entry". Since the previous commit it runs before lane-end's
first act on each of its paths. That is the head of the --retire <pid>
door, and on the ending path it is right after the command's own row
refusals, so that Amendment 15(d)'s pair refusal is still the one a
person reads through a helper that predates both reads.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Close the three findings Copilot left open on 64dfd97

Three review threads from the last Copilot round on this PR (at
64dfd97) were never answered. Each is a fail-open hole in the
lifecycle's own contract, and each fix is small.

1. A dangling symlink is not absent to the writers either.
   `lane_sidecar_schema_ok` tested `-e` alone, which is false for a
   broken link. So set-lane-state, lane_state_follow and set-lane-tree
   passed the guard and renamed a fresh file over a record that
   `lane_state_read` itself calls present-and-unreadable. It now asks
   `[ -L ]` beside `[ -e ]`, as the reader does.
2. An unreadable lane log is never an empty coordinator directory.
   lane_reconcile collapsed `lane_payload_field`'s 1 (log unreadable)
   into an empty `dir`. That skipped both the registration sweep and
   the on-disk sweep, so a SWAPPED lane with no holder could read as
   resumable over paths nobody inspected. The 1 is now kept and the
   verdict is indeterminate. (The binding read of 28ed7c7 already
   failed on the same log and gave indeterminate. This makes the rule
   independent of it.)
3. A refused inventory write keeps the lane SWAPPING. lane-handoff only
   logged a set-lane-tree failure, so a disk, lock or schema refusal
   could still finalize SWAPPED over an inventory missing a polled
   writer. The tree is now named in `lc_unfinished`, on both the
   ordinary and the late path.

Tests: a writer meeting a dangling snapshot and a dangling tree
sidecar refuses and keeps the link. A SWAPPED lane is resumable with
its log readable and indeterminate with the log published twice
(through Amendment 15's own plumbing, so it runs on a case-insensitive
file system too). A handoff whose inventory write is refused stays
SWAPPING. Against ec9847e, which lacks the fixes, 6 of these fail.
With them, the suite's setup plus #91's section and the seam section
give 626 passed.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Take Codex's four inventory findings on ec9847e

Each finding is a tree a recovery would misread, and each is part of a
follow-up this change had filed and deferred, so they are taken here
rather than left behind a review thread:

- An unreadable tree sidecar was skipped, so a record nobody could read
  and no record at all were one silence. lane-trees now carries it as a
  row named by its file with the schema <unreadable>, and lane-reconcile
  reports it as unreadable-sidecar and counts it toward recovery (#113's
  second read).
- tree_id_for folded a path to the file-name alphabet, so a/a+b and a/a-b
  shared one sidecar and the second write replaced the first tree's last
  observation. The cksum of the whole path, which only an over-long id
  carried, now prefixes every id. No migration: no released tooling has
  written a sidecar (#116's first half).
- set-lane-tree completed a partial observation with unknown, none,
  dirty 0 and unpushed 0, the clean-and-published shape nobody observed.
  It is now a usage refusal (64) that writes nothing (#114's second half).
- lane-start stayed silent over any resumable lane. It is now quiet only
  when the TREES line counts nothing dirty or unpushed, requiring
  recovery, or unmanaged or stale, and its report names a binding that
  is neither here nor free.

The manual, design decision 25, four spec scenarios and task 8.12 say
the same; repoRC-15 proves each case.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Say that the reconciliation reads the published register first

Copilot read lane-reconcile as a local report and asked for its fetch to
go. The fetch is kept: the lane's name resolves through the published
register and alias table, and its binding and any managed-owner marker
are read from them, so a stale ref would pronounce from a binding that
has moved. It is bounded, falls back to the ref as it stands, touches no
lane tree, and lane-start already skips it with LANES_NO_FETCH=1 after
its own fetch. The manual now says so, and the question of a local
default is the one deferred finding, filed as #157.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Refuse a managed or unknown row in the state-cell migration

Copilot round 2 on #97 (lanes-edit.sh:11313): migrate-state-cells rewrites
state cells and appends to logs, yet it never asked the seam. The shorthand
marker `MANAGED OWNER · <token>` holds one ` · `, so mig_cell_is_phrase does
not recognise it, and `--yes` rewrote a managed row to `MIGRATED · …`.

The scan now calls managed_seam_refuse for every row it would rewrite. The
call comes after the 15(d) duplicate check and the phrase skip, and before
the plan is built. One managed row (exit 2) or unknown row (exit 1) refuses
the whole migration, the same way one refuses Amendment 19's sweep, because
the migration is one commit. The migration rewrites this checkout's row
while the seam reads the published register. So a local row that carries
the vocabulary where the published one does not counts as unknown too.

The repoMG section gets case 6, in its own workspace. The valid shorthand
(in the dry run and with --yes), a malformed shorthand, and a marker that
only this checkout carries all refuse with zero change. The same register
with no marker migrates. Without the fix, 22 of the case's assertions fail.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Defer the live-swap takeover to #157 and list the migration's seam

Copilot round 2 on #97 (lane-handoff:434) asked lane-handoff to refuse a
second swap while the first is still live. lifecycle_begin supersedes any
lane recorded SWAPPING, which is design.md's settled answer for an
interrupted swap. Telling a live operation from an interrupted one needs the
handoff process's liveness. The snapshot does not record that, and design.md
rules out a PID alone. The fence already bounds the harm: the superseded
operation's finalizer and inventory writes are refused with 7.

So the spec's "Competing swap begins" scenario now states what the code
guarantees, not "without minting another owner". The requirement names the
deferral. design.md's settled answer says what it cannot yet tell, and
tasks.md files the finding under #157 beside the first one.

The manual's and decision 21's lists of seam call sites now name
migrate-state-cells, which 19df774 added, and task 8.13 records that change.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Close the seam on every lane-kind line, request-handoff and archive-rows

Copilot round 3 on #97 (lanes-edit.sh:4947, spec.md:169) found legacy
writers that still reach a managed lane. The spec says every log,
register-row and sweep act refuses one:

- write_event asked the seam for STARTED, RESUMED, ENDED and RETIRED only,
  so `log PAUSED` and request-handoff's HANDOFF-REQUESTED wrote to a managed
  lane's log. Every lane-kind verb now asks. The two new ones get no
  lifecycle follow-up.
- request-handoff now refuses at its head, so --dry-run plans nothing.
- archive-rows moved a RETIRED managed row out of the register. Its scan now
  asks after the RETIRED test, and one hit refuses the whole move.

The sweep of every writer arm closed four more gaps. append-session-id
rewrote a managed row's session cell. add-row now names the owner of an
existing managed lane before its duplicate refusal. append-line, the new
text of append-session-id and rename-lane's new name could all write the
marker's vocabulary into the register.

managed_seam_refuse now also reads this checkout's row. Every legacy row
writer rewrites that row, while the seam's first read is the published
one, so a local row that carries the vocabulary where the published one
does not is UNKNOWN (1). The migration's own copy of that check is now
this one.

The repoMG section proves each newly guarded arm on all seven managed and
unknown fixtures with the zero-change fingerprint. It also covers the
three back doors, the legacy controls, and case 7: archive-rows over a
valid and a malformed retired marker, then the same move landing once the
managed row is gone.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Name every arm the seam guards in the spec, the design and the manual

07fb3ad closed the seam on every legacy writer arm. The documents now
list the same set:

- the spec requirement names lane-kind log lines, the archive, the
  migration and this checkout's row, and says no legacy writer may write
  the marker's vocabulary;
- design decision 21 and the manual list PAUSED, request-handoff,
  archive-rows, append-session-id, add-row for an existing lane and the
  three back doors;
- task 8.14 records the round.

Object-kind lines (a claim, a release) are stated as unchanged, because
they concern the object a lane holds and not the lane.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
brettheap added a commit that referenced this pull request Oct 19, 2026
…meout, interrupt, TERM or hangup, pin the launcher precedence of lane <name> with launchers the suite names, and say what the pty driver comment counts (#217)

* Say what the pty driver comment counts: six CI runs in #107, five on darwin and one on Linux whose two jobs both went red, not seven

Copilot read "five on darwin, then both Linux jobs of #61's `ready` run" as
seven runs. #107 names six: five `tests-macos` runs and one Linux run,
37124906535, in which both the `tests` and `tests-no-submodule` jobs failed.
The count was right and the wording was ambiguous; this changes a comment only.

Closes #147

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

* Pin the launcher precedence of `lane <name>` with launchers the suite names itself, so no host's lclaude can be picked

#143's eight false reds were already gone: c1bac0d exports PCLAUDE before the
`lane` cases, which pins the launcher seam to the suite's fake. What was never
added is a case for the rule that applies when the seam is unset, which is
`lclaude`, else `pclaude`. Three cases now, each on a PATH of its own:

* both launchers present, the pclaude directory FIRST, so the rule is shown to
  prefer a name and not a position: lclaude runs, once;
* every directory holding an lclaude taken out of PATH (the a17 section's way
  of making a word absent, and on a workstation the directory the real one is
  in): pclaude runs with the same argv;
* PCLAUDE set explicitly, with an lclaude on PATH: PCLAUDE wins.

Each was checked against a throwaway slice of the suite on a host that has
workBenches' /usr/local/bin/lclaude, and each goes red under the matching
mutation of `lane`'s launcher() (order swapped, seam ignored, fallback dropped).

Closes #143

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

* WIP: checkpoint before account swap; done: #147 comment reword, #143 launcher-precedence cases (harness + mutation checked), #142 item 3 test file written; left: apply the start_new_session/killpg fix in tests/test_lane_helpers_suite.py, run the new pytest file red-then-green under the lock, push CI watch, open the PR

The new tests/test_lane_helpers_suite_timeout.py is unrun: its first run was queued behind other lanes on the pytest lock and was stopped before it started. The wrapper in tests/test_lane_helpers_suite.py is still the unfixed subprocess.run.

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

* Start the shell suite in a session of its own and kill its whole process group when the wrapper gives up, so a timeout leaves no orphan `sleep`

subprocess.run(timeout=) killed the bash it started and nothing under it, and
the suite's EXIT trap does not run on a SIGKILL, so the liveness fixture's
`sleep` (longer than TIMEOUT_SECONDS on purpose, #83) and every later
fixture's were orphaned for up to 70 minutes. The suite now runs under
Popen(start_new_session=True), and any exception out of communicate() - the
timeout, and a Ctrl-C, which a session of its own no longer receives from the
terminal - kills the group with os.killpg before it propagates.

tests/test_lane_helpers_suite_timeout.py drives the wrapper's own test function
against a stand-in suite that starts a `sleep 600` and hangs: on the old
wrapper the timeout and interrupt tests fail with that sleep still running
(2 failed, 2 passed); the green-suite and red-suite tests pin that the
footer check and the transcript on failure are unchanged.

Refs #142 (item 3)

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

* Stop the shell suite's group on a TERM or hangup to pytest as well as on the timeout, TERM before KILL, and clean up in the tests that watch it

Review of the session change found that moving the suite out of tests/run.sh's
process group opened a new way to orphan the fixture `sleep`: run.sh's
`kill -TERM -- -<pgid>` and a terminal's hangup now reach pytest alone, pytest
has no handler for either, and the suite's bash dies on its dead pipe with its
TERM trap never run. On main the suite shared the group and its trap cleaned up.

The wrapper's call is now run_in_own_group(): for as long as it waits it
installs a TERM and a HUP handler, where the disposition is still the default
(a nohup'd run keeps ignoring a hangup), which stops the suite's group and then
lets the signal take pytest as it would have. The timeout and a Ctrl-C stop the
group the same way. stop_group sends TERM first and waits up to ten seconds
(run.sh's own grace) for the suite's trap to remove its sandbox, then KILLs
what is left. The comment no longer claims the group is everything the suite
started: the pty driver's children are session leaders of their own.

The new tests signal the runner's own group the way run.sh does (TERM and HUP)
and assert no `sleep` survives, that the TERM trap ran, that a TERM-deaf group
is killed after the grace, and that an ignored hangup stays ignored. The
tests' own cleanup no longer depends on the wrapper working: a fixture kills a
leaked `sleep`, and the SIGINT sender is gated on an Event so it cannot fire
after the wrapper has returned.

Refs #142 (item 3)

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

* Add the claude-profile tier and the no-launcher refusal to the launcher-precedence cases, and check the exit code of the PCLAUDE case

The `lane` launcher is `$PCLAUDE`, else lclaude, else pclaude, else
claude-profile, else a refusal with 2. The cases covered the first three; two
more now cover the last two, on a PATH where the suite's own pclaude (in
fakebin, beside the fake tmux, ps and pgrep) is replaced by links to everything
else in that directory, and where every directory holding one of the three
words is taken out. The PCLAUDE case also asserts the exit code.

Checked in the throwaway slice of the suite, on a host with the real
/usr/local/bin/lclaude: dropping the claude-profile fallback, and letting
`claude` itself be found, each turn the matching cases red.

Refs #143

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

* Let the suite-timeout tests import where the signal module has no SIGHUP

The Windows job collected tests/test_lane_helpers_suite_timeout.py and died with
`AttributeError: module 'signal' has no attribute 'SIGHUP'`: the parametrize
decorator names the signal at import, before the module-wide Windows skip can
apply. SIGHUP is now read with getattr, and the module imports with the
attribute removed (checked by deleting it from `signal` and importing).

Refs #142 (item 3)

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

* Make the suite wrapper's stop survive a Ctrl-C during the TERM grace, finish inside run.sh's own, and note a TERM or hangup instead of raising from its handler

The delta check of the signal handling found two edges and a window.

* A SIGINT during the grace left child.wait() with a KeyboardInterrupt before
  the KILL stage, so a suite that ignores TERM was orphaned: TERM then Ctrl-C,
  and Ctrl-C twice, both ended the runner with the suite's `sleep` still
  running. stop_group now ignores SIGINT until it is done, and the KILL is in a
  `finally` as well.
* GROUP_TERM_GRACE equalled the ten seconds tests/run.sh's stop_group gives its
  own group, which is really about 10.7 (fifty polls of 0.2 s and a `ps` each),
  so a delay on pytest's side let run.sh KILL pytest mid-stop. It is five now,
  and the comment says why.
* A handler that raised also raised inside Popen(), after the fork and before
  `child` was bound, leaving the suite with nobody to stop it. The handlers now
  only note the signal; the wait is made in half-second slices that look for
  one, a signal that comes as the suite finishes is not swallowed, and the
  signal is sent again with its default action after the group is stopped.

The new test sends a deaf suite's runner a TERM, or a Ctrl-C, and a Ctrl-C
inside the grace, and asserts no `sleep` survives. The tests' `ps` check is now
a probe that skips the module where `ps -o stat= -p` cannot answer, rather than
one that passes by finding nothing.

Refs #142 (item 3)

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

* Report the suite wrapper's real timeout bound, and pin that a Ctrl-C during the TERM grace lets a slow trap finish

The wrapper now waits in half-second slices, and the TimeoutExpired it re-raised
was the last slice's, so a 5400 s CI timeout would have read "timed out after
0.4 seconds". It is raised again with the bound that was passed and the output
and stderr gathered so far, and a test asserts the bound, the message and the
partial transcript.

Nothing pinned stop_group's SIGINT ignore: with it removed the KILL in the
`finally` still prevents an orphan, but a Ctrl-C in the grace cuts short the
cleanup of a suite that does answer TERM, slowly. A stand-in whose TERM trap
takes two seconds now has to finish writing its marker through a Ctrl-C.

Refs #142 (item 3)

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

* Give the slow-trap test a margin that survives a loaded bench: a one-second trap inside the three-second grace

The stand-in's TERM trap took two seconds against a three-second grace, and the
marker landed 2.1 to 2.5 s after the TERM, so about a second of scheduler delay
would have failed it. The trap now takes one second, which roughly doubles the
margin and still leaves the Ctrl-C landing mid-trap, and the comment says where
the Ctrl-C lands rather than where the trap is.

Refs #142 (item 3)

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

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Co-authored-by: Brett Heap <[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

2 participants