Repository navigation
Description
Problem Description
The bwrap row of devops ci (added by #5110) starts its test only after a host check. The host check uses the code that the row must test, so the row can pass when that code is broken.
_sandbox_host_refusal() in src/devops_cli/commands/ci.py calls SandboxToolExecutor().host_refusal(). That method calls _host_cause() in src/devops_cli/security/tool_executor.py, which makes its probe with HostSandbox.build_bwrap_args. tests/sandbox/test_host_sandbox.py tests that same method. _execute_check_async treats each refusal string as a skip: passed=True, skipped=<cause>.
Thus, when a change breaks the sandbox command, the probe fails, the host check reports bubblewrap cannot make a sandbox on this host: ..., and the row starts no test and passes. Static Analysis runs the row on its GitHub-hosted runner, so the required check is green when the sandbox is broken. No other test starts real bubblewrap, so no other check finds this regression.
The host check also returns a cause when the probe does not end in CONST_TOOL_SANDBOX_CHECK_TIMEOUT_SECONDS (30 s). Thus a slow host stores a skip as a pass, also in the cached verdict.
Reproduction Steps
- Use a host where bubblewrap can make a sandbox (the devcontainer or a GitHub-hosted runner).
- Run
uv run python -c "from devops_cli.commands import ci; print(ci._sandbox_host_refusal())". It printsNone. - Change
HostSandbox.build_bwrap_argsso that it adds--ro-bind /no/such/source /xbefore--. - Run
uv run pytest -m bwrap -n 0 tests/sandbox/test_host_sandbox.py tests/ai/test_tool_executor_contract.py. The measured result is46 failed, 9 passed. - Run the command of step 2 again. It prints
bubblewrap cannot make a sandbox on this host: bwrap: Can't find source path /no/such/source: No such file or directory. - Run
uv run devops ci --only bwrap. The row showsskippedand the gate exits 0.
Expected vs Actual Behavior
Expected: the row skips only when the host cannot run any sandbox. When the product's own sandbox command fails on a host that can run a sandbox, the row runs the suites and the suites fail. A probe that does not end in time is a failure, not a skip.
Actual: any failure of the product's sandbox command, and a probe timeout, make the row skip and pass.
Proposed fix:
- Probe the host with a fixed bubblewrap command that does not come from
HostSandbox.build_bwrap_args, for examplebwrap --unshare-all --ro-bind / / -- true, after a check thatbwrapandprlimitare on PATH. - Treat a probe timeout as a failure of the row, not a skip.
- Add a test: when a stand-in
bwrapaccepts the fixed probe and refuses the product command, the row runs pytest and does not showskipped. - Change the requirement
The bwrap row runs the sandbox contract suites where the host can make a sandboxinopenspec/specs/ci-gate-rows/spec.mdto match.
Environment Diagnostics
- Commit:
ba3082025onmain(the code came in9a0659dcc, fix(tests): repair the bwrap contract suite and gate it #5110). - Host: the devcontainer, where bubblewrap can make a sandbox.
Logs, Traces, or Terminal Output
clean: None
broken: bubblewrap cannot make a sandbox on this host: bwrap: Can't find source path /no/such/source: No such file or directory
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #5110
Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches found no maintained tool or library that decides host sandbox support for a CI row; bubblewrap is the sandbox itself, and the fix is a change to the project's own bwrap row probe and timeout handling.
Lacks:
- No tool decides whether a host can run a bubblewrap sandbox
- No probe that is independent of the product's own sandbox arguments
- No rule that turns a probe timeout into a failed check instead of a skip
- No stand-in bwrap harness for a product-command-failure regression test
Proposed design
Problem statement
The bwrap row of devops ci can pass when the product's sandbox command is broken. Its host check calls SandboxToolExecutor().host_refusal(), which uses HostSandbox.build_bwrap_args, and _execute_check_async treats every refusal string as a skip. A probe timeout also becomes a skip. The fix uses a fixed bubblewrap probe, fails on a probe timeout, and adds a regression test.
Acceptance criteria
Requirement: The bwrap host check uses a fixed probe
The bwrap row SHALL decide host sandbox support with a fixed bubblewrap command that does not call HostSandbox.build_bwrap_args.
Scenario: A broken product command does not make the host check refuse
- WHEN A test makes
HostSandbox.build_bwrap_argsadd a missing bind and puts a stand-inbwrapon PATH that exits 0 forbwrap --unshare-all --ro-bind / / -- true, then it calls_sandbox_host_refusal(). - THEN
_sandbox_host_refusal()returnsNone, so the row does not skip.
Requirement: The bwrap row skips only when the host cannot run a sandbox
The bwrap row SHALL return a skip refusal when bwrap or prlimit is missing from PATH, or when the fixed probe exits nonzero.
Scenario: The fixed probe fails
- WHEN A test puts a stand-in
bwrapon PATH that exits 1 for the fixed probe, then it awaits_execute_check_asyncfor the bwrap row. - THEN The result has
skippedset,passed is True, and the row started no command.
Requirement: A probe timeout fails the bwrap row
The bwrap row MUST report a fixed-probe timeout as a failure and not as a skip.
Scenario: The fixed probe exceeds its timeout
- WHEN A test gives
_execute_check_asynca bwrapCheckSpecwhosehost_refusalraisessubprocess.TimeoutExpired, then it awaits the row. - THEN The result has
passed is False,skipped is None, andtimed_out is True.
Requirement: A failed product sandbox command does not make the row skip
The bwrap row SHALL run its command when the fixed probe succeeds, even if the product sandbox command fails.
Scenario: The fixed probe succeeds and the product command fails
- WHEN A test uses a stand-in
bwrapthat exits 0 for the fixed probe and nonzero for the product arguments, then it awaits_execute_check_asyncfor the bwrap row with a sentinel command that records its start and exits 1. - THEN The sentinel command recorded its start,
result.skippedisNone, andresult.passedisFalse.
Requirement: The ci-gate-rows spec states the fixed probe and timeout behavior
The ci-gate-rows spec SHALL state that the bwrap row uses a fixed probe and treats a probe timeout as a failure.
Scenario: The OpenSpec row validates the updated spec
- WHEN A developer runs
uv run devops ci --only openspecafter the spec change. - THEN The openspec row passes.
Existing Tool Considered
No open, maintained tool or library covers the need: the alternatives check of 2026-11-16 found none. No new build is needed: the change edits existing functions and adds a regression test.
Key questions
- Which command should the bwrap row use to probe host sandbox support?: Use the fixed command
bwrap --unshare-all --ro-bind / / -- trueaftershutil.whichfindsbwrapandprlimit. Do not callSandboxToolExecutor.host_refusal()orHostSandbox.build_bwrap_args. (best practice) [sources: src/devops_cli/commands/ci.py, src/devops_cli/security/tool_executor.py, src/devops_cli/sandbox/host.py, tests/sandbox/test_host_sandbox.py, openspec/specs/ci-gate-rows/spec.md]- Chosen: Fixed probe command. It does not call the product command that the row must test.
- Rejected: SandboxToolExecutor.host_refusal. It calls
_host_cause()andHostSandbox.build_bwrap_args, so a product defect becomes a skip. - Rejected: HostSandbox.build_bwrap_args. The row would test the same code that it must verify.
- How should the bwrap row report a fixed-probe timeout?: Raise
subprocess.TimeoutExpiredfrom_sandbox_host_refusal(). Catch it in_execute_check_asyncand return aCheckResultwithpassed=False,skipped=None,timed_out=Trueand a stderr line that names the row and timeout. (best practice) [sources: src/devops_cli/commands/ci.py, src/devops_cli/config/constants.py:5078]- Chosen: Fail the check result. A timeout shows that the host cannot prove sandbox support and must fail the gate.
- Rejected: Return a skip refusal.
_execute_check_asyncturns a refusal string intopassed=True, skipped=<cause>. - Rejected: Run the suites after a timeout. It gives no explicit failure and can still pass on a slow host.
- Where should the regression test for the bwrap row live?: Extend
tests/commands/test_ci_bwrap_row.py. Use a stand-inbwrapon PATH and patch_run_check_commandswhen the test must not run the full suites. (best practice) [sources: tests/commands/test_ci_bwrap_row.py, tests/support/fakes/process.py]- Chosen: Extend test_ci_bwrap_row.py. The file already owns the bwrap row tests and keeps the regression close to the row.
- Rejected: Add a new test file. It splits the row tests and adds no new coverage.
- Rejected: Use the real bwrap only. It needs a host that can make a sandbox and cannot simulate a product failure.
- Should the fix change
SandboxToolExecutor.host_refusal()for every caller?: No. Keep the change in the bwrap row._sandbox_host_refusal()stops calling that method. Other callers keep their current contract. (best practice) [sources: src/devops_cli/commands/ci.py, src/devops_cli/security/tool_executor.py]- Chosen: Scope the fix to the bwrap row. The issue is the row's skip behavior; a wider contract change is not needed.
- Rejected: Change SandboxToolExecutor.host_refusal for all callers. It broadens the change and can alter other rows without a test need.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Both fix bwrap test skipping in CI, but #1337 fixes the conftest collection hook condition while this candidate fixes the CI row host check that uses the product's own probe code.devops-cli-service commentedon Nov 16, 2026
Alternatives check: none
Reason: The issue asks for a fix to the project's own CI host-check code (use a fixed bubblewrap probe command instead of the product's own
HostSandbox.build_bwrap_args), not for a new external tool or library. Web searches for a bubblewrap CI host-capability probe tool or library returned no relevant maintained project that covers this need.Tool: none found
Lacks:
Searches run:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at c58b592 (see proposed design in issue body).
devops-cli-service commentedon Nov 28, 2026
Released in v0.241.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.241.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 00:41 UTC