Skip to content

Fix two cluster test flakes: prelude cancel race and record lock race - #1743

Merged
davidtai merged 3 commits into
devfrom
fix/cluster-test-flakes
Nov 3, 2026
Merged

davidtai merged 3 commits into
devfrom
fix/cluster-test-flakes

Conversation

@davidtai

@davidtai davidtai commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

This PR fixes two flaky tests on dev.

focused-PreludeChecks: "child did not finish its asserted path"

  • Cause: the transcript-mismatch group cancels the rank 1 owner socket right after it refuses rank 0. Rank 1 writes its completion packet only after it reads the peer confirmation. When the cancel came first, the shutdown failed that write and the child exited with status 1.
  • Fix (test): the owner reads the rank 1 completion before it cancels. This waits on the real condition. The rank 0 refusal assertion does not change.
  • Children now inherit stderr, so a failing child prints its own failure in the log.

ClusterServiceRecoveryTests.plannedStopWaitsForOwnedServiceChildBeforePeerAndRetainsFailureIntent (timeout retry)

  • Cause: the service writes service-status.json and then, in the same supervision tick, clears stop drain A with updateRecord. The record lock was one non-blocking flock. A stop request that came in that window failed with "could not save the stop request", and the peer was never asked to stop.
  • The defect is in production, not in the test. After a local timeout, the stop message tells the operator to run darkbloom cluster stop again. That second stop meets the same service write.
  • Fix: ClusterSetupStore.updateRecord polls the record lock for up to 2 s. Each holder only reads, changes and writes the record, so a held lock is a write in progress. Other withLock and update callers keep one attempt.
  • New test: a record write waits for another holder of the lock. A lock held past the bound still gives .busy.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

PreludeChecks: the transcript-mismatch group cancelled rank 1's owner
socket right after it refused rank 0. Rank 1 writes its completion only
after it reads the peer confirmation, so a cancel that came first shut
the socket under that write and the child exited 1. The owner now reads
rank 1's completion before it cancels. Children inherit stderr, so a
failing child names its own failure.

ClusterSetupStore.updateRecord: the record lock was a single
non-blocking flock. The service clears a stop drain in the same
supervision tick that publishes child.running=false, so a stop request
at that moment failed with "could not save the stop request". An
operator who runs `darkbloom cluster stop` again after a timeout hits
the same window. Record writes now poll the lock for up to 2 s. Other
callers of withLock and update keep the single attempt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Error Error Nov 3, 2026 6:01pm UTC
d-inference-console-ui-dev Error Error Nov 3, 2026 6:01pm UTC
d-inference-landing Ready Ready Preview Nov 3, 2026 6:01pm UTC
darkbloom-status Ready Ready Preview Nov 3, 2026 6:01pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 3, 2026 6:01pm UTC

Request Review

- ClusterService.publish(afterSupervision:) clears the stop drain while
  it holds the service lock. It now tries the record lock once and waits
  for the next tick when the record is busy, so the service lock is
  never held for the 2 s wait.
- withLock polls only while flock reports EWOULDBLOCK or EINTR.
- The new test closes its descriptor only after the scheduled unlock.
- PreludeChecks: a failing child prints its mode and rank; the summary
  counts 11 children.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch had an error being deployed

2 failed and 3 active deployments
Preview – darkbloom-status — 3aa8535f Deployed Nov 3, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 3aa8535f Deployed Nov 3, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 3aa8535f Deployed Nov 3, 2026 by vercel[bot]
Preview – d-inference-landing — 3aa8535f Deployed Nov 3, 2026 by vercel[bot]
Preview – d-inference — 3aa8535f Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant