Skip to content

Prove six-worker harness stall diagnosis - #3942

Merged
Sinity merged 3 commits into
masterfrom
feature/test/close-harness-stall
Aug 11, 2026
Merged

Prove six-worker harness stall diagnosis#3942
Sinity merged 3 commits into
masterfrom
feature/test/close-harness-stall

Conversation

@Sinity

@Sinity Sinity commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • complete the final controlled xdist-stall proof for the test-harness Bead
  • record the parent Bead closure against the exact current Beads snapshot

Problem

The resource harness had in-process worker identity support and typed all-worker stall logic, but lacked a controlled six-worker regression proving that post-exec worker identities are sufficient for the terminal diagnosis. The parent Bead was therefore kept open after exact-head review rather than being closed on the earlier implementation evidence.

Solution

Add a controlled six-worker sampler fixture with six session_started worker receipts and D-state process observations. The fixture proves complete worker observation, typed stall diagnosis only after the configured interval, and compatibility with the existing partial-observation fail-closed behavior. The Beads export closes the parent and its three named residual successors; this is harness implementation/verification scope only.

Verification

  • devtools test tests/unit/devtools/test_verify.py -k 'six_worker_d_state_fixture or resource_sampler_resolves_worker_identity' — 2 passed
  • devtools verify --quick — 25/25 steps passed
  • No green full-suite or production reindex is claimed.

Summary by CodeRabbit

  • Bug Fixes

    • Improved diagnostics for scenarios where multiple test workers become unresponsive, including clearer identification of SQLite or filesystem-related stalls.
    • Updated incident-tracking records to reflect completed recovery and fail-safe handling.
  • Tests

    • Added regression coverage for detecting six simultaneously stalled workers.
    • Refreshed test fixture verification data to keep incident-recovery checks accurate.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds regression coverage for six pytest-xdist workers in uninterruptible D state, updates a campaign snapshot hash, and records closure metadata for two completed issues.

Changes

xdist stall follow-up

Layer / File(s) Summary
Six-worker stall regression coverage
tests/unit/devtools/test_verify.py, tests/fixtures/reindex_incident_coverage/campaign_graph.json
The test simulates six D-state workers and verifies stalled-worker sampling and the typed 30-second diagnosis. The fixture uses a new source snapshot hash.
Issue closure records
.beads/issues.jsonl
The worker-discovery and fail-safe harness issues now include closed status, completion metadata, rationale, and evidence.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: proving six-worker harness stall diagnosis.
Description check ✅ Passed The description covers the required summary, problem, solution, verification, and bead disposition details; omitted changelog and risks sections are optional here.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/close-harness-stall

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/fixtures/reindex_incident_coverage/campaign_graph.json`:
- Line 4: Update the source_snapshot_sha256 value in campaign_graph.json to
4952994decfd523ce773249e90c4e6e9f54b1597f462552e0292facc732190b1, preserving the
surrounding fixture content.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 90c6b0d2-9b49-45df-a73e-bf8450b34ef4

📥 Commits

Reviewing files that changed from the base of the PR and between 2518213 and ee93e8d.

📒 Files selected for processing (3)
  • .beads/issues.jsonl
  • tests/fixtures/reindex_incident_coverage/campaign_graph.json
  • tests/unit/devtools/test_verify.py

"schema_version": 1,
"source_commit": "12618c007a987b227e73cfc9e4f462dcaa669914",
"source_snapshot_sha256": "767d60ce405c65d6fa19a8302c6a6920f054ca8be6adbfaca1d0c88444b9b424",
"source_snapshot_sha256": "2ff286443fd3f2b4b08e16c22d39162b68ca601752bab3ce57290d4bc37abf99",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

graph='tests/fixtures/reindex_incident_coverage/campaign_graph.json'
commit="$(jq -r '.source_commit' "$graph")"
source_path="$(jq -r '.source_path' "$graph")"
expected="$(jq -r '.source_snapshot_sha256' "$graph")"
actual="$(git show "${commit}:${source_path}" | sha256sum | cut -d' ' -f1)"

printf 'expected=%s\nactual=%s\n' "$expected" "$actual"
test "$actual" = "$expected"

Repository: Sinity/polylogue

Length of output: 300


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

graph='tests/fixtures/reindex_incident_coverage/campaign_graph.json'
commit="$(jq -r '.source_commit' "$graph")"
source_path="$(jq -r '.source_path' "$graph")"
expected="$(jq -r '.source_snapshot_sha256' "$graph")"

printf 'commit=%s\nsource_path=%s\nexpected=%s\n' "$commit" "$source_path" "$expected"
git cat-file -e "${commit}^{commit}"
git cat-file -e "${commit}:${source_path}"

git show "${commit}:${source_path}" > /tmp/source_snapshot.bin
actual="$(sha256sum /tmp/source_snapshot.bin | cut -d' ' -f1)"
printf 'actual=%s\n' "$actual"

printf '\nCurrent fixture fields:\n'
sed -n '1,8p' "$graph"
printf '\nSource object metadata:\n'
git cat-file -s "${commit}:${source_path}"
file /tmp/source_snapshot.bin

test "$actual" = "$expected"

Repository: Sinity/polylogue

Length of output: 779


Update source_snapshot_sha256.

The exact bytes of .beads/issues.jsonl at source_commit hash to 4952994decfd523ce773249e90c4e6e9f54b1597f462552e0292facc732190b1, not the recorded value. Set line 4 to this hash.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/fixtures/reindex_incident_coverage/campaign_graph.json` at line 4,
Update the source_snapshot_sha256 value in campaign_graph.json to
4952994decfd523ce773249e90c4e6e9f54b1597f462552e0292facc732190b1, preserving the
surrounding fixture content.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee93e8d248

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1453 to +1455
assert sample["xdist_worker_count"] == 6
assert sample["xdist_uninterruptible_count"] == 6
reason = xdist_uninterruptible_stall_reason(sample, started_at=10.0, now=40.1, timeout_s=30.0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind the stall decision to the expected worker count

When one of the six session_started receipts is missing or unreadable, ResourceSampler observes five workers, reports five uninterruptible workers, and sets all_xdist_workers_uninterruptible=True; the stall helper can then terminate the run even if the unobserved sixth worker is still progressing. This fixture creates all six receipts, while the existing partial test manually supplies a false flag, so neither exercises that partial-observation failure and the commit closes AC4 prematurely. Pass the configured xdist worker count into the decision and add a five-of-six sampler/termination regression before closing the bead.

AGENTS.md reference: AGENTS.md:L480-L482

Useful? React with 👍 / 👎.


assert sample["xdist_worker_count"] == 6
assert sample["xdist_uninterruptible_count"] == 6
reason = xdist_uninterruptible_stall_reason(sample, started_at=10.0, now=40.1, timeout_s=30.0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drive the D-state case through the supervisor

If _run stops sampling D-state workers or fails to pass this reason to _request_supervisor_termination, this test still passes because it invokes the pure classifier directly and never exercises the monitor loop, subprocess containment, or terminal receipt. Removing the production D-state branch would therefore leave this claimed proof green, so it does not establish the typed owned-process-group termination named in the bead and its close reason. Add an _run-level controlled regression that asserts the return code, typed termination reason, containment signals, and terminated receipt, or leave that acceptance scope open.

AGENTS.md reference: AGENTS.md:L477-L482

Useful? React with 👍 / 👎.

Comment on lines +1445 to +1447
env={
"POLYLOGUE_PYTEST_BASETEMP_ROOT": str(tmp_path),
"POLYLOGUE_PYTEST_EVENTS_DIR": str(events),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Read progress from the per-run events directory

In a real _run(..., run=VerifyRun(...)), env_for_pytest_step directs the plugin to the step-specific artifacts.events_dir, but _read_latest_pytest_event() monitors only the global current-events directory/path, which are copied or merged after the subprocess finishes. This test passes that per-run directory directly to ResourceSampler, so it misses that the live supervisor never observes worker test-progress events: with controller output flowing, seen_any_progress_event remains false and the progress-stall detector cannot fire, while the D-state timer cannot be checked against actual progress age. Thread the active artifacts directory into the progress reader and cover the real route before closing the acceptance scope.

AGENTS.md reference: AGENTS.md:L480-L482

Useful? React with 👍 / 👎.

@Sinity
Sinity merged commit 678c791 into master Aug 11, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the feature/test/close-harness-stall branch August 11, 2026 01:00
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