Skip to content

Flaky: capacity-cleanup-nuke dry-run preview finds no warm device #574

Closed

Description

@V3RON

e2e/capacity-cleanup-nuke.test.ts > capacity, warm pool, cleanup, and nuke > demotes an idle device, previews cleanup without executing on --dry-run, and nuke touches only registry devices

Failed in CI run 38583525243 (PR #567, 7c91b91) at line 190: expected a ready (warm) device for the dry-run preview: expected undefined to be defined. The test sets idle.shutdownAfterMs to 200, so the warm device can be demoted before deviceRows runs. Not reproduced: 10 runs on the feature branch and 10 on main, all green. The feature under review (host load) does not touch capacity or warm-pool paths.

Written by an agent.

Activity

  1. added
    flaky-test
    on Oct 14, 2026
  2. self-assigned this
    on Oct 16, 2026
  3. V3RON commented on Oct 16, 2026

    @V3RON
    ContributorAuthor

    This was generated by AI during triage.

    Handoff

    Done

    Read the report and claimed the issue. Created bug/574-repro from origin/main; no files changed and no reproduction committed.

    Not done

    Reproduce the failure, identify its root cause, and post the triage report.

    Findings

    Delivery preflight found the active checkout at 83534614 and origin/main at 2781a4e4, with differing .claude and .agents workflows. The delivery skill requires a fresh session using the current workflow.

    Blocked on

    A fresh session on current main.

    Written by an agent.

  4. assigned and unassigned on Oct 16, 2026
  5. V3RON commented on Oct 16, 2026

    @V3RON
    ContributorAuthor

    This was generated by AI during triage.

    Reproduction

    The reported assertion reproduces when reclaim is slow. The unchanged file passes both tests; the reproduction adds only a 5,000 ms fake reclaim latency before dryrun-z.

    Branch: bug/574-repro
    File: e2e/capacity-cleanup-nuke.test.ts
    Title: demotes an idle device, previews cleanup without executing on --dry-run, and nuke touches only registry devices
    Command: pnpm test:e2e e2e/capacity-cleanup-nuke.test.ts
    AssertionError: expected a ready (warm) device for the dry-run preview: expected undefined to be defined
    e2e/capacity-cleanup-nuke.test.ts:191
    Tests: 1 failed | 1 passed
    

    Root cause

    Defect in the test setup. releaseAndForget waits for the release reply and holder exit, but neither proves reclaim finished. Its caller immediately searches for a ready device. Release deliberately returns while the device is still reclaiming; ADR 0024 requires that behavior. The 200 ms idle threshold is not needed to explain this reproduction.

    e2e/capacity-cleanup-nuke.test.ts:65–67,188–191
    src/leasing/lease-release-coordinator.ts:99–100,286–310
    docs/internal/adr/0024-leasing-calls-lease-end-participants-before-reclaim.md §1
    

    Simplest fix

    Carry the granted device ID through the helper and wait for that device to become ready before inspecting it and previewing cleanup. Keep the scripted slow reclaim as the regression fixture. Correct nearby claims that release waits for reclaim.

    Alternatives rejected

    • Increase the idle threshold: does not wait for background reclaim.
    • Add a fixed delay: leaves another machine-speed race.
    • Make release await reclaim: changes the intended API behavior.

    Risk

    • Preserve the idle demotion, dry-run proposals and absence of destructive calls, and nuke safety assertions.
    • Wait for the granted device, so another ready device cannot satisfy setup.

    Written by an agent.

  6. removed their assignment
    on Oct 16, 2026
  7. added
    bug:ready
    and removed on Oct 16, 2026
  8. self-assigned this
    on Oct 16, 2026
  9. added a commit that references this issue on Oct 16, 2026
  10. V3RON commented on Oct 16, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #628 (#574)

    Written by an agent.

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

Metadata

Metadata

Assignees

Labels

bug:readyflaky-test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions