Skip to content

fix(review): criteria commands run in the reviewed project's environment with a measured python timeout #847

Closed

Description

@dan-petty

Context & Rationale

Allowlisted binaries that can't run.

  • CONST_ALLOWED_CRITERIA_BINARIES (config/constants.py:856-873) and review.md:56 offer pytest and ruff.
  • The host sandbox's PATH is /usr/local/bin:/usr/bin:/bin, with only /usr bound (constants.py:2265-2275), and neither binary is in /usr/bin.
  • All 6 pytest criteria and all 5 ruff criteria in saved sessions failed with bwrap: execvp. rg and file are allowlisted and missing too.

The wrong Python.

  • python is the system /usr/bin/python3, which has a stale devops_cli 0.2.23 in /usr/local/lib/python3.14/dist-packages.
  • PYTHONPATH puts the repo's src first (review_environment.py:273-277), but third-party modules still come from that stale install.
  • In CI, python-is-python3 makes python Ubuntu's Python 3.12.

Timeouts. In the 9 sessions since #683, 310 of 777 python criteria (40%) hit the 5.0 s cap (defaults.py:404). Passing runs have a p90 of 4.5 s.

The reviewed repo's .venv/bin/python links into the bound /usr, so it can run inside the sandbox.

Scope & Deliverables

  • Deliverable:
    • When the reviewed repo has a .venv/bin, put it first on PATH; otherwise fall back to the current PATH. All binds stay read-only.
    • Remove pytest from the allowlist and from review.md. Under -n logical it cannot start within a criterion's budget, and a passing existing test does not demonstrate a defect.
    • Remove rg and file from the allowlist, or make them runnable.
    • Set DEFAULT_CRITERIA_PYTHON_TIMEOUT_SECONDS in config/defaults.py by replaying the criteria that timed out in saved sessions, and record that measurement in the PR. grep and git keep 5 s.
    • The report counts timed-out criteria separately from failed ones.
  • Acceptance criteria:
    • A test asserts that every allowlisted binary resolves on the sandbox PATH inside the bound mounts.
    • A real-bwrap test in tests/test_host_sandbox.py runs ruff --version and python -c pass from the repo environment. It takes at most 1 s, and it is verified in the devcontainer and the local gate, because refactor(ci): ci installs nothing on the runner, and live bubblewrap tests skip where bwrap is missing #832 skips live bwrap tests in GitHub CI.
    • A pytest criterion is rejected without running.
    • The timeout constant exists with its recorded measurement, and the report shows a timed-out count.
  • Key questions: none.
  • Constraint: Coordinate with fix(security): the host sandbox declares a noexec /tmp it never applies #798 (noexec /tmp), which edits the same sandbox policy.

Strategic Alignment

  • Milestone: Backlog
  • Depends on: none

Moved into v0.2.25 (2026-10-02)

#846's extended evidence rule (2026-10-02) counts a criterion only when it imports the cited code and asserts. In review session 20261001-224227, 215 of 588 commands that import devops_cli timed out at 5 s, against 11 of 534 that do not. Without this item, the evidence rule leaves almost nothing verifiable, so it lands with or right after #846.

Scope added 2026-10-02 from review sessions 20261002-205520 and 20261002-214641 (.data/review-evaluation-20261002-s6.md, section 7): the one criterion that settled a verdict correctly passed in 4.52 s in one run and timed out at 5.07 s in the next. In S6 the invalidation criterion for tests/test_security_bandit.py failed with No module named 'pytest' because it ran under the system Python.

  • A replay of that criterion (python -c importing pytest and the test module) runs under the reviewed project's interpreter in the sandbox and does not fail on the import.

Activity

  1. added
    type/bug
    scope/review
    priority/p2-medium
    on Oct 1, 2026
  2. added this to the v0.2.25 milestone on Oct 2, 2026
  3. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Closed by #1040, merged into release/v0.2.25.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  4. added a commit that references this issue on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2-mediumscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions