Skip to content

Launch current Claude Code and report stale running sessions - #134

Merged
brettheap merged 19 commits into
mainfrom
feat/claude-current
Oct 4, 2026
Merged

brettheap merged 19 commits into
mainfrom
feat/claude-current

Conversation

@brettheap

@brettheap brettheap commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Profile and direct lane launches can start an outdated Claude Code installation, and running sessions need a warning when their executable has been replaced. This change installs claude-current and claude-restart-check, resolves an unpinned lane-start launch to the verified absolute executable, and records its version before launching.

The resolver checks npm with bounded calls, serializes updates across checkouts even with relative cache paths, preserves explicit pins, launches the newest installed candidate unverified when offline, and refuses a still-stale installation unless explicitly allowed. The restart check distinguishes replaced binaries from newer installed candidates; version-only notices leave selection to the next registry check. Session restarts remain the operator's choice. openRepoTools --install places both commands and their manual, preserving main's installer receipt behavior.

The workBenches integration is already on main: PR #121 (2c4d7e7), amendments #122 and Speckit alignment #123. It calls these commands from the profile launcher and status line and installs the user-owned Claude copy in Layer 3. This PR completes the remaining command dependency for opensoft/openBenches#119.

Validation, merged with current main 82ecebe:

  • The serialized focused wrapper run passed 463 tests on 11037f0, covering resolver/update locking, restart detection, direct lane-start resolution, installer receipts, hooks, guards and repository hygiene.
  • Both relative-cache cross-checkout regressions passed; the lock is anchored under the user home for explicit cache and XDG overrides.
  • Handoff approval precedes resolver work; refusal is checked before release, window rename or transcript movement. Declined handoffs perform no update, and the agent is read afresh after handoff.
  • Malformed resolver-output cases include searchable-directory rejection before any lane write.
  • After resolution, the binding is rechecked immediately before window rename, including initially free bindings and bindings in this same window.
  • The watchdog rejects timed-out output even when the command handles TERM and exits 0. Its dedicated process group also covers children created by TERM handlers.
  • Retired lanes and new-window name collisions refuse before resolver work or a handoff request; both fences are read again after resolution before rename.
  • Restart notices preserve the equal-before-ahead resolver policy and qualify version-only notices rather than promising a different restart target.
  • All 18 workBenches suite invocations passed on their recorded workBenches test revision, including profile and lane launches, status-line snapshots, and mocked Layer 3 installation/freshness.
  • Strict OpenSpec validation of launch-current-claude passed; git diff --check passed.
  • The README merge conflict is resolved, retaining both the fifteen installed commands and the receipt configuration. Final-head CI on 11037f0 passed: 874 tests; without the submodule 666 passed, 208 skipped; Windows 153 passed, 721 skipped. Guard/hygiene, macOS Bash 3.2 syntax and Sonar checks passed. Full macOS testing remains the coordinator's ready-label landing gate.

The local checks use fake registry, executable and Docker fixtures. No image was rebuilt, real installation updated, or running session restarted. PRs #97 and #121 in openRepoTools remain held and are outside this change.

Late Copilot findings are tracked under the repository's two-round cap as #148 (current installer count descriptions/assertions) and #149 (canonical Bash inventory membership). Both review threads are answered with their follow-up issue.

Late agent-selection and executable-directory findings were filed as #150 and #151 and addressed alongside launch-preflight validation. Fixes #150. Fixes #151.

The late watchdog finding was filed as #152 and fixed with a regression. Fixes #152.

The late native-candidate fallback finding remains tracked as #154 under the two-round cap. The watchdog descendant finding in #153 was also reported by Codex and fixed with a regression in 11037f0. Fixes #153.

Final-head Codex review was requested, but the service refused it because the account code-review quota is exhausted. Earlier findings were addressed and their threads resolved; this does not claim a fresh Codex review of the final commit.

The final late Copilot custom-native process-detection finding is tracked as #155, also under the two-round cap. No additional review cycle is required by the repository ruling.

…shed Claude Code, and tell a running session when its binary moved

For opensoft/openBenches#119, on Brett Heap's rulings of 2026-09-29:
the home decision ("this work is really for openRepoTools repo") puts
the resolver here, installed by `openRepoTools --install`, and point 2
("for 2, we can run update on every start, this ensures we have the
latest models") makes every launch run the check.

claude-current resolves the executable by ABSOLUTE PATH, never through
PATH: the newest native version, the user npm prefix, ~/.local/bin/claude,
then the image's copies, each read with --version and read once per
physical file. It asks npm for the published version with a bound, updates
the user-writable install under a lock when every candidate is behind
(claude update for a native install, else npm install -g --prefix <user>
plus the package's install.cjs that npm 12 skips), and hands back the path
whose version equals npm. An equal candidate beats a newer one, and a newer
one launches as ahead. Offline, it launches unverified. Still behind after
the update, it refuses (exit 2) unless CLAUDE_ALLOW_STALE=1.
--porcelain gives path/version/published/status, and --offline reads no npm.

claude-restart-check prints one green RESTART NEEDED line when the claude
process above it (at most three processes up) runs a binary since
replaced on disk (exe ends " (deleted)") or older than the installed one,
read from the native versions directory or the package's package.json. It
reads /proc and two small files, runs no binary, reaches no network, and
always exits 0.

Tests: tests/test_claude_current.py and tests/test_claude_restart_check.py,
both hermetic, and both commands held to test_repo_hygiene.py's bash rules.
The macOS job parses both with /bin/bash -n.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 16:40
@sourcery-ai

sourcery-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds two hermetic Bash tools: claude-current resolves an absolute path to the newest published Claude Code and safely updates or refuses stale installs, while claude-restart-check detects replaced or outdated binaries in running sessions and emits a restart prompt; comprehensive fake-environment tests and macOS Bash parsing checks cover their behavior.

File-Level Changes

Change Details Files
Add a hermetic resolver that selects, verifies, updates, and reports the newest published Claude Code executable.
  • Search native, user-prefix, local, and system candidates in deterministic priority order using absolute paths.
  • Query npm with a timeout; support offline/unverified, ahead, stale refusal, and explicit stale override outcomes.
  • Update native installs or fall back to a user-prefix npm installation, including the package install hook, while serializing launches with a lock.
  • Expose plain-path and porcelain output with documented exit-code behavior.
claude-current
tests/test_claude_current.py
Add a non-invasive restart detector for sessions running a replaced or older Claude Code binary.
  • Walk up to three parent processes to locate Claude above the status-line shell.
  • Detect deleted executables and compare running and installed versions from native or npm metadata.
  • Emit an optional green restart notice while remaining silent for current sessions and always exiting successfully for runtime conditions.
claude-restart-check
tests/test_claude_restart_check.py
Integrate the new shell commands into platform syntax validation and enforce shared repository shell conventions.
  • Run bash syntax checks for both commands in the macOS workflow.
  • Test executable/failure-discipline, portability hygiene, and identical version-comparison logic across the commands.
.github/workflows/tests.yml
tests/test_claude_current.py

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-5 (openXfactory-5)

@codex review

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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

The macOS timeout fallback can exceed its bound, and stale-lock takeover can permit concurrent updates.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds Claude Code version resolution and restart detection utilities.

Changes:

  • Adds bounded version resolution, updating, locking, and offline behavior.
  • Adds stale-session restart notifications.
  • Adds extensive tests and macOS Bash parsing.
File Description
claude-current Resolves and updates Claude Code.
claude-restart-check Detects stale running sessions.
tests/​test_claude_current.py Tests resolver behavior.
tests/​test_claude_restart_check.py Tests restart detection.
.github/​workflows/​tests.yml Parses new scripts on macOS.

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

Comment thread claude-current Resolved
Comment thread claude-current Resolved
brettheap and others added 3 commits September 29, 2026 17:43
…s a dead owner's lock

Two Copilot findings on #134, both in the fallbacks a
stock macOS takes, and a third wording fault found beside them:

- With no `timeout` and no `gtimeout`, the watchdog killed only the command.
  A child the command had started (npm's lifecycle processes, a script's
  `sleep`) kept the caller's command substitution open, so a 1 s bound took
  as long as the child did. `kill_tree` now stops, walks (`pgrep -P`),
  signals and continues the whole tree, as GNU `timeout` ends its process
  group, and the watchdog's own `sleep` is ended the same way.
- With no `flock`, two launches that both read one dead owner each removed
  "the stale lock", and the second removal could take the lock the first had
  just made, so both updated at once. Only the launch holding the reaper
  directory (`<lock>.d.reap`) removes it now, and only while the lock still
  names the pid it saw dead. A reaper left by a launch killed in those lines
  blocks the takeover, and the refusal names it.
- A lock directory that could not be created was reported as a lock that
  "was not free within 330s". It is named as what it is.

tests/test_claude_current.py runs the two fallbacks on every host by hiding
`timeout`, `gtimeout` or `flock` from PATH. Against the previous head the
watchdog case takes the fake npm's full 30 s and the reaper case removes the
lock and updates; both pass here. 52 cases.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd a stale one is refused before any write

opensoft/openBenches#119, Brett Heap 2026-09-29, verbatim "for 2, we can run
update on every start, this ensures we have the latest models". The hook is
minimal and touches three places only:

- Beside the CLAUDE_BIN default: CLAUDE_VERIFIED_VERSION is read once and
  removed, so no session inherits it. CLAUDE_BIN unset, or equal to
  CLAUDE_RESOLVED_BIN with no CLAUDE_VERIFIED_VERSION (an earlier launch's
  answer inherited through a session's environment), is resolved. Any other
  CLAUDE_BIN is a pin, launched as it is.
- At the foot of 5a, once the agent and the launch are known and before the
  row, the object log and the handoff stamp are written: `claude-current
  --porcelain`, found beside this command or in $OPENREPOTOOLS_BIN_DIR and
  never on PATH. Exit 0 replaces the command's first word with the absolute
  path and exports CLAUDE_BIN and CLAUDE_RESOLVED_BIN; exit 2 ends the run
  with 2 and anything else with 1, nothing written. `--dry-run` plans the
  call and `--no-launch` makes none. Only the `claude` agent asks. With no
  claude-current installed, one note, and CLAUDE_BIN as before.
- The lane's STARTED/RESUMED payload gains `; claude <version>` when a
  version is in hand, and only when it is x.y.z.

Step 4 is untouched. The bare path a `--confirm` answered No takes still
launches CLAUDE_BIN unresolved.

tests/test_lane_start_claude_current.py: 17 cases in a cut-down copy of the
lane suite's sandbox, with a stub resolver and a decoy one on PATH.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…anual

`INSTALLABLES` gains the two commands at its END, so every index the suite
takes still names the file it did: FIFTEEN files and TWENTY-NINE artifacts,
with the usage text, the header and every in-body count moved with them
(`THIRTEEN SINCE AMENDMENT 16` and "the thirteen placements" stay: one is
history and the other a different count). The home ruling of 2026-09-29 is
why they are here: Brett Heap, verbatim "this work is really for
openRepoTools repo".

docs/README-claude-current.md is the manual: the candidates and their order,
the update and its lock, output, exit codes and variables, the hand-off
between launchers (CLAUDE_BIN, CLAUDE_RESOLVED_BIN, CLAUDE_VERIFIED_VERSION),
what `lane-start` does with it, and the restart check the status line calls.

README.md stays at 472 lines, the cap tests/test_repo_hygiene.py holds it
to: the counts are rewritten in place, and "THIRTEEN files" and
`13 of 13 placed`, which that test also asserts, survive as the history
sentence that says when they stopped being true. The doc is linked from the
existing line that names docs/README-lanes.md.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 17:43
The workBenches side (opensoft/openBenches#121, 016-launch-current-claude)
reports claude-current's exit 1 as "Claude CLI not found.", which is what 1
means for every other cause. A CLAUDE_CURRENT_* bound that is not a whole
number of seconds is a typo in a setting, not a missing Claude Code, so it
exits 64 now, as an argument it does not know already did. The launcher there
already refuses on 64 and names the status.

`lane-start` ends with 1 for any failure but 2, as before, and its message
says "named no Claude Code to launch" so it reads true for 64 as well as 1.
The header, the usage text, the manual and both suites say the same.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>

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

Some launch paths still bypass resolution, and version comparison and restart detection have correctness gaps.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
Resolved since last review (2)

Comment thread claude-current Resolved
Comment thread claude-restart-check Resolved
Comment thread lane-start Resolved
Copilot AI balanced review requested due to automatic review settings September 29, 2026 17:48

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

Some launch paths bypass resolution, restart detection misses cross-installation upgrades, and directory paths can pass executable validation.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
Previously missed (3)

In code that hasn't changed since last review

Medium severity Resolve bare claude launches on the --confirm No path

docs/​README-claude-current.md:185

This documented exception contradicts the PR's “every launch” contract and the ratified new-session scenario. The --confirm No branch exits at lane-start:1982, before the resolver block, so a direct lane start with unset CLAUDE_BIN still executes bare claude from PATH even when claude-current is installed. Resolve that bare launch too (without performing lane writes), rather than landing a known uncovered launch path.

Medium severity Require resolver path to be an executable regular file

lane-start:2693

-x also succeeds for searchable directories. If a malformed resolver returns path=/some/directory, this check accepts it, the lane records are written, and the final exec fails with status 126. Require both -f and -x so only an executable file can pass this pre-write gate.

Low severity Update contributor guide with the fifteen-file installer inventory

openRepoTools:28

The contributor guide still states at AGENTS.md:6 that openRepoTools places thirteen files. Since this change makes the installer contract fifteen files, update that authoritative repository guide in the same PR so contributors are not given a conflicting inventory.

…ed version across both families, and the bare --confirm launch resolves

Three findings, all real:

- Pre-release tags were compared as one string, so `2.1.284-beta.9` sorted
  after `2.1.284-beta.10` and a launch could take an older pre-release as
  ahead of npm. `precmp` compares the dot-separated identifiers by SemVer
  2.0.0 rule 11: numbers as numbers and before words, words in byte order
  (LC_ALL=C), fewer identifiers lower. It is in both commands byte for byte,
  like `numcmp` and `vercmp`; the suite checks the identity and runs rule
  11's own example chain.
- claude-restart-check read the installed version only from the running
  binary's family, so an npm 2.1.283 session beside a native 2.1.284 said
  nothing, though the next launch starts the native one. It now takes the
  highest of the running install's own, the native versions directory
  ($CLAUDE_CURRENT_NATIVE_DIR) and the user npm prefix's package, which it
  finds with claude-current's `npm_user_prefix`, byte for byte. No `$HOME`
  reads only the running install. Its suite now runs with `$HOME` and the
  npm prefix inside the fixture.
- lane-start's bare launch, the one a `--confirm` answered No takes, came
  before the resolution and started `claude` from PATH. The resolution is
  one function now, `lane_claude_resolve_launch`, called from that launch
  and from the foot of 5a, and it refuses a stale copy in both. The bare
  path gains one line; step 4 is untouched.

Also: the lane-start suite asks for the `claude <version>` sub-field by name
rather than at the end of the payload, because Amendment 18 (#83) appends
`host`, `os` and `container` after it (measured on a test-merge of #83).

Counts: tests/test_claude_current.py 70, tests/test_claude_restart_check.py
19, tests/test_lane_start_claude_current.py 20.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 17:59

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

The fallback lock can become permanently orphaned, directory paths can pass executable validation, and the central Bash inventory omits the new commands.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
Resolved since last review (3)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Require a regular executable file, not just a searchable directory

lane-start:669

-x is also true for a searchable directory. If malformed porcelain names such a directory, resolution succeeds, the lane records are written, and the final exec then fails instead of preserving the “Nothing was written” guarantee. Require a regular executable file here.

Comment thread claude-current Resolved
Comment thread tests/test_claude_current.py Resolved
… as it is taken, and the two commands borrow every per-file hygiene rule

- Without `flock`, the lock was a directory made first and given its
  owner's pid a line later. A launch killed between the two left a lock with
  no owner, which the takeover never removes (it reaps only a named dead
  owner), so every later launch waited it out and refused. The lock is now a
  symlink whose text is `pid=<pid>`: one `ln -s` makes it and names the
  owner, so no ownerless lock can exist. The reaper is unchanged. A
  directory standing at the lock path (where `ln` would put the link inside
  it and succeed) is refused by name. The release removes the link only
  while it still names this launch.
- The two commands are still not in test_repo_hygiene.py's `ALL_BASH`,
  because that file is being changed by open PR #93 and this PR touches none
  of #93's files. tests/test_claude_current.py now also borrows the
  flag-spelling rule and runs the LF-index check for both. The follow-up
  after #93 lands is to put `claude-current` in `SHIPPED_BASH` and
  `claude-restart-check` in `HELPER_BASH`, then drop the borrowed list.

tests/test_claude_current.py, 72 cases:
- `test_the_link_lock_names_its_owner_while_it_is_held` reads the lock from
  inside the update. It fails on the directory lock.
- `test_a_directory_at_the_lock_path_is_refused_not_taken` is new.
- The takeover, reaper and live-lock cases now work on the link.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 18:09

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

The post-lock recheck can incorrectly refuse a newly appeared ahead version as stale.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Accept newer candidates after lock wait instead of reporting stale

claude-current:657

The post-lock recheck only accepts an exact version match. If a newer-than-published candidate appears while this process is waiting, a lock timeout reaches the stale refusal even though the same candidate would have been accepted as ahead before waiting (for example, published 2.1.284 and installed 2.1.285). Accept ahead here as well before attempting another update or reporting stale.

… is ahead, not stale

Copilot's overview at 9ba858d, a finding in code unchanged since its
earlier rounds: after the wait for another launch's update, only a copy
EQUAL to npm was accepted. A copy newer than the published version that the
other launch installed meanwhile (npm moved on while this launch waited)
therefore went to another update, or, when the wait ran out, to the stale
refusal, although the same copy is `ahead` before any wait. The re-read
after the lock now gives the same two answers as the first read, in the same
order.

test_a_copy_ahead_of_npm_that_appears_during_the_wait_is_ahead: the other
launch installs 2.1.285 against a published 2.1.284 while it holds the lock
past this launch's wait. At 9ba858d this is exit 2; here it is `ahead`, and
this launch installs nothing. 73 cases.

Refs opensoft/openBenches#119

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 18:17

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

Relative npm prefixes install successfully but are then rejected as non-absolute candidates.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Normalize relative npm prefixes before installation and validation

claude-current:348

Normalize the configured npm prefix to an absolute path before using it. npm accepts a relative --prefix and installs there, but add_candidate rejects non-absolute paths, so a run with NPM_CONFIG_PREFIX=relative-prefix installs the published version successfully and then exits 1 claiming nothing runnable was produced. claude-restart-check also needs the same normalization so it inspects that installation consistently. Please cover relative environment and .npmrc prefix values.

Copilot AI balanced review requested due to automatic review settings October 4, 2026 14:38
Recheck the binding immediately before window rename after resolver waits. A watchdog timeout stays 124 even when the command traps TERM and exits successfully.

Fixes #152
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

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

The watchdog can exceed its timeout, and a broken newest native executable can hide an older runnable installation.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Signal the command's process group to prevent escaped descendants

claude-current:249

The fallback snapshots $tree before sending TERM, so a TERM handler can spawn a new descendant that is absent from both the grace-period checks and the final KILL loop. That descendant inherits the command-substitution pipe and can keep run_bounded blocked past its deadline; with a 1-second timeout, a handler that ran sleep 10 & exit 0 made this path return only after 11 seconds. Run the bounded command in a dedicated process group and signal the group for both TERM and KILL (with a macOS-compatible implementation), rather than relying on a pre-signal PID snapshot.

Medium severity Skip invalid newest native executable and fall back to older versions

claude-current:419

native_newest selects the highest filename before any --version validation. If that executable is broken or times out while an older native version is runnable, add_candidate drops the selected file and never considers the older one; in offline mode this can incorrectly exit 1 with “no runnable Claude Code.” Select the highest native entry whose bounded --version succeeds (or add all native entries and let candidate selection choose the highest).

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2110ff7b8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread claude-current Resolved
Comment thread lane-start Resolved
@brettheap

Copy link
Copy Markdown
Contributor Author

The two previously missed findings in the current-head Copilot review are tracked as #153 (descendants spawned by TERM handlers) and #154 (falling back from a broken newest native executable), following the repository two-round cap. The timeout-output validation and post-resolution binding recheck are fixed and verified by 457 focused tests. These two additional findings remain follow-ups.

Run the watchdog command in a dedicated process group so TERM-handler children remain covered by the final KILL. Refuse known retired lanes and new-window name collisions before resolver work or a handoff, and recheck those fences after resolution before rename.

Validation: 463 focused tests passed, 411 deselected in 195.30s through tests/run.sh in py-bench.

Fixes #153.
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

Copilot AI balanced review requested due to automatic review settings October 4, 2026 15:08
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@sonarqubecloud

sonarqubecloud Bot commented Oct 4, 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

🔵 Needs a closer look

Restart detection silently fails for sessions launched from a configured custom native directory.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Process detector ignores custom native directory paths

claude-restart-check:209

CLAUDE_CURRENT_NATIVE_DIR is honored when finding installed versions below, but this process detector recognizes only paths containing /claude/versions/. If claude-current launches /custom/native/2.1.283, the walk never identifies that process, so even a newer sibling produces no notice. Match the executable against the configured native directory (canonically, because /proc/.../exe is resolved) and add a running-custom-native regression.

@brettheap

Copy link
Copy Markdown
Contributor Author

The final Copilot custom-native process-detection finding is filed as #155 under the repository two-round cap. The watchdog descendant finding #153 is fixed in 11037f0; #154 remains a separate native-candidate fallback follow-up. All existing review threads are resolved. Final-head Codex requests were refused due to account code-review quota, as disclosed in the PR description.

@brettheap brettheap added the ready landing gate: runs tests-macos once before the squash label Oct 4, 2026
@brettheap
brettheap merged commit daed209 into main Oct 4, 2026
15 checks passed
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 to opensoft/openBenches that referenced this pull request Oct 5, 2026
Archive launch-current-claude, PR-B of #124. It ticks the archive gate (task 2.2: feature 016 and the openRepoTools commands it calls have landed, opensoft/openRepoTools#134 as daed2095), archives the change, verifies every delta by content, rewrites the claude-profile-binary-selection Purpose for the claude-current resolution, and repoints six comment lines to the archived path. It lands on Brett Heap's word "archive the four changes in the ruled order, land when green" (2026-09-30).

Lane: openxfactory-5 (openXfactory-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit to opensoft/openBenches that referenced this pull request Oct 5, 2026
…fteen installables (#134)

Re-vendor openRepoTools at b1015f46, which contains opensoft/openRepoTools#134 (daed2095), with all 15 installables: claude-current and claude-restart-check are new. TOOLS_FILES, the pin file, the Dockerfile COPY and chmod lines and the estate-commands tests all move to 15, and a new test keeps the Dockerfile and the installables list in step. Once the image is rebuilt, a container start stops reinstalling the 2026-09-15 copy over ~/.local/bin. Lands on Brett Heap's word "land workBenches#134 when green" (2026-10-05).

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

Labels

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

Projects

None yet

2 participants