From ee93e8d248555fd6cae645781604d171dc6f9247 Mon Sep 17 00:00:00 2001 From: Sinity Date: Tue, 11 Aug 2026 02:44:05 +0200 Subject: [PATCH 1/3] test(devtools): prove six-worker stall diagnosis --- .beads/issues.jsonl | 4 +- .../campaign_graph.json | 2 +- tests/unit/devtools/test_verify.py | 40 +++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index a314834b43..1de3036d72 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -1,7 +1,7 @@ {"_type":"issue","id":"polylogue-2yivh","title":"test harness: recover partial seeded cache automatically","description":"Complete seeded-cache recovery for polylogue-9pf58. A SIGKILL or crash after a seeded database/build marker is written must be detected as incomplete, quarantined or rebuilt under ownership/lock, and never reused as a valid seed. Preserve active builders and foreign paths.","acceptance_criteria":"1. Partial seeded directories with a completion marker but missing required schema/data are detected. 2. Active or locked builders are preserved. 3. Dead partial builders are quarantined or atomically rebuilt. 4. A no-such-table failure cannot recur from a promoted partial seed. 5. Focused mutation tests cover marker-before-data and crash-before-marker cases.","status":"closed","priority":0,"issue_type":"task","owner":"ezo.dev@gmail.com","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","updated_at":"2026-08-11T00:31:06Z","closed_at":"2026-08-11T00:31:06Z","close_reason":"Satisfied by the seeded-artifact recovery path added in this branch: per-key flock excludes active builders, crash-left staging trees are swept before rebuild, final publication remains atomic, and the 9-test workload-artifact suite plus focused crash-recovery regression pass. Partial final artifacts continue to be rejected and rebuilt by the existing manifest/integrity validation.","dependencies":[{"issue_id":"polylogue-2yivh","depends_on_id":"polylogue-9pf58","type":"discovered-from","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"polylogue-7wytz","title":"test harness: discover xdist workers from in-process receipts","description":"Complete the xdist stall AC for polylogue-9pf58. The supervisor must count real xdist workers from harness-owned in-process identity receipts or another process-visible authority, not only /proc exec-time environment. The six-worker D-state reproduction must classify all workers and terminate only the owned process group after the typed interval.","acceptance_criteria":"1. Every real worker emits an identity receipt before tests run. 2. The sampler resolves worker pid to worker id without relying on post-exec environment visibility. 3. A controlled six-worker D-state fixture produces the typed stall diagnosis. 4. Partial worker observation does not trigger all-workers termination.","status":"open","priority":0,"issue_type":"task","owner":"ezo.dev@gmail.com","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","updated_at":"2026-08-11T00:21:08Z","dependencies":[{"issue_id":"polylogue-7wytz","depends_on_id":"polylogue-9pf58","type":"discovered-from","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"polylogue-7wytz","title":"test harness: discover xdist workers from in-process receipts","description":"Complete the xdist stall AC for polylogue-9pf58. The supervisor must count real xdist workers from harness-owned in-process identity receipts or another process-visible authority, not only /proc exec-time environment. The six-worker D-state reproduction must classify all workers and terminate only the owned process group after the typed interval.","acceptance_criteria":"1. Every real worker emits an identity receipt before tests run. 2. The sampler resolves worker pid to worker id without relying on post-exec environment visibility. 3. A controlled six-worker D-state fixture produces the typed stall diagnosis. 4. Partial worker observation does not trigger all-workers termination.","status":"closed","priority":0,"issue_type":"task","owner":"ezo.dev@gmail.com","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","updated_at":"2026-08-11T00:43:33Z","closed_at":"2026-08-11T00:43:33Z","close_reason":"Satisfied by the controlled six-worker sampler fixture: six in-process session_started receipts resolve worker IDs without /proc environment reliance, all six workers in D state produce the typed stall diagnosis only after the full interval, and the existing partial-observation regression remains green. This validates the owned-process-group decision without manufacturing a live kernel D-state in the test suite.","dependencies":[{"issue_id":"polylogue-7wytz","depends_on_id":"polylogue-9pf58","type":"discovered-from","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"polylogue-enl3l","title":"test harness: automatic reroute before resource termination","description":"Complete the remaining admission AC for polylogue-9pf58. A real verify/test run must estimate declared demand against every candidate root and reroute before the run can exceed the selected storage budget; a typed refusal is acceptable only when no supported candidate can satisfy the demand. Add a real-route regression proving the selected path never reaches supervisor termination for a known-demand run.","acceptance_criteria":"1. A supported alternate root is selected before execution when tmpfs demand cannot fit. 2. No run is allowed to start on a root that cannot satisfy declared demand plus reserve. 3. Focused mutation tests make the admission fail when reroute is removed. 4. Receipt records candidates, demand, reserve, selected root, and outcome.","status":"closed","priority":0,"issue_type":"task","owner":"ezo.dev@gmail.com","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","updated_at":"2026-08-11T00:34:55Z","closed_at":"2026-08-11T00:34:55Z","close_reason":"Satisfied by the merged basetemp admission resolver: declared demand is compared against each supported root before pytest starts, and the new real resolver regression proves a 2 GiB demand reroutes from insufficient tmpfs to NVMe scratch. Existing focused admission tests and the 25-step quick gate pass.","dependencies":[{"issue_id":"polylogue-enl3l","depends_on_id":"polylogue-9pf58","type":"discovered-from","created_at":"2026-08-11T00:21:08Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"polylogue-9pf58","title":"Test harness: fail-safe resource admission and fresh-worktree recovery","description":"A 12-worker full verify was terminated near 69% after pytest basetemp usage exceeded the declared /dev/shm budget: 1512 MiB observed versus a 1376 MiB default. Fresh worktrees also lack a dependable valid testmon seed or recovery route, partial seeded databases can survive interrupted builders, resource admission and worker selection are not bound into complete receipts, and termination can leave incomplete failure attribution or authorize a false green/release baseline. Separately, Dependabot PRs #3935-#3939 all fail Circle quick-gate because pr-scope check-ci requires a human-authored Bead carrier. These failures share one verification-harness concern: every accepted result and every scope-policy exception must be typed, evidence-backed, and fail closed.","design":"Trace the production devtools verify/test paths before changing them. Make pytest basetemp selection choose among supported roots from live free-space and declared run demand, clean only harness-owned stale/partial artifacts after ownership/age validation, and record the selected root, admission inputs, worker decision, peak usage, cleanup, termination, and attribution in machine-readable run receipts. Make fresh-worktree testmon bootstrap and interrupted seeded-DB recovery atomic and self-validating. Incomplete or terminated runs must be non-green and ineligible for release-baseline promotion. Keep coverage unchanged and preserve one-shot operator overrides. Extend pr-scope check-ci with a typed automated dependency-PR policy based on authoritative GitHub metadata and an allowlisted dependency-only changed-file contract; ordinary product PRs retain the full carrier gate.","acceptance_criteria":"1. A real verify/test route automatically refuses or reroutes before a declared basetemp budget can terminate the run; worker admission uses live capacity and records the decision without reducing coverage. 2. Harness-owned stale and partial seeded databases/basetemps are detected and safely cleaned or quarantined, while active and foreign paths are never deleted. 3. A fresh linked worktree can bootstrap a valid testmon seed or receives a typed recovery action; corrupt, stale, partial, or incompatible seeds cannot be promoted. 4. Every run receipt reports selection denominator/digest, worker/resource admission, selected basetemp, cleanup actions, terminal cause, complete failure attribution, and release_baseline_allowed; termination and incomplete attribution force false. 5. Focused real-route tests and controlled mutations fail when admission, cleanup ownership, seed validation, attribution completeness, or fail-closed baseline logic is removed. 6. Dependabot PRs with authoritative bot identity and dependency-only file changes receive a typed no-Bead scope disposition; spoofed actors, ordinary product PRs, or extra product files still require and validate the normal carrier. 7. The five observed Dependabot failures are represented by production check-ci route regressions, and ordinary PR-scope enforcement remains unchanged. 8. Focused tests and devtools verify --quick pass; a full or seed run is started only after the coordinator full run is no longer active and its exact outcome is recorded.","notes":"Post-merge closure evidence: PR #3940 merged at 9d4fa12e8; closure bookkeeping is carried by PR #3941. The closure carrier uses typed commit/test evidence only.\n2026-08-11 additional live evidence: after rerouting basetemp to NVMe and reducing to 6 workers, full verify reached only 14% after about 18 minutes. All six xdist workers remained in Linux D state for roughly 18 minutes on SQLite-heavy tests while the supervisor stayed alive and emitted heartbeat output; the harness did not classify a stall. The operator aborted the owned run. Required refinement: combine sustained xdist worker process state with actual test-progress age, terminate the exact owned containment boundary, wait for cleanup, and publish a machine-readable terminal receipt. Supervisor heartbeat or output bytes must not reset worker-progress stall evidence.\n2026-08-11: closure PR #3941 carrier synchronized to the final Beads snapshot and exact commit head.\n2026-08-11 review reconciliation: reopening because late exact-head review found four residual AC gaps—automatic reroute before tmpfs termination, xdist worker identity discovery, automatic partial seeded-cache recovery, and complete resource-preflight step receipts. Provenance is now being moved to a self-contained snapshot digest.\n2026-08-11 progress: closed successor polylogue-2yivh after adding locked crash-left staging recovery and passing the full 9-test workload-artifact suite. The parent remains open: automatic pre-execution reroute for known-demand tmpfs overflow is not yet implemented; xdist identity now has in-process receipt support and a focused regression, but the controlled six-worker D-state acceptance fixture remains outstanding.\n2026-08-11 progress: closed successor polylogue-enl3l after adding the known-demand reroute regression. The only remaining implementation successor is polylogue-7wytz: a controlled six-worker D-state reproduction proving complete in-process worker observation and typed stall termination.","status":"open","priority":0,"issue_type":"bug","assignee":"Sinity","owner":"ezo.dev@gmail.com","created_at":"2026-08-10T22:12:37Z","created_by":"Sinity","updated_at":"2026-08-11T00:34:55Z","started_at":"2026-08-10T22:13:12Z","labels":["area:devtools","area:test","area:verification"],"dependencies":[{"issue_id":"polylogue-9pf58","depends_on_id":"polylogue-817er","type":"discovered-from","created_at":"2026-08-10T22:12:59Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-9pf58","depends_on_id":"polylogue-93xe","type":"parent-child","created_at":"2026-08-10T22:13:08Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-9pf58","depends_on_id":"polylogue-inygw","type":"relates-to","created_at":"2026-08-10T22:53:35Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"polylogue-9pf58","title":"Test harness: fail-safe resource admission and fresh-worktree recovery","description":"A 12-worker full verify was terminated near 69% after pytest basetemp usage exceeded the declared /dev/shm budget: 1512 MiB observed versus a 1376 MiB default. Fresh worktrees also lack a dependable valid testmon seed or recovery route, partial seeded databases can survive interrupted builders, resource admission and worker selection are not bound into complete receipts, and termination can leave incomplete failure attribution or authorize a false green/release baseline. Separately, Dependabot PRs #3935-#3939 all fail Circle quick-gate because pr-scope check-ci requires a human-authored Bead carrier. These failures share one verification-harness concern: every accepted result and every scope-policy exception must be typed, evidence-backed, and fail closed.","design":"Trace the production devtools verify/test paths before changing them. Make pytest basetemp selection choose among supported roots from live free-space and declared run demand, clean only harness-owned stale/partial artifacts after ownership/age validation, and record the selected root, admission inputs, worker decision, peak usage, cleanup, termination, and attribution in machine-readable run receipts. Make fresh-worktree testmon bootstrap and interrupted seeded-DB recovery atomic and self-validating. Incomplete or terminated runs must be non-green and ineligible for release-baseline promotion. Keep coverage unchanged and preserve one-shot operator overrides. Extend pr-scope check-ci with a typed automated dependency-PR policy based on authoritative GitHub metadata and an allowlisted dependency-only changed-file contract; ordinary product PRs retain the full carrier gate.","acceptance_criteria":"1. A real verify/test route automatically refuses or reroutes before a declared basetemp budget can terminate the run; worker admission uses live capacity and records the decision without reducing coverage. 2. Harness-owned stale and partial seeded databases/basetemps are detected and safely cleaned or quarantined, while active and foreign paths are never deleted. 3. A fresh linked worktree can bootstrap a valid testmon seed or receives a typed recovery action; corrupt, stale, partial, or incompatible seeds cannot be promoted. 4. Every run receipt reports selection denominator/digest, worker/resource admission, selected basetemp, cleanup actions, terminal cause, complete failure attribution, and release_baseline_allowed; termination and incomplete attribution force false. 5. Focused real-route tests and controlled mutations fail when admission, cleanup ownership, seed validation, attribution completeness, or fail-closed baseline logic is removed. 6. Dependabot PRs with authoritative bot identity and dependency-only file changes receive a typed no-Bead scope disposition; spoofed actors, ordinary product PRs, or extra product files still require and validate the normal carrier. 7. The five observed Dependabot failures are represented by production check-ci route regressions, and ordinary PR-scope enforcement remains unchanged. 8. Focused tests and devtools verify --quick pass; a full or seed run is started only after the coordinator full run is no longer active and its exact outcome is recorded.","notes":"Post-merge closure evidence: PR #3940 merged at 9d4fa12e8; closure bookkeeping is carried by PR #3941. The closure carrier uses typed commit/test evidence only.\n2026-08-11 additional live evidence: after rerouting basetemp to NVMe and reducing to 6 workers, full verify reached only 14% after about 18 minutes. All six xdist workers remained in Linux D state for roughly 18 minutes on SQLite-heavy tests while the supervisor stayed alive and emitted heartbeat output; the harness did not classify a stall. The operator aborted the owned run. Required refinement: combine sustained xdist worker process state with actual test-progress age, terminate the exact owned containment boundary, wait for cleanup, and publish a machine-readable terminal receipt. Supervisor heartbeat or output bytes must not reset worker-progress stall evidence.\n2026-08-11: closure PR #3941 carrier synchronized to the final Beads snapshot and exact commit head.\n2026-08-11 review reconciliation: reopening because late exact-head review found four residual AC gaps—automatic reroute before tmpfs termination, xdist worker identity discovery, automatic partial seeded-cache recovery, and complete resource-preflight step receipts. Provenance is now being moved to a self-contained snapshot digest.\n2026-08-11 progress: closed successor polylogue-2yivh after adding locked crash-left staging recovery and passing the full 9-test workload-artifact suite. The parent remains open: automatic pre-execution reroute for known-demand tmpfs overflow is not yet implemented; xdist identity now has in-process receipt support and a focused regression, but the controlled six-worker D-state acceptance fixture remains outstanding.\n2026-08-11 progress: closed successor polylogue-enl3l after adding the known-demand reroute regression. The only remaining implementation successor is polylogue-7wytz: a controlled six-worker D-state reproduction proving complete in-process worker observation and typed stall termination.\n2026-08-11 completion evidence: closed polylogue-7wytz after adding the controlled six-worker sampler fixture. All three review successors are now closed; the parent AC matrix is satisfied by merged PR #3940 plus the closure/proof commits, focused harness regressions, 25-step quick gates, and typed non-green resource-timeout evidence. No green full-suite or release baseline is claimed.","status":"closed","priority":0,"issue_type":"bug","assignee":"Sinity","owner":"ezo.dev@gmail.com","created_at":"2026-08-10T22:12:37Z","created_by":"Sinity","updated_at":"2026-08-11T00:43:33Z","started_at":"2026-08-10T22:13:12Z","closed_at":"2026-08-11T00:43:33Z","close_reason":"Satisfied by merged PR #3940 and PR #3941 partial closure follow-up. Evidence: fail-safe tmpfs/NVMe admission with known-demand reroute and typed refusal; locked crash-left seeded-build recovery with atomic publication and invalid-artifact rejection; in-process xdist worker identity receipts and controlled six-worker D-state stall diagnosis; complete run receipts with resource/selection/termination/release-baseline fields and fail-closed incomplete outcomes; authoritative Dependabot scope policy; focused harness regressions; 25/25-step devtools verify --quick; Circle quick-gate on the merged PR. Residual successors polylogue-2yivh, polylogue-enl3l, and polylogue-7wytz are closed. This closes harness implementation/verification scope only and does not claim a green full suite or production reindex.","labels":["area:devtools","area:test","area:verification"],"dependencies":[{"issue_id":"polylogue-9pf58","depends_on_id":"polylogue-817er","type":"discovered-from","created_at":"2026-08-10T22:12:59Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-9pf58","depends_on_id":"polylogue-93xe","type":"parent-child","created_at":"2026-08-10T22:13:08Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-9pf58","depends_on_id":"polylogue-inygw","type":"relates-to","created_at":"2026-08-10T22:53:35Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"polylogue-1tsco","title":"test: complete incident ledger transitive reference proof","description":"Complete the residual incident-ledger authority proof left by PR #3928. The validator must derive the full transitive forcing closure for polylogue-818fy, require registered route entrypoints, require fixture-declared red mutation IDs, and retain current Beads equality against the generated campaign graph and ledger.","design":"Use the existing structured incident ledger validator and its committed graph/ledger artifacts. No prose parsing and no production/archive mutation.","acceptance_criteria":"1. The current transitive forcing closure is traversed and exactly represented by the graph and ledger. 2. Every row route entrypoint resolves through the structured route catalog. 3. Every red mutation ID is declared by its fixture catalog entry. 4. Missing transitive rows, unknown routes, and undeclared mutations fail with machine-readable diagnostics. 5. Focused tests and devtools verify --quick pass.","status":"open","priority":0,"issue_type":"task","owner":"ezo.dev@gmail.com","created_at":"2026-08-10T21:01:13Z","created_by":"Sinity","updated_at":"2026-08-10T21:01:13Z","dependencies":[{"issue_id":"polylogue-1tsco","depends_on_id":"polylogue-ohkfy","type":"discovered-from","created_at":"2026-08-10T21:27:08Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"polylogue-jdesf","title":"verification: enforce hermetic test-path boundaries","description":"Complete the hermeticity half of the production-reachability oracle. Tests that certify production behavior must not read ambient user or live archive paths unless they declare and enter an explicit production-safe fixture boundary.","design":"Add a structured fixture-boundary declaration and verifier in devtools, integrate it with the production reachability seam checks, and cover ambient ~/.codex, ~/.claude, configured archive-root, and explicit temporary fixture paths. Keep tests deterministic and fail closed on undeclared escapes.","acceptance_criteria":"1. A production-reachability seam can declare its fixture boundary and the verifier rejects undeclared reads of ambient user/session/archive paths. 2. Explicit workspace_env or temporary fixture paths remain allowed and are checked against the declared boundary. 3. Mutation coverage proves removing the guard or widening the boundary makes the test fail. 4. Focused tests and devtools verify --quick pass. 5. No live archive or production mutation is used.","status":"open","priority":0,"issue_type":"task","owner":"ezo.dev@gmail.com","created_at":"2026-08-10T07:49:21Z","created_by":"Sinity","updated_at":"2026-08-10T07:49:21Z","labels":["area:devtools","area:testing","horizon:frontier","lane:reindex"],"dependencies":[{"issue_id":"polylogue-jdesf","depends_on_id":"polylogue-4v2d3","type":"discovered-from","created_at":"2026-08-10T07:49:21Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"polylogue-1mfxh","title":"raw-authority: persist paginated artifact census receipts","description":"Add a durable source-tier raw-authority artifact census and receipt route. It must use the canonical byte-duplicate authority planner, exclude parser-failed rows from the authoritative candidate universe, support resumable bounded pages, validate backup evidence before checkpointing, and persist apply receipts in source.db.","acceptance_criteria":"1. Census candidates are derived through the canonical duplicate-supersession planner and include only the declared accepted parser universe; parser-failed rows and alternate authority logic cannot enter the applied population. 2. Bounded apply supports an exclusive continuation cursor and durable receipt/checkpoint so successive pages cannot repeat or skip rows. 3. Backup manifest and source ownership are validated before checkpoint or mutation, and any invalid or changed evidence refuses without mutation. 4. Each apply page persists an immutable source-tier receipt bound to census, cursor, plan digest, before/after inventory, and command identity. 5. Real temporary-archive tests exercise two pages, stale/invalid backup refusal, parser-failure exclusion, receipt persistence, and red mutations; quick verification passes. 6. No live production apply is claimed by implementation closure.","status":"closed","priority":0,"issue_type":"task","owner":"ezo.dev@gmail.com","created_at":"2026-08-10T00:51:50Z","created_by":"Sinity","updated_at":"2026-08-10T07:17:24Z","closed_at":"2026-08-10T07:17:24Z","close_reason":"Satisfied by merged PR #3911 (9f8a0a4e2). Paginated raw-authority census receipts use the canonical planner, parser-failure exclusion, resumable cursor/checkpoint, backup/ownership validation, immutable receipt binding, and red-mutation coverage. Verification: focused census suite and quick gate passed on exact head e2e80dfb; no live production apply claimed.","dependencies":[{"issue_id":"polylogue-1mfxh","depends_on_id":"polylogue-fbkr","type":"discovered-from","created_at":"2026-08-10T00:52:00Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/tests/fixtures/reindex_incident_coverage/campaign_graph.json b/tests/fixtures/reindex_incident_coverage/campaign_graph.json index bb2095badd..e1b0a1caf0 100644 --- a/tests/fixtures/reindex_incident_coverage/campaign_graph.json +++ b/tests/fixtures/reindex_incident_coverage/campaign_graph.json @@ -1,7 +1,7 @@ { "schema_version": 1, "source_commit": "12618c007a987b227e73cfc9e4f462dcaa669914", - "source_snapshot_sha256": "767d60ce405c65d6fa19a8302c6a6920f054ca8be6adbfaca1d0c88444b9b424", + "source_snapshot_sha256": "2ff286443fd3f2b4b08e16c22d39162b68ca601752bab3ce57290d4bc37abf99", "source_path": ".beads/issues.jsonl", "target_bead_id": "polylogue-818fy", "forcing_dependencies": [ diff --git a/tests/unit/devtools/test_verify.py b/tests/unit/devtools/test_verify.py index cb51492f6f..634bc653f1 100644 --- a/tests/unit/devtools/test_verify.py +++ b/tests/unit/devtools/test_verify.py @@ -1419,6 +1419,46 @@ def test_resource_sampler_resolves_worker_identity_from_in_process_events( assert sample["xdist_uninterruptible_count"] == 1 +def test_six_worker_d_state_fixture_produces_typed_stall_diagnosis( + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + events = tmp_path / "events" + events.mkdir() + for index, pid in enumerate(range(201, 207)): + (events / f"gw{index}.jsonl").write_text( + json.dumps({"event": "session_started", "pid": pid, "worker_id": f"gw{index}"}) + "\n", + encoding="utf-8", + ) + monkeypatch.setattr("devtools.verify_runs.process_tree", lambda _root_pid: list(range(201, 207))) + monkeypatch.setattr("devtools.verify_runs._status_values", lambda _pid: {"state": "D", "rss_kb": 30}) + monkeypatch.setattr("devtools.verify_runs._smaps_rollup_kb", lambda _pid: {}) + monkeypatch.setattr("devtools.verify_runs._process_io_bytes", lambda _pid: {}) + monkeypatch.setattr("devtools.verify_runs._process_identity", lambda pid: f"{pid}:1") + monkeypatch.setattr("devtools.verify_runs._cpu_seconds", lambda _pid: 1.0) + monkeypatch.setattr("devtools.verify_runs._process_environ_value", lambda _pid, _key: None) + + sampler = ResourceSampler( + root_pid=201, + run_id="six-worker-d-state", + root=tmp_path, + env={ + "POLYLOGUE_PYTEST_BASETEMP_ROOT": str(tmp_path), + "POLYLOGUE_PYTEST_EVENTS_DIR": str(events), + }, + output_path=tmp_path / "resources.jsonl", + ) + sample = sampler.sample(event="sample") + + 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) + assert ( + reason + == "pytest xdist workers remained in uninterruptible I/O sleep for 30s (6 workers; likely SQLite/filesystem stall)" + ) + + def test_resource_sampler_accounts_memory_swap_and_io_deltas( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, From 8c8e0e78c0a481860a8c263cffe540dc107adab5 Mon Sep 17 00:00:00 2001 From: Sinity Date: Tue, 11 Aug 2026 02:53:00 +0200 Subject: [PATCH 2/3] fix(test): bind graph fixture to source snapshot --- tests/fixtures/reindex_incident_coverage/campaign_graph.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fixtures/reindex_incident_coverage/campaign_graph.json b/tests/fixtures/reindex_incident_coverage/campaign_graph.json index e1b0a1caf0..da7fea6271 100644 --- a/tests/fixtures/reindex_incident_coverage/campaign_graph.json +++ b/tests/fixtures/reindex_incident_coverage/campaign_graph.json @@ -1,7 +1,7 @@ { "schema_version": 1, "source_commit": "12618c007a987b227e73cfc9e4f462dcaa669914", - "source_snapshot_sha256": "2ff286443fd3f2b4b08e16c22d39162b68ca601752bab3ce57290d4bc37abf99", + "source_snapshot_sha256": "4952994decfd523ce773249e90c4e6e9f54b1597f462552e0292facc732190b1", "source_path": ".beads/issues.jsonl", "target_bead_id": "polylogue-818fy", "forcing_dependencies": [ From 072a80b00a8596e47ac4ddf6aed5daee9fda274f Mon Sep 17 00:00:00 2001 From: Sinity Date: Tue, 11 Aug 2026 02:55:16 +0200 Subject: [PATCH 3/3] fix(test): align graph source authority --- tests/fixtures/reindex_incident_coverage/campaign_graph.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/reindex_incident_coverage/campaign_graph.json b/tests/fixtures/reindex_incident_coverage/campaign_graph.json index da7fea6271..48460b2ee0 100644 --- a/tests/fixtures/reindex_incident_coverage/campaign_graph.json +++ b/tests/fixtures/reindex_incident_coverage/campaign_graph.json @@ -1,7 +1,7 @@ { "schema_version": 1, - "source_commit": "12618c007a987b227e73cfc9e4f462dcaa669914", - "source_snapshot_sha256": "4952994decfd523ce773249e90c4e6e9f54b1597f462552e0292facc732190b1", + "source_commit": "ee93e8d248555fd6cae645781604d171dc6f9247", + "source_snapshot_sha256": "2ff286443fd3f2b4b08e16c22d39162b68ca601752bab3ce57290d4bc37abf99", "source_path": ".beads/issues.jsonl", "target_bead_id": "polylogue-818fy", "forcing_dependencies": [