Skip to main content

Local-first maintainer automation for open-source CI triage

Project description

PatchRail

Local-first CI failure triage for open-source maintainers. Paste a failing CI log, get the failure class, the reproduction command, and a suggested fix strategy — in seconds, fully offline.

PyPI CI License Python

patchrail ci explain reading a failed CI log and emitting root cause, confidence, and a reproduce command

The recording above is real output from the bundled examples/ci-triage/typescript-import-type-drift.log fixture. No model calls, no network, no telemetry: the classifier is a curated rule engine that runs entirely on your machine.

Why maintainers use it

  • 33 failure classes backed by real log signatures — dependency resolution, flaky network, OOM-killed runners, Docker builds, lint, type checks, and test failures across Python, Node, TypeScript, Go, Rust, Java, .NET, Ruby, PHP, and C++.
  • 153 sanitized CI log fixtures keep the classifier honest: every rule is benchmarked against the public fixture zoo in examples/ci-triage/ on every test run.
  • 23 secret-redaction patterns (GitHub/GitLab/npm/PyPI/AWS tokens, private keys, JWTs, emails, home paths) so logs can be shared safely.
  • Local-first by design: no network access, no billing, no external model, no telemetry. Nothing leaves the machine.
  • Markdown for humans, JSON for automation — pipe the same result into a PR comment or a workflow step.

Quickstart

PatchRail is published on PyPI:

pipx install patchrail

Classify any failed CI log:

patchrail ci explain --log failed-ci.log

Or try it on a bundled fixture from a clone of this repo:

git clone https://github.com/patchrail/patchrail
cd patchrail
patchrail ci explain --log examples/ci-triage/dependency-failure.log --format markdown

Real output:

# PatchRail CI Report

- Root cause: `python_dependency_resolution`
- Confidence: `0.95`
- Subsystem: Python dependency installation
- Reproduce: `python -m pip install -r requirements.txt`
- Suggested action: Pin or relax the conflicting dependency range, then rerun the same install command and the affected tests.

## Evidence signals

- `Could not find a version that satisfies the requirement`
- `ResolutionImpossible`
- `python -m pip install`

It also reads from stdin, so you can pipe a log straight in:

tail -n 200 failed-ci.log | patchrail ci explain

Every failure class has a step-by-step remediation write-up in docs/fix/.

GitHub Action

Run the same triage on every red CI run with patchrail/ci-triage-action (also on the GitHub Marketplace). It classifies the log locally on the runner — no PR, no comment, nothing leaves the job:

- name: PatchRail CI triage
  if: failure()
  uses: patchrail/ci-triage-action@v1
  with:
    log-path: test.log

See examples/ci-triage-action for the report artifact shape.

Features

Feature Status Notes
CI failure triage (ci explain, ci classify) Beta 33 failure classes for GitHub Actions-style logs and common toolchains
Secret redaction (redact, ci explain --redact) Beta 23 patterns for tokens, keys, emails, and home paths
Reports Beta Markdown, JSON, and plain text
Fixture benchmark (ci benchmark) Beta Scores the classifier against all 153 public fixtures
GitHub Action Beta Read-only triage artifact on failed workflows
Local queue / control plane (queue) Experimental SQLite-backed work items with human approval states
Funded issue discovery (funded-issues) Experimental (read-only) Safe-only defaults, no claiming or commenting; see docs/funded-issues-ethics.md

Local-first & safety

PatchRail never phones home. The classifier needs no API key, no GitHub App, no repo write permission, and no external model call. Write actions (PRs, comments, claims) are out of scope; anything that could become one sits behind an explicit human approval state.

Secret redaction is a first-class feature, not an afterthought. Redact a log before sharing it anywhere:

patchrail redact --log failed.log > failed.redacted.log
patchrail ci explain --redact --log failed.log

The redaction pass covers GitHub, GitLab, npm, PyPI, AWS, Stripe, Slack, Google, Hugging Face, and SendGrid credentials, private key blocks, JWTs, bearer tokens, URL-embedded credentials, *_TOKEN/*_SECRET environment assignments, email addresses, and user home paths.

See ETHICS.md, SECURITY.md, and docs/threat-model.md.

Roadmap

  • v0.3 — public demo of the local agent control plane: SQLite-backed work queue, approval gates, and audit export.
  • v0.4 — ethical funded-maintenance workflow: read-only discovery with human-gated follow-up, no automated claiming.

Details in docs/roadmap.md.

Documentation

Contributing

The fastest way in is adding a CI fixture — it takes about 10 minutes: grab a failed log, redact it, trim it to the smallest excerpt that still shows the root cause, and add it with its expected classification under examples/ci-triage/. The full path is in CONTRIBUTING.md, and the CI failure fixture issue template works if you are not ready to open a pull request.

Issues labeled good first issue are scoped for first-time contributors.

Run the checks locally before opening a PR:

uv run --extra dev pytest -q
uv run --extra dev ruff check .
uv run --extra dev patchrail ci benchmark examples/ci-triage --format json

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patchrail-0.2.0.tar.gz (238.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patchrail-0.2.0-py3-none-any.whl (189.5 kB view details)

Uploaded Python 3

File details

Details for the file patchrail-0.2.0.tar.gz.

File metadata

  • Download URL: patchrail-0.2.0.tar.gz
  • Upload date:
  • Size: 238.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for patchrail-0.2.0.tar.gz
Algorithm Hash digest
SHA256 495e8344e8a6f92b46edb3e7f6ceb0b6ba66fc2b8514554f4b113d3950d90bcc
MD5 a33325c6bf75b964bdf6ca3d79348727
BLAKE2b-256 998ec69c5dc1c403944aa2eaa3d5415df7cb5567f858f7f738b96ba6ddaf60e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchrail-0.2.0.tar.gz:

Publisher: release.yml on patchrail/patchrail

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchrail-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: patchrail-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 189.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for patchrail-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90d2c354f61fc24cf19dda7df7f77d57c0cdccc64edbf7d7fd8ea2218b06bbfa
MD5 ff3f6db3fdbb0a592a7232ff95747004
BLAKE2b-256 922466c37e5acd319f1e7faf2c5b19af49e41e232599021d5aab22a469ef8c33

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchrail-0.2.0-py3-none-any.whl:

Publisher: release.yml on patchrail/patchrail

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page