-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add Copilot cascade routing: multi-agent PR review at $0 #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,44 @@ | ||||||
| # Copilot Instructions for simulation-hypothesis | ||||||
|
|
||||||
| ## Repository Overview | ||||||
|
|
||||||
| This is a static research repository containing a paper and supporting code exploring the "Simulation Hypothesis" — the computational argument that reality is self-referential. It is authored by Alexa Louise Amundson at BlackRoad OS, Inc. | ||||||
|
|
||||||
| ## Repository Structure | ||||||
|
|
||||||
| - `PAPER.md` — The main research paper (21 sections) | ||||||
| - `DECLARATION.md`, `ORIGIN.md` — Supporting declarations | ||||||
| - `README.md` — Overview, abstract, and evidence index | ||||||
| - `code/` — Python 3 demonstration scripts (no external dependencies except `matplotlib` for `lorenz.py`) | ||||||
| - `evidence/` — Evidence index with references | ||||||
| - `index.html`, `vr.html`, `qr.html` — Static web app pages | ||||||
| - `manifest.json`, `icon.svg` — PWA manifest assets | ||||||
| - `LICENSE` — BlackRoad OS proprietary license | ||||||
|
|
||||||
| ## Languages & Runtimes | ||||||
|
|
||||||
| - **Python 3** for all scripts in `code/` | ||||||
| - **HTML/CSS/JS** for the web app (`index.html`, `vr.html`, `qr.html`) | ||||||
| - No build system, no package manager, no compilation step | ||||||
|
|
||||||
| ## Running the Code | ||||||
|
|
||||||
| ```bash | ||||||
| cd code | ||||||
| python3 hashchain.py # no external deps | ||||||
| python3 riemann_zeros.py # no external deps | ||||||
| python3 lorenz.py # requires: pip install matplotlib | ||||||
| python3 magic_square.py # no external deps | ||||||
| python3 dna_encoding.py # no external deps | ||||||
| python3 roadchain.py # no external deps | ||||||
| ``` | ||||||
|
|
||||||
| ## Validation | ||||||
|
|
||||||
| There are no automated tests. To validate changes to Python scripts, run them directly and confirm they produce expected output without errors. There are no linting configs or CI pipelines defined in this repository. | ||||||
|
||||||
| There are no automated tests. To validate changes to Python scripts, run them directly and confirm they produce expected output without errors. There are no linting configs or CI pipelines defined in this repository. | |
| There are no automated tests or dedicated linting configuration files. To validate changes to Python scripts, run them directly and confirm they produce expected output without errors. A basic GitHub Actions workflow exists under `.github/workflows/`, but it does not replace manual validation. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,136 @@ | ||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env python3 | ||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||
| Cascade PR review using multiple free GitHub Models agents. | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Routes each pull request through two independent free-tier AI models | ||||||||||||||||||||||||||||||||||||
| and writes a combined Markdown review to /tmp/cascade_review.md. | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Cost: $0 — uses the GitHub Models free rate-limited tier. | ||||||||||||||||||||||||||||||||||||
| Docs: https://docs.github.com/en/github-models/about-github-models | ||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import json | ||||||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||||||
| import subprocess | ||||||||||||||||||||||||||||||||||||
| import urllib.request | ||||||||||||||||||||||||||||||||||||
| import urllib.error | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # --------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| # Configuration — free models only (no premium request multiplier cost) | ||||||||||||||||||||||||||||||||||||
| # --------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||
| MODELS = [ | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| "id": "openai/gpt-4o-mini", | ||||||||||||||||||||||||||||||||||||
| "label": "Agent 1 · `openai/gpt-4o-mini`", | ||||||||||||||||||||||||||||||||||||
| "system": ( | ||||||||||||||||||||||||||||||||||||
| "You are a concise code reviewer. Provide clear, actionable feedback " | ||||||||||||||||||||||||||||||||||||
| "focused on correctness, clarity, and potential issues." | ||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| "id": "meta/meta-llama-3.1-8b-instruct", | ||||||||||||||||||||||||||||||||||||
| "label": "Agent 2 · `meta/meta-llama-3.1-8b-instruct`", | ||||||||||||||||||||||||||||||||||||
| "system": ( | ||||||||||||||||||||||||||||||||||||
| "You are a thoughtful code reviewer. Focus on logic, edge cases, " | ||||||||||||||||||||||||||||||||||||
| "and documentation quality." | ||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| MODELS_ENDPOINT = "https://models.inference.ai.azure.com/chat/completions" | ||||||||||||||||||||||||||||||||||||
| MAX_DIFF_CHARS = 6000 # stay well within free-tier token limits | ||||||||||||||||||||||||||||||||||||
| MAX_TOKENS = 512 | ||||||||||||||||||||||||||||||||||||
| TEMPERATURE = 0.3 | ||||||||||||||||||||||||||||||||||||
| OUTPUT_FILE = "/tmp/cascade_review.md" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| def get_pr_diff(pr_number: str, repo: str) -> str: | ||||||||||||||||||||||||||||||||||||
| """Fetch the PR diff using the GitHub CLI.""" | ||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||
| result = subprocess.run( | ||||||||||||||||||||||||||||||||||||
| ["gh", "pr", "diff", pr_number, "--repo", repo], | ||||||||||||||||||||||||||||||||||||
| capture_output=True, | ||||||||||||||||||||||||||||||||||||
| text=True, | ||||||||||||||||||||||||||||||||||||
| timeout=30, | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| diff = result.stdout or "" | ||||||||||||||||||||||||||||||||||||
| return diff[:MAX_DIFF_CHARS] | ||||||||||||||||||||||||||||||||||||
| except Exception as exc: | ||||||||||||||||||||||||||||||||||||
| return f"(diff unavailable: {exc})" | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+55
to
+59
|
||||||||||||||||||||||||||||||||||||
| ) | |
| diff = result.stdout or "" | |
| return diff[:MAX_DIFF_CHARS] | |
| except Exception as exc: | |
| return f"(diff unavailable: {exc})" | |
| check=True, | |
| ) | |
| diff = result.stdout or "" | |
| return diff[:MAX_DIFF_CHARS] | |
| except subprocess.CalledProcessError as exc: | |
| stderr = (exc.stderr or "").strip() | |
| message = f"gh pr diff failed with exit code {exc.returncode}" | |
| if stderr: | |
| message += f": {stderr}" | |
| raise RuntimeError(message) from exc | |
| except Exception as exc: | |
| raise RuntimeError(f"Unexpected error while fetching PR diff: {exc}") from exc |
Copilot
AI
Feb 25, 2026
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.
main() proceeds even if PR_NUMBER, REPO, or the token are missing/empty, which will generate misleading “model unavailable” output and still post a comment. Validate these env vars up front and exit non-zero (so the workflow fails) when required inputs are not present.
Copilot
AI
Feb 25, 2026
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.
The generated Markdown wraps the PR diff in a fenced code block, but neither the PR body nor the diff are escaped for occurrences of triple backticks. If either contains ``` the resulting PR comment can render incorrectly. Consider escaping/backtick-neutralizing fence sequences before embedding.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Cascade PR Review — Multiple Free Agents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: [opened, synchronize, reopened] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+10
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cascade-review: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Route PR to multiple free AI agents ($0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: github.event.pull_request.draft == false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run cascade review via GitHub Models free tier | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PR_BODY: ${{ github.event.pull_request.body }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| REPO: ${{ github.repository }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| python3 .github/scripts/cascade_review.py | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Post review comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh pr comment "$PR_NUMBER" --body-file /tmp/cascade_review.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+38
to
+39
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | |
| gh pr comment "$PR_NUMBER" --body-file /tmp/cascade_review.md | |
| REPO: ${{ github.repository }} | |
| run: | | |
| set -euo pipefail | |
| MARKER="<!-- CASCADE_REVIEW_COMMENT -->" | |
| BODY_FILE="/tmp/cascade_review_with_marker.md" | |
| # Prepend a stable marker so we can find/update this comment later. | |
| { | |
| echo "$MARKER" | |
| cat /tmp/cascade_review.md | |
| } > "$BODY_FILE" | |
| # Look for an existing Cascade Review comment on this PR. | |
| EXISTING_COMMENT_ID="$( | |
| gh api \ | |
| "repos/$REPO/issues/$PR_NUMBER/comments" \ | |
| --paginate \ | |
| --jq "[.[] | select(.body | contains(\"$MARKER\"))][0].id // empty" | |
| )" | |
| if [ -n "${EXISTING_COMMENT_ID:-}" ]; then | |
| # Update the existing comment. | |
| gh api \ | |
| "repos/$REPO/issues/comments/$EXISTING_COMMENT_ID" \ | |
| -X PATCH \ | |
| -f body=@"$BODY_FILE" | |
| else | |
| # Create a new comment (first run on this PR). | |
| gh api \ | |
| "repos/$REPO/issues/$PR_NUMBER/comments" \ | |
| -f body=@"$BODY_FILE" | |
| fi |
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.
This claims the
code/scripts have no external dependencies exceptmatplotlibforlorenz.py, butcode/hue_man.pyimportsnumpyandscipy. Update the repo instructions so agents don’t assume a dependency-free runtime.