Skip to content

Notice a reservation whose owning process has died #1959

Closed

Description

@JacobStephens2

This was generated by AI during triage.

From a 2026-11-10 investigation of why the Fix run Pass never repaired the Merge conflicts on #1823 and #1935.

Agent Brief

Category: enhancement
Summary: An origin reservation whose owning process has died stays held until someone notices and releases it by hand. The host that took it can tell for certain that its owner is gone, so thirdshift should notice too.

Current behavior:

Reservations (refs/heads/thirdshift/pickup/<n>, refs/heads/thirdshift/pickup/ci-red, refs/thirdshift/reservations/<PR>) are commits whose message records Host:, Launch:, Process: and Started: (take_ref in src/reservation.rs). After a crash, docs/guide.md tells the Day shift to confirm the owner stopped, then delete the ref with an exact --force-with-lease. ADR 0017 and the guide say: "Never delete a live owner's reservation or remove one on a timer."

Nothing tells the Day shift that a reservation is orphaned. On 2026-11-10 the fleet had three:

  • thirdshift/pickup/ci-red: Host stephens, Process 966509, Started 2026-10-30 14:21 UTC. The process was gone, and stephens had been up since 2026-10-26, so the PID had not been reused. Held for 11 days, it skipped every Fix run Pass in the fleet and stopped Pickup filing CI-red Tickets.
  • thirdshift/pickup/1821 and thirdshift/pickup/1901, left by Commands that died.

Desired behavior:

The host named in a reservation's Host: can prove its owner stopped: no process with that PID, or a process with that PID that started after the reservation's Started: time (or the host booted after it). That is liveness evidence, not a timer, so it doesn't contradict ADR 0017.

Pick one response during triage (or both):

  1. Surface it: the Console shows an orphaned reservation in Needs you: the ref, its owner, how long it has been held, what it is blocking (e.g. "Fix run Passes on JacobStephens2/thirdshift skip while this is held"), and the exact release command with the observed SHA filled in.
  2. Release it: the owning host releases its own orphaned reservation with an exact lease on the observed SHA, and logs that it did. Other hosts never release a reservation they don't own.

Key interfaces:

  • src/reservation.rs: parse a reservation's owner fields; a liveness check that runs only on the owning host.
  • Console Needs you (option 1) and/or a Pass's startup (option 2).
  • ADR 0017 and docs/guide.md: say when a reservation counts as orphaned, and what thirdshift does about it.

Acceptance criteria:

  • A reservation whose Host: is this machine and whose Process: is not running, or is running but started after the reservation's Started:, is reported as orphaned. It is released only if option 2 is chosen.
  • A reservation owned by a live process is never reported or released.
  • A reservation owned by another host, or with no Host: field, is never released by this host.
  • Release uses --force-with-lease with the observed SHA, so a reservation retaken in between is left alone.
  • Covered for issue, ci-red and PR reservations.

Out of scope:

  • Timer-based expiry.
  • The Fix run Pass skipping its PR search when ci-red is held (separate issue).

Activity

  1. added
    needs-triage
    in-progress
    and removed
    needs-triage
    on Nov 10, 2026
  2. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation summary

    Investigated #1959 against selected Base branch main at 960513a. The recovery gap is confirmed; the historical fleet incidents remain supplied evidence, not independently verified observations.

    Confirmed behavior

    • src/reservation.rs:62 creates an empty-tree reservation commit containing Host, Launch, Process and Started. Acquisition never adopts or expires an existing reservation. Only the holding object's Drop releases it, using an exact lease against its token (line 118).
    • tests/pickup_run.rs:969 reproduces an uncertain successful push: the first Command exits, its reservation remains, and the next Pickup skips without dispatching. This covers a reservation surviving its originating Command without requiring a production crash.
    • tests/pickup_run/base_ci.rs:452 confirms an occupied ci-red reservation suppresses CI reporting while ordinary Pickup dispatch continues. src/fix/base_ci.rs:22 currently ends an unscoped Fix Pass when that reservation is occupied; changing that behavior belongs to A held CI-red reservation skips the whole Fix run Pass, not just its Base branch CI step #1958.
    • src/review/reservation.rs:22 acquires both the numbered legacy ref and refs/thirdshift/reservations/. Inspection must cover both, plus ci-red.
    • src/logs/reading.rs:172 and src/logs/reading/inbox.rs:457 build Inbox rows from retained Command records and history. They do not inventory origin reservations. A reservation can survive before any work is recorded, so existing Died rows are insufficient.

    Recommended direction

    Choose option 1 first: surface reservations with local evidence of a dead owner, their observed SHA, owner fields, age, blocked work and an exact release command. Keep automatic deletion, Claim recovery and continuation outside this change. ADR 0017 and docs/guide.md:3751 currently require human recovery; preserve the prohibition on timer-based release.

    The requested certainty needs a defined ownership contract. src/host.rs records only the OS hostname, which does not establish uniqueness or a shared PID namespace. Started is wall-clock time. Command records already use boot ID plus native process-start ticks (src/logs/process_identity.rs:35), but reservations do not. Also, that helper returns None for read failures as well as dead processes, so None must not become proof of death. Missing, unknown, foreign or ambiguous ownership and unreadable process data must remain uncertain rather than be classified as orphaned.

    Validation

    All 10 tests selected by cargo test --test pickup_run reservation -- --test-threads=2 passed, including legacy-owner protection, uncertain-push retention, CI exclusion and changed-ref preservation. The PR test selected by cargo test --test fix_pass busy_origin_reservations_are_passed_over_and_all_busy_is_a_skip -- --exact passed. scripts/affected-tests main reported no changed files and no affected tests. Git status is clean.

    No duplicate was found among open issues searched for reservation and orphan. #710 concerns dead Claims; #1960 concerns sustained Pass skips. Both are related but distinct. Keep this issue open for the ownership decision and proposed split below.

    Questionnaire

    For the Day shift shaping #1959:

    The repository confirms that origin reservations survive their Command and have no dedicated Needs you observation. I recommend surfacing them first, with manual exact-lease recovery, while leaving automatic release out of scope.

    1. Approve shaping this as a Spec with two dependent Tickets: A — shared origin reservation inventory, conservative owner classification and Pass diagnostics with exact release guidance; B — blocked by A, expose the observations in Console Needs you and shared status output, including reservations without Command records, and document recovery. Both must cover numbered issue/legacy PR refs, ci-red and PR reservation refs. This establishes reviewable implementation scope without combining Claim recovery or A held CI-red reservation skips the whole Fix run Pass, not just its Base branch CI step #1958.
    2. What ownership contract should the detector require? Recommended: record native boot/process-start identity for new reservations, treat failed probes as unknown, and retain a conservative fallback for existing Host/Process/Started records. Confirm whether OS hostnames are guaranteed unique and Commands share the inspecting process's PID namespace; otherwise decide how stable machine identity will be established. This determines when a local observation can safely be called orphaned rather than suspected.
    3. Approve a bounded refresh over known Launch directories, with unavailable origins shown as unavailable rather than healthy, and reservation warnings remaining visible until a fresh observation shows the reservation gone, replaced or no longer orphaned. Should these warnings permit Dismissal while the same reservation still blocks work? This settles discovery and Inbox lifetime independently of Command-record retention.
  3. added
    enhancement
    ready-for-human
    and removed
    in-progress
    on Nov 11, 2026
  4. JacobStephens2 commented on Nov 11, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Moved to ready-for-human for a grill with the Day shift, not a machine triage. The brief in the body stands, but it leaves open decisions that need Day shift judgment:

    • Surface an orphaned reservation in Needs you, release it on the owning host automatically, or both.
    • Whether host-local liveness evidence (PID gone, or PID or boot newer than Started:) fits ADR 0017's "never remove one on a timer", or needs an ADR of its own.
    • Whether a reservation with no Host: field, or one from a host that has been retired, ever gets a path other than release by hand.
  5. JacobStephens2 commented on Nov 17, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Second occurrence: ci-red held 5 days, 2026-11-12 to 2026-11-17

    The same orphaned-reservation shape as the 2026-11-10 case in the brief, on a different host. A duplicate report was about to be filed; this comment adds that evidence here instead.

    • Ref: refs/heads/thirdshift/pickup/ci-red at 340a954b3a2da98f4e0a4b26bd0c9248f56f6245 ("thirdshift Pickup reservation for CI-red Ticket filing").
    • Owner fields: Host thirdshift, Launch /home/jacob/repos/thirdshift, Process 201924, Started 2026-11-12 22:17:03 UTC.
    • Liveness evidence on the owning host: ps -p 201924 found no process on 2026-11-17, and the host had been up since 2026-09-15, so the PID was not reused. This meets the brief's "provably gone" test.
    • What it blocked: from 2026-11-12 on, every thirdshift fix base main Pass on JacobStephens2/thirdshift, on 4 hosts (every 10, 15, 15 and 20 minutes), logged Base branch CI step skipped: Base branch CI is reserved on origin. When main went red at c58b4bfc on 2026-11-17 (CI run 44088645739; the flaky api::release_url_keeps_api_openapi_and_cli_parity), no Pass gave it the one failed-jobs re-run or a CI-fix. It surfaced only because the maintainer saw red main and asked why the crons weren't handling it.
    • Release: done by hand on 2026-11-17 with the exact lease the guide prescribes (--force-with-lease=refs/heads/thirdshift/pickup/ci-red:340a954b…).

    For the open decision: this is the second fleet-wide stall from ci-red alone, for 11 days and then 5. Both times the only sign was a skip line repeated in Activity logs. #1960 (show how long a Pass has been skipping, and why) would have surfaced it within hours under either option.

  6. JacobStephens2 commented on Nov 17, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Decisions (Day shift, 2026-11-17)

    The three open questions from the ready-for-human move are settled:

    1. Both. The owning host releases its own orphaned reservation automatically, and the Console shows in Needs you the reservations no host can release.
    2. A new ADR extends ADR 0017 rather than amending it. "Never remove a reservation on a timer" still stands, and proof of death on the owning host is written down as its one exception.
    3. Release by hand stays for a reservation with no Host: field, or one whose host can't check it (retired, or never runs a Pass on that repository). It is listed in Needs you with the release command filled in, and never removed automatically.

    Agent Brief

    Category: enhancement
    Summary: A host releases the origin reservations it took whose process has provably died, and the Console lists any reservation that can only be released by hand.

    Current behavior:

    Reservations (issue refs/heads/thirdshift/pickup/<n>, refs/heads/thirdshift/pickup/ci-red, PR refs/thirdshift/reservations/<n>, and the Release run's refs/thirdshift/reservations/release) are empty-tree commits whose message records Host:, Launch:, Process: and Started:. Only the holder's own Drop releases one, with an exact lease on its token. When the holder dies without running Drop, the reservation stays until the Day shift notices and deletes it by hand. Nothing reports it. ci-red has stalled Base branch CI repair across the fleet twice: 11 days from 2026-10-30, and 5 days from 2026-11-12 (evidence in the comments above).

    Desired behavior:

    • Orphan test, run only on the host whose name matches the reservation's Host: (the same name thirdshift records there). The reservation is orphaned when no process has its Process: ID, or that process started after Started:, or the host booted after Started:. Anything else, including a failure to read process or boot times, counts as alive.
    • Automatic release: before choosing work, each scheduled Pass (Pickup, Fix, Review, Triage, Architect, Security, Release) lists the repository's reservations on origin. It runs the orphan test on those naming this host, and releases each orphan with --force-with-lease=<ref>:<observed sha>. A release adds an Activity log line and a stderr line naming the ref, its Process: and Started:, and what it had been blocking. A failed or lost lease (retaken in between) leaves the ref alone and logs a warning. The Pass then carries on normally, so a Pass that frees ci-red can go on to its Base branch CI step in the same run.
    • Needs you: when a Pass is skipped because of a reservation it can't test (another host's, or one with no Host:), and that reservation's Started: is more than 24 hours old, the Console shows a Needs you row for it. The row shows the ref, its owner fields, how long it has been held, what it is blocking (for example "Fix run Passes on skip their Base branch CI step"), and the exact release command with the observed SHA filled in. The row clears once the ref is gone or its SHA changes. The 24 hours only decides when to report; nothing is removed on a timer. Dismissing the row follows the usual Needs you rules.
    • ADR: a new ADR, building on ADR 0017, records the proof-of-death exception, why it isn't a timer, and the release-by-hand rule for reservations no host can test. The user manual's crash-recovery text for reservations (where it says the Day shift must confirm the owner stopped) describes the automatic release, the Needs you row, and when it is still the Day shift's job.

    Key interfaces:

    • The reservation commit message: parse Host:, Process: and Started: into an owner record. Old reservations missing a field still parse, as untestable.
    • Process liveness and start time, and host boot time: Linux (/proc) and macOS, the platforms thirdshift runs Passes on.
    • The Pass startup path, shared by every scheduled Pass, where releases happen before work is chosen.
    • Console Needs you: a new row kind for a reservation that can only be released by hand.

    Acceptance criteria:

    • A Pass on host H releases a reservation naming H whose Process: doesn't exist, using the observed-SHA lease, and logs it. Covered for issue, ci-red, PR and Release reservations.
    • It also releases one whose Process: exists but started after Started:, and one taken before H's last boot.
    • A reservation whose process is alive and started before Started: is never released or reported.
    • A reservation naming another host, or with no Host:, is never released by H, and an unreadable process or boot time counts as alive.
    • If origin's ref moved between listing and release, the release fails its lease, leaves the ref alone and logs a warning.
    • A Fix Pass that releases an orphaned ci-red proceeds to its Base branch CI step in the same run.
    • An untestable reservation older than 24 hours that skipped a Pass shows one Needs you row with the filled-in release command, and the row clears when the ref is deleted or its SHA changes.
    • The new ADR and the updated user manual text are in the same pull request.

    Out of scope:

  7. added
    ready-for-agent
    in-progress
    and removed
    ready-for-human
    ready-for-agent
    on Nov 17, 2026
  8. removed
    in-progress
    on Nov 17, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions