Skip to content

pm-stack(ready-for-agent): failed clone step after npm upgrade loses the pending restart — retry reports the pinned version running while the old process serves (install.sh) #4839

Closed

Description

@dezren39

Finding (from PR review, never addressed)

pm-stack/ready-for-agent/install.sh: if install.sh clone upgrades the pinned npm package but the subsequent Git clone/fetch fails, the script exits (set -e) after npm has already replaced the on-disk binary, while the old process keeps serving. On the next invocation, both on-disk comparisons match — the binary at ~/.local/bin/ready-for-agent reports the pinned version and the unit is unchanged — so the script takes the no-restart path and reports the pinned version as running, even though the still-running old process serves requests. The version checks read the on-disk binary (ready-for-agent --version spawns a fresh process from the new binary), never the serving process, and there is no pending-restart marker, so the failed deployment is silently forgotten.

No-response evidence

  • The thread has the single Codex comment and no replies; GraphQL reviewThreads for PR fix(pm-stack): restart ready-for-agent only on change #4190 (checked this run): the thread is unresolved.
  • PR fix(pm-stack): restart ready-for-agent only on change #4190 had a single commit (95addedd4, 2026-11-02T05:09:06Z, before the comment) and merged 2026-11-02T15:36:34Z (merge commit 58857615c) with no fix commit after the comment.
  • Held under the open-PR 24h grace rule by the pr-comment-review run of 2026-11-02 03:54 CST; grace expired 2026-11-03T05:12:14Z and the PR has since merged unaddressed, so it is filed now.

Still live on current main (verified 2026-11-03 via gh api raw read)

pm-stack/ready-for-agent/install.sh on main:

  • Line 53–58: package_changed is derived solely from the on-disk binary's --version vs PINNED_VERSION.
  • Lines 64–77: the clone step runs after the npm install; a Git failure exits the script before any restart.
  • Lines 101–108: when neither package nor unit changed, the script prints "no package or unit changes detected; leaving ready-for-agent.service running" (service_action=unchanged) — no check that the running process corresponds to the installed package, and no pending-restart state anywhere in the script.
  • Lines 135–150: the "unchanged" verification path marks the process verified unconditionally and again reads the version from the on-disk binary, then reports ready-for-agent@<pinned> is already running (no restart).

Dedupe: gh issue list --state all searches (ready-for-agent install pending restart / install.sh restart / 4190) found no issue tracking this residual failure mode. Related but distinct: issue #2513 (closed — install.sh never restarted at all; PR #4190 was its fix, and this finding is a hole in that fix), issue #1150 / #1332 (aggregator install.sh, a different script).

Acceptance criteria

  • A deployment that changes the installed package but fails before the restart completes is not forgotten: a later install.sh run restarts the service (e.g. a pending-restart marker written when the package changes and cleared only after a verified restart), or the no-op path verifies the running process actually corresponds to the installed package before reporting success.
  • A regression case in the stubbed harness covers the sequence: npm succeeds, Git clone/fetch fails, retry succeeds without a service PID change must no longer be reported as the pinned version running.
  • Or: a documented decision on this issue explaining why this failure sequence is accepted, stated explicitly.

Found by the pr-comment-review job from an unaddressed PR review comment.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 3, 2026
  2. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 3, 2026
  4. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Agent note — picked up (queue task 7066, openchamber-scheduled-lane, 2026-11-03)

    Claimed as small_fix. Revalidated: issue OPEN, PR #4190 merged unaddressed, no other agent owns this. Plan: pending-restart marker in pm-stack/ready-for-agent/install.sh (written on package change, cleared only after verified restart) + regression case in test-install.sh for the npm-ok / git-fail / retry sequence. Worktree + branch next.

  5. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1

    Transition: triage complete (task 7049)
    Worker: repo-worker-code (lane code-f, direct execution lane)

    Triage verdict — task 7049, fresh check 2026-11-03

    • CONFIRMED at current main 1e3763faf. In pm-stack/ready-for-agent/install.sh: package_changed is derived solely from the on-disk binary's --version vs PINNED_VERSION (~lines 48–58); the clone step runs after the npm install and a git failure exits under set -e before any restart (~lines 64–77); on the unchanged path the verification loop marks an active, unchanged service's process verified unconditionally, reads the version from the on-disk binary, and reports ready-for-agent@<pinned> is already running (no restart) (~lines 101–150). A search of the script finds no pending-restart state anywhere. The filed sequence reproduces by inspection exactly as the Codex P2 on PR fix(pm-stack): restart ready-for-agent only on change #4190 (discussion r4439108345) described: npm upgrade succeeds → clone fails → old process keeps serving → retry reports the pinned version running.
    • No competing or duplicate work: PR fix(pm-stack): restart ready-for-agent only on change #4190 merged 2026-11-02 with that thread unresolved; the stubbed harness pm-stack/ready-for-agent/test-install.sh (isolated HOME, stubbed systemctl/npm/curl) exists and is the regression case's home.
    • Follow-up enqueued: task 7066 (small_fix) — pending-restart marker written on package change and cleared only after a verified restart (or equivalent running-process verification on the no-op path), plus the harness regression case for npm-ok / git-fail / retry-without-PID-change. It has already been claimed by another lane. Packet: packet-task7049-fix4839.json in the goal's hidden_files.
    • This issue stays OPEN for task 7066 to close. My triage claim labels are removed per protocol; the claiming worker for task 7066 re-stamps its own.
    • Checks the follow-up must run: bash pm-stack/ready-for-agent/test-install.sh (all cases incl. the new regression) on the laptop worktree or in CI, plus bash -n on install.sh.
  6. 4 remaining items

  7. added
    work/assignedQueue worker lifecycle state
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 3, 2026
  8. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Agent note — parked (queue task 7066, openchamber-scheduled-lane, 2026-11-03)

    Parked 20 minutes: PR #4844 is open and checks have not reported beyond CodeRabbit skip. Resume condition: read PR/check state fresh; merge only if green and diff/tests verified, otherwise continue diagnosis. Worktree/branch retained at ~/git/fleet/7066-4839-pending-restart, queue/7066-4839-pending-restart.

  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 3, 2026
  10. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    🤖 Agent note · done (fix merged)

    Verification (fresh, 2026-11-03)

    • CI re-read: no GitHub Actions workflow triggers on pull_request for pm-stack/** (pm-stack-tests.yml is push-to-main + dispatch only), so the "CI pending" park reason could never resolve — nothing was ever pending. Reported checks: CodeRabbit neutral; Codex review "failed" = usage-limit error, no substantive findings. mergeStateStatus: CLEAN, mergeable: MERGEABLE.
    • Diff reviewed (queue/7066-4839-pending-restart @ b85c3eb vs base): pending-restart marker written after npm upgrade before the clone step can fail; forces service_changed on retry; cleared only in the verified restart/start success branch; no-op path untouched otherwise. Matches triage intent.
    • Targeted tests run on laptop worktree: bash -n install.sh clean; test-install.sh 6/6 PASS incl. new clone-fail-retry (marker written on failed run, retry restarts, no false no-op report, marker cleared).
    • No conflicts: main untouched those files since PR base; no held/Drew-owned labels.
  11. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    Verified: PR #4844 MERGED (merge commit 74064cb, landed by task 7066); issue #4839 auto-closed 2026-11-03T10:47:06Z. Task 7398 completed with outcome already_done.

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

    app/pm-stackpm-stack (Pad/Grist) in developing-today/codekind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions