← Back to Pull requests

Reap verify containers whose checkout is gone or whose vite stopped, and restart a dead watchdog (#3210) #3324

Closed
unknown closed this pull request without merging on Oct 23, 2026 21:49 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 20:39 UTC
Author

Fixes #3210.

Summary

A verify Postgres or Mailpit container was removed only by its own checkout's down.sh. A deleted worktree, a killed watchdog, or a run that ended without down.sh left it running, and the container's name, a hash of a path that may no longer exist, gave nothing a way to find it again. The containers already carry ployz.verify.checkout=<worktree>. The new scripts/verify/reap.sh uses that label, and every up.sh runs it first.

reap.sh, for each container labelled ployz.verify.checkout (by id, never name)
  checkout not fully visible            → keep           (unmounted, or a directory this user may not enter)
  younger than VERIFY_REAP_GRACE (600s) → keep           (its up.sh may still be starting vite)
  checkout's dashboard gone             → docker rm      "its checkout … is gone"
  vite.pid runs vite in this checkout   → keep; name it if its idle watchdog died
  vite.pid runs vite, cwd unreadable    → keep
  otherwise                             → docker rm      "no vite runs for …"
VERIFY_REAP_DRY=1 → only lists what it would remove

  • By id: a checkout's up.sh can replace its container under the same name while a reaper runs.

  • Whose vite: a pid a dead instance left may since belong to another process, or to another checkout's vite, so vite counts only when its command line is vite's and its working directory is this checkout's dashboard.

  • A live instance whose watchdog died is kept and named, not restarted. Restarting it from another checkout's up.sh raced that checkout's own up.sh and other reapers in every form tried (a lock, stale-lock recovery, self-checking watchdogs). Only a checkout's own up.sh starts its watchdog, as before. That instance is live, not leaked: its own up.sh or down.sh restores or stops it, and once its checkout is deleted this reaps it.
  • Additive: dev tooling only. up.sh gains one call; idle.sh and down.sh are unchanged. No new daemon, and nothing in Cloud or the Engine changes.

    Bets touched: none (dev scripts). New refusal: none.

    Not covered: processes orphaned with a deleted checkout (the issue's ppid-1 worker) aren't killed. Their containers are removed; their pid files went with the checkout, and matching them by command line risks other checkouts' processes.

    Evidence

    tools/verify/reap.test.ts runs the real reap.sh against temporary checkouts, stand-in vite processes and a stub docker that records removals by id. It has 11 cases:

  • a checkout that is gone: removed by id once past the grace; a young one kept;

  • a checkout whose parent this host can't see, or that it may not enter: kept;

  • a stopped vite, or a vite pid now held by another process or another checkout's vite: removed;

  • a live instance with a dead watchdog: kept, named, nothing started;

  • an instance still starting, and an unlabelled container: kept;

  • VERIFY_REAP_DRY=1: lists and removes nothing;

  • up.sh calls reap.sh before its first docker run.
  • Before: all fail; reap.sh doesn't exist.

  • After: 11/11 pass. shellcheck reap.sh and lint are clean.

  • On the shared host, VERIFY_REAP_DRY=1 scripts/verify/reap.sh listed nothing.
  • Merge Danger

    Door: two-way

    Blast Radius: verify tooling

    Every up.sh can now remove another checkout's verify container, but only one at least 10 minutes old whose checkout is gone or runs no vite of its own.

    Diff: 429 lines (+321 / -108) across 5 files Reviewer: nick-potts Review duration: 70m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 429 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.363
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3324"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.1% (MEDIUM) · Higher = larger blast radius
    45.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.8% · Safe to merge
    17.8%
    Repository