fix: budget pytest tmpfs from measured cgroup overhead - #3948
Conversation
📝 WalkthroughWalkthroughPytest verification now parses all supported xdist worker forms, applies measured resource budgets, selects basetemp storage from demand, manages nested benchmark runs, and reads progress artifacts from repository-anchored configurable paths. ChangesPytest resource policy
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant PytestCommand
participant Verify
participant RuntimePolicy
participant CgroupMetrics
participant BasetempPlacement
PytestCommand->>Verify: provide worker options and suite scope
Verify->>RuntimePolicy: pass policy overrides
RuntimePolicy->>CgroupMetrics: read cgroup memory headroom
CgroupMetrics-->>RuntimePolicy: available memory
RuntimePolicy-->>Verify: worker count and predicted demand
Verify->>BasetempPlacement: evaluate configured and predicted demand
BasetempPlacement-->>Verify: select tmpfs or scratch
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90af040608
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17703e74be
ℹ️ 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".
Problem: the ce4dd62 full suite had 15,190 MiB available but the 10 percent tmpfs heuristic imposed a 1,519 MiB cap and terminated the run at 1,521.6 MiB. What changed: reserve host and command-worker headroom before deriving the bounded tmpfs cap, and pass the parsed pytest concurrency into that admission decision. The monitor remains active and low-headroom commands fail before launch.
Problem: xdist option parsing under-reserved several production command forms, and a 768 MiB per-worker estimate admitted a four-worker run on a 4 GiB host despite the measured process, tmpfs, and cgroup envelope. What changed: parse all supported xdist spellings, reserve logical CPU concurrency for auto, and derive admission from the measured four-worker envelope. The cgroup measurement already includes tmpfs charging, so admission uses it as a composite bound while separately constraining a proposed tmpfs cap.
Problem: the four-worker resource measurements were divided into worker-only costs, so default selection, low-worker admission, and basetemp placement could disagree at launch. What changed: retain fixed controller and cgroup components, scale only the marginal worker cost, reserve the full-run basetemp as aggregate demand, and compare inherited tmpfs caps before selecting the basetemp root. The default selector now uses the same envelope as launch admission, including the conservative ceiling of the observed 1,521.6 MiB basetemp peak.
17703e7 to
fb74235
Compare
|
@codex review |
There was a problem hiding this comment.
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 `@devtools/verify_runs.py`:
- Around line 677-680: Remove the unconditional PytestResourceError for a
missing or unreadable /dev/shm in the resource-admission flow, while preserving
worker-memory checks and disabling tmpfs usage. Ensure
apply_managed_pytest_runtime_policy continues to resolve placement through
resolve_pytest_basetemp_root so scratch is selected when capacity permits, and
add coverage for this unavailable-tmpfs path.
🪄 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: 4ef9c4b0-a766-4938-bde5-07df2b93d056
📒 Files selected for processing (4)
devtools/verify.pydevtools/verify_runs.pytests/unit/devtools/test_run_tests.pytests/unit/devtools/test_verify.py
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb74235e0f
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efe9b8f282
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e7b431a3b
ℹ️ 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".
Clamp inherited tmpfs limits to the measured host-safe policy, account serial pytest runs without inventing an xdist worker, and route unsupervised bare pytest basetemps to NVMe scratch.\n\nAdd production-route regression coverage for each admission boundary.\n\nCo-Authored-By: OpenAI Codex <noreply@openai.com>
Cap pytest admission by the smallest remaining ancestor cgroup allowance, keep worker-memory checks active for explicit basetemp roots, and reserve the measured full-suite basetemp only for broad runs.\n\nExercise the hierarchy reader, explicit-root refusal, focused placement, and runner scope propagation through production policy paths.\n\nCo-Authored-By: OpenAI Codex <noreply@openai.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8647d622e7
ℹ️ 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".
Reserve the measured full-suite basetemp only for seed, full, load-sensitive, and broad-testmon steps. Ordinary affected testmon runs retain the focused disk requirement.\n\nCover every managed pytest label class through the production runner.\n\nCo-Authored-By: OpenAI Codex <noreply@openai.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c74810e0dd
ℹ️ 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".
Use the focused controller and proportional cgroup envelope for non-broad runs, preserve measured full-suite disk demand on explicit scratch roots, and normalize leaked cloud basetemp configuration before bare pytest selects storage. Cover low-memory focused admission, explicit-root disk refusal, and workstation cloud-default normalization. Co-Authored-By: OpenAI Codex <noreply@openai.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@devtools/run_tests.py`:
- Line 50: Update _subprocess_env in devtools/run_tests.py to construct pytest
artifact paths from ROOT instead of Path.cwd(), matching the checkout-root
behavior already used by _managed_env and ensuring paths remain correct when
devtools test runs from a subdirectory.
In `@devtools/verify.py`:
- Around line 1727-1730: In the concurrency argument, remove the unreachable
None fallback and use the already-assigned pytest_concurrency value directly,
while preserving the minimum concurrency of 1 via max. Do not call
_pytest_command_concurrency again or read the policy-mutated env.
In `@tests/conftest.py`:
- Around line 105-114: Update devtools/verify_slos.py so _run_benchmarks()
launches pytest with the managed pytest environment, preserving
POLYLOGUE_VERIFY_RUN_ID, POLYLOGUE_PYTEST_BASETEMP_ROOT, and
POLYLOGUE_PYTEST_TMPFS from the parent managed step. Ensure the nested pytest
receives the configured tmpfs budget instead of triggering the bare-pytest
fallback in tests/conftest.py.
In `@tests/unit/devtools/test_verify.py`:
- Around line 1917-1930: Patch verify_runs.read_cgroup_memory_headroom_bytes in
test_managed_policy_uses_scratch_when_tmpfs_is_unavailable to return an
effectively unlimited memory headroom value, matching the other tests in this
file. Keep the existing _meminfo, _pressure, os.cpu_count, and _fs_usage patches
unchanged so the policy assertions are independent of the host cgroup
configuration.
🪄 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: 1c5dd074-09db-4006-a3e6-054e865b1224
📒 Files selected for processing (9)
devtools/run_tests.pydevtools/verify.pydevtools/verify_runs.pypolylogue/core/metrics.pytests/conftest.pytests/unit/core/test_metrics_cgroup_memory_limits.pytests/unit/devtools/test_run_tests.pytests/unit/devtools/test_verify.pytests/unit/test_pytest_temp_policy.py
💤 Files with no reviewable changes (1)
- tests/unit/devtools/test_run_tests.py
Problem: focused and nested benchmark pytest launches could lose checkout-scoped artifacts or managed tmpfs context when invoked from a subdirectory.\n\nWhat changed: anchor inherited artifact paths to the checkout, pass managed policy and run markers through the SLO parent and child, and make the supervisor read the event ledger supplied to pytest. The concurrency receipt now uses its already-parsed value, and the scratch fallback test isolates cgroup state.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16d1cb7e3c
ℹ️ 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".
Give the output-stall and progress-stall supervisor tests independent VerifyRun artifact directories. This prevents one invocation's event stream from changing another invocation's termination classification while preserving the real process-control route.\n\nCo-Authored-By: OpenAI Codex <noreply@openai.com>
|
@codex review Please review exact head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f671d8ad2
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f8c57d9a8
ℹ️ 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".
| ) -> dict[str, Any] | None: | ||
| """Return the latest valid pytest event from the live JSONL ledger.""" | ||
| if events_dir is not None: | ||
| return latest_event_from_paths(events_dir, path) |
There was a problem hiding this comment.
Tail worker ledgers instead of rereading them
During broad seed/full xdist runs, every output chunk now reaches this branch—twice via _refresh_progress_marker() and _write_pytest_progress()—and latest_event_from_paths() calls _read_last_jsonl() for every worker file; that helper uses read_text().splitlines(), so it rereads each entire, continually growing event ledger merely to obtain its final row. Since the plugin emits several rows per test, this makes live progress monitoring approach quadratic I/O and allocation across the roughly 16K-node suite and can substantially slow or exhaust memory during the verification run it is supervising. Tail a bounded byte range, or retain per-file offsets/latest records, rather than materializing every ledger on each poll.
Useful? React with 👍 / 👎.
| None, | ||
| ) | ||
|
|
||
| workers = largest_with(PYTEST_BASETEMP_PEAK_KB) |
There was a problem hiding this comment.
Size default workers for the actual test scope
When no worker override is set for the ordinary affected-testmon path, _pytest_worker_args() calls adaptive_pytest_worker_count(), which invokes the policy with its default full_suite=True, so this line reserves the 1,522 MiB full-suite basetemp and broad controller envelope even though _run() later classifies pytest testmon with full_suite=False. On a 6 GiB/24-CPU host this selects 3 workers although the focused envelope admits 6, and around 2 GiB it refuses during step construction although a one-worker focused run fits. Fresh evidence beyond the resolved focused-admission thread is that only launch admission was scoped; default worker selection still uses the broad envelope. Pass the actual verification scope into adaptive worker selection.
AGENTS.md reference: AGENTS.md:L323-L328
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72dfe5e3b7
ℹ️ 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".
| default_full_suite_scratch = ( | ||
| full_suite | ||
| and not normalized.get("POLYLOGUE_PYTEST_BASETEMP_ROOT") | ||
| and "POLYLOGUE_PYTEST_TMPFS" not in normalized |
There was a problem hiding this comment.
Treat blank tmpfs settings as unset
When the environment contains POLYLOGUE_PYTEST_TMPFS="" (or any value other than 0/1), this key-presence check disables the broad-suite scratch default; manages_tmpfs then treats the value as enabled and rewrites it to 1. On a host whose computed cap accommodates the measured peak, seed, full, and broad-testmon runs consequently stay on /dev/shm, although only an explicit value of 1 is documented to override their scratch placement. Parse the opt-in by value, treating blank as unset and rejecting other values.
AGENTS.md reference: AGENTS.md:L510-L517
Useful? React with 👍 / 👎.
| ) | ||
|
|
||
| if config.option.basetemp is None: |
There was a problem hiding this comment.
Route explicit tmpfs roots away from bare pytest
For a direct pytest invocation with POLYLOGUE_PYTEST_BASETEMP_ROOT=/dev/shm/... and no verify-run marker, this condition skips the scratch fallback because the normalized root remains configured; resolution then accepts that root, while configured roots receive no pytest_tmpfs_budget_kb cap and there is no external supervisor. An interrupted or broad run can therefore consume the shared tmpfs without the bounded behavior promised for /dev/shm. Fresh evidence beyond the resolved cloud-default case is that a genuine configured root beneath /dev/shm survives normalization; detect such roots and force scratch or reject them for bare pytest.
AGENTS.md reference: AGENTS.md:L510-L517
Useful? React with 👍 / 👎.
| full_suite=full_suite, | ||
| ) | ||
| if full_suite and policy.tmpfs_predicted_mb is not None: | ||
| normalized.setdefault(PYTEST_BASETEMP_REQUIRED_MB_ENV, str(policy.tmpfs_predicted_mb)) |
There was a problem hiding this comment.
Keep measured full-suite demand as a floor
When a full-suite process inherits POLYLOGUE_PYTEST_BASETEMP_REQUIRED_MB=0 (or any value below 1522), setdefault preserves that smaller declaration instead of applying the measured peak. Scratch admission then falls back to the ordinary 1 GiB floor, so a filesystem with, for example, 1.2 GiB free is accepted even though the measured suite tree requires 1.522 GiB and can exhaust it mid-run. Fresh evidence beyond the earlier larger-demand case is that smaller declarations suppress the new measured requirement; take the maximum of the configured and measured values while continuing to honor larger declarations.
AGENTS.md reference: AGENTS.md:L510-L521
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@CLAUDE.md`:
- Around line 516-517: Update the documentation sentence describing
POLYLOGUE_PYTEST_TMPFS=1 to state that it requests bounded tmpfs, but is honored
only when the effective budget satisfies the declared basetemp requirement;
retain the existing POLYLOGUE_PYTEST_BASETEMP_MIN_FREE_MB override description.
In `@devtools/verify.py`:
- Around line 1817-1819: Update _subprocess_env in devtools/verify.py to export
POLYLOGUE_PYTEST_EVENTS_DIR rooted at ROOT / PYTEST_EVENTS_DIR, alongside the
existing rooted pytest paths. In tests/unit/devtools/test_run_tests.py lines
58-65, extend the environment assertions to verify this variable resolves under
the checkout root.
In `@tests/conftest.py`:
- Around line 192-212: Update _remove_stale_basetemp in tests/conftest.py to
return immediately when the top-level entry is a symbolic link, before os.walk
or any permission changes. In tests/unit/test_pytest_temp_policy.py lines
289-303, add coverage for a stale top-level symbolic link and verify the linked
target tree’s permissions remain unchanged.
In `@tests/unit/test_pytest_temp_policy.py`:
- Around line 273-303: Update both stale-cleanup tests, especially
test_sweep_stale_polylogue_basetemps_reclaims_reused_pid_identity and
test_sweep_stale_polylogue_basetemps_reclaims_read_only_fixture_tree, to accept
the frozen_clock fixture and derive each entry’s mtime relative to its frozen
timestamp instead of using the hard-coded old = 1.0 value. Keep the existing
stale-reclamation assertions unchanged.
🪄 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: 478f1985-4e38-4a74-8095-e9b94f7a901e
📒 Files selected for processing (11)
CLAUDE.mdTESTING.mddevtools/verify.pydevtools/verify_runs.pydevtools/verify_slos.pytests/conftest.pytests/unit/devtools/test_run_tests.pytests/unit/devtools/test_slo_catalog.pytests/unit/devtools/test_verify.pytests/unit/operations/test_mutation_actuators.pytests/unit/test_pytest_temp_policy.py
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e3c097539
ℹ️ 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".
| and effective_tmpfs_budget_kb is not None | ||
| and effective_tmpfs_budget_kb < required_basetemp_kb | ||
| ): | ||
| normalized["POLYLOGUE_PYTEST_TMPFS"] = "0" |
There was a problem hiding this comment.
Keep the cap active for configured tmpfs roots
When a managed full-suite run uses POLYLOGUE_PYTEST_BASETEMP_ROOT beneath /dev/shm and its effective cap is below the declared demand (for example, a 512 MiB cap versus the 1,522 MiB estimate), this assignment disables tmpfs supervision but leaves the configured root intact. resolve_pytest_basetemp_root() then selects that root before consulting POLYLOGUE_PYTEST_TMPFS, and pytest_tmpfs_budget_kb() returns None, so the run can consume the shared tmpfs without any cap instead of routing to scratch. Clear/reroute the configured tmpfs root when disabling tmpfs, or keep the supervisor cap active.
AGENTS.md reference: AGENTS.md:L510-L517
Useful? React with 👍 / 👎.
|
@codex review Please review exact head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d479aa057
ℹ️ 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".
| configured_root = normalized.get("POLYLOGUE_PYTEST_BASETEMP_ROOT") | ||
| configured_tmpfs = configured_root is not None and _is_beneath(Path(configured_root), PYTEST_TMPFS_ROOT) | ||
| manages_tmpfs = configured_tmpfs or (configured_root is None and normalized.get("POLYLOGUE_PYTEST_TMPFS") != "0") |
There was a problem hiding this comment.
Reserve headroom for configured tmpfs roots
When POLYLOGUE_PYTEST_BASETEMP_ROOT points beneath /dev/shm, this new classification enables a cap but leaves resolve_pytest_basetemp_root() on its configured-root branch, which admits using only max(min_free, declared_demand) rather than the ordinary tmpfs requirement of min_free + max(declared_demand, cap). For example, a focused run with 2.5 GiB free can receive a 2 GiB cap and be admitted, allowing it to leave only 0.5 GiB instead of the promised 1 GiB headroom and potentially strand other shared-tmpfs users. Apply the tmpfs headroom calculation to configured roots beneath /dev/shm as well.
AGENTS.md reference: AGENTS.md:L510-L519
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in a0da692. Configured tmpfs roots now require the configured free-space floor plus the larger of declared demand and the effective supervisor cap; a 2.5 GiB fixture is refused against the 3.024 GiB requirement.
|
@codex review Please review exact head |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Make the managed pytest harness select, supervise, and reclaim test storage from measured process, cgroup-overhead, basetemp, host-headroom, and filesystem envelopes.
Problem
The previous policy could admit a tmpfs cap from predicted demand while ignoring the larger allowed cap, and it could double-count or omit the cgroup charge around tmpfs pages. Broad suites then either filled shared memory or refused under misleading arithmetic. Real xdist progress was also written to per-worker event files that the live stall supervisor did not read, while nested benchmark pytest could consume tmpfs without that supervisor enforcing the cap. Explicit basetemp roots below
/dev/shmbypassed the common budget, and legacy read-only fixture trees could survive the stale-directory sweep indefinitely.Solution
Use the observed 6,278,623,232-byte cgroup peak, separate fixed process/cgroup overhead from adjustable tmpfs demand, and cap host capacity by the smallest remaining ancestor cgroup allowance. Worker-memory admission remains active for explicit scratch roots. Focused tests retain bounded tmpfs by default. Full-suite and seed-testmon runs default to NVMe scratch because the fixture tree can exceed the supervised 2 GiB tmpfs ceiling; an explicit tmpfs broad run remains bounded.
The live supervisor reads both per-worker event files and the merged event artifact, so flowing controller output cannot mask wedged workers. Nested benchmark pytest preserves managed admission and run identity while using scratch because its parent is not a pytest supervisor. Explicit
/dev/shmroots now use the same cap and cleanup path. Stale basetemp ownership binds PID plus process-start identity, and stale read-only fixture publications are made owner-writable only after liveness adjudication so cleanup can finish.The full-suite diagnostic also exposed a test fixture that created current durable tier files without fresh-bootstrap authority. The mutation-actuator fixture now initializes the active archive through the production bootstrap route.
Verification
direnv exec . devtools test tests/unit/devtools/test_verify.py tests/unit/test_pytest_temp_policy.py tests/unit/operations/test_mutation_actuators.py: 216 passed in 28.12sdirenv exec . devtools test -k managed_pytest_policy_bounds_explicit_tmpfs_root: 1 passed, 21,312 deselecteddirenv exec . devtools test tests/unit/devtools/test_run_tests.py tests/unit/test_pytest_temp_policy.py: 33 passed in 1.91sdirenv exec . devtools verify --quick: all 25 steps passed in 108.08s ata0da69269458fdd7c90b717109434f05df8ac603gw0.jsonlwhile continuously emitting output; it is terminated by the progress timeout rather than the output-silence timeout.a0da69269458fdd7c90b717109434f05df8ac603.