-
Notifications
You must be signed in to change notification settings - Fork 16
Matas/fix/fix actions #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dkargatzis
merged 25 commits into
warestack:main
from
MT-superdev:matas/fix/fix-actions
Jan 31, 2026
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4bfd1c6
Matas: Minor overall refactor and fixed bugs
MT-superdev 407e34e
fix: Resolve all pytest failures (imports, api, mocks, async_client)
MT-superdev 6ae016c
fix: add respx to dev dependencies for CI compatibility
MT-superdev cfaae12
triggering ci cd
MT-superdev 527d626
chore: update uv.lock with respx dependency
MT-superdev 2c92405
chore: triggering docs workflow
MT-superdev 58931d7
fix: add docs dependencies for mkdocs build in CI
MT-superdev 8a647ca
chore: triggering docs workflow
MT-superdev f088920
fix: restrict docs deployment to upstream repo only
MT-superdev a28fedb
chore: triggering docs workflow
MT-superdev e851eb6
feat: Enhance Repository Analysis Agent with AI Immune System features
MT-superdev 02276f3
fix: updated uv.lock file
MT-superdev 963abb2
feat: Enhance repository analysis with new hygiene metrics and API re…
MT-superdev a9f74b4
refactor: Remove giturlparse dependency and update event handler regi…
MT-superdev 6a426e2
refactor: immune system metrics, require_linked_issue validator, API …
dkargatzis 154b56d
Merge branch 'matas/fix/fix-actions' of https://github.com/MT-superde…
MT-superdev f791d37
Architectural Modernization and Production Hardening
MT-superdev 8c26009
Fix Pydantic & Ruff Conflicts
MT-superdev e313021
feat: Introduce core infrastructure for GitHub event processing with …
MT-superdev 63b3e2b
minor fix on previous commit
MT-superdev 61cfbcd
fix(rules,webhooks,api): preserve engine conditions, CODEOWNERS rules…
dkargatzis 3e642f0
docs: align all docs with rule engine, tone, and supported logic
dkargatzis aab5d42
fix: acknowledgment matching, processor Task type, and response norma…
dkargatzis 89fc0c4
fix: CodeRabbit and WebhookResponse status
dkargatzis 07e3918
fix(pr,webhooks): remove dead code and handle JSON parse errors
dkargatzis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,231 +1,83 @@ | ||
| # Contributing to Watchflow | ||
|
|
||
| Welcome to Watchflow! We're building the future of agentic DevOps governance. This guide will help you contribute | ||
| effectively to our advanced multi-agent system. | ||
| Thanks for considering contributing. Watchflow is a **rule engine** for GitHub—rules in YAML, enforcement on PR and push. We aim for **maintainer-first** docs and code: tech-forward, slightly retro, no marketing fluff. The hot path is condition-based (no LLM for rule evaluation); optional AI is used for repo analysis and feasibility suggestions. See [README](README.md) and [docs](docs/) for the supported logic and architecture. | ||
|
|
||
| ## 🎯 Our Vision | ||
| --- | ||
|
|
||
| Watchflow implements cutting-edge agentic AI techniques for DevOps governance, combining: | ||
| - **Advanced Multi-Agent Systems** with sophisticated coordination patterns | ||
| - **Hybrid Intelligence** (static rules + LLM reasoning) | ||
| - **Context-Aware Decision Making** with temporal and spatial awareness | ||
| - **Regression Prevention** to avoid duplicate violations | ||
| - **Enterprise-Grade Policy Coverage** based on real-world research | ||
| ## Direction and scope | ||
|
|
||
| ## Architecture Overview | ||
| - **Rule engine** — Conditions map parameter keys to built-in logic (e.g. `require_linked_issue`, `max_lines`, `require_code_owner_reviewers`). New conditions live in `src/rules/conditions/` and are registered in `src/rules/registry.py` and `src/rules/acknowledgment.py`. | ||
| - **Webhooks** — Delivery ID–based dedup so handler and processor both run; welcome comment when no rules file exists. | ||
| - **API** — Repo analysis and proceed-with-PR support `installation_id` so install-flow users don’t need a PAT. | ||
| - **Docs** — All MD files should speak to engineers: direct, no fluff, immune-system framing (Watchflow as necessary governance, not “another AI tool”). | ||
|
|
||
| ### Design Patterns We Use | ||
| - **Agent Pattern**: Each agent has specific responsibilities and interfaces | ||
| - **Strategy Pattern**: Dynamic validation strategy selection | ||
| - **Observer Pattern**: Event-driven agent coordination | ||
| - **Command Pattern**: Action execution with undo capabilities | ||
| - **Factory Pattern**: Dynamic agent and validator creation | ||
| - **Decorator Pattern**: Cross-cutting concerns (logging, metrics, retry) | ||
| - **State Machine Pattern**: Agent lifecycle management | ||
| --- | ||
|
|
||
| ## Getting Started | ||
| ## Getting started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Python 3.12+ | ||
| - OpenAI API key | ||
| - LangSmith account (for tracing) | ||
| - GitHub App setup | ||
| - [uv](https://docs.astral.sh/uv/) (recommended) or pip | ||
| - OpenAI API key (for repo analysis and feasibility agents) | ||
| - LangSmith (optional, for agent debugging) | ||
| - GitHub App credentials (for local webhook testing; see [LOCAL_SETUP.md](LOCAL_SETUP.md)) | ||
|
|
||
| ### Development setup | ||
|
|
||
| ### Development Setup | ||
| ```bash | ||
| # Clone and setup | ||
| git clone https://github.com/warestack/watchflow.git | ||
| cd watchflow | ||
| uv sync | ||
|
|
||
| # Environment setup | ||
| cp .env.example .env | ||
| # Add your API keys to .env | ||
|
|
||
| # Run tests | ||
| uv run pytest | ||
|
|
||
| # Start development server | ||
| uv run python -m src.main | ||
| ``` | ||
|
|
||
| ## Advanced Techniques We're Implementing | ||
|
|
||
| ### 1. Sophisticated Agent Coordination | ||
| - **Hierarchical Agent Orchestration**: Supervisor agents coordinate specialized sub-agents | ||
| - **Conflict Resolution**: Multi-agent decision synthesis with confidence scoring | ||
| - **Dynamic Agent Composition**: Runtime agent creation based on context | ||
| - **Agent Communication Protocols**: Message passing with typed interfaces | ||
|
|
||
| ### 2. Advanced LLM Integration | ||
| - **Chain-of-Thought Reasoning**: Step-by-step decision making | ||
| - **ReAct Pattern**: Reasoning + Acting in agent workflows | ||
| - **Few-Shot Learning**: Dynamic prompt examples based on context | ||
| - **Structured Output Validation**: Pydantic models with retry logic | ||
| - **Prompt Injection Mitigation**: Security-first prompt engineering | ||
|
|
||
| ### 3. Context-Aware Intelligence | ||
| - **Temporal Context**: Historical decision patterns and outcomes | ||
| - **Spatial Context**: Repository, team, and organizational context | ||
| - **Developer Context**: Experience level, contribution patterns, team dynamics | ||
| - **Business Context**: Project phase, compliance requirements, risk profiles | ||
|
|
||
| ### 4. Regression Prevention System | ||
| - **Violation Deduplication**: Avoid sending same violations repeatedly | ||
| - **State Tracking**: Track violation resolution status across events | ||
| - **Smart Notifications**: Context-aware escalation and reminder systems | ||
| - **Learning from Feedback**: Adapt based on developer responses | ||
|
|
||
| ## Development Guidelines | ||
|
|
||
| ### Code Quality Standards | ||
| - **Type Hints**: All functions must have complete type annotations | ||
| - **Async/Await**: Use async patterns throughout for performance | ||
| - **Error Handling**: Comprehensive error handling with structured logging | ||
| - **Testing**: Unit tests, integration tests, and agent behavior tests | ||
| - **Documentation**: Docstrings with examples and type information | ||
|
|
||
| ### Agent Development | ||
| ```python | ||
| class AdvancedAgent(BaseAgent): | ||
| """Example of advanced agent implementation.""" | ||
|
|
||
| def __init__(self, **kwargs): | ||
| super().__init__(**kwargs) | ||
| self.context_store = ContextStore() | ||
| self.learning_engine = LearningEngine() | ||
| self.regression_preventer = RegressionPreventer() | ||
|
|
||
| async def execute(self, **kwargs) -> AgentResult: | ||
| """Execute with advanced techniques.""" | ||
| # 1. Context enrichment | ||
| context = await self.context_store.enrich(kwargs) | ||
|
|
||
| # 2. Regression check | ||
| if await self.regression_preventer.is_duplicate(context): | ||
| return AgentResult(success=True, message="Duplicate violation prevented") | ||
|
|
||
| # 3. Advanced reasoning | ||
| result = await self._advanced_reasoning(context) | ||
|
|
||
| # 4. Learning update | ||
| await self.learning_engine.update(result, context) | ||
|
|
||
| return result | ||
| ``` | ||
| # Add API keys and GitHub App credentials to .env | ||
|
|
||
| ### Design Pattern Examples | ||
| ```python | ||
| # Strategy Pattern for validation | ||
| class ValidationStrategy(ABC): | ||
| @abstractmethod | ||
| async def validate(self, context: ValidationContext) -> ValidationResult: | ||
| pass | ||
|
|
||
| class LLMValidationStrategy(ValidationStrategy): | ||
| async def validate(self, context: ValidationContext) -> ValidationResult: | ||
| # Advanced LLM reasoning with CoT | ||
| pass | ||
|
|
||
| # Observer Pattern for agent coordination | ||
| class AgentCoordinator: | ||
| def __init__(self): | ||
| self.observers: List[AgentObserver] = [] | ||
|
|
||
| def notify_agents(self, event: AgentEvent): | ||
| for observer in self.observers: | ||
| asyncio.create_task(observer.handle_event(event)) | ||
| uv run pytest tests/unit/ tests/integration/ -v # run tests | ||
| uv run python -m src.main # start server | ||
| ``` | ||
|
|
||
| ## Contribution Areas | ||
|
|
||
| ### High-Priority Issues | ||
| 1. **Advanced Agent Coordination** - Implement sophisticated multi-agent orchestration | ||
| 2. **Regression Prevention System** - Build violation deduplication and state tracking | ||
| 3. **Context-Aware Intelligence** - Enhance context enrichment and decision making | ||
| 4. **Learning Agent Implementation** - Add feedback-based policy adaptation | ||
| 5. **Enterprise Policy Coverage** - Implement 70+ real-world enterprise policies | ||
|
|
||
| ### Advanced Features | ||
| - **Agent Specialization**: Domain-specific agents (security, compliance, performance) | ||
| - **Cross-Platform Support**: Extend beyond GitHub to GitLab, Azure DevOps | ||
| - **Advanced Analytics**: Decision quality metrics and performance optimization | ||
| - **Custom Agent Development**: Framework for users to create custom agents | ||
|
|
||
| ## Testing Strategy | ||
|
|
||
| ### Agent Testing | ||
| ```python | ||
| @pytest.mark.asyncio | ||
| async def test_agent_coordination(): | ||
| """Test sophisticated agent coordination.""" | ||
| coordinator = AgentCoordinator() | ||
| result = await coordinator.coordinate_agents( | ||
| task="complex_policy_evaluation", | ||
| context=test_context | ||
| ) | ||
| assert result.confidence > 0.8 | ||
| assert len(result.agent_decisions) > 0 | ||
| ``` | ||
| See [DEVELOPMENT.md](DEVELOPMENT.md) for full env vars and [LOCAL_SETUP.md](LOCAL_SETUP.md) for GitHub App and ngrok. | ||
|
|
||
| ### Integration Testing | ||
| - **End-to-End Workflows**: Complete agent orchestration scenarios | ||
| - **Performance Testing**: Latency and throughput under load | ||
| - **Regression Testing**: Ensure new features don't break existing functionality | ||
| --- | ||
|
|
||
| ## 📚 Resources | ||
| ## Code and architecture | ||
|
|
||
| ### Academic Foundation | ||
| - Our thesis: "Watchflow: Agentic DevOps Governance" | ||
| - Multi-Agent Systems literature | ||
| - LLM reasoning techniques (CoT, ReAct, etc.) | ||
| - DevOps governance best practices | ||
| - **Conditions** — One class per rule type in `src/rules/conditions/`; each has `name`, `parameter_patterns`, `event_types`, and `evaluate()` / `validate()`. Registry maps parameter keys to condition classes. | ||
| - **Rule loading** — `src/rules/loaders/github_loader.py` reads `.watchflow/rules.yaml` from the default branch; normalizes aliases (e.g. `max_changed_lines` → `max_lines`). | ||
| - **PR processor** — Loads rules, enriches event with PR files and CODEOWNERS content, passes **Rule objects** (with condition instances) to the engine so conditions aren’t stripped. | ||
| - **Task queue** — Task ID includes `delivery_id` when present so handler and processor get distinct IDs per webhook delivery. | ||
|
|
||
| ### Technical Resources | ||
| - [LangGraph Documentation](https://langchain-ai.github.io/langgraph/) | ||
| - [OpenAI API Best Practices](https://platform.openai.com/docs/guides/production-best-practices) | ||
| - [Pydantic Documentation](https://docs.pydantic.dev/) | ||
| - [FastAPI Documentation](https://fastapi.tiangolo.com/) | ||
| --- | ||
|
|
||
| ## Community | ||
| ## Running tests | ||
|
|
||
| - **Discussions**: Use GitHub Discussions for architecture questions | ||
| - **Issues**: Report bugs and request features | ||
| - **Pull Requests**: Submit improvements and new features | ||
| - **Discord**: Join our community for real-time collaboration | ||
| ```bash | ||
| uv sync --all-extras | ||
| uv run pytest tests/unit/ tests/integration/ -v | ||
| ``` | ||
|
|
||
| ## Pull Request Process | ||
| Run from repo root with the project venv active (or use `just test-local` / see DEVELOPMENT.md) so the correct interpreter and deps are used. | ||
|
|
||
| 1. **Fork** the repository | ||
| 2. **Create** a feature branch (`git checkout -b feature/amazing-feature`) | ||
| 3. **Implement** with tests and documentation | ||
| 4. **Run** tests (`uv run pytest`) | ||
| 5. **Commit** changes (`git commit -m 'Add amazing feature'`) | ||
| 6. **Push** to branch (`git push origin feature/amazing-feature`) | ||
| 7. **Open** a Pull Request | ||
| --- | ||
|
|
||
| ### PR Requirements | ||
| - [ ] All tests pass | ||
| - [ ] Type hints added | ||
| - [ ] Documentation updated | ||
| - [ ] No regression in performance | ||
| - [ ] Agent behavior tests included | ||
| ## Pull requests | ||
|
|
||
| ## Recognition | ||
| 1. Branch from `main` (or the current target branch). | ||
| 2. Keep changes focused; prefer multiple small PRs over one large one. | ||
| 3. Ensure tests pass and pre-commit hooks (ruff, etc.) pass. | ||
| 4. Use conventional commit style where possible (e.g. `fix(rules): preserve conditions in engine`). | ||
|
|
||
| Contributors will be recognized in: | ||
| - README contributors section | ||
| - Release notes | ||
| - Academic papers (where applicable) | ||
| - Community highlights | ||
| --- | ||
|
|
||
| ## Questions? | ||
| ## Docs | ||
|
|
||
| - **Architecture**: Open a discussion | ||
| - **Implementation**: Ask in issues | ||
| - **Research**: Contact maintainers | ||
| - **Community**: Join Discord | ||
| - **Tone** — Tech-forward, slightly retro, maintainer-first. Speak to engineers, not marketing. “Immune system” framing: Watchflow as necessary governance, not another AI tool. | ||
| - **Accuracy** — Parameter names and conditions in docs must match the code (see `src/rules/registry.py` and condition modules). | ||
| - **Examples** — Use real parameter names: `require_linked_issue`, `max_lines`, `require_code_owner_reviewers`, `no_force_push`, etc. | ||
|
|
||
| --- | ||
|
|
||
| Thank you for contributing to Watchflow! | ||
| ## Questions | ||
|
|
||
| - [GitHub Discussions](https://github.com/warestack/watchflow/discussions) | ||
| - [GitHub Issues](https://github.com/warestack/watchflow/issues) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
latest version of ruff linter 2025 2026💡 Result:
As of January 24, 2026:
0.14.14, released January 22, 2026. [1]0.14.13, uploaded January 15, 2026. [2]Sources: [1] [2]
Update Ruff to a current version—v0.3.0 is outdated.
The pinned version
v0.3.0is approximately two years old (from early 2024). The current latest version isv0.14.14(released January 22, 2026). This appears to be a downgrade or typo. Update to at leastv0.14.13orv0.14.14to benefit from bug fixes, security updates, and improvements across 11+ minor versions.🤖 Prompt for AI Agents