Skip to content

Add free OpenRouter PR flow diagrams - #19502

Merged
xiangfu0 merged 5 commits into
masterfrom
xiangfu0/codex/pr-flow-openrouter
Sep 8, 2026
Merged

xiangfu0 merged 5 commits into
masterfrom
xiangfu0/codex/pr-flow-openrouter

Conversation

@xiangfu0

@xiangfu0 xiangfu0 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Adds a compact, colored Mermaid PR flow section to PR descriptions using the repository's OPEN_ROUTER_API_KEY and nvidia/nemotron-3-super-120b-a12b:free. PR updates and a regeneration checkbox refresh the section; an hourly bounded scan recovers pending work. Author text stays outside the signed managed block.

An unprivileged PR signal triggers trusted default-branch code through workflow_run, following ASF Actions policy. The scripts read public diffs through the GitHub API and use Python's standard library. Free-only routing and zero price caps prevent paid fallback. Quota failures preserve existing flows. Publication checks revisions, audits edit history, and retains recovery snapshots; GitHub's body update API is not atomic.

Validation:

  • 61 Python tests pass locally; the GitHub-hosted Python 3.12 workflow runs the same suite. The tests cover fork signals, quota handling, ownership (including CRLF description edits), stale revisions, publication races, and model-output validation.
  • All three permanent workflows pass actionlint; root-level Spotless, Checkstyle, license formatting, and license checks pass.
  • Hosted preview on PR #19489 verified the repository secret, Actions edit-history access, and structured diagram generation: 23,064 tokens, one request, $0 reported cost. The temporary preview workflow was removed from the final diff.

The permanent workflows activate on merge. Set PR_FLOW_ENABLED=false to pause them. Setup, manual preview/regeneration, and recovery instructions are in .github/scripts/pr_flow/README.md.

@xiangfu0 xiangfu0 added testing feature New functionality labels Sep 8, 2026
@codecov-commenter

codecov-commenter commented Sep 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.72%. Comparing base (6aaa040) to head (45d2142).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19502      +/-   ##
============================================
- Coverage     67.72%   67.72%   -0.01%     
  Complexity     1430     1430              
============================================
  Files          3489     3489              
  Lines        224634   224637       +3     
  Branches      35468    35468              
============================================
+ Hits         152130   152131       +1     
+ Misses        60485    60477       -8     
- Partials      12019    12029      +10     
Flag Coverage Δ
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-25 67.72% <ø> (-0.01%) ⬇️
lane-a 100.00% <ø> (ø)
lane-b 0.00% <ø> (ø)
temurin 67.72% <ø> (-0.01%) ⬇️
unittests 67.72% <ø> (-0.01%) ⬇️
unittests1 57.77% <ø> (-0.01%) ⬇️
unittests2 39.45% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gortiz
gortiz self-requested a review September 8, 2026 10:16

@gortiz gortiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving — the overall design holds up. The two-hop signal → workflow_run split keeps PR code and secrets properly apart without reaching for pull_request_target, and I particularly like that the model emits typed data rather than renderer syntax: validate_graph cross-checks every citation against real +/- lines, and _mermaid entity-encodes every non-alphanumeric character, so model output has no reachable path to Mermaid syntax, link targets, or the ownership markers. That is what makes "PR content is untrusted" structurally true rather than just asked for in the system prompt. Coverage of the adversarial paths (fork spoofing, superseded heads, publication races, quota deferral) is better than most of what lands here.

One thing I would fix before this handles real traffic, inline on main.py — CRLF-normalized PR bodies will permanently break block ownership, and CRLF is already present in ~13% of PR bodies on this repo. Everything else I noticed was minor enough not to hold this up.

Comment thread .github/scripts/pr_flow/main.py Resolved
@xiangfu0
xiangfu0 merged commit 1f5b06c into master Sep 8, 2026
16 checks passed
@xiangfu0
xiangfu0 deleted the xiangfu0/codex/pr-flow-openrouter branch September 8, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants