Skip to content

FlexNetOS/noa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

812 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– FlexNetOS Automated CI System

Fully Automated GitHub - No Human in the Loop

This is a comprehensive CI/CD automation system that aggregates issues from pull requests, uses AI to resolve them, and automatically merges changes into main. Designed for the FlexNetOS organization to use across all repositories.

🎯 What This System Does

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FlexNetOS Automation Flow                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                          β”‚
β”‚   PR Created ──► Aggregate Issues ──► Create Tracking Issue              β”‚
β”‚                        β”‚                      β”‚                          β”‚
β”‚                        β–Ό                      β–Ό                          β”‚
β”‚               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”‚
β”‚               β”‚     πŸ€– AI Resolution Engine           β”‚                 β”‚
β”‚               β”‚                                       β”‚                 β”‚
β”‚               β”‚  β€’ Resolve merge conflicts            β”‚                 β”‚
β”‚               β”‚  β€’ Fix linting errors                 β”‚                 β”‚
β”‚               β”‚  β€’ Apply code suggestions             β”‚                 β”‚
β”‚               β”‚  β€’ Fix security vulnerabilities       β”‚                 β”‚
β”‚               β”‚  β€’ Resolve review comments            β”‚                 β”‚
β”‚               β”‚  β€’ Fix type errors                    β”‚                 β”‚
β”‚               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β”‚
β”‚                        β”‚                                                 β”‚
β”‚                        β–Ό                                                 β”‚
β”‚            β”Œβ”€β”€β”€β”€ Issues Remaining? ────┐                                β”‚
β”‚            β”‚                           β”‚                                β”‚
β”‚           Yes                          No                               β”‚
β”‚            β”‚                           β”‚                                β”‚
β”‚            β–Ό                           β–Ό                                β”‚
β”‚     Loop (max 10x)              Auto-Merge to Main                      β”‚
β”‚                                        β”‚                                β”‚
β”‚                                        β–Ό                                β”‚
β”‚                                Close Tracking Issue                     β”‚
β”‚                                        β”‚                                β”‚
β”‚                                        β–Ό                                β”‚
β”‚                                     Done βœ…                             β”‚
β”‚                                                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Components

Core Workflows

File Purpose
workflows/flexnetos-auto-resolve.yml Main CI workflow for automated resolution
workflows/flexnetos-reusable-resolver.yml Reusable workflow for organization repos

Actions

File Purpose
actions/ai-resolver/action.yml Composite action for AI-powered resolution

Scripts

File Purpose
scripts/web-app-auth.py Web app authentication for AI providers
scripts/rate-limiter.py Rate limiting and circuit breaker
scripts/rollback-manager.py Automatic rollback system
scripts/audit-logger.py Comprehensive audit logging
scripts/deploy-to-org.sh Deploy to all org repositories

AI Providers

File Purpose
scripts/providers/cursor-cli.py Cursor CLI integration
scripts/providers/abacus-ai.py Abacus AI integration

Auth Connectors

File Purpose
scripts/auth/github-app.py GitHub App management
scripts/auth/oauth-connectors.py OAuth providers (Google, GitHub, Microsoft, OpenAI)
scripts/auth/oauth-server.py Local OAuth callback server

Configuration

File Purpose
org-config/flexnetos-automation.yml Organization-wide settings

πŸš€ Quick Start

1. Set Up Organization Secrets

# Required: Bot token for GitHub operations
gh secret set FLEXNETOS_BOT_TOKEN --org FlexNetOS

# AI Provider API Keys
gh secret set CURSOR_API_KEY --org FlexNetOS      # Cursor CLI
gh secret set ABACUS_API_KEY --org FlexNetOS      # Abacus AI
gh secret set ANTHROPIC_API_KEY --org FlexNetOS   # Claude API
gh secret set OPENAI_API_KEY --org FlexNetOS      # OpenAI API

# Optional: Web session tokens
gh secret set CLAUDE_SESSION_TOKEN --org FlexNetOS
gh secret set CHATGPT_SESSION_TOKEN --org FlexNetOS

# GitHub App (recommended for org-wide access)
gh secret set GITHUB_APP_ID --org FlexNetOS
gh secret set GITHUB_APP_PRIVATE_KEY --org FlexNetOS

# OAuth Clients (for user account linking)
gh secret set GOOGLE_CLIENT_ID --org FlexNetOS
gh secret set GOOGLE_CLIENT_SECRET --org FlexNetOS
gh secret set GITHUB_CLIENT_ID --org FlexNetOS
gh secret set GITHUB_CLIENT_SECRET --org FlexNetOS

2. Deploy to All Repositories

# Deploy to all repos in the organization
.github/scripts/deploy-to-org.sh

# Or do a dry run first
.github/scripts/deploy-to-org.sh --dry-run

# Deploy to specific repos
.github/scripts/deploy-to-org.sh --repos "repo1,repo2,repo3"

3. Use in Individual Repositories

Add this workflow to any repository:

# .github/workflows/auto-resolve.yml
name: FlexNetOS Automation

on:
  pull_request:
    types: [opened, synchronize, reopened, review_requested]
  pull_request_review:
    types: [submitted]

jobs:
  auto-resolve:
    uses: FlexNetOS/.github/.github/workflows/flexnetos-reusable-resolver.yml@main
    with:
      pr_number: ${{ github.event.pull_request.number }}
      max_iterations: 10
      ai_provider: copilot
      auto_merge: true
    secrets:
      BOT_TOKEN: ${{ secrets.FLEXNETOS_BOT_TOKEN }}

🧠 AI Provider Support

This system supports multiple AI providers with flexible authentication:

Provider Auth Method Best For Reference
Cursor CLI API Key Code operations, CI fix Docs
Abacus AI API Key Workflow automation Docs
GitHub Copilot GitHub Token Code suggestions Native integration
Claude.ai Web Session/API Complex reasoning anthropic.com
ChatGPT Web Session/API General fixes openai.com
Gemini OAuth/API Multi-modal ai.google.dev
Local LLM None Offline, privacy Ollama, llama.cpp

Provider Priority

ai_providers:
  priority:
    - cursor     # Best for code operations
    - copilot    # Best GitHub integration
    - abacus     # Workflow automation
    - claude     # Complex reasoning
    - chatgpt    # General purpose
    - gemini     # Multi-modal
    - local      # Fallback

Cursor CLI Integration

Cursor CLI provides powerful headless code operations:

# Install Cursor CLI
curl https://cursor.com/install -fsS | bash

# Run analysis
cursor-agent -p --force "Fix linting errors in this file"

# Fix CI failures
cursor-agent -p --force "A CI workflow failed: $(cat failure.log)"

Abacus AI Integration

Abacus AI enables AI workflow automation:

from abacusai import ApiClient

client = ApiClient(api_key=os.environ['ABACUS_API_KEY'])
agent = client.execute_agent(agent_id='your_agent', input_text='Review this code')

Why Multiple Auth Methods?

  • βœ… API Keys: Best for CI/CD automation
  • βœ… Web App Auth: Access latest models without API costs
  • βœ… OAuth: User-level authentication and account linking
  • βœ… GitHub App: Organization-wide access with fine-grained permissions

πŸ“Š Issue Aggregation

The system collects issues from multiple sources:

Collected Issue Types

Category Source Auto-Fixable
Workflow Failures GitHub Actions ⚠️ Partial
Linting Errors ESLint, etc. βœ… Yes
Type Errors TypeScript ⚠️ Partial
Test Failures Jest, etc. ❌ No
Security Issues npm audit, CodeQL βœ… Yes
Merge Conflicts Git βœ… Yes
Review Comments PR Reviews ⚠️ Partial
Suggestions Code Suggestions βœ… Yes
Conversations Review Threads ⚠️ Partial

Consolidated Issue Example

When issues are found, a tracking issue is created:

## πŸ€– FlexNetOS Auto-Resolution Report

**PR:** #42
**Iteration:** 1

### πŸ“Š Issue Summary

| Severity | Count |
|----------|-------|
| πŸ”΄ Critical | 2 |
| 🟠 High | 5 |
| 🟑 Medium | 12 |
| 🟒 Low | 3 |

### πŸ”§ Issues by Category

#### πŸ”€ Merge Conflicts
- [ ] πŸ”΄ Conflict in src/index.ts

#### πŸ“ Linting Errors
- [ ] 🟑 Missing semicolon (line 42)
- [ ] 🟑 Unused variable 'temp'

πŸ”„ Loop Control

The system runs in a loop until all issues are resolved:

Iteration 1: 22 issues found β†’ 15 fixed β†’ 7 remaining
Iteration 2: 7 issues found β†’ 5 fixed β†’ 2 remaining
Iteration 3: 2 issues found β†’ 2 fixed β†’ 0 remaining
βœ… All issues resolved β†’ Auto-merge to main

Loop Settings

Setting Default Description
Max Iterations 10 Maximum loop iterations
Iteration Delay 30s Delay between iterations
Total Timeout 2 hours Maximum total runtime
Confidence Threshold 0.85 Min confidence for auto-apply

πŸ” Authentication & OAuth

GitHub App Setup

For organization-wide automation, create a GitHub App:

# Generate setup instructions
python .github/scripts/auth/github-app.py --setup

# Generate app manifest
python .github/scripts/auth/github-app.py --manifest

Reference: Creating GitHub Apps

OAuth Connectors

Connect user accounts from multiple providers:

Provider Type Use Case
Google OAuth 2.0 Gemini AI, GCP services
GitHub OAuth 2.0 Repository access
Microsoft OAuth 2.0 Azure AD, M365
OpenAI OAuth 2.0 ChatGPT integration
Anthropic API Key Claude API
Abacus API Key AI workflows
Cursor API Key Code operations

OAuth Server

Run the local OAuth server for testing:

# Start OAuth server
python .github/scripts/auth/oauth-server.py --port 8080

# Navigate to http://localhost:8080 to connect accounts

Reference: Authorizing OAuth Apps

Auth Connector Files

File Purpose
auth/github-app.py GitHub App JWT auth
auth/oauth-connectors.py Unified OAuth providers
auth/oauth-server.py Local OAuth server

πŸ›‘οΈ Safety Features

Rate Limiting

# GitHub API: 5000 requests/hour
# Claude: 50 requests/hour
# ChatGPT: 60 requests/hour
# Copilot: 200 requests/hour

Circuit Breaker

Prevents cascading failures:

CLOSED β†’ (5 failures) β†’ OPEN β†’ (5 min timeout) β†’ HALF_OPEN β†’ (success) β†’ CLOSED

Automatic Rollback

Triggers on:

  • 🚨 Deployment failure
  • πŸ§ͺ Test regression
  • πŸ”’ Security regression

Audit Logging

All actions are logged for compliance:

[2024-01-15T10:30:00Z] [resolution_started] FlexNetOS/noa PR#42
[2024-01-15T10:30:05Z] [fix_applied] ESLint auto-fix
[2024-01-15T10:30:10Z] [merge_completed] PR merged to main

βš™οΈ Configuration

Organization Config

Edit .github/org-config/flexnetos-automation.yml:

automation:
  enabled: true
  mode: fully_automated  # or semi_automated, manual_review

ai_providers:
  priority:
    - copilot
    - claude
    - chatgpt
    - local

auto_merge:
  enabled: true
  requirements:
    all_checks_passing: true
    no_critical_issues: true

Per-Repository Override

Create .github/flexnetos-config.yml in any repo:

# Override organization defaults
automation:
  mode: semi_automated  # Require approval for this repo

resolution:
  max_iterations: 5

auto_merge:
  enabled: false  # Disable auto-merge for this repo

πŸ”§ What Was Missing (Gaps Filled)

The original request asked for automated CI. Here's what was added:

1. Rate Limiting & Backoff

  • Per-provider rate limits
  • Exponential backoff on failures
  • Burst limiting

2. Circuit Breaker Pattern

  • Prevents hammering failing services
  • Automatic recovery testing
  • Configurable thresholds

3. Security Scanning Integration

  • CodeQL analysis
  • Dependency auditing
  • Secret scanning

4. Rollback System

  • Automatic rollback on failures
  • Health check monitoring
  • Rollback PR creation

5. State Management

  • Iteration state persistence
  • Cross-run continuity
  • Cleanup on completion

6. Audit Trail

  • Structured event logging
  • Cost tracking
  • Compliance reports

7. Cost Management

  • Token usage tracking
  • Per-provider cost estimation
  • Monthly limits

8. Error Handling

  • Graceful degradation
  • Retry with backoff
  • Fallback providers

9. Quality Gates

  • Test coverage checks
  • Lint validation
  • Security scanning before merge

10. Notification System

  • GitHub Issues for errors
  • Workflow run summaries
  • Rollback notifications

πŸ“ˆ Monitoring

GitHub Actions Summary

Each run produces a summary:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   FlexNetOS Auto-Resolution Report     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ PR Number: #42                         β”‚
β”‚ Iterations: 3                          β”‚
β”‚ Fixes Applied: 22                      β”‚
β”‚ Status: βœ… Merged                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Audit Report

Generate compliance reports:

python .github/scripts/audit-logger.py --action report --repo FlexNetOS/noa --days 30

Cost Report

Track AI usage costs:

python .github/scripts/audit-logger.py --action costs --days 30

🚨 Troubleshooting

Common Issues

Issue Solution
Rate limited Wait or switch provider
Circuit open Check service health
Max iterations Increase limit or fix manually
Merge conflict Check conflict resolution logs
Auth failed Refresh session tokens

Manual Intervention

If automation gets stuck:

# Force close circuit breaker
python .github/scripts/rate-limiter.py --action force-close --resource github_api

# Trigger manual rollback
python .github/scripts/rollback-manager.py --repo FlexNetOS/noa --action rollback

# View audit logs
python .github/scripts/audit-logger.py --action report --repo FlexNetOS/noa

πŸ“„ License

Part of the FlexNetOS project. See LICENSE for details.


πŸ€– Fully Automated GitHub - Because developers should code, not manage PRs.

About

NOA: Multi-Platform Autonomous Self-Modifying Agentic OS

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 8