Skip to content

lane-start: a reader that stops early, under set -euo pipefail, can end lane-start with no message, or take the minted-transcript branch for a session it has recorded (the shape of #280) #281

Open

Description

@brettheap

What happens

lane-start runs under set -euo pipefail. In several places it pipes printf '%s\n' "$multi_line_value" into a reader that stops early (awk … exit, grep -q).

  • Bash's builtin printf writes a multi-line value one line per write.
  • So once the reader has exited, the next write can get SIGPIPE.
  • Under pipefail, the pipeline's status is then 141.

Line numbers below are at 21e0829.

  • A silent stop. lane-start:1254, :1519, :1520 and :3168-3179 (12 lines) are plain statements of the form x="$(printf '%s\n' "$multi_line" | awk … exit)". A 141 there makes errexit end lane-start with no message.
    • :1254 and :1519-1520 run before anything is changed.
    • :3168-3179 run after the window rename (:2647) and before the first register write (:3819). Nothing undoes the rename on exit, so the window stays renamed, with no row and no log line.
    • Measured: 1 in 12,000 substitutions with an awk that returns at the first record, on a 14-line value. With plain mawk, which reads to the end of input, it was 0 in 12,000.
  • The wrong branch at :2156. The line is elif printf '%s\n' "$session_ids" | grep -qx -F -- "$win_sid". grep -q stops at the first match, so a 141 makes the condition false although the uuid is recorded.
    • Measured: 2 in 5,000, with at least three ids and the wanted one first.
    • When it is reached: this window's live session is in the lane's session list, but live-holder did not report it as the holder here.
    • What follows: session-lane names this lane, so neither refusal fires, and the "harness minted a new transcript" branch runs (:2190-2193). That branch:
      • prints that note, which is false here;
      • skips the PAUSED-record fallback (:3401);
      • stamps RESUMED by the window's session;
      • appends → harness <uuid>, with the commit text "the harness minted" (:3837-3851). The uuid then appears twice in an append-only cell, and becomes the lane's resume target.
    • Under --no-launch nothing is started.
    • In a launch, it would claude --resume the transcript that is already live in this window. The only check on that path, dup_check … resume-here, skips interactive holders. So two live processes on one transcript are possible (Amendment 18(h)). This consequence comes from reading the code, not from a run.
  • The recovery report at :3680 (lrec_attn, with || var="") can race in principle, because TREES is the second-to-last record (lanes-edit.sh:14381).
    • If it fires, a resumable lane whose trees need attention is reported as quiet, and its LANE RECOVERY report is skipped.
    • Measured: 0 in 5,000. A control that read the first record of the same output hit 2 in 5,000.
    • :3674 (lrec_verdict) cannot race. VERDICT is the last record on every path (lanes-edit.sh:14383, :13862, :13868), and its closing newline is the final write.

Where it is safe

How it was found

The fix

Lane: openRepoTools-3

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions