Welcome to OpenSRE
- GitHub: https://github.com/Tracer-Cloud/opensre
- Discord: https://discord.gg/opensre
- X/Twitter: @open_sre
Looking for a safe first contribution? See Good First Issues.
Use the path that matches the kind of contribution you want to make:
- Bugs & small fixes -> Open a PR. If you need to file an issue first, use the bug report template.
- New features or behavioral changes -> Start with a feature request or ask in Discord before coding. Most feature ideas are better shipped as third-party plugins via the plugin SDK.
- Improvements tied to concrete work -> Use the improvement template when proposing a focused refactor, optimization, or quality improvement.
- Refactor-only PRs -> Do not open one unless a maintainer explicitly asked for it as part of a real fix.
- Test/CI-only PRs for known
mainfailures -> Do not open one unless the change is required to validate a real fix the maintainers asked for. - Questions -> Use the docs, email [email protected], or ask in Discord #contribute. GitHub Issues are for actionable work.
- Security issues -> Follow
SECURITY.md; do not open a public issue.
See SETUP.md for detailed setup instructions including Windows-specific guidance. For benchmark, deployment detail, and telemetry reference, see docs/DEVELOPMENT.md.
Quick start:
- Install uv and clone the repository (see SETUP.md for Windows and alternatives)
- Install dependencies:
make install - Run checks:
make lint && make format-check && make typecheck && make test-cov- When invoking the CLI from your checkout, prefer
uv run opensre …(seeSETUP.mdtroubleshooting if anotheropensreshadows.venv).
- When invoking the CLI from your checkout, prefer
- Build release artifacts when needed:
make build
If you prefer VS Code, use the devcontainer at .devcontainer/devcontainer.json. Details: docs/DEVELOPMENT.md.
Contribution flow:
- Find or create an issue — Pick an existing one (Path A) or raise a new one (Path B)
- Request assignment — Comment on the issue so maintainers know you're working on it
- Discuss (if needed) — For features/changes, discuss approach in the issue before coding
- Fork and branch — Create a branch for your work:
git checkout -b issue/123-description - Code and test — Make changes, add tests, ensure all checks pass
- Submit a PR — Open a pull request (or draft PR) linked to the issue; use the PR template
- Review & iterate — Respond to feedback, make changes as needed
- Merge — Maintainer merges once approved
Detailed steps: See the "Development Workflow" section below.
git checkout -b issue/123-short-descriptionUse issue/ or fix/ prefix. Branch names should be lowercase with hyphens.
- Keep commits focused and logical
- Write clear commit messages:
"Fix: CLI returns error on incomplete commands" - One concern per commit when possible
For simple tools, you do not need a class or ClassVar metadata. Add one file under app/tools/ and register a function with @tool.
Example (app/tools/example_status_tool.py):
from app.tools.tool_decorator import tool
@tool(source="knowledge")
def get_example_status(run_id: str, include_history: bool = False) -> dict[str, object]:
"""Return a lightweight status summary for a run."""
return {
"run_id": run_id,
"include_history": include_history,
}Notes:
sourceis required for function tools.name,description, andinput_schemaare inferred by default.surfacesdefaults to("investigation",). Passsurfaces=("investigation", "chat")to expose the tool in both investigation and chat contexts.- Use the existing package/class style when a tool has complex helper logic, multiple exports, or substantial integration-specific code.
- Test Location: New tests should be placed in the
tests/directory, mirroring the structure of theapp/directory (e.g., tests forapp/cli/go intests/cli/). - No Inline Tests: Avoid adding
*_test.pyfiles directly inside theapp/directory. We are phasing out existing inline tests to keep the core logic clean. - Bug fixes should include a test that would have caught the bug
- New features should have corresponding tests
- Aim for >80% code coverage (run
make test-covto check)
The synthetic test tree has its own Make target (make test-synthetic) and is excluded from make test-cov. The two targets use marker filters:
make test-covrunspytest --ignore=tests/synthetic -m "not synthetic", so the wholetests/synthetic/tree is excluded.make test-syntheticrunspytest -m synthetic, so a file withoutpytest.mark.syntheticis collected but skipped.
If you add a new test file under tests/synthetic/, declare the marker at module level so the file runs under make test-synthetic:
import pytest
pytestmark = pytest.mark.syntheticWithout this marker the new file silently runs in zero standard CI configurations. The pattern is already in tests/synthetic/rds_postgres/test_suite.py; new files in the same tree should follow it.
See #1671 for the meta-issue tracking this discoverability gap.
make lint # ruff: check code style
make format-check # ruff: check formatting (read-only)
make typecheck # mypy: check type annotations
make test-cov # pytest: run tests with coverage reportAll four must pass. CI will block merging if any fail.
Replace the placeholders with your actual file or test name:
pytest tests/cli/test_.py # single file
pytest tests/cli/test_.py::test_ # single function
pytest tests/tools/ -k "test_registry" # tools example
pytest tests/synthetic/ -k "test_scenario" # no live infra neededFollow the PR template (see below). Link the relevant issue and describe what changed and why.
Use the PR template (automatically provided when you open a PR). Key sections:
- Issue link:
Fixes #123(auto-closes the issue when merged) - Type of Change: Select bug fix, feature, breaking change, or docs (helps categorize)
- Description: What changed and why
- Testing: How you tested it with specific steps and evidence
- Impact Analysis: Is it backward compatible? Any breaking changes? Performance impact?
- Linked to the relevant issue
- All local checks pass:
make lint && make format-check && make typecheck && make test-cov - Added tests for bug fixes or new features
- Updated documentation if behavior changed
- Code follows project style (see Code Quality section below)
- Self-reviewed your own code first
- Considered edge cases
We use Greptile for automated code review. Before a PR can be merged it must reach a 5/5 confidence score with zero unresolved comments.
Trigger a review by posting this comment on your PR:
@greptile review
Wait 30–60 seconds for the review to appear, then address each comment and re-trigger until you hit 5/5.
Automate the loop — the greploop skill handles triggering, waiting, fixing, and re-reviewing automatically until 5/5 is reached.
Provide before and after examples when:
- Changing CLI output or error messages
- Updating agent behavior
- Fixing a bug with visible impact
If you used AI tools (Claude, ChatGPT, Copilot, etc.) to generate code, the PR template requires you to confirm:
- I reviewed every single line of AI-generated code (not just skimmed)
- I understand the logic and can explain it in my own words
- I tested edge cases (what could break?)
- I modified output to match project conventions (Code Quality Standards)
- Verified tests pass with the AI-generated code
This ensures you understand the code, not just copied it. Reviewers will pay extra attention to AI-assisted code.
- Clarity over cleverness: Code should be easy to understand and maintain
- DRY principle: Don't repeat yourself; extract common patterns
- Strong typing: Use type hints for all function parameters and returns
- One responsibility: Each function/class should do one thing well
- Comments for "why": Explain non-obvious logic; code already shows the "what"
- Breaking changes: Call them out explicitly in PR descriptions and docs
We use:
- ruff for linting and import sorting
- mypy for strict type checking
- Black-compatible formatting (4-space indents)
- pytest for testing with coverage tracking
Run these before every commit:
make lint # Auto-fixes many style issues
make format-check # Checks formatting without modifying files
make typecheck # Catches type errors
make test-cov # Ensures tests pass and coverage is trackedTo verify the package can be shipped, run:
make buildUse the bug report template when creating an issue. It guides you to include:
- Summary: One-line description of the bug (specific, not vague)
- Expected behavior: What should happen
- Actual behavior: What actually happens (with error message)
- Reproduction steps: Clear, minimal steps to consistently trigger the bug
- Can you reproduce it consistently? Every time / Intermittent / Sometimes
- Environment: OS, Python version, agent version, install method, relevant config
- Error output: Full error messages and logs (redact secrets like API keys)
- Workarounds: If you found a way to work around it
- Context: What were you trying to do? Is this blocking your work?
Example:
### Expected Behavior
`opensre investigate --org myorg` should return investigation results
### Actual Behavior
Command exits silently with no output
Error: exit code 0
### Steps to Reproduce
1. Run `opensre investigate --org myorg`
2. Observe output
### Environment
- OS: macOS 14.2
- Python: 3.11.5
- opensre version: v0.2.1
Use the feature request template to propose new functionality. It guides you to clarify:
- Problem statement: Why do we need this? (focus on the problem, not solution)
- Proposed solution: How should it work? (specific and concrete with examples)
- Acceptance criteria: What needs to be true for this to be "done"?
- Alternative approaches: Other solutions you considered and why you prefer this one
- Backward compatible? Yes / No / Breaking changes (describe what changes)
- Impact: Which modules? New dependencies?
Use the improvement template to propose refactors, optimizations, or quality improvements. It requires:
- Current state: How does it work now? (with code references)
- Desired state: How should it work instead?
- Why it matters: Performance? Maintainability? Reliability?
- Scope: One focused concern per issue (not bundled work)
- Acceptance criteria: How will we measure success?
- Metrics: Before and after values (e.g., "15ms → <1ms")
- Setup issues? Check this guide first, then open an issue with details
- How do I...? Check the project docs or ask in a Discussion
- Found a bug? Open a bug report issue with the template
- Have an idea? Start a Discussion to gauge interest before opening an issue
By contributing, you agree that your contributions will be licensed under the project's license (see LICENSE).