Overview
Currently parrot wraps tox/pytest as a subprocess runner and intercepts failures externally. This issue tracks the creation of pytest-theow — a proper pytest plugin that hooks directly into pytest's internals and uses theow for healing in-process.
This replaces the subprocess interception model entirely.
Core flow
test fails
→ pytest_runtest_logreport fires (in-process, has full ExceptionInfo)
→ theow.heal() runs against the failure
→ rule cache checked first → if hit, fix applied immediately
→ if miss, LLM consulted, rule written back
→ on retry=true, test re-runs in same session
→ on session end: summary printed locally / batch PR opened in CI
Key hooks
pytest_runtest_logreport — primary failure interception
pytest_sessionfinish — summary output and PR creation
pytest_runtest_call — access to item (fixture values, parametrize args, test source) for richer context
Local UX
━━━━ theow healing summary ━━━━
✖ test_parse_invoice → theow: DateParseError — applied fix (rule hit, no LLM)
✖ test_fetch_orders → theow: ConnectionTimeout — LLM generated fix
✓ test_calculate_tax → retried + passed after fix
CLI flags
pytest --heal # heal in-place + retry
pytest --heal --heal-pr # heal + open batch PR
pytest --heal-dry-run # show what theow would do, don't apply
CI auto-detection
Detect CI=true env and auto-switch to PR mode — no config needed for the common case.
Config
[tool.pytest-theow]
gh_token = "env:GH_TOKEN"
retry = true
pr_mode = "batch" # or "per-failure"
rules_dir = ".theow/rules"
Repo
Should live as a separate repo pytest-theow to keep the dependency graph clean. theow stays as the core library, parrot stays as the tox wrapper, pytest-theow is the pytest-native path.
Skeleton
pytest-theow/
├── pyproject.toml ← pytest11 entry point + theow dep
├── pytest_theow/
│ ├── __init__.py
│ ├── plugin.py ← hooks (~80 lines)
│ ├── healer.py ← ExceptionInfo → theow.heal() adapter
│ └── reporter.py ← local summary + batch PR logic
Overview
Currently parrot wraps tox/pytest as a subprocess runner and intercepts failures externally. This issue tracks the creation of
pytest-theow— a proper pytest plugin that hooks directly into pytest's internals and uses theow for healing in-process.This replaces the subprocess interception model entirely.
Core flow
Key hooks
pytest_runtest_logreport— primary failure interceptionpytest_sessionfinish— summary output and PR creationpytest_runtest_call— access toitem(fixture values, parametrize args, test source) for richer contextLocal UX
CLI flags
CI auto-detection
Detect
CI=trueenv and auto-switch to PR mode — no config needed for the common case.Config
Repo
Should live as a separate repo
pytest-theowto keep the dependency graph clean. theow stays as the core library, parrot stays as the tox wrapper, pytest-theow is the pytest-native path.Skeleton