Skip to content

pregate: a missing pytest is PREGATE_LANE_FAILED (blames the diff), not PREGATE_ENVIRONMENT #3598

Closed

Description

@vilano93

What happened

On a machine without pytest, gstack-pregate's lanes check blames the diff for it. A selected Python test runs as python3 -m pytest {files}. That exits 1 with No module named pytest, and the lane reports PREGATE_LANE_FAILED with "fix the in-branch failure". The test itself is fine: it is a unittest test, and python3 -m unittest passes it.

$ python3 -m unittest tests/test_alpha.py
OK
$ python3 -m pytest --version
/opt/homebrew/opt/[email protected]/bin/python3.15: No module named pytest

# upstream main, 1.91.311.0 (94165fff3)
$ gstack-pregate run --stage tests --only lanes --base origin/main --allow-repo-commands
...
    lanes: fix: read ~/.gstack/projects/repro-pytest/pregate/runs/…/lanes/lanes.log, fix the in-branch failure, rerun gstack-pregate --stage tests
PREGATE: fail tree=075ba803dd3a head=7ae1d5e297a9 checks=1
gstack-pregate: lanes: local lane exited 1 (? failed of ? ran; 1 files; pipefail); … (PREGATE_LANE_FAILED)

Expected: the same verdict a missing pnpm, cargo, dart or flutter gets: PREGATE_ENVIRONMENT (missing-binary), "install pytest on this machine and rerun, or run the lane remotely; the diff is not at fault". The machine is missing a tool; the diff did nothing wrong.

classifyCommandEnvironment can't catch this at run time: the command's binary is python3, which is on PATH, and No module named pytest is not a not-found line. planRuns already checks PATH before a run for pnpm/yarn (packageRunner), cargo (cargoRunner) and dart/flutter (dartRunner). The pytest branch of detectRunner (lib/pregate/checks/lanes.ts) does no such check.

Steps to reproduce

  1. A machine where python3 -m pytest fails with No module named pytest.
  2. A repo with no package.json and one committed test, tests/test_alpha.py:
    import unittest
    
    class T(unittest.TestCase):
        def test_a(self):
            self.assertEqual(1 + 1, 2)
  3. On a branch, change tests/test_alpha.py, then run gstack-pregate run --stage tests --only lanes --base origin/main --allow-repo-commands.

Found while fixing mixed .mjs + .py root selections, which today get no runner at all (PR follows). Once each language gets its own runner, the Python part hits this on such a machine. This issue is pre-existing and separate from that PR.

Readiness report

gstack doctor 1.91.275.0
ok              install root    ~/.claude/skills/gstack: claude global current (1.91.275.0)
ok              rescue refs     none in ~/.claude/skills/gstack
ok              state root      ~/.gstack durable=yes (selected by default)
ok              bun             1.4.3 at /opt/homebrew/bin/bun (floor 1.3.3, tested 1.4.2)
ok              hooks           9 hook(s) parse
ok              codex           codex-cli 0.164.0; self-locate ok; model gpt-6.1-sol (source: ~/.codex/config.toml model)
ok              codex probe     cached MODEL_OK, 17h ago (not re-run; --live probes now)
not configured  artifacts sync  off; cross-machine artifacts sync is unavailable
ok              browse bundle   browse/dist built
ok              binaries        find-browse, design, pdf, gstack-global-discover launch (4 of 4)
ok              cso             native helper 1.91.275.0 (f8d0ab033914)
ok              claude code     2.1.312 (Claude Code) at ~/.local/bin/claude
ok              session journal largest of 60: 36.3 MiB
ok              guard log       30 decisions (4 denied)
warn            CLAUDE.md       the gstack section in ~/.claude/CLAUDE.md lists 39 skills; …
13 ok, 1 warn, 1 not configured, 0 fail

The repro above was also run against upstream main (1.91.311.0), with the same result.

Environment

  • Host (Claude Code, Codex, Cursor, ...) and its version: Claude Code 2.1.312
  • OS: macOS 26.6.2, Python 3.15 (Homebrew), no pytest installed

Activity

  1. added
    S3
    on Oct 31, 2026
  2. capy-ai commented on Nov 2, 2026

    @capy-ai
    Contributor

    Fixed in v1.93.15.0 by #3741 (90ccf30). When the machine can't import pytest, pregate now reports PREGATE_ENVIRONMENT naming pytest. It no longer reports PREGATE_LANE_FAILED against your diff. Thanks for the clear report.

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

    S3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions