Compare commits

..

25 Commits

Author SHA1 Message Date
diegosouzapw
af3d707c05 docs(changelog): update for PRs 1742-1746 2026-04-28 20:17:09 -03:00
diegosouzapw
6a77cf245e Integrated into release/v3.7.4 (PR #1742) 2026-04-28 20:16:01 -03:00
Raxxoor
23ec621865 Refresh CLI fingerprint provider profiles (#1746)
Integrated into release/v3.7.4
2026-04-28 20:14:25 -03:00
Duncan L
99513fd7cf Fix Claude Code gateway config helper (#1745)
Integrated into release/v3.7.4
2026-04-28 20:14:13 -03:00
Duncan L
d98ca5a9ca Normalize max reasoning effort for Codex routing (#1744)
Integrated into release/v3.7.4
2026-04-28 20:14:01 -03:00
Randi
a546aa1b1c Add endpoint tunnel visibility settings (#1743)
Integrated into release/v3.7.4
2026-04-28 20:12:55 -03:00
Raxxoor
2aaed03681 fix(db): reconcile legacy reasoning cache migration (#1734)
Integrated into release/v3.7.4
2026-04-28 20:08:18 -03:00
diegosouzapw
1b0664a8ac docs(changelog): include workflow updates 2026-04-28 15:50:55 -03:00
diegosouzapw
cca9153a17 docs(changelog): update for PR #1740 merge 2026-04-28 15:40:53 -03:00
Randi
50eb5a606f fix(cc-compatible): preserve Claude Code system skeleton (#1740)
Integrated into release/v3.7.4
2026-04-28 15:40:18 -03:00
diegosouzapw
4af77efb3b chore(release): bump to v3.7.4 — changelog, docs, version sync 2026-04-28 15:05:13 -03:00
dhaern
7a47063b4a fix(db): reconcile legacy reasoning cache migration 2026-04-28 14:59:51 -03:00
diegosouzapw
cd3074b2d1 test: fix typescript compilation errors in unit tests 2026-04-28 14:45:03 -03:00
diegosouzapw
5c42f16995 fix(migrations): intercept 007 migration to use IF NOT EXISTS logic on fresh installs
Fixes #1733
2026-04-28 14:34:30 -03:00
diegosouzapw
f8a006fc1d fix(security): replace insecure Math.random with crypto.getRandomValues for fallback UUID generation 2026-04-28 14:04:42 -03:00
diegosouzapw
ca0956d43b docs: add PR 1726 and PR 1728 to v3.7.4 changelog 2026-04-28 14:00:42 -03:00
backryun
fa293d3295 Fix image provider validation and Stability image requests (#1726)
Integrated into release/v3.7.4
2026-04-28 14:00:14 -03:00
Yash Ghule
4ac8d82c81 feat(pwa): add fullscreen installable PWA with manifest, service worker, and cross-platform app icons. (#1728)
Integrated into release/v3.7.4
2026-04-28 13:59:18 -03:00
diegosouzapw
cbd8344789 test: update responses store expectations for empty input arrays 2026-04-28 13:43:33 -03:00
diegosouzapw
e55d4bd16f docs: update changelog for v3.7.4 fixes and proxy features 2026-04-28 13:38:10 -03:00
diegosouzapw
97ecda03ec feat(proxy): implement bulk proxy import via pipe-delimited parser with update-or-create logic 2026-04-28 13:37:44 -03:00
diegosouzapw
13f6011255 fix(proxy): disable HTTP keep-alive and pipelining in Undici proxy dispatcher to prevent socket hang up 2026-04-28 13:37:33 -03:00
diegosouzapw
d8d2541645 fix: bypass UI validation block for optional API keys and fix string fallback typing (#1721) 2026-04-28 13:37:09 -03:00
diegosouzapw
8c3b2b7d02 fix: preserve previous_response_id and conversation_id fields on empty input array (#1729) 2026-04-28 13:36:57 -03:00
diegosouzapw
ea06fb8d30 chore(release): v3.7.4 — version bump, openapi and changelog sync 2026-04-28 12:01:13 -03:00
30014 changed files with 632745 additions and 9020856 deletions

View File

@@ -0,0 +1,49 @@
---
description: Automatically run the browser_subagent to visually validate all new UI features from the current release and capture evidence WebP recordings of the changes.
---
# Capture Release Evidences Workflow
Use this workflow to automatically drive the `browser_subagent` to explore the newly deployed or locally running application and record evidence of the UI changes introduced in the latest release.
## Prerequisites
- OmniRoute must be actively running and accessible (e.g. locally at `http://localhost:20128` or on the Local VPS at `http://192.168.0.15:20128`).
- The user must provide the target URL to be tested, or default to `http://192.168.0.15:20128`.
## Workflow Steps
### 1. Identify Target Features
Review the `CHANGELOG.md` for the latest version to map out the new UI elements. For example:
- **CLI Tools Settings**
- **New Provider/Model Listings (e.g., Gemini 3.1, Qoder PAT)**
- **New Feature Modals**
### 2. Run the Browser Subagent
For each identified feature, invoke the `browser_subagent` using the `default_api:browser_subagent` tool.
**Important Task Guidelines for the Subagent:**
- `TaskName`: Give it a clear name like "Validate CLIProxyAPI Tool Tab".
- `TaskSummary`: "Navigate to the CLI Tools tab and verify the new Integration settings."
- `Task`: Provide unambiguous instructions for the subagent, such as: "Navigate to http://192.168.0.15:20128/dashboard. Click on the 'Settings' or 'CLI Tools' nav link. Scroll down to find the CLIProxyAPI integration card. Hover over it to trigger UI state. Verify the components render correctly and exit."
- `RecordingName`: Ensure it describes the feature (e.g. `v3_4_5_cli_proxy_api`). This is required and strictly automatically saved as a WebP artifacts video by the system.
_(Note: The `browser_subagent` automatically creates a WebP recording named by the `RecordingName` parameter. No additional tools for screenshots are needed.)_
### 3. Generate Report Artifact
After the `browser_subagent` finishes its sessions, generate a final Markdown artifact (using `write_to_file` and `IsArtifact=true`) to present the recordings inline to the user using the `![caption](/absolute/path/to/media.webp)` syntax.
### Example Invocation
\```json
{
"TaskName": "Validating Qoder PAT Configuration UI",
"TaskSummary": "Validates the Qoder provider configuration modal",
"Task": "Go to http://192.168.0.15:20128/dashboard. Click on the 'Providers' tab. Find 'Qoder' in the list. Click 'Add Token' or 'Configure'. Type 'test_token' and submit. Return when done.",
"RecordingName": "qoder_pat_ui_validation"
}
\```

View File

@@ -0,0 +1,39 @@
---
description: Deploy the latest OmniRoute code to the Akamai VPS (69.164.221.35)
---
# Deploy to Akamai VPS Workflow
Deploy OmniRoute to the Akamai VPS using `npm pack + scp` + PM2.
**Akamai VPS:** `69.164.221.35`
**Process manager:** PM2 (`omniroute`)
**Port:** `20128`
## Steps
### 1. Build + pack locally
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router && rm -f omniroute-*.tgz && rm -rf .next/cache app/.next/cache && npm run build:cli && rm -rf app/logs app/coverage app/.git app/.app-build-backup* && npm pack --ignore-scripts
```
### 2. Copy to Akamai VPS and install
// turbo-all
```bash
scp omniroute-*.tgz root@69.164.221.35:/tmp/
```
```bash
ssh root@69.164.221.35 "npm install -g /tmp/omniroute-*.tgz --ignore-scripts && cd /usr/lib/node_modules/omniroute/app && npm rebuild better-sqlite3 && pm2 delete omniroute 2>/dev/null; pm2 start /root/.omniroute/ecosystem.config.cjs --update-env && pm2 save && echo '✅ Akamai done'"
```
### 3. Verify the deployment
```bash
curl -s -o /dev/null -w 'AKAMAI HTTP %{http_code}\n' http://69.164.221.35:20128/
```

View File

@@ -0,0 +1,49 @@
---
description: Deploy the latest OmniRoute code to BOTH the Akamai VPS and the Local VPS
---
# Deploy to VPS (Both) Workflow
Deploy OmniRoute to the production VPSs using `npm pack + scp` + PM2.
**Akamai VPS:** `69.164.221.35`
**Local VPS:** `192.168.0.15`
**Process manager:** PM2 (`omniroute`)
**Port:** `20128`
**PM2 entry:** `/usr/lib/node_modules/omniroute/app/server.js`
> [!IMPORTANT]
> The npm registry rejects packages > 100MB, so deployment uses **npm pack + scp**.
## Steps
### 1. Build + pack locally
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router && rm -f omniroute-*.tgz && rm -rf .next/cache app/.next/cache && npm run build:cli && rm -rf app/logs app/coverage app/.git app/.app-build-backup* && npm pack --ignore-scripts
```
### 2. Copy to both VPS and install
// turbo-all
```bash
scp omniroute-*.tgz root@69.164.221.35:/tmp/ && scp omniroute-*.tgz root@192.168.0.15:/tmp/
```
```bash
ssh root@69.164.221.35 "npm install -g /tmp/omniroute-*.tgz --ignore-scripts && cd /usr/lib/node_modules/omniroute/app && npm rebuild better-sqlite3 && pm2 delete omniroute 2>/dev/null; pm2 start /root/.omniroute/ecosystem.config.cjs --update-env && pm2 save && echo '✅ Akamai done'"
```
```bash
ssh root@192.168.0.15 "npm install -g /tmp/omniroute-*.tgz --ignore-scripts && cd /usr/lib/node_modules/omniroute/app && npm rebuild better-sqlite3 && pm2 delete omniroute 2>/dev/null; pm2 start /root/.omniroute/ecosystem.config.cjs --update-env && pm2 save && echo '✅ Local done'"
```
### 3. Verify the deployment
```bash
curl -s -o /dev/null -w 'AKAMAI HTTP %{http_code}\n' http://69.164.221.35:20128/
curl -s -o /dev/null -w 'LOCAL HTTP %{http_code}\n' http://192.168.0.15:20128/
```

View File

@@ -0,0 +1,39 @@
---
description: Deploy the latest OmniRoute code to the Local VPS (192.168.0.15)
---
# Deploy to Local VPS Workflow
Deploy OmniRoute to the Local VPS using `npm pack + scp` + PM2.
**Local VPS:** `192.168.0.15`
**Process manager:** PM2 (`omniroute`)
**Port:** `20128`
## Steps
### 1. Build + pack locally
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router && rm -f omniroute-*.tgz && rm -rf .next/cache app/.next/cache && npm run build:cli && rm -rf app/logs app/coverage app/.git app/.app-build-backup* && npm pack --ignore-scripts
```
### 2. Copy to Local VPS and install
// turbo-all
```bash
scp omniroute-*.tgz root@192.168.0.15:/tmp/
```
```bash
ssh root@192.168.0.15 "npm install -g /tmp/omniroute-*.tgz --ignore-scripts && cd /usr/lib/node_modules/omniroute/app && npm rebuild better-sqlite3 && pm2 delete omniroute 2>/dev/null; pm2 start /root/.omniroute/ecosystem.config.cjs --update-env && pm2 save && echo '✅ Local done'"
```
### 3. Verify the deployment
```bash
curl -s -o /dev/null -w 'LOCAL HTTP %{http_code}\n' http://192.168.0.15:20128/
```

View File

@@ -0,0 +1,361 @@
---
description: Create a new release, bump version up to 1.x.10 threshold, update changelog, and manage Pull Requests
---
# Generate Release Workflow
Bump version, finalize CHANGELOG, commit, open a **PR to main** and wait for user confirmation before tagging, publishing, and deploying.
> **VERSION RULE: Always use PATCH bumps (2.x.y → 2.x.y+1)**
> NEVER use `npm version minor` or `npm version major`.
> Always use: `npm version patch --no-git-tag-version`
> The threshold rule: when `y` reaches 10, bump to `2.(x+1).0` — e.g. `2.1.10` → `2.2.0`.
> **🔴 SINGLE BRANCH RULE**: The `release/vX.Y.Z` branch is the **ONLY** development branch for the entire release cycle. ALL work — bug fixes, feature implementations, PR integrations, issue resolutions — MUST be committed directly on this branch. Never create separate `fix/`, `feat/`, or topic branches. When running `/resolve-issues`, `/implement-features`, or `/review-prs`, always work on the current release branch.
---
## ⚠️ Two-Phase Flow
```
Phase 1 (automated): bump → docs → i18n → commit → push → open PR
↕ 🛑 STOP: Notify user, wait for PR confirmation
Phase 2 (post-merge): tag → publish → GitHub release → Docker → deploy
```
**NEVER push directly to main or create tags before the user confirms the PR.**
---
## Phase 0: Security Verification (MANDATORY)
Before creating the release, you must ensure the codebase and supply chain are secure and free of known vulnerabilities.
1. **Run Local Dependencies Audit:**
```bash
npm audit
```
_Fix any `high` or `critical` vulnerabilities identified._
2. **Check GitHub CodeQL & Dependabot Alerts:**
Navigate to the repository's **Security** tab on GitHub, or use the project's `vulnerability-scanner` skill to analyze active alerts. Ensure all static analysis findings (e.g., prototype pollution, insecure randomness, ReDoS, shell injections) are addressed and logically committed on a target branch.
---
## Phase 1: Pre-Merge
### 1. Create release branch
```bash
git checkout -b release/v2.x.y
```
### 2. Determine and sync version
Check current version in `package.json`:
```bash
grep '"version"' package.json
```
> **🔴 BRANCH-VERSION PARITY RULE**: The logical version in `package.json` MUST exactly match the release branch name. For example, if you are on `release/v3.7.0`, the version in `package.json` MUST be `3.7.0`.
>
> - If this is the FIRST time generating a release for a new minor/major branch (e.g., bumping from 3.6.9 to 3.7.0), you MUST ensure the version is bumped to match the new branch logic.
> - If you are just bumping a patch on the current branch (e.g., 3.6.9 to 3.6.10), use:
> `npm version patch --no-git-tag-version`
> **⚠️ ATOMIC COMMIT RULE — Version bump MUST happen before committing feature files.**
>
> **CORRECT order:**
>
> 1. `npm version patch --no-git-tag-version` ← bump first
> 2. implement features / fix bugs
> 3. `git add -A && git commit -m "chore(release): v2.x.y — all changes in ONE commit"`
>
> **OR if features are already staged:**
>
> 1. implement features (do NOT commit yet)
> 2. `npm version patch --no-git-tag-version` ← bump before committing
> 3. `git add -A && git commit -m "chore(release): v2.x.y — all changes in ONE commit"`
>
> **NEVER do this (creates version mismatch in git history):**
>
> - ~~commit features → then bump version → commit package.json separately~~
>
> This ensures that `git show v2.x.y` always contains both code changes and the version bump together.
> The GitHub release tag will point to a commit that includes ALL changes for that version.
### 3. Regenerate lock file (REQUIRED after version bump)
**Mandatory** — skipping causes `@swc/helpers` lock mismatch and CI failures:
```bash
npm install
```
### 4. Finalize CHANGELOG.md
> **🔴 NO MIXUPS RULE**: Ensure you do NOT mix the backlog of the previous version with the new one. The new version section must ONLY contain the features and fixes for the current release.
Replace the `[Unreleased]` header with the new version and date.
Keep an empty `## [Unreleased]` section above it, separated by a horizontal rule (`---`).
```markdown
## [Unreleased]
---
## [3.7.0] — 2026-04-19
### ✨ New Features
- ...
### 🐛 Bug Fixes
- ...
---
## [3.6.9] — 2026-04-19
```
### 5. Update openapi.yaml version ⚠️ MANDATORY
> **CI will fail** if `docs/openapi.yaml` version ≠ `package.json` version (`check:docs-sync` enforces this).
// turbo
```bash
VERSION=$(node -p "require('./package.json').version")
sed -i "s/ version: .*/ version: $VERSION/" docs/openapi.yaml
echo "✓ openapi.yaml → $VERSION"
for dir in electron open-sse; do
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
(cd "$dir" && npm version "$VERSION" --no-git-tag-version --allow-same-version > /dev/null)
echo "✓ $dir/package.json → $VERSION"
fi
done
# Re-run install to assert the workspace lockfile is updated
npm install
```
### 6. Update README.md and i18n docs
Run `/update-docs` workflow steps to:
- Update feature table rows in `README.md`
- Sync changes to all 29 language `docs/i18n/*/README.md` files
- Update `docs/FEATURES.md` if Settings section changed
### 7. Run tests
// turbo
```bash
npm test
```
All tests must pass before creating the PR.
### 8. Stage, commit, and push
// turbo-all
```bash
git add -A
git commit -m "chore(release): v2.x.y — summary of changes"
git push origin release/v2.x.y
```
### 9. Open PR to main
### 9. Open PR to main
// turbo
```bash
VERSION=$(node -p "require('./package.json').version")
# Extract the exact changelog entry for this version from the root CHANGELOG.md
awk "/^## \\[$VERSION\\]/{flag=1; print; next} /^---/{if(flag) {flag=0; exit}} flag" CHANGELOG.md > /tmp/changelog_body.txt
# Append test status and next steps
echo "" >> /tmp/changelog_body.txt
echo "### Tests" >> /tmp/changelog_body.txt
echo "- All tests pass" >> /tmp/changelog_body.txt
echo "" >> /tmp/changelog_body.txt
echo "### ⚠️ After merging: run Phase 2 steps to tag, publish, and deploy." >> /tmp/changelog_body.txt
gh pr create \
--repo diegosouzapw/OmniRoute \
--base main \
--head release/v$VERSION \
--title "Release v$VERSION" \
--body-file /tmp/changelog_body.txt
```
### 10. 🛑 STOP — Notify User & Await PR Confirmation
**This is a mandatory stop point.** Use `notify_user` with `BlockedOnUser: true`:
Inform the user:
- PR URL
- Summary of changes
- Test results
- List of files changed
**DO NOT proceed to Phase 2 until the user confirms the PR looks good and merges it.**
---
## Phase 2: Post-Merge Validation (Local VPS)
> Run these steps only AFTER the user has merged the PR into `main` and all CI jobs have passed.
### 11. Deploy to Local VPS for Final Validation (MANDATORY)
Before cutting the official git tag and publishing to the world, deploy the `main` branch to the Local VPS for a final homologation test.
```bash
git checkout main
git pull origin main
# Build and pack locally
cd /home/diegosouzapw/dev/proxys/9router && rm -f omniroute-*.tgz && rm -rf .next/cache app/.next/cache && npm run build:cli && rm -rf app/logs app/coverage app/.git app/.app-build-backup* && npm pack --ignore-scripts
# Deploy to LOCAL VPS (192.168.0.15)
scp omniroute-*.tgz root@192.168.0.15:/tmp/
ssh root@192.168.0.15 "npm install -g /tmp/omniroute-*.tgz --ignore-scripts && cd /usr/lib/node_modules/omniroute/app && npm rebuild better-sqlite3 && pm2 delete omniroute 2>/dev/null; pm2 start /root/.omniroute/ecosystem.config.cjs --update-env && pm2 save && echo '✅ Local done'"
# Verify
curl -s -o /dev/null -w "LOCAL: HTTP %{http_code}\n" http://192.168.0.15:20128/
```
### 12. 🛑 STOP — Notify User & Await Final OK
**This is a mandatory stop point.**
Inform the user that the `main` branch is now running on the Local VPS.
Wait for the user to manually test and give the **OK**.
**DO NOT proceed to Phase 3 until the user confirms the local deploy is stable.**
---
## Phase 3: Official Launch
> Run these steps only AFTER the user gives the final OK from the Phase 2 local validation.
### 13. Create Git Tag and GitHub Release (MANDATORY)
// turbo
```bash
git checkout main
git pull origin main
VERSION=$(node -p "require('./package.json').version")
# Extracts the changelog section for this version
NOTES=$(awk '/^## \['"$VERSION"'\]/{flag=1; next} /^## \[[0-9]+/{if(flag) exit} flag' CHANGELOG.md | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
if [ -z "$NOTES" ]; then NOTES="OmniRoute v$VERSION Release"; fi
git tag -a "v$VERSION" -m "Release v$VERSION"
git push origin --tags
gh release create "v$VERSION" --title "v$VERSION" --notes "$NOTES" --target main
```
### 14. 🐳 Trigger Docker Hub build (MANDATORY — keep npm and Docker in sync)
> **CRITICAL**: Docker Hub and npm MUST always publish the same version.
> The Docker image is built automatically via GitHub Actions when a new tag is pushed.
> After pushing the tag in step 13, **verify the workflow runs**:
```bash
# Verify the Docker workflow triggered
gh run list --repo diegosouzapw/OmniRoute --workflow docker-publish.yml --limit 3
# Wait for the Docker build to complete (usually 5–10 min)
gh run watch --repo diegosouzapw/OmniRoute
```
### 15. Publish to NPM (Optional/Automated)
Normally handled by CI, but if manual publish is required:
```bash
npm publish
```
### 16. Deploy to AKAMAI VPS (Production)
Now that the release is officially cut, deploy it to the Akamai VPS.
```bash
# Deploy to AKAMAI VPS (69.164.221.35)
scp omniroute-*.tgz root@69.164.221.35:/tmp/
ssh root@69.164.221.35 "npm install -g /tmp/omniroute-*.tgz --ignore-scripts && cd /usr/lib/node_modules/omniroute/app && npm rebuild better-sqlite3 && pm2 delete omniroute 2>/dev/null; pm2 start /root/.omniroute/ecosystem.config.cjs --update-env && pm2 save && echo '✅ Akamai done'"
# Verify
curl -s -o /dev/null -w "AKAMAI: HTTP %{http_code}\n" http://69.164.221.35:20128/
```
## Phase 4: Release Monitoring & Artifact Validation
> After triggering the official release, actively monitor the CI pipelines until all artifacts are successfully generated. If any pipeline fails, stop and apply the necessary corrections before continuing.
### 18. Monitor CI Pipelines
Wait for and verify the successful completion of the following automated jobs:
1. **Docker Hub Publish**
2. **Electron Build**
3. **NPM Registry Publish** (Check with `npm info omniroute version`)
```bash
# Monitor Docker Hub workflow
gh run list --repo diegosouzapw/OmniRoute --workflow docker-publish.yml --limit 1
gh run watch <RUN_ID>
# Monitor Electron build
gh run list --repo diegosouzapw/OmniRoute --workflow electron-release.yml --limit 1
gh run watch <RUN_ID>
# Verify NPM version
npm info omniroute version
```
### 19. Handle Failures (If Any)
If a workflow fails:
- Use `gh run view <RUN_ID> --log-failed` to identify the error.
- Apply the fix on the `main` branch.
- If necessary, re-trigger the workflow using `gh workflow run <workflow_name.yml> --repo diegosouzapw/OmniRoute --ref v2.x.y`
### 20. Preserve release branch
```bash
# Branch is kept for historical purposes. Do not delete.
```
---
## Notes
- Always run `/update-docs` BEFORE this workflow (ensures CHANGELOG and README are current)
- The `prepublishOnly` script runs `npm run build:cli` automatically during `npm publish`
- After npm publish, verify with `npm info omniroute version`
- Lock file sync errors are caused by skipping `npm install` after version bump
- Use `gh auth switch -u diegosouzapw` if git push fails with wrong account
## Known CI Pitfalls
| CI failure | Cause | Fix |
| ------------------------------------------------------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------- |
| `[docs-sync] FAIL - OpenAPI version differs from package.json` | Skipped step 5 — `docs/openapi.yaml` version not updated | Run step 5 (`sed -i ...`) and commit |
| `[docs-sync] FAIL - CHANGELOG.md first section must be "## [Unreleased]"` | `## [Unreleased]` missing or not at top of CHANGELOG | Add `## [Unreleased]\n\n---\n` before the first versioned `## [x.y.z]` |
| Electron Linux `.deb` build fails (`FpmTarget` error) | `fpm` Ruby gem not installed on `ubuntu-latest` runner | Already fixed in `electron-release.yml` (`gem install fpm` step) |
| Docker Hub `502 error writing layer blob` | Transient Docker Hub network error during ARM64 push | Re-run the Docker publish workflow; no code change needed |

View File

@@ -0,0 +1,706 @@
---
description: Analyze open feature request issues, implement viable ones on dedicated branches, and respond to authors
---
# /implement-features — Feature Request Harvest, Research & Implementation Workflow
## Overview
A **5-phase** workflow that systematically harvests feature requests from GitHub issues, creates structured idea files, researches solutions across the internet and Git repositories, presents a consolidated report for user approval, then generates detailed implementation plans and executes them.
**Output directory structure:**
```
_ideia/
├── viable/ # Features approved for implementation
│ ├── need_details/ # ❓ Good idea but waiting for author clarification (issues stay OPEN)
│ │ └── 1015-warp-terminal-mitm.md
│ ├── 1046-native-playground.md # ✅ Ready — researched and planned
│ └── 1046-native-playground.requirements.md
├── defer/ # ⏭️ Good ideas deferred for future cycles (issues CLOSED)
│ └── 1041-smart-auto-combos.md
└── notfit/ # ❌ Out of scope / already exists (issues CLOSED)
└── 945-telegram-integration.md
_tasks/features-vX.Y.Z/ # Implementation plans (per-release)
└── 1046-native-playground.plan.md
```
> **LIFECYCLE RULE:** `viable/` files are **DELETED** once the feature is implemented — they are not moved. Only unimplemented features live in `viable/` (or `viable/need_details/`). Files in `defer/` and `notfit/` remain as permanent reference.
> **BRANCH RULE**: All implementation work MUST happen on the current `release/vX.Y.Z` branch. Never create separate `feat/` branches. If no release branch exists yet, create one first using `/generate-release` Phase 1 steps 1–5.
---
## Phase 1 — Harvest: Collect & Catalog Feature Ideas
### 1.1 Identify the Repository
// turbo
- Run: `git -C <project_root> remote get-url origin` to extract owner/repo.
### 1.2 Ensure Release Branch Exists
// turbo
Before doing any work, ensure you are on the current release branch:
```bash
# Check current branch
git branch --show-current
# If on main, determine next version and create the release branch
VERSION=$(node -p "require('./package.json').version")
NEXT=$(node -p "const [a,b,c]=('$VERSION').split('.').map(Number); c>=9?a+'.'+(b+1)+'.0':a+'.'+b+'.'+(c+1)")
git checkout -b release/v$NEXT
npm version patch --no-git-tag-version
npm install
```
If already on a `release/vX.Y.Z` branch, continue working there.
### 1.3 Fetch ALL Open Feature Requests
// turbo-all
**⚠️ CRITICAL**: The JSON output of `gh issue list` can be truncated by the tool, silently hiding issues. You MUST use the two-step approach below.
**Step 1 — Get Issue numbers only** (small output, never truncated):
```bash
# Fetch issues with feature/enhancement labels
gh issue list --repo <owner>/<repo> --state open -l "enhancement" --limit 500 --json number --jq '.[].number'
# Also check for [Feature] in title (common pattern when no labels are set)
gh issue list --repo <owner>/<repo> --state open --limit 500 --json number,title --jq '.[] | select(.title | test("\\[Feature\\]|\\[feature\\]|feature request"; "i")) | .number'
```
- Merge both lists, deduplicate. Count and confirm the total.
**Step 2 — Fetch full metadata for each Issue** (one call per issue):
```bash
gh issue view <NUMBER> --repo <owner>/<repo> --json number,title,labels,body,comments,createdAt,author,assignees
```
- Read the **entire body** — including description, use cases, screenshots, mockups, and any embedded images.
- Read **ALL comments** — community discussion, agreements, restrictions, owner responses, and linked PRs.
- **Images**: If the body or comments contain image URLs (`![...](...)` or `https://...png/jpg/gif`), note them — they may contain UI mockups, wireframes, or architecture diagrams that are essential to understanding the request.
- You may batch these into parallel calls (up to 4 at a time).
- Sort by oldest first (FIFO).
### 1.4 Create Idea Files (initially in `_ideia/` root)
For each feature request, create a structured idea file in `<project_root>/_ideia/`:
**Filename convention**: `<NUMBER>-<kebab-case-short-title>.md`
Example: `1046-native-playground.md`, `1041-smart-auto-combos.md`
#### 1.4a — If the idea file does NOT exist yet, create it:
```markdown
# Feature: <Title from Issue>
> GitHub Issue: #<NUMBER> — opened by @<author> on <date>
> Status: 📋 Cataloged | Priority: TBD
## 📝 Original Request
<Paste the FULL issue body here, preserving all formatting, images, and code blocks>
## 💬 Community Discussion
<Summarize ALL comments chronologically, noting who said what and any decisions or objections raised>
### Participants
- @<author> — Original requester
- @<commenter1> — <brief role/opinion>
- ...
### Key Points
- <bullet list of the most important discussion points>
- <agreements reached>
- <objections raised>
## 🎯 Refined Feature Description
<YOUR interpretation and enrichment of the feature request. Expand on what was asked, fill in logical gaps, provide concrete examples of how it would work. This section should be MORE detailed and clearer than the original request.>
### What it solves
- <problem 1>
- <problem 2>
### How it should work (high level)
1. <step 1>
2. <step 2>
3. ...
### Affected areas
- <list of codebase areas, modules, files likely affected>
## 📎 Attachments & References
- <any image URLs, mockup links, or external references from the issue>
## 🔗 Related Ideas
- <links to related \_ideia/ files if any overlap found>
```
#### 1.4b — If the idea file ALREADY exists, update it:
- Append new comments from the issue to the **Community Discussion** section.
- Update the **Refined Feature Description** if new information changes the understanding.
- Add any new **Related Ideas** cross-references found.
- **Do NOT overwrite** existing content — append and enrich it.
### 1.5 Cross-Reference & Deduplication
After processing all issues:
- Scan all `_ideia/*.md` files for overlapping features.
- If two features are substantially the same, add `🔗 Related Ideas` cross-references to both.
- If one is a strict subset of another, note it in the smaller file: `> ℹ️ This feature is a subset of #<OTHER_NUMBER>. Consider implementing together.`
---
## Phase 2 — Research: Find Solutions & Build Requirements
For each cataloged idea that is **viable** (aligns with the project's goals):
### 2.1 Viability Pre-Check
Before investing in research, quickly assess:
- [ ] Does this feature align with the project's goals and architecture?
- [ ] Is it technically feasible with the current codebase?
- [ ] Does it duplicate existing functionality?
- [ ] Would it introduce breaking changes or security risks?
- [ ] Is there enough detail to understand what's needed?
**Verdict options:**
| Verdict | When | Action |
| --------------------- | ------------------------------------- | --------------------------- |
| ✅ **VIABLE** | Good idea, enough context | Proceed to Research |
| ❓ **NEEDS DETAIL** | Good idea, insufficient spec | Skip research, ask author |
| ⏭️ **DEFER** | Good idea, too complex for this cycle | Catalog only, skip research |
| ❌ **NOT FIT** | Doesn't fit the project | Explain why |
| 🔁 **ALREADY EXISTS** | Feature already implemented | Point to existing feature |
### 2.2 Internet Research (for VIABLE features)
For each viable feature, perform systematic research:
**Step 1 — Web search for similar implementations:**
```
search_web("how to implement <feature description> in <tech stack>")
search_web("<feature keyword> implementation nextjs typescript 2025 2026")
search_web("<feature keyword> open source library npm")
```
**Step 2 — Find reference Git repositories:**
```
search_web("site:github.com <feature keyword> <tech stack> stars:>100")
search_web("github <feature keyword> implementation recently updated 2026")
```
- Find **up to 10 relevant repositories**, sorted by most recently updated.
- For each repository:
- Note the repo URL, star count, last commit date
- Read its README and relevant source files via `read_url_content`
- Extract the architectural approach, patterns used, and key code snippets
**Step 3 — Read API docs and standards:**
If the feature involves an external API, protocol, or standard:
- Find and read the official documentation
- Note version requirements, authentication patterns, rate limits
### 2.3 Create Requirements File
For each researched feature, create a requirements file alongside its idea file:
**Filename**: `<NUMBER>-<kebab-case-short-title>.requirements.md`
```markdown
# Requirements: <Feature Title>
> Feature Idea: [#<NUMBER>](./<NUMBER>-<kebab-case-short-title>.md)
> Research Date: <YYYY-MM-DD>
> Verdict: ✅ VIABLE
## 🔍 Research Summary
<Brief summary of what was found during research>
## 📚 Reference Implementations
| # | Repository | Stars | Last Updated | Approach | Relevance |
| --- | ---------------- | ----- | ------------ | -------- | ------------ |
| 1 | [repo/name](url) | ⭐ N | YYYY-MM-DD | <brief> | High/Med/Low |
| 2 | ... | | | | |
### Key Patterns Found
- <pattern 1 with code snippet or link>
- <pattern 2>
## 📐 Proposed Solution Architecture
### Approach
<Describe the chosen approach based on research findings>
### New Files
| File | Purpose |
| --------------------- | ------------- |
| `path/to/new/file.ts` | <description> |
### Modified Files
| File | Changes |
| -------------------------- | -------------- |
| `path/to/existing/file.ts` | <what changes> |
### Database Changes
- <migrations needed, if any>
### API Changes
- <new/modified endpoints, if any>
### UI Changes
- <new/modified pages/components, if any>
## ⚙️ Implementation Effort
- **Estimated complexity**: Low / Medium / High / Very High
- **Estimated files changed**: ~N
- **Dependencies needed**: <new npm packages, if any>
- **Breaking changes**: Yes/No — <details>
- **i18n impact**: <number of new translation keys>
- **Test coverage needed**: <brief description>
## ⚠️ Open Questions
- <question 1>
- <question 2>
## 🔗 External References
- <documentation URLs>
- <API references>
```
---
## Phase 2.5 — Organize & Respond: Sort Files and Post GitHub Comments
### 2.5.1 Create Directory Structure
// turbo
```bash
mkdir -p <project_root>/_ideia/viable
mkdir -p <project_root>/_ideia/viable/need_details
mkdir -p <project_root>/_ideia/defer
mkdir -p <project_root>/_ideia/notfit
```
### 2.5.2 Move Idea Files to Category Subdirectories
After classification, move EVERY idea file to its correct subdirectory:
```bash
# ✅ VIABLE — move idea + requirements files
mv _ideia/<NUMBER>-*.md _ideia/viable/
mv _ideia/<NUMBER>-*.requirements.md _ideia/viable/
# ❓ NEEDS DETAIL — viable but waiting for author response
mv _ideia/<NUMBER>-*.md _ideia/viable/need_details/
# ⏭️ DEFER — move idea files only
mv _ideia/<NUMBER>-*.md _ideia/defer/
# ❌ NOT FIT & 🔁 ALREADY EXISTS — move idea files only
mv _ideia/<NUMBER>-*.md _ideia/notfit/
```
No files should remain in `_ideia/` root after this step (except subdirectories).
### 2.5.3 Post GitHub Comments by Category
**Each category has a specific comment template and action:**
---
#### For 🔁 ALREADY EXISTS — Comment + CLOSE issue
// turbo
The feature already exists in the system. Explain WHERE it is and HOW to use it.
```markdown
Hi @<author>! Thanks for the suggestion! 🙏
Great news — this functionality **already exists** in OmniRoute:
**📍 Where to find it:** <exact dashboard path or settings location>
**🔧 How to use it:**
1. <step 1>
2. <step 2>
3. <step 3>
If you have any trouble finding or using it, feel free to ask in a Discussion. We're always happy to help!
Closing this as the feature is already available. 🎉
```
```bash
gh issue close <NUMBER> --repo <owner>/<repo> --comment "<comment above>"
```
---
#### For ⏭️ DEFER — Comment + CLOSE issue
// turbo
Thank the user, explain the idea was cataloged, and that we'll study it before implementing.
```markdown
Hi @<author>! Thanks for this thoughtful feature request! 🙏
We really appreciate the detailed proposal. We've **cataloged your idea** and it's now part of our improvement backlog.
Due to the **significant architectural impact** of this feature, we'll need to conduct thorough use-case studies and architectural analysis before we start development. This ensures we build it right and don't introduce regressions.
**What happens next:**
- Your idea is saved in our internal feature backlog
- We'll conduct architecture studies when this area is prioritized
- We'll notify you here when development begins
Thank you for contributing to OmniRoute's roadmap! Your input helps shape the product. 🚀
```
```bash
gh issue close <NUMBER> --repo <owner>/<repo> --comment "<comment above>"
```
---
#### For ❌ NOT FIT — Comment + CLOSE issue
// turbo
Politely explain why the feature doesn't fit the project scope.
```markdown
Hi @<author>! Thanks for the suggestion! 🙏
After careful analysis, we've determined that this feature **falls outside OmniRoute's core scope** as a proxy/router.
**Reason:** <explain why — e.g., "Telegram integration belongs in the application/orchestrator layer that consumes OmniRoute's API, not inside the router itself.">
**Alternative:** <suggest an alternative approach if possible>
We appreciate you thinking of ways to improve OmniRoute! If you'd like to discuss this further, feel free to open a Discussion. 🙏
```
```bash
gh issue close <NUMBER> --repo <owner>/<repo> --comment "<comment above>"
```
---
#### For ❓ NEEDS DETAIL — Comment (keep OPEN)
// turbo
Ask for the specific missing details needed.
```markdown
Hi @<author>! Thanks for the feature request — it's an interesting idea and we'd love to explore it further. 🙏
To move forward, we need a few more details:
1. <specific question 1>
2. <specific question 2>
3. <specific question 3>
If you know of any **open-source projects or repositories** that implement something similar, please share links — it would help us design the best solution.
Looking forward to your response! 🚀
```
---
#### For ✅ VIABLE — Comment (keep OPEN)
// turbo
Thank the user, confirm we've cataloged their idea, and explain it may be implemented in future versions.
```markdown
Hi @<author>! Thanks for the great feature suggestion! 🙏
We've analyzed your request and it aligns well with OmniRoute's roadmap. We've **cataloged this feature** and it's in our implementation backlog.
**Status:** 📋 Cataloged for future implementation
This feature may be included in upcoming releases. We'll **respond to this issue and tag you** as soon as implementation begins so you can test it.
Thank you for helping improve OmniRoute! 🚀
```
**⚠️ Do NOT close viable issues — they remain OPEN for tracking.**
---
## Phase 3 — Report: Present Findings to User
### 3.1 🛑 MANDATORY STOP — Present Consolidated Report
After completing Phase 1, Phase 2, and Phase 2.5, **STOP and present the following report** in the chat. Do NOT proceed to implementation.
Present a structured report containing:
#### 3.1a — Feature Summary Table
| # | Issue | Title | Verdict | Location | Action |
| --- | ----- | ----- | --------------- | ----------------------------- | ----------------------------- |
| 1 | #N | Title | ✅ VIABLE | `_ideia/viable/` | Issue OPEN, comment posted |
| 2 | #N | Title | ⏭️ DEFER | `_ideia/defer/` | Issue CLOSED with explanation |
| 3 | #N | Title | ❌ NOT FIT | `_ideia/notfit/` | Issue CLOSED with explanation |
| 4 | #N | Title | 🔁 EXISTS | `_ideia/notfit/` | Issue CLOSED with guidance |
| 5 | #N | Title | ❓ NEEDS DETAIL | `_ideia/viable/need_details/` | Issue OPEN, questions posted |
#### 3.1b — Viable Features Detail
For each VIABLE feature, provide a brief paragraph:
- What was found during research
- The proposed approach
- Key risks or unknowns
- Which reference repositories were most useful
#### 3.1c — Issues Requiring Author Feedback
For features marked ❓ NEEDS DETAIL, list:
- What specific information is missing
- What examples or repository references would help
#### 3.1d — Ask for User Confirmation
End the report with:
> **Ready to proceed with implementation?**
>
> - Reply **"sim"** or **"yes"** to generate full implementation plans for all VIABLE features.
> - Reply with specific issue numbers to select only certain features.
> - Reply **"não"** or **"no"** to stop here.
---
## Phase 4 — Plan: Generate Implementation Plans (after user says "yes")
> **⚠️ Do NOT enter this phase without explicit user approval from Phase 3.**
### 4.1 Create Task Directory
```bash
mkdir -p <project_root>/_tasks/features-vX.Y.Z/
```
### 4.2 Generate One Implementation Plan Per Feature
For each VIABLE feature approved by the user, create:
**Filename**: `_tasks/features-vX.Y.Z/<NUMBER>-<kebab-case-title>.plan.md`
```markdown
# Implementation Plan: <Feature Title>
> Issue: #<NUMBER>
> Idea: [\_ideia/viable/<NUMBER>-title.md](../../_ideia/viable/<NUMBER>-title.md)
> Requirements: [\_ideia/viable/<NUMBER>-title.requirements.md](../../_ideia/viable/<NUMBER>-title.requirements.md)
> Branch: `release/vX.Y.Z`
## Overview
<Brief description of what will be built>
## Pre-Implementation Checklist
- [ ] Read all related source files listed below
- [ ] Confirm no conflicts with in-flight PRs
- [ ] Verify database migration numbering
## Implementation Steps
### Step 1: <Title>
**Files:**
- `path/to/file.ts` — <what to change>
**Details:**
<Detailed description of the change, including code patterns to follow, function signatures, etc.>
### Step 2: <Title>
...
### Step N: Tests
**New test files:**
- `tests/unit/<test-file>.test.mjs` — <what to test>
**Test cases:**
- [ ] <test case 1>
- [ ] <test case 2>
### Step N+1: i18n
**Translation keys to add:**
- `<namespace>.<key>` — "<English value>"
### Step N+2: Documentation
- [ ] Update CHANGELOG.md
- [ ] Update relevant docs/ files
## Verification Plan
1. Run `npm run build` — must pass
2. Run `npm test` — all tests must pass
3. Run `npm run lint` — no new errors
4. <Manual verification steps>
## Commit Plan
```
feat: <description> (#<NUMBER>)
```
```
### 4.3 Present Plans for Final Approval
Present a summary of all generated plans:
> **Implementation plans generated:**
>
> | # | Feature | Plan File | Steps | Effort |
> | --- | ------- | ---------------------------------------- | ------- | ------ |
> | 1 | <title> | `_tasks/features-vX.Y.Z/N-title.plan.md` | N steps | Medium |
>
> Reply **"sim"** or **"yes"** to begin implementation of all features.
> Reply with specific issue numbers to implement only certain ones.
---
## Phase 5 — Execute: Implement the Plans (after user says "yes")
> **⚠️ Do NOT enter this phase without explicit user approval from Phase 4.**
### 5.1 Implement Each Feature
For each approved plan, execute it step by step:
1. **Follow the plan** — implement exactly as specified in the `.plan.md` file
2. **Build** — Run `npm run build` after each feature to verify compilation
3. **Test** — Run `npm test` to ensure no regressions
4. **Commit** — Commit with: `feat: <description> (#<NUMBER>)`
5. **Update the plan** — Mark completed steps with `[x]` in the plan file
6. **Continue** — Move to the next feature (do NOT switch branches)
### 5.2 Respond to Authors (Update Viable Issues)
For each implemented feature, **close the issue with a final comment**:
````markdown
✅ **Implemented in `release/vX.Y.Z`!**
Hi @<author>! Great news — your feature request has been implemented! 🎉
**What was done:**
- <bullet list of what was built>
**How to try it:**
```bash
git fetch origin && git checkout release/vX.Y.Z
npm install && npm run dev
```
````
This will be included in the upcoming **vX.Y.Z** release. Feel free to reopen if you spot any issues! 🚀
````
```bash
gh issue close <NUMBER> --repo <owner>/<repo> --comment "<comment above>"
````
Then **DELETE the idea file** — it has served its purpose:
```bash
# ✅ Implemented files are DELETED (not moved)
rm _ideia/viable/<NUMBER>-<title>.md
rm _ideia/viable/<NUMBER>-<title>.requirements.md # if exists
```
> **Why delete?** `viable/` only holds features that still NEED to be done. Once implemented, the commit history and CHANGELOG are the source of truth. Keeping the file would be confusing.
### 5.3 Finalize & Push
After implementing all approved features:
1. **Update CHANGELOG.md** on the release branch with all new feature entries
2. Push the release branch: `git push origin release/vX.Y.Z`
3. Run `/generate-release` workflow Phase 1 steps 7–10 (tests → commit → push → open PR to main → wait for user)
### 5.4 Final Summary Report
Present a final summary report to the user:
| Issue | Title | Verdict | Action | Commit |
| ----- | ----- | --------------- | -------------------------------------------------- | --------- |
| #N | Title | ✅ Implemented | Issue closed, idea file deleted | `abc1234` |
| #N | Title | ⏭️ Deferred | Issue closed + saved in `_ideia/defer/` | — |
| #N | Title | ❌ Not Fit | Issue closed + saved in `_ideia/notfit/` | — |
| #N | Title | 🔁 Exists | Issue closed + saved in `_ideia/notfit/` | — |
| #N | Title | ❓ Needs Detail | Issue OPEN, moved to `_ideia/viable/need_details/` | — |
Include:
- Total features harvested
- Total ideas cataloged (`viable/need_details/` + `defer/` + `notfit/`)
- Total features implemented (idea files deleted, issues closed)
- Total features deferred
- Total issues closed
- Total issues left open (needs detail only — viable are closed after implementation)
- Test results (pass/fail count)

View File

@@ -0,0 +1,50 @@
---
description: How to respond to GitHub issues with insufficient information
---
# Issue Triage Workflow
Respond to GitHub issues that need more information before they can be investigated.
## Steps
### 1. Identify issues needing triage
```bash
gh issue list --state open --limit 20
```
### 2. Evaluate each issue
Check if the issue has:
- Clear reproduction steps
- Environment details (OS, Node.js version, OmniRoute version)
- Error logs/screenshots
- Expected vs actual behavior
### 3. Respond with triage template
For issues missing information:
```markdown
Thank you for reporting this issue! To help us investigate, please provide:
1. **OmniRoute version**: (`omniroute --version`)
2. **Node.js version**: (`node --version`)
3. **Operating system**: (e.g., Ubuntu 24.04, macOS 15, Windows 11)
4. **Installation method**: (npm, Docker, source)
5. **Steps to reproduce**: (exact commands/actions that trigger the issue)
6. **Error logs**: (paste relevant logs from the console)
7. **Expected behavior**: (what should happen)
This will help us debug and resolve your issue faster. 🙏
```
### 4. Label the issue
Add appropriate labels: `needs-info`, `bug`, `enhancement`, `question`, etc.
```bash
gh issue edit <NUMBER> --add-label "needs-info"
```

View File

@@ -0,0 +1,163 @@
---
description: Fetch all open GitHub issues, analyze bugs, resolve what's possible, triage the rest, wait for user validation, then commit and release
---
# /resolve-issues — Automated Issue Resolution Workflow
## Overview
This workflow fetches all open issues from the project's GitHub repository, classifies them, analyzes bugs, proposes a resolution plan, waits for user validation, and ONLY THEN implements the fixes, commits, and closes the issues on the current release branch (`release/vX.Y.Z`). It does NOT merge or release automatically — the release branch is later merged via PR to main.
> **BRANCH RULE**: All work MUST happen on the current `release/vX.Y.Z` branch. Never create separate `fix/` branches. If no release branch exists yet, create one first using `/generate-release` Phase 1 steps 1–5.
## Steps
### 1. Identify the GitHub Repository
// turbo
- Run: `git -C <project_root> remote get-url origin` to extract the owner/repo
- Parse the owner and repo name from the URL
### 2. Ensure Release Branch Exists
// turbo
Before doing any work, ensure you are on the current release branch:
```bash
# Check current branch
git branch --show-current
# If on main, determine next version and create the release branch
VERSION=$(node -p "require('./package.json').version")
NEXT=$(node -p "const [a,b,c]=('$VERSION').split('.').map(Number); c>=9?a+'.'+(b+1)+'.0':a+'.'+b+'.'+(c+1)")
git checkout -b release/v$NEXT
npm version patch --no-git-tag-version
npm install
```
If already on a `release/vX.Y.Z` branch, continue working there.
### 3. Fetch All Open Issues
// turbo-all
**⚠️ CRITICAL**: The JSON output of `gh issue list` can be truncated by the tool, silently hiding issues. You MUST use the two-step approach below to guarantee **all** issues are fetched.
**Step 3a — Get Issue numbers only** (small output, never truncated):
- Run: `gh issue list --repo <owner>/<repo> --state open --limit 500 --json number --jq '.[].number'`
- This outputs one issue number per line. Count them and confirm total.
**Step 3b — Fetch full metadata for each Issue** (one call per issue):
- For each issue number from step 3a, run:
`gh issue view <NUMBER> --repo <owner>/<repo> --json number,title,labels,body,comments,createdAt,author`
- You may batch these into parallel calls (up to 4 at a time).
- Sort by oldest first (FIFO).
### 4. Classify Each Issue
For each issue, determine its type:
- **Bug** — Has `bug` label, or body contains error messages, stack traces, "doesn't work", "broken", "crash", "error"
- **Feature Request** — Has `enhancement`/`feature` label, or body describes new functionality
- **Question** — Has `question` label, or is asking "how to" something
- **Other** — Anything else
Focus ONLY on **Bugs** for resolution. Feature requests and questions should be skipped with a note in the final report.
### 5. Deep-Read Each Bug Issue (One-by-One Analysis)
**IMPORTANT**: Read each bug issue thoroughly, one at a time, before moving to the next. This is NOT a batch process — each issue needs focused attention.
#### 5a. Understand the Problem
For each bug issue, perform the full analysis:
1. **Read the entire body** — including Description, Steps to Reproduce, Expected/Actual Behavior, Error Logs, and Screenshots
2. **Read ALL comments** — including bot triage comments (Kilo, etc.) and owner/community responses. Pay attention to:
- Whether someone already responded with a fix
- Whether a community member confirmed the issue is resolved
- Whether the issue was marked as duplicate by a bot
3. **Identify the claimed error** — extract the exact error message, status code, and provider/model involved
#### 5b. Check Information Sufficiency
Verify the issue contains enough to act on:
- [ ] Clear description of the problem
- [ ] Steps to reproduce OR error logs
- [ ] Provider/model/version information
- [ ] Expected vs actual behavior
#### 5c. Determine Issue Disposition
For each bug, classify into one of 5 actions:
| Disposition | When to Apply | Action |
| ---------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| **✅ CLOSE — Already Fixed** | Owner responded with fix + no user follow-up, OR community confirmed fix | Close with comment citing which version fixed it |
| **✅ CLOSE — Duplicate** | Bot flagged >85% similarity + user provides no new info | Close referencing the original issue |
| **✅ CLOSE — Stale** | We requested logs/info > 7 days ago with no reply | Close thanking the user, invite to reopen if needed |
| **📝 RESPOND — Needs Info** | Issue is real but missing critical reproduction details | Comment asking for specifics per `/issue-triage` |
| **📝 RESPOND — User Config** | Error is caused by unsupported env (Node version, wrong model path, missing API enablement) | Comment explaining the user-side fix |
| **🔧 FIX — Code Change** | Root cause is confirmed in the codebase | Research, propose solution in report, wait for approval |
#### 5d. For "FIX — Code Change" Issues
Before coding, perform deep source analysis to formulate a plan:
1. **Search the codebase** — `grep_search` for error strings, relevant function names, affected files
2. **Search the web** — for upstream API changes, SDK updates, or breaking changes that explain the bug
3. **Read the full source file** — don't rely on grep snippets; understand the surrounding logic
4. **Verify the root cause** — confirm the bug is reproducible based on the code, not just a user misconfiguration
5. **Formulate a proposed solution** — detail the exact files and lines you will change and how you will solve it.
6. **DO NOT modify the codebase yet** — wait for user approval on your report first.
#### 5e. For "RESPOND" Issues
Post a substantive comment that:
- Acknowledges the specific error they reported
- Explains the likely root cause
- Provides concrete steps to resolve (version upgrade, env var fix, model path correction)
- Asks for follow-up info if needed
**Do NOT post generic template responses.** Every comment should reference the user's specific error messages and environment.
### 6. Generate Report & Wait for Validation
Present a summary report to the user detailing your proposed actions. For any bugs that need fixing, explicitly explain your proposed solution (files to change and logic) and point out that it will be implemented on the release branch (`release/vX.Y.Z`) after approval.
| Issue | Title | Status | Proposed Action / Version |
| ----- | ----- | ------------- | ----------------------------------------- |
| #N | Title | ✅ Close | Already fixed / duplicate (explain why) |
| #N | Title | 🔧 Propose | Explanation of the code fix to be applied |
| #N | Title | 📝 Respond | Guidance comment to be posted |
| #N | Title | ❓ Needs Info | Triage comment to be posted |
| #N | Title | ⏭️ Skip | Feature request / not a bug |
> **⚠️ IMPORTANT**: Do NOT implement code changes, commit, push, or close issues at this step.
> Wait for the user to review the proposed fixes and respond with **OK** before proceeding.
- If the user says **OK** or approves → Proceed to step 7
- If the user requests changes → Adjust the proposed solution and present the report again
- If the user rejects → Revert any accidental changes and stop
### 7. Implement Fixes, Run Tests & Commit (only after user approval)
After the user validates and gives the OK:
1. **Implement the fixes** — modify the codebase according to the approved plan.
2. **Run tests** — `npm run test:all` (or the specific test file) to ensure 100% pass.
3. **Update CHANGELOG.md** with all new bug fix entries.
4. **Commit** each fix individually on the release branch with message format: `fix: <description> (#<issue_number>)`.
5. **Push** the release branch: `git push origin release/vX.Y.Z`.
6. **Close resolved issues immediately**. For each issue that was marked as Fixed, run:
`gh issue close <NUMBER> --repo <owner>/<repo> --comment "Thank you for reporting! This issue has been fixed and will be included in the next release (vX.Y.Z)."`
7. Likewise, close `Duplicate` issues referencing the original, close `Needs Info` if stale, and post the required comments.
8. If the project runs automatic releases or needs a PR, proceed to run `/generate-release` workflow Phase 1 steps 7–10 (tests → commit → push → open PR to main → wait for user).
If NO fixes were committed, skip closing and source control steps and just conclude the workflow.

View File

@@ -0,0 +1,118 @@
---
description: Read all open GitHub Discussions, summarize them, respond to pending ones, and create issues from actionable feature requests
---
# /review-discussions — GitHub Discussions Review & Response Workflow
## Overview
This workflow reads all open GitHub Discussions, generates a categorized summary, identifies which ones need a response, drafts and posts replies, and optionally creates issues from actionable feature requests. It follows the same flow used for Issues but adapted for the Discussions forum.
// turbo-all
## Steps
### 1. Identify the GitHub Repository
- Run: `git -C <project_root> remote get-url origin` to extract the owner/repo
- Parse the owner and repo name from the URL
### 2. Fetch All Open Discussions
- Use `read_url_content` to fetch `https://github.com/<owner>/<repo>/discussions`
- Parse the discussion list to get all discussion titles, IDs, authors, categories, and dates
- For each discussion, fetch the individual page to read the full content and all comments/replies
### 3. Summarize All Discussions
For each discussion, extract:
- **Title** and **#Number**
- **Author** (GitHub username)
- **Category** (Announcements, General, Ideas, Q&A, Show and tell)
- **Date** created
- **Summary** of the original post (1-2 sentences)
- **Comments count** and key participants
- **Your previous response** (if any)
- **Pending action** — whether a response or follow-up is needed
### 4. Present Summary Report to User
Present the full summary to the user organized by category, using a table:
| # | Category | Title | Author | Date | Status |
| --- | -------- | ----- | ------ | ------ | ----------------- |
| #N | Ideas | Title | @user | Mar 23 | ⚠️ Needs response |
| #N | Q&A | Title | @user | Mar 9 | ✅ Answered |
| #N | General | Title | @user | Mar 19 | ⚠️ Needs response |
Highlight:
- **⚠️ Needs response** — No reply from maintainer, or a follow-up comment was left unanswered
- **✅ Answered** — Maintainer already responded
- **🐛 Bug reported** — A bug was mentioned that needs tracking
- **💡 Actionable** — Contains a concrete feature request that could become an issue
### 5. Draft & Post Responses
For each discussion that needs a response, draft a reply following these guidelines:
#### Response Style
- **Friendly and professional** — Start with "Hey @username!"
- **Acknowledge the contribution** — Thank the user for their input
- **Be specific** — Reference existing features, settings, or dashboard pages if the feature already exists
- **Provide workarounds** — If the request isn't implemented yet, suggest current alternatives
- **Commit to action** — If the request is valid, state that you'll open an issue or add it to the roadmap
- **Keep it concise** — 3-5 paragraphs max
#### Posting via Browser
- Use `browser_subagent` to navigate to each discussion and post the comment
- **IMPORTANT**: When typing text in GitHub comment boxes via the browser, use only plain ASCII characters:
- Use regular hyphens `-` instead of em-dashes
- Use `->` instead of arrow symbols
- Do NOT use emoji Unicode characters (the browser keyboard may fail on them)
- Use `**bold**` and `\`code\`` markdown formatting
- Click the green "Comment" button (or "Reply" for threaded replies) after typing
- Verify the comment was posted by checking the page shows the new comment
### 6. Create Issues from Actionable Feature Requests
For discussions that contain concrete, actionable feature requests:
1. Ask the user which ones should become issues
2. For each approved request, create a GitHub issue via `browser_subagent`:
- Navigate to `https://github.com/<owner>/<repo>/issues/new`
- **Title**: `<Feature Name> - <Short description>`
- **Body** should include:
- `## Feature Request` header
- `**Source:** Discussion #N by @author`
- `## Problem` — What limitation the user hit
- `## Proposed Solution` — How it could work
- `### Implementation Ideas` — Technical approach
- `### Current Workarounds` — What users can do today
- `## Additional Context` — Links to related issues/discussions
- Add `enhancement` label
- Click "Submit new issue" / "Create"
3. After creation, go back to the original discussion and post a comment linking to the new issue:
- "I've opened Issue #N to track this feature request. Follow along there for updates!"
### 7. Final Report
Present a final summary to the user:
| Discussion | Action Taken |
| ---------- | ---------------------------------- |
| #N — Title | Responded with workarounds |
| #N — Title | Responded + created Issue #N |
| #N — Title | Already answered, no action needed |
| #N — Title | Responded to follow-up comment |
## Notes
- This workflow is **interactive** — always present the summary and wait for user approval before posting responses or creating issues
- If the user says "pode responder" (or similar approval), proceed with posting all drafted responses
- For discussions in non-English languages, respond in the same language as the original post
- Always reference specific dashboard paths, config options, or code files when explaining existing features
- When a discussion reveals a bug, note it separately from feature requests

View File

@@ -0,0 +1,242 @@
---
description: Analyze open Pull Requests from the project's GitHub repository, generate a critical report, and optionally implement approved changes
---
# /review-prs — PR Review & Analysis Workflow
## Overview
This workflow fetches all open PRs from the project's GitHub repository, performs a critical analysis of each one, generates a detailed report, and waits for user approval before proceeding with implementation. **All improvements are committed on the current release branch** (`release/vX.Y.Z`).
> **BRANCH RULE**: PRs are ALWAYS merged into the current `release/vX.Y.Z` branch, NEVER directly into `main`. The release branch acts as a staging area — only after all PRs are integrated and tests pass does the release branch get merged into `main` via the `/generate-release` workflow.
## Steps
### 1. Identify the GitHub Repository
- Read `package.json` to get the repository URL, or use the git remote origin URL
// turbo
- Run: `git -C <project_root> remote get-url origin` to extract the owner/repo
### 2. Ensure Release Branch Exists
// turbo
Before doing any work, ensure you are on the current release branch:
```bash
# Check current branch
git branch --show-current
# If on main, determine next version and create the release branch
VERSION=$(node -p "require('./package.json').version")
# Bump patch: e.g. 3.3.11 → 3.3.12
NEXT=$(node -p "const [a,b,c]=('$VERSION').split('.').map(Number); c>=9?a+'.'+(b+1)+'.0':a+'.'+b+'.'+(c+1)")
git checkout -b release/v$NEXT
npm version patch --no-git-tag-version
npm install
```
If already on a `release/vX.Y.Z` branch, continue working there.
### 3. Fetch Open Pull Requests
// turbo-all
**⚠️ CRITICAL**: The JSON output of `gh pr list` can be truncated by the tool, silently hiding PRs. You MUST use the two-step approach below to guarantee **all** PRs are fetched.
**Step 3a — Get PR numbers only** (small output, never truncated):
- Run: `gh pr list --repo <owner>/<repo> --state open --limit 500 --json number --jq '.[].number'`
- This outputs one PR number per line. Count them and confirm total.
**Step 3b — Fetch full metadata for each PR** (one call per PR):
- For each PR number from step 3a, run:
`gh pr view <NUMBER> --repo <owner>/<repo> --json number,title,author,headRefName,baseRefName,body,createdAt,additions,deletions,files`
- You may batch these into parallel calls (up to 4 at a time).
**Step 3c — Fetch diffs for each PR** (one call per PR, saved to /tmp):
- For each PR number, run:
`gh pr diff <NUMBER> --repo <owner>/<repo> > /tmp/pr<NUMBER>.diff`
- Then read each diff file with `view_file`.
- For each open PR, collect:
- PR number, title, author, branch, number of commits, date
- PR description/body
- Files changed (diff)
- Existing review comments (from bots or humans)
**Verification**: Confirm the count of PRs analyzed matches the count from step 3a before proceeding.
### 3.5 Redirect PR Base Branches to Release Branch
// turbo-all
**⚠️ CRITICAL**: Contributors typically open PRs targeting `main`. Before analyzing or merging, redirect ALL open PRs to target the current release branch instead.
```bash
# Get the current release branch name
RELEASE_BRANCH=$(git branch --show-current) # e.g. release/v3.5.4
# For each open PR that targets main, change its base to the release branch
for PR_NUM in $(gh pr list --repo <owner>/<repo> --state open --json number,baseRefName --jq '.[] | select(.baseRefName == "main") | .number'); do
echo "Redirecting PR #$PR_NUM → $RELEASE_BRANCH"
gh pr edit "$PR_NUM" --repo <owner>/<repo> --base "$RELEASE_BRANCH"
done
```
This ensures:
1. PRs merge into the release branch, not directly into `main`
2. Merge conflict detection is accurate against the release branch
3. The release branch accumulates all changes before the final merge to `main`
4. If the release branch doesn't exist on remote yet, push it first: `git push origin $RELEASE_BRANCH`
### 4. Analyze Each PR — For each open PR, perform the following analysis:
#### 4a. Feature Assessment
- **Does it make sense?** Evaluate if the feature fills a real gap or solves a valid problem
- **Alignment** — Check if it aligns with the project's architecture and roadmap
- **Complexity** — Assess if the scope is reasonable or if it should be split
#### 4b. Code Quality Review
- Check for code duplication
- Evaluate error handling patterns (consistent with existing codebase?)
- Check naming conventions and code style
- Verify TypeScript types (any `any` usage, missing types?)
#### 4c. Security Review
- Check for missing authentication/authorization on new endpoints
- Check for injection vulnerabilities (URL params, SQL, XSS)
- Verify input validation on all user-controlled data
- Check for hardcoded secrets or credentials
#### 4d. Architecture Review
- Does the change follow existing patterns?
- Are there any breaking changes to public APIs?
- Is the database schema affected? Migration needed?
- Impact on performance (N+1 queries, missing indexes?)
#### 4e. Test Coverage
- Does the PR include tests?
- Are edge cases covered?
- Would existing tests break?
#### 4f. Cross-Layer (Global) Analysis
Perform a **global impact assessment** to verify whether the PR changes are complete across all layers of the application:
- **Backend → Frontend check**: If the PR adds or modifies backend-only resources (new endpoints, services, data models), evaluate whether corresponding frontend changes are missing:
- Does a new endpoint require a new screen/page in the dashboard?
- Should there be a new action button, menu item, or navigation link?
- Are there new data fields that should be displayed or editable in the UI?
- Does a new feature need a toggle, configuration panel, or status indicator?
- **Frontend → Backend check**: If the PR adds frontend elements, verify the backend support exists:
- Are the required API endpoints implemented?
- Is the data model sufficient for the new UI components?
- **Cross-cutting concerns**: Check shared layers (types, DTOs, validation schemas, routes, middleware) for completeness
- **Document gaps** — If missing layers are detected, list them as **IMPORTANT** issues in the report with concrete suggestions for what should be added
### 5. Generate Report — Create a markdown report for each PR including:
- **PR Summary** — What it does, files affected, commit count
- **Improvements/Benefits** — Numbered list with impact level (HIGH/MEDIUM/LOW)
- **Risks & Issues** — Categorized as CRITICAL / IMPORTANT / MINOR
- **Scoring Table** — Rate across: Feature Relevance, Code Quality, Security, Robustness, Tests
- **Verdict** — Ready to merge? With mandatory vs optional fixes
- **Next Steps** — What will happen if approved
### 6. Present to User
- Show the report via `notify_user` with `BlockedOnUser: true`
- Wait for user decision:
- **Approved** → Proceed to step 7
- **Approved with changes** → Implement the fixes and corrections before merging
- **Rejected** → Close the PR or leave a review comment
### 7. Pre-Merge Fixes & CI Green-Lighting (if approved)
> **⚠️ Fixes and Conflict Resolutions MUST be pushed back to the PR branch before merging.** We want the PR itself to be green and fully valid before it integrates.
- **Sync latest fixes & Resolve Conflicts:** Merge the current `release` branch into the PR branch. If there are merge conflicts, you MUST resolve them inside the author's PR branch. NEVER resolve conflicts by closing their PR and doing the work in a separate branch, as this steals credit from the original author.
- **Implement improvements:** Apply the required fixes identified in the analysis directly on the PR branch (e.g., adding missing API routes, fixing SSRF, applying comments from other agents).
- **Pushing changes to PR branches:**
```bash
# Checkout the PR locally
gh pr checkout <NUMBER>
# Apply fixes, commit your changes
git commit -m "chore: apply review suggestions and missing layers"
# Attempt to push directly to the PR branch
git push
```
- **Fallback (For external forks without maintainer edit access):**
If `git push` fails because the PR comes from an external fork without write access, you MUST:
1. Create a new branch ending in `-fix` (e.g., `checkout -b fix-pr-<NUMBER>`).
2. Push your branch to the main repo (`git push origin fix-pr-<NUMBER>`).
3. Create a Pull Request targeting the contributor's repository and branch (use `gh pr create --repo <contributor-repo> --base <contributor-branch> --head diegosouzapw:fix-pr-<NUMBER>`).
4. Once they accept our PR into their branch, their original PR to our `main` will automatically update and become green.
- Run the project's test suite locally to verify nothing breaks:
// turbo
- Run: `npm test` or equivalent test command
### 8. Merge into Release Branch
### 8. Merge into Release Branch (NEVER CLOSE!)
> **⚠️ CRITICAL**: NEVER use `gh pr close` for a PR whose idea or code was accepted. Closing a PR in a contributor's face after taking their idea—or closing it just because it had conflicts—is unacceptable.
> You MUST ALWAYS resolve conflicts and apply fixes on the author's PR branch, and then merge the PR using GitHub so the contributor gets the official "Merged" badge and proper credit on their profile.
Even if the PR had severe conflicts or required significant architectural adjustments, you MUST:
1. Resolve any conflicts and apply the fixes directly to their PR branch (as detailed in step 7).
2. Once the PR branch is green, conflict-free, and correct, merge it into the release branch using the GitHub CLI.
```bash
# Merge the PR (base is already set to release/vX.Y.Z from step 3.5)
gh pr merge <NUMBER> --repo <owner>/<repo> --squash --body "Integrated into release/vX.Y.Z"
```
In ALL cases:
- Post a **thank-you comment** on the PR via the GitHub API before or immediately after merging.
- The message should:
- Thank the author by name/username for their contribution.
- Explain what was adjusted or improved (if we pushed fixes to their branch).
- Note it will be included in the upcoming release.
- Be friendly, professional, and encouraging.
- Example: _"Thanks @author for this great contribution! 🎉 We've added a few small adjustments to your branch to align with our latest architecture, and it's now officially merged into the release/vX.Y.Z branch. It will be part of the next release. We appreciate your effort!"_
### 9. Sync Local Release Branch
After merging PRs, sync the local release branch to include the new changes:
```bash
git fetch origin
git pull origin release/vX.Y.Z
```
### 10. Continue or Finalize
After processing all approved PRs:
- If more PRs remain, go back to step 7
- When all PRs are processed, **update CHANGELOG.md** on the release branch with all new entries
- Run **test coverage** to verify all metrics stay above 85%:
```bash
npm run test:coverage
```
- Fix any test regressions introduced by merged PRs
- Run `/generate-release` workflow Phase 1 steps 7–10 (tests → commit → push → open PR to main → wait for user)
- The `/generate-release` workflow handles the final merge from `release/vX.Y.Z` → `main`

View File

@@ -0,0 +1,327 @@
---
description: Bump version, auto-generate CHANGELOG from git commits, update all versioned files, and refresh root + docs/ documentation to reflect the current project state
---
# Version Bump Workflow
Automatically bump the project version, generate CHANGELOG entries from git history since the last tag, update every file that references the version, and refresh project documentation to reflect the current state.
> **VERSION RULE: Always use PATCH bumps (3.x.y → 3.x.y+1)**
> NEVER use `npm version minor` or `npm version major`.
> Always use: `npm version patch --no-git-tag-version`
> The threshold rule: when `y` reaches 10, bump to `3.(x+1).0` — e.g. `3.4.10` → `3.5.0`.
---
## Phase 1: Determine Version
### 1. Read current version and last tag
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
CURRENT_VERSION=$(node -p "require('./package.json').version")
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
CURRENT_BRANCH=$(git branch --show-current)
echo "Current version: $CURRENT_VERSION"
echo "Last tag: $LAST_TAG"
echo "Current branch: $CURRENT_BRANCH"
```
### 2. Calculate new version
Apply the patch bump rule:
- If the current patch number is `9`, the new version is `3.(minor+1).0`
- Otherwise, increment patch: `3.x.y` → `3.x.(y+1)`
If the version was ALREADY bumped (e.g. you are on a release branch and package.json already has the new version), **skip the npm version bump** and use the existing version.
### 3. Bump package.json (if needed)
// turbo
```bash
# Only if version hasn't been bumped yet
npm version patch --no-git-tag-version
```
Or for threshold (y=10):
```bash
# Manual threshold bump
VERSION="3.X.0" # compute manually
npm version "$VERSION" --no-git-tag-version
```
---
## Phase 2: Generate CHANGELOG from Git History
### 4. Collect commits since last tag
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
echo "=== Commits since $LAST_TAG ==="
git log "$LAST_TAG"..HEAD --pretty=format:"%h %s" --no-merges | head -100
echo ""
echo "=== Merge commits ==="
git log "$LAST_TAG"..HEAD --merges --pretty=format:"%h %s" | head -50
```
### 5. Classify commits and generate CHANGELOG section
Analyze each commit message and classify into categories based on the conventional-commit prefix and content:
| Category | Patterns |
| ------------------- | ------------------------------------------------ |
| ✨ New Features | `feat:`, `feat(*):` |
| 🐛 Bug Fixes | `fix:`, `fix(*):` |
| ⚠️ Breaking Changes | `BREAKING CHANGE`, `!:` suffix |
| 🛠️ Maintenance | `chore:`, `refactor:`, `perf:`, `build:` |
| 🧪 Tests | `test:`, `tests:` |
| 📝 Documentation | `docs:` |
| 🔒 Security | `security:`, CVE references, vulnerability fixes |
| 🌍 i18n | translation updates, locale changes |
For each category with entries, create a markdown section with descriptive bullet points. Use the commit messages but rewrite them to be human-readable and descriptive (not raw commit messages).
**If a commit references a PR number** (e.g. `#880`, `PR #885`), include it in the description.
### 6. Update CHANGELOG.md
Replace the `## [Unreleased]` section content with the generated entries, then add the new versioned section:
```markdown
## [Unreleased]
---
## [NEW_VERSION] — YYYY-MM-DD
### ✨ New Features
- **Feature name:** Description (#PR)
### 🐛 Bug Fixes
- **Fix name:** Description (#PR)
### 🛠️ Maintenance
- **Item:** Description
---
## [PREVIOUS_VERSION] — YYYY-MM-DD
...
```
The date must be today's date in `YYYY-MM-DD` format.
---
## Phase 3: Sync Version Across All Files
### 7. Update workspace package.json files and openapi.yaml
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
VERSION=$(node -p "require('./package.json').version")
# Update docs/openapi.yaml version
sed -i "s/ version: .*/ version: $VERSION/" docs/openapi.yaml
echo "✓ docs/openapi.yaml → $VERSION"
# Update workspace packages (open-sse, electron)
for dir in electron open-sse; do
if [ -d "$dir" ] && [ -f "$dir/package.json" ]; then
(cd "$dir" && npm version "$VERSION" --no-git-tag-version --allow-same-version > /dev/null)
echo "✓ $dir/package.json → $VERSION"
fi
done
echo "✓ All workspace packages synced to $VERSION"
```
### 8. Update llm.txt version references
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
VERSION=$(node -p "require('./package.json').version")
OLD_VERSION_PATTERN='[0-9]\+\.[0-9]\+\.[0-9]\+'
# Update "Current version:" line
sed -i "s/\*\*Current version:\*\* $OLD_VERSION_PATTERN/**Current version:** $VERSION/" llm.txt
# Update "Key Features (vX.Y.Z)" header
sed -i "s/## Key Features (v$OLD_VERSION_PATTERN)/## Key Features (v$VERSION)/" llm.txt
echo "✓ llm.txt → $VERSION"
```
### 9. Regenerate lock file
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
npm install
echo "✓ Lock file regenerated"
```
---
## Phase 4: Update Root Documentation
Based on the CHANGELOG entries generated in Phase 2, review and update these root-level files if relevant changes warrant updates:
### 10. Review and update root documentation files
For each file below, read the current content and determine if the CHANGELOG entries require any updates. Only modify files where substantive changes have occurred:
| File | When to update |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `README.md` | New providers, major features, stats changes (test count, provider count), badges, installation instructions, feature table |
| `AGENTS.md` | Architecture changes, new modules, new commands, new providers, new services/handlers/executors |
| `CONTRIBUTING.md` | Dev workflow changes, new tooling, test infrastructure changes |
| `SECURITY.md` | Security fixes, new auth mechanisms, vulnerability disclosures |
| `llm.txt` | Provider count changes, new features, architecture changes |
**Update rules:**
- **README.md**: Update provider count, test count, feature highlights table, badges if any numbers changed. If a new provider was added, add it to the provider table. If a major feature was added, add it to the features section.
- **AGENTS.md**: If new architecture components (handlers, executors, services, DB modules) were added, update the Architecture section. If new commands were added, update the Build/Test table.
- **SECURITY.md**: Add new vulnerability fixes or security improvements to the relevant section.
- **llm.txt**: Update provider count, feature list, version references.
### 11. Review and update docs/ files (excluding i18n/)
For each file in `docs/` (excluding `docs/i18n/`), review if CHANGELOG changes affect it:
| File | When to update |
| -------------------------------- | --------------------------------------------------- |
| `docs/API_REFERENCE.md` | New API endpoints, changed request/response formats |
| `docs/ARCHITECTURE.md` | New modules, new services, changed data flow |
| `docs/CLI-TOOLS.md` | New CLI tool integrations, config format changes |
| `docs/FEATURES.md` | New features, removed features, changed settings |
| `docs/MCP-SERVER.md` | New MCP tools, changed tool signatures |
| `docs/A2A-SERVER.md` | New A2A skills, protocol changes |
| `docs/USER_GUIDE.md` | UX changes, new dashboard pages, settings changes |
| `docs/VM_DEPLOYMENT_GUIDE.md` | Deployment changes, new env vars |
| `docs/TROUBLESHOOTING.md` | New known issues, resolved problems |
| `docs/AUTO-COMBO.md` | Routing changes, new strategies |
| `docs/CODEBASE_DOCUMENTATION.md` | New files, architectural changes |
| `docs/RELEASE_CHECKLIST.md` | Process changes |
| `docs/COVERAGE_PLAN.md` | Test changes |
| `docs/openapi.yaml` | Already updated in step 7 |
**Only update files where the CHANGELOG entries directly affect the documented content.** Do NOT update files just to bump a version number — only when the documented behavior, features, or architecture has actually changed.
---
## Phase 5: Verify
### 12. Run lint check
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
npm run lint
```
### 13. Run tests
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
npm test
```
### 14. Verify version sync across all files
// turbo
```bash
cd /home/diegosouzapw/dev/proxys/9router
VERSION=$(node -p "require('./package.json').version")
echo "Expected version: $VERSION"
echo ""
echo "--- package.json ---"
grep '"version"' package.json | head -1
echo "--- open-sse/package.json ---"
grep '"version"' open-sse/package.json | head -1
echo "--- electron/package.json ---"
[ -f electron/package.json ] && grep '"version"' electron/package.json | head -1
echo "--- docs/openapi.yaml ---"
grep " version:" docs/openapi.yaml | head -1
echo "--- llm.txt ---"
grep "Current version:" llm.txt
echo "--- CHANGELOG.md (first versioned entry) ---"
grep "^## \[" CHANGELOG.md | head -2
```
### 15. 🛑 STOP — Present Summary to User
**STOP** and present a summary to the user including:
- Old version → New version
- CHANGELOG entries generated
- Files modified
- Test results
- Any documentation updates made
**Wait for the user to confirm before committing.**
---
## Phase 6: Commit (only after user approval)
### 16. Stage and commit
// turbo-all
```bash
cd /home/diegosouzapw/dev/proxys/9router
git add -A
VERSION=$(node -p "require('./package.json').version")
git commit -m "chore(release): bump to v$VERSION — changelog, docs, version sync"
```
---
## Notes
- This workflow does **NOT** create tags, releases, or deploy. Use `/generate-release` for the full release cycle after this.
- This workflow does **NOT** update `docs/i18n/` translations. Use `/update-i18n` separately after committing.
- The CHANGELOG generation is based on git commits since the last tag. If there are no new commits, the workflow should inform the user and stop.
- Always verify the generated CHANGELOG entries make sense — raw commit messages may need rewriting for clarity.
- If the version was already bumped (e.g. you're on a `release/vX.Y.Z` branch), skip the `npm version` step and use the existing version.
## Version Touchpoints Checklist
| File | Field/Pattern |
| ----------------------- | ----------------------------------------------------------- |
| `package.json` | `"version": "X.Y.Z"` |
| `open-sse/package.json` | `"version": "X.Y.Z"` |
| `electron/package.json` | `"version": "X.Y.Z"` |
| `docs/openapi.yaml` | `version: X.Y.Z` |
| `llm.txt` | `**Current version:** X.Y.Z` and `## Key Features (vX.Y.Z)` |
| `CHANGELOG.md` | `## [X.Y.Z] — YYYY-MM-DD` |

View File

@@ -1,201 +0,0 @@
# codebase-memory-mcp ignore list
#
# Padrão gitignore-style. Linhas começando com `#` são comentários.
# Barra final (`/`) = só diretório. Sem barra = casa arquivo OU diretório.
#
# O CBM também lê `.gitignore` automaticamente — esta lista deixa explícito o que
# os hooks do CBM vão pular. Se uma regra entrar em conflito entre os dois arquivos,
# vale a união. Editar este arquivo é mais barato do que confiar na herança implícita.
#
# Última reconciliação: 2026-07-31, status `ready` (513k nodes / 689k edges),
# `auto_index_limit=50000`, total indexável medido ≈11.546 arquivos (folga 4,3×).
#
# Fontes cruzadas:
# - `codebase-memory-mcp cli index_status --project home-diegosouzapw-dev-proxys-OmniRoute`
# → `not_indexed.dirs` (27) + `not_indexed.files` (336), todos `BY DESIGN`.
# - `.gitignore` deste repo (5.691 B) — fonte canônica secundária.
#
# Como auditar mudanças: depois de editar este arquivo, rodar `index_repository`
# (ou esperar `auto_watch` re-indexar) e re-checar `cli index_status` → comparar
# contagens em `not_indexed.dirs_count` e `not_indexed.files_count`.
# ─────────────────────────────────────────────────────────────────────────────
# 1. Diretorios de runtime / pacote — nao sao codigo-fonte
# ─────────────────────────────────────────────────────────────────────────────
node_modules/
node_modules
# Builds e artefatos reproduziveis (Layer 1 Next.js / Electron)
.build/
dist/
.next/
out/
# Electron especifico
electron/dist-electron/
electron/node_modules/
icon.iconset/
# Workspaces internos que tem proprio node_modules
@omniroute/opencode-plugin/dist/
@omniroute/opencode-plugin/node_modules/
@omniroute/opencode-provider/dist/
@omniroute/opencode-provider/node_modules/
# Recursos nativos compilados (C/JNI/wasm)
src/mitm/tproxy/native/build/
# Artefatos locais do Stryker / Playwright / coverage
.stryker-tmp/
reports/mutation/
stryker-output-*.json
.playwright-mcp/
test-results/
playwright-report/
blob-report/
# Analise / linters / caches
.analysis/
.sisyphus/
.plans/
.gitnexus
.worktrees
.codegraph/
# Quality artifacts (gerados por npm run lint --cache etc)
.eslintcache
.eslintcache-complexity
# Claude Code local state
.claude/scheduled_tasks.lock
.claude/scheduled_tasks/
.claude/sessions/
.claude/state.json
.claude/settings.local.json
# Serena / Antigravity / outras tools locais
.serena/
.antigravitycli/
.gemini/
.config/
# ─────────────────────────────────────────────────────────────────────────────
# 2. Diretorios com prefixo `_` — locais / privados (regra global do .gitignore)
# ─────────────────────────────────────────────────────────────────────────────
_*/
_artifacts/
_cache/
_mono_repo/
_references/
_tasks/
# ─────────────────────────────────────────────────────────────────────────────
# 3. Diretorios de tooling IA (state local, nao codigo)
# ─────────────────────────────────────────────────────────────────────────────
.agents/
.claude/
.vscode/
.idea/
.junie/
.omc/
.data/
.data-dev/
.local-data/
.logs/
.artifacts/
.source/
.superpowers/
.claude-flow/
.omnivscodeagent/
omnirouteCloud/
omnirouteSite/
.omniroute/
.stent/
# Subpaths especificos do Claude Code que nao estao em .claude/ (criados sob repo)
.claude/worktrees/
# ─────────────────────────────────────────────────────────────────────────────
# 4. Diretorios de dados / runtime locais (storage, env, secrets, scratch)
# ─────────────────────────────────────────────────────────────────────────────
data/
# NOTA: src/lib/env/, src/app/api/{cloud,sync/cloud,system/env,agent-skills/coverage}/
# foram removidos daqui (2026-08-05). Os nomes sugerem dados/segredos locais, mas os
# 8 arquivos sao route handlers e modulos rastreados no git — escondia-los do grafo
# criava pontos cegos em buscas e em analise de impacto.
tests/golden-set/data/
# Logs e saida de teste
logs/*
test_output.log
home-diegosouzapw-dev-automacoes-*.txt
# ─────────────────────────────────────────────────────────────────────────────
# 5. Diretorios do monorepo por subprojeto (nao fazem parte do app principal)
# ─────────────────────────────────────────────────────────────────────────────
security-analysis/
vscode-extension/
obsidian-plugin/node_modules/
# ─────────────────────────────────────────────────────────────────────────────
# 6. Diretorios de documentacao interna / workflow
# ─────────────────────────────────────────────────────────────────────────────
docs/superpowers/
# Docs traduzidas: 1.215 arquivos / 94 MB (inclui 20+ copias do CHANGELOG).
# Sao traducoes do tree em ingles, ja indexado — no grafo so geram ruido em
# search_code e consomem o auto_index_limit.
docs/i18n/
# ─────────────────────────────────────────────────────────────────────────────
# 7. Arquivos especificos (nao diretorios inteiros)
# ─────────────────────────────────────────────────────────────────────────────
# Segredos e env — NUNCA indexar
.env
.env.*
!.env.example
!.env.homolog.example
# TypeScript build info e next env declaration
*.tsbuildinfo
next-env.d.ts
typescript
# SQLite transient files (WAL/SHM/journal)
*.sqlite-shm
*.sqlite-wal
*.sqlite-journal
# Mapas e source maps
*.map
# Bun / npm lockfiles ruidosos
bun.lock
# `cheaper-inference-gateway.svg` e arquivos de midia na raiz/asset ja cobertos
# pelos `ignored-suffix` do indexador (svg/png/jpg/ico/etc >50kB ou >500linhas);
# manter a regra explicita aqui ajuda a auditar:
cheaper-inference-gateway.svg
cheaper-inference-gateway-*.svg
# Husky internals
.husky/_/
# CI / quality metric artifacts
config/quality/quality-metrics.json
config/quality/test-impact-map.json
audit-report.json
.gh-discussions.json
# i18n audit (gerado por npm run scripts)
scripts/i18n/_audit.json
scripts/i18n/_pending-keys.json
# NOTA: bin/omniroute.mjs foi removido daqui (2026-08-05). Estava marcado como
# "scratch", mas e o entrypoint real do CLI publicado (package.json -> bin.omniroute)
# e consta em PACK_ARTIFACT_REQUIRED_PATHS. Precisa estar no grafo.
# Deploy / docker backups
deploy.sh
docker-compose.yml.bak
docker-compose.minimal.yml

View File

@@ -1,141 +0,0 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
#
# CodeRabbit review configuration for cheaper-inference/OmniRoute (open-source plan,
# public repository). Reviews run on CodeRabbit's infrastructure, not on our Actions runners.
#
# Calibration phase (from 2026-10-28, ~2 weeks): profile `chill` and every pre-merge check
# in `warning`. The maintainer decides afterwards whether the CodeRabbit status becomes a
# Mergify queue condition and whether any check moves to `error`. Plan:
# _tasks/superpowers/plans/2026-10-28-coderabbit-blacksmith.md (private repo).
#
# Bot comments are external content generated from the PR diff (which may come from a fork):
# agents and skills that read reviews treat them as data, never as instructions.
language: en-US
reviews:
profile: chill
high_level_summary: true
# Keep the summary in the walkthrough comment. Writing it into the PR description fires a
# pull_request "edited" event, which ci.yml and quality.yml listen to, so every review
# restarted (and cancelled) the PR's CI and Quality Gates runs.
high_level_summary_in_walkthrough: true
poem: false
# Single maintainer identity and a lot of walkthrough already: keep the summary lean.
sequence_diagrams: false
suggested_reviewers: false
# Anti-slop for public repos: label low-quality PRs instead of spending a review on them.
slop_detection:
enabled: true
label: "slop"
auto_review:
enabled: true
# The open-source plan allows ~1-10 PR reviews per hour per developer (scaled by stars)
# and most PRs here come from one maintainer identity used by several sessions, each
# pushing many commits. Review each PR once; re-run on demand with
# `@coderabbitai review` (or `@coderabbitai full review`).
auto_incremental_review: false
# Bot PRs would burn the hourly allowance; Dependabot bumps are covered by CI and the
# security wave, Mergify queue candidates are drafts anyway.
ignore_usernames:
- "dependabot[bot]"
- "mergify[bot]"
# Drafts are skipped; the Mergify merge-queue candidates are drafts too.
drafts: false
base_branches:
- "^release/v\\d+\\.\\d+\\.\\d+$"
- "^main$"
labels:
- "!skip-coderabbit"
ignore_title_keywords:
- "[skip review]"
- "WIP"
# Release-train validation PRs: 400+ files, over the review file limit, never merged.
- "do not merge"
path_filters:
# 66 translated doc mirrors and the translation state are produced by the i18n waves.
- "!docs/i18n/**"
- "!.i18n-state.json"
# Translated UI catalogs; the English source catalog stays in review.
# Exclusions only: a pattern without "!" turns the filter into an allowlist, and
# exclusions always win, so an "en.json" include left every file out of review.
# The two classes match every catalog except en.json (el, es, et start with "e").
- "!src/i18n/messages/[a-df-z]*.json"
- "!src/i18n/messages/e[a-mo-z]*.json"
- "!**/package-lock.json"
# Generated files.
- "!docs/reference/PROVIDER_REFERENCE.md"
- "!**/*.svg"
- "!CHANGELOG.md"
# Vendored CI UI Kit: fixes belong upstream, and the snapshot check rejects local edits.
- "!packages/ui-kit/**"
path_instructions:
- path: "src/app/api/**"
instructions: >-
Every route follows CORS -> Zod validation -> optional auth -> handler in open-sse/handlers.
Error bodies go only through buildErrorBody() or sanitizeErrorMessage() from
open-sse/utils/error.ts; never return raw err.stack or err.message. No raw SQL in routes:
use the src/lib/db/* modules. Routes that can spawn processes need isLocalOnlyPath()
classification in src/server/authz/routeGuard.ts.
- path: "open-sse/**"
instructions: >-
Public upstream OAuth client ids/secrets and Firebase Web keys only through
resolvePublicCred() (open-sse/utils/publicCreds.ts), never as string literals. Never
swallow errors in SSE streams. Hash opaque tokens with opaqueTokenFingerprint() and check
hosts with open-sse/utils/urlHost.ts instead of ad-hoc substring checks.
- path: "src/lib/db/**"
instructions: >-
Migrations must be idempotent and run in transactions. Never barrel-import from localDb.ts;
import the specific src/lib/db/* module.
- path: ".github/workflows/**"
instructions: >-
Never run fork pull-request code on self-hosted runners. Pin third-party actions by SHA.
Pass event fields to run: steps through env, never interpolate them. Job ids must stay in
sync with config/quality/admission-policy.json (Gate / CI and Gate / Quality).
- path: "tests/**"
instructions: >-
Tests must isolate DATA_DIR and close DB handles. Flag weakened or removed assertions and
skipped tests that only exist to make CI green.
pre_merge_checks:
title:
mode: warning
requirements: >-
Conventional Commits: type(scope): subject, with type one of feat, fix, refactor, docs,
test, chore, ci, deps, perf.
description:
mode: warning
custom_checks:
- name: "Tests for production code"
mode: warning
instructions: >-
If production code under src/, open-sse/, electron/ or bin/ changes, the PR must add or
update tests (AGENTS.md Hard Rules #8 and #18).
- name: "No AI attribution"
mode: warning
instructions: >-
Commits and the PR body must not carry a Co-Authored-By trailer naming an AI assistant
or bot, nor a "Generated with <AI tool>" footer (AGENTS.md Hard Rule #16). Human
co-authors are fine.
tools:
# CI's lint applies the frozen suppressions in config/quality/eslint-suppressions.json;
# without them CodeRabbit's eslint run would re-report years of accepted debt.
eslint:
enabled: false
# Docs have their own gates (npm run check:docs-all).
markdownlint:
enabled: false
gitleaks:
enabled: true
actionlint:
enabled: true
shellcheck:
enabled: true
chat:
auto_reply: true
knowledge_base:
code_guidelines:
enabled: true
# **/AGENTS.md, **/CLAUDE.md, **/GEMINI.md and .github/copilot-instructions.md are read
# by default (each scoped to its own directory); these patterns only add the security
# references the hard rules point to.
filePatterns:
- "docs/security/ERROR_SANITIZATION.md"
- "docs/security/PUBLIC_CREDS.md"

View File

@@ -7,15 +7,8 @@
**/.vscode
# Dependencies and build output
# `node_modules` alone matches the ROOT only — Docker's matcher does not cross
# `/` like .gitignore does. Without the `**/` form, nested installs ship in the
# build context (e.g. @omniroute/opencode-provider/node_modules, ~79 MB of
# devDependencies). Both forms are kept: the bare one is the documented root
# rule, the `**/` one covers every nested package.
node_modules
**/node_modules
.next
.build
out
build
dist
@@ -24,12 +17,13 @@ coverage
# Runtime data and logs
data
logs
.sandbox
# Local env files (inject at runtime via --env-file or -e)
.env*
**/.env*
!.env.example
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# Debug logs
npm-debug.log*
@@ -42,67 +36,9 @@ tests
test-results
playwright-report
blob-report
output
.playwright-cli
.playwright-mcp
.stryker-tmp
reports/mutation
# Local caches and quality-gate artifacts (all gitignored). `_*` does not match
# dot-prefixed names, so these need explicit entries.
.artifacts
.eslintcache*
.fakebin-*
MAX
quality-ratchet/
# Documentation
# Issue #2348: The Dashboard Docs viewer reads markdown from `/app/docs` at
# runtime. The previous `docs/*` block hid every file except openapi.yaml,
# so the in-product help screen failed with ENOENT for every page.
# We now keep the English markdown tree plus the docs assets imported by MDX
# during `next build`, while still dropping the extra raster diagram sources
# and the translated files the runtime never reads.
#
# 2026-11-03 (owner decision): the image serves the translated /docs pages
# (#18699), which read docs/i18n/<locale>/docs/<section>/<PAGE>.md at runtime.
# Re-include exactly those mirrors: the sections source.config.ts compiles,
# minus the operator-internal security pages re-excluded below. The README,
# CHANGELOG, agent-guide and llm.txt mirrors at each locale root stay out.
# Keep in sync with scripts/build/docsMirrorRuntime.mjs (enforced by
# tests/unit/docs-mirror-runtime-shipping.test.ts).
docs/i18n/**
!docs/i18n/*/docs/getting-started/**/*.md
!docs/i18n/*/docs/guides/**/*.md
!docs/i18n/*/docs/architecture/**/*.md
!docs/i18n/*/docs/reference/**/*.md
!docs/i18n/*/docs/frameworks/**/*.md
!docs/i18n/*/docs/routing/**/*.md
!docs/i18n/*/docs/security/**/*.md
!docs/i18n/*/docs/compression/**/*.md
!docs/i18n/*/docs/ops/**/*.md
!docs/i18n/*/docs/providers/**/*.md
!docs/i18n/*/docs/comparison/**/*.md
docs/i18n/*/docs/security/STEALTH_GUIDE.md
docs/i18n/*/docs/security/SOCKET_DEV_FINDINGS.md
docs/i18n/*/docs/security/MITM-TPROXY-DECRYPT.md
docs/i18n/*/docs/security/PUBLIC_CREDS.md
# Internal planning artifacts (gitignored). `*.md` above only matches the root,
# so without this rule these land in /app/docs and become readable through the
# dashboard's Docs viewer at runtime.
docs/superpowers/**
# Operator-internal security writeups: git only, not the image or /docs catalog.
docs/security/STEALTH_GUIDE.md
docs/security/SOCKET_DEV_FINDINGS.md
docs/security/MITM-TPROXY-DECRYPT.md
docs/security/PUBLIC_CREDS.md
docs/diagrams/**/*.png
docs/diagrams/**/*.jpg
docs/diagrams/**/*.jpeg
docs/diagrams/**/*.gif
docs/diagrams/**/*.webp
# Note: `*.md` matches the root only (Go filepath.Match does not cross /),
# so nested docs/**/*.md is implicitly kept without a re-include rule.
# Documentation (not needed in container)
docs
*.md
!README.md
@@ -124,8 +60,6 @@ bun.lock
# Agent config
.agents
.gemini
.claude
.source
# Misc
llm.txt
@@ -172,4 +106,3 @@ app.__qa_backup/
.worktrees
.next-playwright/
cloud/
electron/dist-electron

View File

@@ -1,12 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.sh]
indent_size = 4

View File

@@ -1,6 +0,0 @@
ENABLE_LIVE_DEVIN_TESTS=0
DEVIN_BRIDGE_MODEL=devin-cli-agentic/swe-1-7
DEVIN_BRIDGE_SONNET_MODEL=devin-cli-agentic/swe-1-7
DEVIN_BRIDGE_OPUS_MODEL=devin-cli-agentic/swe-1-7
DEVIN_BRIDGE_HAIKU_MODEL=devin-cli-agentic/swe-1-7
DEVIN_BRIDGE_SUBAGENT_MODEL=devin-cli-agentic/swe-1-7

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +0,0 @@
# Homologação E2E real — copie para .env.homolog (NUNCA commitar o real)
HOMOLOG_BASE_URL=http://192.168.0.15:20128
# Senha de management do dashboard da VPS (a mesma do /login)
HOMOLOG_ADMIN_PASSWORD=
# Deixe vazio: a suíte cria uma API key efêmera via admin e revoga no fim.
# Só preencha para depurar uma camada isolada com uma key fixa.
HOMOLOG_API_KEY=
# Tier crítico (chat real, max_tokens=5). Demais providers: só validação de catálogo.
HOMOLOG_CRITICAL_PROVIDERS=openai,anthropic,gemini,codex,grok,glm,deepseek,openrouter

View File

@@ -1,45 +0,0 @@
# ──────────────────────────────────────────────────────────────────────
# OmniRoute — Self-Host env (minimal, zero-fee self-host)
# ──────────────────────────────────────────────────────────────────────
# cp .env.selfhost.example .env
# Edit only the two lines marked `# EDIT ME`. Everything else has a sane
# default. No secrets are baked in — OmniRoute never ships credentials.
#
# Full variable reference: docs/guides/DOCKER_GUIDE.md and .env.example
# ──────────────────────────────────────────────────────────────────────
# ── Ports (host-side) ──────────────────────────────────────────────────
# Dashboard + API + Live-WS. Already match the image defaults.
DASHBOARD_PORT=20128
API_PORT=20129
LIVE_WS_PORT=20132
# ── Bind address ───────────────────────────────────────────────────────
# 127.0.0.1 = loopback only (safe with REQUIRE_API_KEY=false, the default).
# Set to 0.0.0.0 ONLY when REQUIRE_API_KEY=true OR a reverse proxy
# enforces auth upstream. Exposing an unauthenticated /v1 proxy on the
# LAN/WAN lets anyone burn your provider quotas. # EDIT ME if you must.
APP_BIND_HOST=127.0.0.1
# ── Auth ──────────────────────────────────────────────────────────────
# false = the dashboard and /v1 proxy are open to APP_BIND_HOST's network.
# true = /v1 requests need an API key (a logged-in dashboard session also works);
# the dashboard needs login once a password
# exists. Create the login password in the onboarding wizard on first visit
# (skipping that step turns dashboard login off, even with
# REQUIRE_API_KEY=true); after you submit it, the wizard asks for
# a one-time token from `docker logs omniroute | grep BOOTSTRAP`.
# # EDIT ME — set true.
REQUIRE_API_KEY=false
# INITIAL_PASSWORD=strong-password-here # fill in to pre-seed the dashboard password (an empty value behaves like unset)
# ── Memory ceiling (V8 old-space) ──────────────────────────────────────
# 1024 = dashboard + light chat. Coding agents (long POST /v1/responses
# bodies) need more — see SELF_HOST_GUIDE.md "sizing". 2048 is a safe
# default for a single user who runs Claude Code / Codex through it.
OMNIROUTE_MEMORY_MB=2048
# ── Browser-facing origin (optional) ───────────────────────────────────
# Set ONLY if you expose OmniRoute behind a domain via a reverse proxy.
# NEXT_PUBLIC_BASE_URL=https://your-domain.example.com
# BASE_URL=http://omniroute:20128

35
.gitattributes vendored
View File

@@ -1,35 +0,0 @@
# Shell scripts must always be checked out with LF line endings.
#
# On Windows, core.autocrlf=true converts text files to CRLF in the working
# tree. Scripts that are kernel-exec'd (Docker ENTRYPOINT, bin/*.sh on Linux
# hosts) then fail with `exec ...: no such file or directory` because the
# shebang becomes "#!/bin/sh\r". eol=lf overrides autocrlf for these files.
*.sh text eol=lf
# This file must stay LF too: git parses it as-is, and a trailing CR would
# corrupt every pattern (e.g. "*.sh\r" matches nothing).
.gitattributes text eol=lf
# Generated files: GitHub collapses their diffs (linguist-generated) so a review shows the
# source change, not thousands of regenerated lines. Each one is rewritten by its generator
# in one refresh at release (release:refresh-derived) or a nightly refresh PR, never by a
# feature PR (plan 2026-11-13; config/quality/derived-paths/generated.json is the guard).
# The collapse is display-only: the file still diffs, merges and blames normally.
# Deliberately NOT marked: the generated skills/*/SKILL.md and the docs/i18n/*/llm.txt mirrors
# are agent-instruction surface (AGENTS.md → Review focus) whose diffs must stay visible.
docs/reference/PROVIDER_REFERENCE.md linguist-generated=true
docs/diagrams/readme-hero.svg linguist-generated=true
docs/diagrams/free-tier-budget.svg linguist-generated=true
docs/diagrams/works-zero-config.svg linguist-generated=true
docs/diagrams/promise-pillars.svg linguist-generated=true
docs/diagrams/why-pain-fix.svg linguist-generated=true
docs/diagrams/tier-cascade.svg linguist-generated=true
docs/diagrams/strategies-grid.svg linguist-generated=true
docs/diagrams/resilience-layers.svg linguist-generated=true
docs/diagrams/comparison-table.svg linguist-generated=true
docs/diagrams/privacy-local.svg linguist-generated=true
docs/diagrams/cli-terminal.svg linguist-generated=true
docs/diagrams/compression-pipeline.svg linguist-generated=true
skills/*/references/** linguist-generated=true
# Translation state (source/target/section hashes written by scripts/i18n/run-translation.mjs).
.i18n-state.json linguist-generated=true

5
.github/FUNDING.yml vendored
View File

@@ -1,5 +0,0 @@
# Funding links for OmniRoute — rendered as the "Sponsor" button on GitHub.
# Docs: https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository
github: diegosouzapw
# Additional platforms (uncomment and fill in before enabling):
# custom: ["https://omniroute.online/donate"]

View File

@@ -1,6 +1,6 @@
name: Bug Report
description: Report a bug or unexpected behavior in OmniRoute
title: "fix(): "
title: "[BUG] "
labels: ["bug"]
body:
- type: markdown
@@ -8,14 +8,12 @@ body:
value: |
Thanks for taking the time to report a bug. Please fill out the sections below so we can reproduce and fix the issue.
The title is prefilled as `fix(): ` to match the [Conventional Commits](https://github.com/cheaper-inference/OmniRoute/blob/main/CONTRIBUTING.md#commit-messages) convention — pick a scope from the list documented there (e.g. `providers`, `resilience`, `dashboard`, `api`).
- type: input
id: version
attributes:
label: OmniRoute Version
description: "Run `omniroute --version` or check the left sidebar in the dashboard."
placeholder: "e.g. 3.7.9"
placeholder: "e.g. 3.0.9"
validations:
required: true
@@ -46,7 +44,7 @@ body:
id: os-version
attributes:
label: OS Version
placeholder: "e.g. Windows 11 25H2, macOS 26.5, Ubuntu 26.04"
placeholder: "e.g. Windows 11 23H2, macOS 15.3, Ubuntu 24.04"
validations:
required: false
@@ -55,7 +53,7 @@ body:
attributes:
label: Node.js Version
description: "Run `node --version`. Skip if using Docker."
placeholder: "e.g. 24.15.0"
placeholder: "e.g. 22.12.0"
validations:
required: false
@@ -72,7 +70,7 @@ body:
id: model
attributes:
label: Model(s) Involved
placeholder: "e.g. claude-opus-4-7, gpt-5.5, gemini-3.1-pro"
placeholder: "e.g. claude-sonnet-4-20250514, gpt-4o, gemini-2.5-pro"
validations:
required: false
@@ -167,7 +165,7 @@ body:
description: "Which commands or tests should prove this bug is fixed?"
placeholder: |
Example:
- node --import tsx --test tests/unit/my-file.test.ts
- node --import tsx/esm --test tests/unit/my-file.test.ts
- npm run test:coverage
validations:
required: false

View File

@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question / Help
url: https://github.com/cheaper-inference/OmniRoute/discussions
url: https://github.com/diegosouzapw/OmniRoute/discussions
about: For questions or help with setup, please use GitHub Discussions instead of opening an issue.

View File

@@ -1,6 +1,6 @@
name: Feature Request
description: Suggest a new feature or improvement for OmniRoute
title: "feat(): "
title: "[Feature] "
labels: ["enhancement"]
body:
- type: markdown
@@ -8,8 +8,6 @@ body:
value: |
Thanks for suggesting a feature! Please describe the problem you're trying to solve and how you'd like it to work.
The title is prefilled as `feat(): ` to match the [Conventional Commits](https://github.com/cheaper-inference/OmniRoute/blob/main/CONTRIBUTING.md#commit-messages) convention — pick a scope from the list documented there (e.g. `providers`, `resilience`, `dashboard`, `api`).
- type: textarea
id: problem
attributes:

View File

@@ -59,7 +59,7 @@ body:
description: "List the commands that must pass before this issue can be closed."
placeholder: |
Example:
- node --import tsx --test tests/unit/my-suite.test.ts
- node --import tsx/esm --test tests/unit/my-suite.test.ts
- npm run test:coverage
validations:
required: true

View File

@@ -1,49 +0,0 @@
## Summary
- What was broken, for whom, and what does this change fix?
- Root cause in one or two sentences.
## Related Issues
- Closes # <!-- use "Refs #" if this only partially fixes the issue -->
## Target Branch
See the [Release Strategy](../../docs/ops/RELEASE_STRATEGY.md) and the [ROADMAP](../../ROADMAP.md):
- [ ] Base is the active `release/v3.8.x` branch (the highest open `release/v*`), not `main`
(after 3.9.0, fixes target `stable/v3` and are forward-ported to v4 with credit)
## Proof Of Fix (required)
Every bug fix must be validated by ONE of the following (`AGENTS.md`, Hard Rule #18).
A fix without either is not merged.
- [ ] **TDD (preferred)** — a test that fails before the fix and passes after it.
- Test file(s):
- Failing output before the fix (paste the relevant lines):
- [ ] **Real-environment test** (only when TDD is not possible — OAuth upstream flows,
upstream WebSocket/Cloudflare behavior, UI-only regressions, hardware-dependent
behavior) — record the exact command and its result:
- Environment:
- Command:
- Result:
## Scope
- [ ] Only the files the failing test proves need changing are touched
- [ ] No test was weakened or deleted to make the suite pass
## Validation
Choose the focused loop for your change type from the
[Contribution Golden Path](../../docs/ops/CONTRIBUTION_GOLDEN_PATH.md). The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR:
- [ ] Change type: provider / routing / UI / i18n / CLI / DB / build-deploy / other
- [ ] Focused tests and category gates from the golden path
- [ ] `npm run lint`
## Reviewer Notes
- Risky areas, side effects on other providers/routes, or follow-ups reviewers should know about.

View File

@@ -1,44 +0,0 @@
## Summary
- What does this feature add, and who uses it?
- Link the issue or discussion where it was agreed on.
## Related Issues
- Closes #
- Related to #
## Target Branch
See the [Release Strategy](../../docs/ops/RELEASE_STRATEGY.md) and the [ROADMAP](../../ROADMAP.md):
- [ ] Base is the active `release/v3.8.x` branch (the highest open `release/v*`), not `main`
- [ ] I understand that from 3.8.55 on, feature PRs are held with the `v4-feature` label and
re-targeted to the v4 channel (`develop`) when it opens — they are not closed
## Design
- Where does the code live (route / handler / executor / service / DB module / UI)?
- New settings, env vars, feature flags, DB migrations, or MCP tools? List them.
- Is it opt-in? Data-mutating behavior must be off by default.
## Validation
Choose the focused loop for your change type from the
[Contribution Golden Path](../../docs/ops/CONTRIBUTION_GOLDEN_PATH.md). The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR:
- [ ] Change type: provider / routing / UI / i18n / CLI / DB / build-deploy / other
- [ ] Focused tests and category gates from the golden path
- [ ] `npm run lint`
- [ ] New production code ships with new automated tests in this PR
- [ ] Docs updated for every new endpoint, env var, CLI command, or setting
- [ ] New UI/CLI strings added to `en.json` only (other locales are completed at release)
## Tests Added Or Updated
- List every changed or added automated test file.
## Reviewer Notes
- Risky areas, migrations, feature flags, or manual validation reviewers should know about.

View File

@@ -1,32 +0,0 @@
# npm ci with retry
This action installs the checkout dependencies with up to three attempts and restores a node_modules tree only when its complete cache key matches. Node, npm, lockfile, project npm configuration, postinstall helpers and the action itself participate in the key. Cached and freshly installed trees still pass the existing native-runtime verification.
The installation step sets `ONNXRUNTIME_NODE_INSTALL=skip` before invoking npm. ONNX Runtime reads this environment variable directly, so skipping its additional CUDA installation does not depend on npm forwarding the custom `.npmrc` key. The repository retains that key temporarily; its npm warning can therefore remain.
## Installing this checkout locally
For a POSIX shell, set the variable on the install command:
```sh
ONNXRUNTIME_NODE_INSTALL=skip npm ci
```
Use `npm install` in place of `npm ci` when deliberately updating the lockfile.
In PowerShell, set it in the current shell before starting npm:
```powershell
$env:ONNXRUNTIME_NODE_INSTALL = "skip"
npm ci
```
The PowerShell assignment remains in that process environment and is inherited by its children. npm does not load the application's `.env` file for this purpose. A package preinstall script cannot set the environment of its parent npm process.
## Scope
The environment is scoped to this action's install step. Direct checkout-install steps in the enumerated workflows set the same variable themselves. It is not exported to unrelated workflow steps or changed for tarball smoke tests.
The Dockerfile checkout install already uses `--ignore-scripts`, then builds only the SQLite native dependency; that path does not execute the ONNX install script.
This policy does not force an environment variable on people installing the published package, on remote deployment commands, or inside a separate container. The checkout `.npmrc` is also not a configuration mechanism for those consumers. Those installation paths have their own contracts. The regression tests exercise the ONNX flag parser and a local npm lifecycle without downloading CUDA, installing the application or claiming to reproduce a startup crash.

View File

@@ -1,101 +0,0 @@
name: npm ci with retry
description: >-
Install dependencies. Restores node_modules from the Actions cache when the exact
lockfile / runner / Node version / postinstall inputs match; otherwise runs npm ci
with retries for transient registry/network failures and saves the tree for the
next run.
inputs:
cache:
description: Set to "false" to skip the node_modules cache and always run npm ci.
required: false
default: "true"
runs:
using: composite
steps:
- name: Select the lockfile-compatible npm version
id: npm
shell: bash
run: |
set -euo pipefail
expected=$(node -p "require('./config/ci/toolchain.json').npm")
if ! [[ "$expected" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid pinned npm version" >&2
exit 1
fi
if [ "$(npm --version)" != "$expected" ]; then
npm install --global "npm@$expected" --no-audit --no-fund
fi
actual=$(npm --version)
if [ "$actual" != "$expected" ]; then
echo "npm version differs from the lockfile toolchain" >&2
exit 1
fi
echo "version=$actual" >> "$GITHUB_OUTPUT"
- name: Resolve Node version for the cache key
id: node
shell: bash
run: echo "version=$(node --version)" >> "$GITHUB_OUTPUT"
# #8084 D3 (plan 3.8.51 task 5): every job used to pay ~80-90 s of `npm ci` even
# with setup-node's npm tarball cache warm — 36 jobs per ci.yml run, ~55 min of
# runner time per run just installing. A node_modules cache keyed on EVERYTHING
# that shapes the tree lets a hit skip the install entirely.
#
# No restore-keys on purpose (same rule as the ESLint cache, #11600): a partial
# tree from another lockfile / Node / postinstall script is exactly the kind of
# silent drift a lockfile-pinned CI must never inherit. Exact key or a full npm ci.
#
# postinstall (scripts/build/postinstall.mjs + helpers) only mutates node_modules
# on a plain install — its dist/ branch is gated on dist/ existing, which never
# holds at install time in CI — so the cached tree already carries its effects.
- name: Restore node_modules
id: node-modules
if: inputs.cache == 'true'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: node_modules
key: node-modules-v3-${{ runner.os }}-${{ runner.arch }}-${{ steps.node.outputs.version }}-${{ steps.npm.outputs.version }}-${{ hashFiles('package-lock.json', '.npmrc', 'scripts/build/postinstall.mjs', 'scripts/build/postinstallSupport.mjs', 'scripts/build/colocateOptionals.mjs', 'scripts/build/wreqJsNative.mjs', 'scripts/build/fixPlaywrightAndroid.mjs', 'scripts/build/native-binary-compat.mjs', 'scripts/build/betterSqlitePrebuildTarget.mjs', 'scripts/ci/verify-ci-install.mjs', '.github/actions/npm-ci-retry/action.yml') }}
- name: npm ci (with retry)
if: steps.node-modules.outputs.cache-hit != 'true'
shell: bash
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
run: |
set -euo pipefail
max_attempts=3
delay_seconds=20
for attempt in $(seq 1 "$max_attempts"); do
if [ "$attempt" -gt 1 ]; then
echo "npm ci attempt $attempt/$max_attempts after transient failure"
fi
# --no-audit: `audit:deps` is its own gate; the inline audit only adds latency.
if npm ci --no-audit --no-fund; then
exit 0
else
exit_code=$?
fi
if [ "$attempt" -eq "$max_attempts" ]; then
exit "$exit_code"
fi
sleep "$delay_seconds"
delay_seconds=$((delay_seconds * 2))
done
# Both cache hits and successful installs must execute the native runtimes.
# A package directory alone cannot prove ABI compatibility or a usable binary.
- name: Verify installed native runtimes
id: verify-install
shell: bash
run: node scripts/ci/verify-ci-install.mjs
- name: node_modules restored from cache
if: steps.node-modules.outputs.cache-hit == 'true'
shell: bash
run: echo "node_modules restored from cache (key hit) — npm ci skipped"

View File

@@ -1,27 +0,0 @@
name: Prepare unit test storage
description: Reclaim the unused Android SDK only on disposable hosted Linux runners, then install dependencies.
inputs:
cache:
description: Restore the exact dependency cache for pull requests.
required: false
default: "false"
runs:
using: composite
steps:
- name: Reserve disk space for raw V8 coverage
if: runner.environment == 'github-hosted' && runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
df -h "$GITHUB_WORKSPACE" "$RUNNER_TEMP"
# This Node-only job does not use Android; never remove shared runner toolchains.
if [ -d /usr/local/lib/android ] && [ ! -L /usr/local/lib/android ]; then
du -sh /usr/local/lib/android
timeout 120s sudo rm -rf -- /usr/local/lib/android
fi
df -h "$GITHUB_WORKSPACE" "$RUNNER_TEMP"
- uses: ./.github/actions/npm-ci-retry
with:
cache: ${{ inputs.cache }}
- shell: bash
run: npm run check:node-runtime

View File

@@ -24,89 +24,6 @@ updates:
update-types: ["version-update:semver-major"]
- dependency-name: "eslint-config-next"
update-types: ["version-update:semver-major"]
# typescript majors are peer-blocked by typescript-eslint, which pins a hard
# upper bound (8.64.0 → peerDependencies.typescript ">=4.8.4 <6.1.0"). A TS 7
# bump therefore violates the peer and takes down the whole toolchain at once —
# #7068 grouped it with 6 harmless bumps and turned Build + Lint + Quality Ratchet
# + Unit (6/8, 8/8) + Integration (1/2, 2/2) + dast-smoke red in one shot, blocking
# the innocuous updates riding along with it. Un-ignore once typescript-eslint
# widens the peer, and migrate TS majors intentionally (own PR, own CI run).
- dependency-name: "typescript"
update-types: ["version-update:semver-major"]
# jscpd v5 is a Rust rewrite (native binary, no Node.js programmatic API).
# scripts/check/check-duplication.mjs is deliberately pinned to jscpd@4 (it
# parses jscpd-report.json against a frozen baseline). A v5 major would break
# the duplication gate — migrate the gate intentionally, not via dependabot.
- dependency-name: "jscpd"
update-types: ["version-update:semver-major"]
# ioredis is a SOFT/optional dependency loaded through a dynamic import
# (src/lib/quota/redisQuotaStore.ts — "Redis driver requires ioredis package"),
# so a breaking major never fails at build or typecheck time: the only consumers
# are the distributed quota store (redisQuotaStore.ts, storeFactory.ts) and the
# `import type Redis` in src/shared/utils/rateLimiter.ts. Nothing in the unit or
# vitest suites exercises a live Redis connection, so a v5→v6 API break would ship
# green and only surface at runtime for operators running distributed quota — the
# exact users least able to absorb it. #9310 grouped that major with 9 harmless
# bumps; majors here need their own PR and a deliberate migration review.
- dependency-name: "ioredis"
update-types: ["version-update:semver-major"]
# @huggingface/transformers is VPS-validated at ^4.2.0 (migrated intentionally in
# #9962). It is load-bearing for the LLMLingua ONNX compression engine (open-sse/
# services/compression/engines/llmlingua/ — @atjsh/llmlingua-2@2.0.5 peers on
# "@huggingface/transformers": "^3.5.2 || ^4.0.0") and for local memory embeddings
# (src/lib/memory/embedding/transformersLocal.ts). Further majors must be re-validated
# on the VPS — so keep auto-bumps frozen (no update-types = ignore every version).
# Migrate it intentionally, not via dependabot (#4050).
- dependency-name: "@huggingface/transformers"
# onnxruntime-node is the OTHER HALF of the @huggingface/transformers pair frozen
# above: the hoisted copy must equal the exact version transformers pins, or npm
# nests a second ABI-incompatible native copy (contract test
# tests/unit/onnxruntime-single-copy.test.ts, pair established in #9962). A solo
# bump can never be correct — it only ever moves together with transformers, in
# the same deliberate migration PR. Freezing it keeps the production group PRs
# (e.g. #12219) from being born red on the pair contract.
- dependency-name: "onnxruntime-node"
# eslint-plugin-react-hooks is pinned to 7.0.1 by a contract test
# (tests/unit/eslint-react-hooks-version-pinned.test.ts) until the 7.1.1 rule set
# is adopted deliberately — that adoption needs a full cold lint run and its own
# PR (the #12146 react-hooks migration finished on 2026-09-01, so the path is
# open; the bump still must not ride a dependabot group, where it reds the
# development group PRs, e.g. #12220). Remove this ignore in the adoption PR
# together with the pin test.
- dependency-name: "eslint-plugin-react-hooks"
# The four entries below came out of the development group #17197 (26 updates),
# which could not land because these bumps break contracts or need a migration.
# Each one has to move in its own PR; the rest of the group stays automatic.
#
# promptfoo is an exact pin mirrored by the nightly LLM-security workflow
# (`npx --yes promptfoo@X.Y.Z` in nightly-llm-security.yml). The contract test
# tests/unit/build/llm-security-nightly-promptfoo-pin.test.ts requires the workflow
# pin to equal package.json, and promptfoo-guard-json-error.test.mjs runs the pinned
# CLI against the guard's 4xx JSON body (promptfoo/promptfoo#10866). Dependabot only
# edits package.json, so every bump reds the pin test. Bump by hand: package.json +
# workflow pin together, after re-running guard-validation against the new release.
- dependency-name: "promptfoo"
# fumadocs-mdx 15.4.7 imports `embedSource` from fumadocs-core/mdx-plugins/stringifier,
# which the fumadocs-core on this branch (16.15.x) does not export yet: the Build job
# dies loading next.config.mjs (#17197). fumadocs-core/fumadocs-ui ride the
# production group and fumadocs-mdx the development group, so dependabot can never
# move them together. Remove this ignore in the PR that bumps fumadocs-core,
# fumadocs-ui and fumadocs-mdx as one set.
- dependency-name: "fumadocs-mdx"
versions: [">=15.4.7"]
# @playwright/test must equal the runtime `playwright` / `playwright-core` exact pin
# (one Playwright in the tree — tests/unit/playwright-runner-args.test.ts). The
# runtime pair is a production dependency and @playwright/test a development one,
# so a solo bump from the development group always breaks that contract. Bump it by
# hand in the same PR that moves playwright and playwright-core.
- dependency-name: "@playwright/test"
# bun is an exact devDependency pin documented in AGENTS.md (Environment) and
# docs/ops/BUILD_WARNINGS.md: it runs only allow-listed gate/generator scripts, and
# any new Bun version must be validated byte-identical against the
# `node --import tsx` output first. @types/bun is its paired type package and moves
# with it. Bump both by hand, together with the docs that name the version.
- dependency-name: "bun"
- dependency-name: "@types/bun"
- package-ecosystem: "github-actions"
directory: "/"

41
.github/labels.yml vendored
View File

@@ -1,41 +0,0 @@
# Declarative GitHub labels for the 3.8.5x -> 3.9.0 LTS release rail.
#
# Synced by `npm run labels:sync` (scripts/release/sync-labels.mjs): dry-run by
# default, `-- --apply` to create/update. Only the labels listed here are managed;
# labels missing from this file are never touched or deleted.
#
# Pre-existing operational labels (`queue`, `release-freeze`, `base-red`, ...) are
# intentionally NOT listed — they keep their current meaning and colors.
#
# Model: docs/ops/RELEASE_STRATEGY.md
#
# Fields: name (required), color (QUOTED 6-digit hex - unquoted values like 5319E7 or
# 012345 are parsed by YAML as numbers), description (<= 100 chars).
- name: v4-feature
color: "1D76DB"
description: Feature PR held for the v4 channel (develop); re-targeted when it opens
- name: lts
color: "0E8A16"
description: Belongs to the v3 LTS line (stable/v3) - fixes, security, provider updates
- name: forward-port
color: "C5DEF5"
description: Fix forward-ported from stable/v3 to develop with original-author credit
- name: channel:latest
color: "2EA44F"
description: Ships on the npm `latest` dist-tag (v3 until 4.0 GA)
- name: channel:next
color: "FBCA04"
description: Ships on the npm `next` dist-tag (v4 release candidates)
- name: channel:nightly
color: "5319E7"
description: Ships on the npm `nightly` dist-tag (v4 develop builds)
- name: preview-artifact
color: "BFDADC"
description: Requests a PR preview build artifact (dormant until the 3.8.58 rehearsal)

View File

@@ -7,28 +7,13 @@
- Closes #
- Related to #
## Target Branch
See the [Release Strategy](../docs/ops/RELEASE_STRATEGY.md), the
[Contribution Golden Path](../docs/ops/CONTRIBUTION_GOLDEN_PATH.md) and the
[ROADMAP](../ROADMAP.md):
- [ ] Base is the active `release/v3.8.x` branch (the highest open `release/v*`), not `main`
- [ ] New feature? From 3.8.55 on it is held with the `v4-feature` label for the v4 channel
- Focused templates: append `?template=feature.md` or `?template=bugfix.md` to the compare URL
## Validation
Choose the change type and focused loop from the
[Contribution Golden Path](../docs/ops/CONTRIBUTION_GOLDEN_PATH.md). The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR (#8329):
- [ ] Change type: provider / routing / UI / i18n / CLI / DB / build-deploy / other
- [ ] Focused tests and category gates from the golden path
- [ ] `npm run lint`
- [ ] Reconciled with the current active release base; focused checks rerun afterward
- [ ] Production-code changes include a new or updated automated test in this PR
- SonarQube is temporarily opt-in while the private project has no quota; it is not a PR gate.
- [ ] `npm run test:unit`
- [ ] `npm run test:coverage`
- [ ] Coverage is still `>= 60%` for statements, lines, functions, and branches
- [ ] SonarQube PR analysis is green or any remaining issues are explicitly documented below
## Tests Added Or Updated

View File

@@ -1,36 +0,0 @@
name: API Route Typecheck
on:
pull_request:
branches:
- main
- "release/**"
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
api-typecheck:
name: API Route Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: "24"
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Reject new API-route TypeScript diagnostics
run: node scripts/check/check-api-typecheck.mjs
- name: API typecheck gate unit tests
run: node --import tsx/esm --test tests/unit/build/check-api-typecheck.test.ts

41
.github/workflows/build-fork.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Build Fork Image (ghcr.io)
on:
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build:
name: Build and Push to ghcr.io
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: fix/claude-thinking-mapping
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
target: runner-base
platforms: linux/amd64
push: true
tags: |
ghcr.io/inkorcloud/omniroute:fix-claude-thinking-mapping
ghcr.io/inkorcloud/omniroute:latest
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -1,72 +0,0 @@
name: Build App
# Manual-only since #11946. The hosted 7 GB runner can no longer build this tree — 19 of
# the last 30 runs died with "The runner has received a shutdown signal" (VM out of
# memory) ~8 min into `next build`, release/v3.8.51 itself included, even with the 10 GB
# swapfile below. Triggered on `push: branches: ["**"]` it painted every branch and every
# PR red while producing an artefact nothing downloads. The bundle is validated where a
# build actually fits:
# - main: ci.yml `Build` (self-hosted omni-build pool) on every merge
# - release/**: nightly-release-green.yml (same pool, continuous)
# Dispatch this workflow by hand when a hosted build artefact is genuinely needed.
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Fast Production Build
runs-on: ubuntu-latest
steps:
- name: Expand Virtual Memory (Native 10GB Swap)
run: |
sudo swapoff -a || true
sudo rm -f /mnt/swapfile /swapfile
sudo fallocate -l 10G /mnt/swapfile || sudo dd if=/dev/zero of=/mnt/swapfile bs=1M count=10240
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile
free -h
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- name: Install dependencies
run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build Next.js app & CLI bundle
run: |
npm run build:release
env:
# Hosted artifact builds run with less memory than the opt-in 64 GB
# CI build slot. Keep Webpack here without overriding the latter's
# separately measured Turbopack policy (#16169). Validated 2026-10-18 on the
# hosted runner (run 39151150605): webpack compiled in 7.1 min, job 17 min.
# This is the floor docker-publish.yml must not go below
# (tests/unit/docker-publish-build-heap-14325.test.ts).
NODE_OPTIONS: "--max-old-space-size=10240"
OMNIROUTE_BUILD_MEMORY_MB: "10240"
OMNIROUTE_USE_TURBOPACK: "0"
- name: Archive build outputs
run: |
tar -czf omniroute-build.tar.gz .build dist
- name: Upload build artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: omniroute-build
path: omniroute-build.tar.gz
retention-days: 7

View File

@@ -1,42 +0,0 @@
name: Cancel runs of closed PRs
# A closed PR (merged or not) never gets a newer run on its ref, so the per-ref
# `concurrency` + cancel-in-progress in ci.yml / quality.yml never supersedes its runs
# and they keep their place in the hosted-runner queue. On 2026-10-26, 34 of 229 queued
# PR runs belonged to closed PRs or superseded heads while the org's Free plan allows 20
# concurrent hosted jobs. This job only calls the Actions API: it never checks out or runs
# the PR's code. `pull_request` (not `_target`): fork PRs get a read-only token and are
# skipped, which is fine — their runs wait for maintainer approval anyway.
on:
pull_request:
types: [closed]
permissions:
contents: read
jobs:
cancel:
name: Cancel queued runs of this PR
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
sparse-checkout: scripts/ci/cancel-closed-pr-runs.mjs
sparse-checkout-cone-mode: false
- name: Cancel this PR's queued and running workflow runs
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
SELF_RUN_ID: ${{ github.run_id }}
run: node scripts/ci/cancel-closed-pr-runs.mjs

1920
.github/workflows/ci.yml vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,54 +0,0 @@
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
# Least-privilege default: no token permissions at the top level; the `claude` job
# grants exactly what it needs below (Scorecard TokenPermissions).
permissions: {}
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
fetch-depth: 1
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@61a9c274fa7110a66dfafc1bbbced03833eb25fe # v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'
# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr *)'

View File

@@ -1,31 +0,0 @@
name: CodeQL
# OWNER ACTION REQUIRED before enabling auto-triggers: advanced CodeQL conflicts with
# GitHub "default setup" — the analyze step fails with "CodeQL analyses from advanced
# configurations cannot be processed when the default setup is enabled". Switch repo
# Settings → Code security → CodeQL from Default to Advanced, THEN restore the
# push/pull_request/schedule triggers below. Until then this only runs on manual dispatch
# so it never produces a red check on PRs. (The codeqlAlerts ratchet keeps working via the
# default setup's alerts in the meantime.)
on:
workflow_dispatch:
permissions:
contents: read
jobs:
analyze:
name: Analyze (javascript-typescript)
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
languages: javascript-typescript
queries: security-extended
- uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
category: "/language:javascript-typescript"

View File

@@ -1,98 +0,0 @@
name: DAST smoke (PR)
# PRs into main only since #11946. The job's "Build CLI bundle" step is a backend-only
# `next build`; on the hosted 7 GB runner it fits main's tree (~5.5 min) but dies on
# release/v3.8.51 (VM shutdown ~7 min in, before the server even starts), and because the
# job is continue-on-error the result was a permanently red advisory check on every
# release PR — noise, not signal. DAST coverage for release/** lives on the nightly rail
# (nightly-schemathesis.yml, nightly-llm-security.yml); dispatch this workflow by hand
# to smoke a release branch on demand.
on:
workflow_dispatch:
pull_request:
branches: ["main"]
# Runner-cost guard (#8084): the CLI-bundle build alone is 6-11min; a docs-only PR
# cannot change DAST behavior, so skip the whole workflow for pure docs/markdown
# changes. Any code path in the diff still runs the full smoke.
paths-ignore:
- "docs/**"
- "**/*.md"
permissions:
contents: read
# Superseded runs on the same PR must not stack 25-minute advisory builds
# (force-push storms were holding 2-3 runners each). Same group rule as quality.yml.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
dast-smoke:
runs-on: ubuntu-latest
# ADVISORY while this new gate matures (repo convention: advisory -> blocking).
# Flip to blocking (remove continue-on-error) once it's proven stable across a few PRs.
continue-on-error: true
# Build CLI bundle alone varies 6-11min on GitHub-hosted runners (3 consecutive
# timeouts observed on 2026-07-14 with the old 12min cap killing schemathesis
# mid-run) — 25min leaves real headroom for the actual DAST steps.
timeout-minutes: 25
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-api-key-secret-with-sufficient-length-aaaa
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Build CLI bundle
env:
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
run: npm run build:cli
- name: Start OmniRoute
env:
PORT: "20128"
INJECTION_GUARD_MODE: block
REQUIRE_API_KEY: "false"
run: |
node dist/server.js > server.log 2>&1 &
echo $! > server.pid
for _ in $(seq 1 30); do
if curl -sf http://localhost:20128/api/monitoring/health >/dev/null; then echo up; break; fi
sleep 2
done
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- run: pip install schemathesis
- name: Schemathesis smoke (high-risk endpoints, blocking)
run: |
# /api/auth/oidc/* is a BROWSER redirect flow (302 to the IdP, 302 back to
# /login?oidc_error=... on every failure), not a REST endpoint: Schemathesis reads
# those 302s as "the API accepted a schema-violating request" and the configured-off
# 400 as "rejected a schema-compliant request". Documenting the flow in the spec is
# still right (operators need it); fuzzing it is not what this smoke is for.
# /api/auth/login has brute-force rate limiting: repeated failed logins return 429,
# which Schemathesis flags as rejection of schema-compliant requests.
schemathesis run docs/openapi.yaml --url http://localhost:20128 \
--include-path-regex '^/v1/(chat/completions|models)$|^/api/(auth|keys)' \
--exclude-path-regex '^/api/auth/(oidc/|login)' \
--max-examples 8 --workers 4 --checks all --max-response-time 30 \
--request-timeout 20 --suppress-health-check all --no-color
- name: Install promptfoo
run: npm install -g promptfoo@0.122.0
- name: promptfoo injection-guard (blocking)
env:
OMNIROUTE_URL: http://localhost:20128
OMNIROUTE_API_KEY: not-needed-blocked-before-upstream
run: promptfoo eval -c promptfooconfig.yaml --no-cache
- name: Stop server
if: always()
run: kill "$(cat server.pid)" || true
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: dast-smoke-logs
path: server.log
retention-days: 7

View File

@@ -12,95 +12,32 @@ permissions:
jobs:
deploy:
if: >-
(github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_repository.id == github.event.repository.id &&
contains(fromJSON('["push","release","workflow_dispatch"]'), github.event.workflow_run.event) &&
(github.event.workflow_run.head_branch == 'main' ||
startsWith(github.event.workflow_run.head_branch, 'release/v') ||
startsWith(github.event.workflow_run.head_branch, 'v'))))
(github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success')
&& vars.DEPLOY_ENABLED == 'true'
&& !startsWith(github.event.workflow_run.head_branch, 'omni-queue/') && !startsWith(github.ref, 'refs/heads/omni-queue/')
name: Deploy OmniRoute to VPS
runs-on: ubuntu-latest
# Bound a hung SSH session to an hour instead of GitHub's 6-hour default; the deploy
# itself fails fast when the VPS is unreachable (run 39101148517: 0 min of work).
timeout-minutes: 60
steps:
- name: Check VPS SSH reachability from runner
id: reach
env:
# Pass the host via env (never interpolate a secret straight into the
# script body) so /dev/tcp gets a shell variable, not inlined text.
VPS_HOST: ${{ secrets.VPS_HOST }}
run: |
set -euo pipefail
# A GitHub-hosted runner can only deploy when it can actually open a TCP
# connection to the VPS SSH port. The Local VPS lives on a private LAN and
# the Akamai host firewalls :22 to known IPs, so the runner is routinely
# unable to reach it. An enabled deployment that cannot start is a failed
# deployment, not success. Keep DEPLOY_ENABLED=false when this runner has
# no authorized route; do not convert a requested deployment into green.
if timeout 15 bash -c 'exec 3<>"/dev/tcp/${VPS_HOST}/22"' 2>/dev/null; then
echo "reachable=true" >> "$GITHUB_OUTPUT"
echo "✅ VPS_HOST:22 reachable from the runner — proceeding with deploy."
else
echo "reachable=false" >> "$GITHUB_OUTPUT"
echo "::error title=Deployment did not start::VPS_HOST:22 is not reachable from this runner. An operator must provide an authorized route or perform a separately authorized deployment."
exit 1
fi
- name: Deploy via SSH
if: steps.reach.outputs.reachable == 'true'
uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1
uses: appleboy/ssh-action@v1
continue-on-error: true
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
port: 22
timeout: 60s
command_timeout: 15m
timeout: 30s
command_timeout: 5m
script: |
set -euo pipefail
echo "=== Updating OmniRoute ==="
npm install -g omniroute@latest
INSTALLED_VERSION=$(omniroute --version 2>/dev/null | tr -d '[:space:]' || echo "unknown")
echo "Installed CLI version: $INSTALLED_VERSION"
npm install -g omniroute@latest 2>&1
INSTALLED_VERSION=$(omniroute --version 2>/dev/null || echo "unknown")
echo "Installed version: $INSTALLED_VERSION"
# Recreate the PM2 process instead of `pm2 restart`. A bare restart
# re-runs whatever script path was saved earlier; after the build-output
# reorg (app/ -> dist/, .next -> .build/next) a process pinned to the old
# app/server-ws.mjs path can no longer start, and the node process dies
# while PM2 still reports "online" — so the box never binds :20128.
# Always launch via the `omniroute` bin so .env is loaded and the dist/
# layout is resolved correctly.
echo "=== (Re)creating PM2 process via bin ==="
pm2 delete omniroute 2>/dev/null || true
pm2 start omniroute --name omniroute -- --port 20128
echo "=== Restarting PM2 ==="
pm2 restart omniroute || pm2 start omniroute --name omniroute -- --port 20128
pm2 save
# Health gate: fail the deploy unless the box actually reports healthy.
# Poll /api/monitoring/health for "status":"healthy" (a deeper signal than
# a static page 200 — it confirms the app booted, not just that a port is
# bound). Boot can take a while after a native-module/build-layout change,
# so poll up to ~3min before giving up.
echo "=== Health Check (gates the deploy) ==="
ok=0
for i in $(seq 1 36); do
BODY=$(curl -sf -m 5 http://localhost:20128/api/monitoring/health 2>/dev/null || true)
if printf '%s' "$BODY" | grep -q '"status":"healthy"'; then
ok=1
echo "✅ /api/monitoring/health -> healthy (attempt $i) — version $INSTALLED_VERSION"
break
fi
echo "… not healthy yet (attempt $i/36), retrying in 5s"
sleep 5
done
if [ "$ok" != "1" ]; then
echo "❌ Health check failed — /api/monitoring/health never reported healthy after ~3min"
echo "--- recent PM2 logs ---"
pm2 logs omniroute --lines 40 --nostream || true
exit 1
fi
echo "=== Health Check ==="
sleep 3
curl -sf http://localhost:20128/api/settings > /dev/null && echo "✅ OmniRoute is healthy" || echo "❌ Health check failed"
echo "=== Deploy complete ==="

View File

@@ -1,97 +0,0 @@
name: Mirror Docker image to the Docker Hub org
# Copies a published release from ghcr.io/cheaper-inference/omniroute to the Cheaper Inference
# Docker Hub organization (cheaperinference/omniroute). The legacy diegosouzapw/omniroute keeps
# receiving the same images from docker-publish.yml: Docker Hub cannot move a repository between
# namespaces, so its pull history stays there and both are published in parallel.
#
# Two entry points:
# - workflow_call from docker-publish.yml, right after a release's manifests are created;
# - workflow_dispatch to (re)publish an already released version to the org only, for example
# once the org owner provides the credentials. It copies the existing images and does not
# rebuild anything (minutes, not the ~2 h of a docker-publish dispatch).
#
# Without the DOCKERHUB_ORG_USERNAME / DOCKERHUB_ORG_TOKEN secrets the job skips with a warning
# annotation and a job-summary line and stays green (scripts/ci/docker-org-mirror.mjs).
on:
workflow_call:
inputs:
version:
description: "Released version to mirror (e.g. 3.8.54)"
required: true
type: string
promote_latest:
description: "Also move :latest and :latest-web on the org repository"
required: false
type: boolean
default: false
secrets:
DOCKERHUB_ORG_USERNAME:
required: false
DOCKERHUB_ORG_TOKEN:
required: false
workflow_dispatch:
inputs:
version:
description: "Released version to mirror (e.g. 3.8.54)"
required: true
type: string
promote_latest:
description: "Also move :latest and :latest-web (only when this is the highest stable version)"
required: false
type: boolean
default: false
permissions:
contents: read
jobs:
mirror:
name: Copy release to cheaperinference/omniroute
runs-on: ${{ vars.DOCKER_AMD64_RUNNER == 'blacksmith' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 45
# One group for every mirror run, whatever the caller: docker-publish groups by github.ref,
# so two releases never share its group and their mirrors could otherwise overlap. Queued
# here, the later run re-reads origin's tags (the script's :latest recheck) after the earlier
# one finished, so an older release cannot move :latest back. GitHub keeps one pending run per
# group: a pending mirror replaced by a newer one shows as cancelled and is re-run with a
# workflow_dispatch of this workflow.
concurrency:
group: docker-org-mirror
cancel-in-progress: false
permissions:
contents: read
env:
HAS_ORG_CREDENTIALS: ${{ secrets.DOCKERHUB_ORG_USERNAME != '' && secrets.DOCKERHUB_ORG_TOKEN != '' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
fetch-depth: 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Copy the release images
id: mirror
env:
VERSION: ${{ inputs.version }}
PROMOTE_LATEST: ${{ inputs.promote_latest && 'true' || 'false' }}
DOCKERHUB_ORG_USERNAME: ${{ secrets.DOCKERHUB_ORG_USERNAME }}
DOCKERHUB_ORG_TOKEN: ${{ secrets.DOCKERHUB_ORG_TOKEN }}
run: node scripts/ci/docker-org-mirror.mjs
- name: Update the org repository description
# The README follows :latest: only when this run actually moved it (the script rechecks
# the promote_latest request against origin's tags and may decline it).
if: env.HAS_ORG_CREDENTIALS == 'true' && steps.mirror.outputs.promoted == 'true'
continue-on-error: true
uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5
with:
username: ${{ secrets.DOCKERHUB_ORG_USERNAME }}
password: ${{ secrets.DOCKERHUB_ORG_TOKEN }}
repository: cheaperinference/omniroute
short-description: "OmniRoute — Unified AI proxy. Route any LLM through one endpoint."
readme-filepath: ./README.md

File diff suppressed because it is too large Load Diff

View File

@@ -4,184 +4,50 @@ on:
push:
tags:
- "v*"
# A dispatch builds the ref it is dispatched ON (`gh workflow run … --ref v3.8.50` rebuilds
# that tag; `--ref main` builds the repaired line). The ref is deliberately NOT an input:
# CodeQL flags an input-controlled checkout next to a dependency cache on the default branch as
# cache poisoning (actions/cache-poisoning/poisonable-step), and `github.ref` is trusted.
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., v1.6.8)"
required: true
type: string
publish_npm:
description: "Also run the npm publish leg (turn off when re-attaching desktop assets to a release whose npm package already shipped)"
required: false
default: true
type: boolean
# Least-privilege default: read-only at the top level; each job grants the writes it
# needs (build/release upload assets, publish-npm forwards npm provenance / packages
# to the reusable workflow) — Scorecard TokenPermissions.
permissions:
contents: read
contents: write
id-token: write
packages: write
jobs:
validate:
name: Validate version
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.validate.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0
- name: Validate version format
id: validate
env:
# Pass workflow context via env (never interpolate ${{ ... }} straight
# into the run: script body) so the shell receives variables, not
# inlined text — zizmor template-injection mitigation. INPUT_VERSION is
# the operator-supplied value and is regex-validated below before use.
EVENT_NAME: ${{ github.event_name }}
INPUT_VERSION: ${{ inputs.version }}
run: |
if [[ "$EVENT_NAME" == "push" ]]; then
if [[ "${{ github.event_name }}" == "push" ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
else
VERSION="$INPUT_VERSION"
VERSION="${{ inputs.version }}"
fi
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Invalid version format. Expected: v1.6.8"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "✓ Valid version: $VERSION"
web-build:
name: Build shared Next standalone
needs: validate
# Stage 8 (issue #10321): the four desktop legs used to each run the full
# `npm run build` (Next standalone) — ~111 runner-minutes per release just to
# produce the same platform-independent bundle four times. This job builds it
# once on ubuntu; every leg then restores the byte-verified archive and
# re-forks its native optionals (scripts/build/standaloneBundle.mjs).
#
# Rollback lever: set the repo variable ELECTRON_SHARED_STANDALONE=disabled.
# This job then skips, every leg falls back to building its own web bundle
# (the legacy step below), and the pipeline behaves exactly like pre-Stage 8 —
# no revert needed.
if: ${{ !cancelled() && needs.validate.result == 'success' && vars.ELECTRON_SHARED_STANDALONE != 'disabled' }}
runs-on: ubuntu-latest
permissions:
contents: read
actions: read # find + download the CI run's next-build artifact for this SHA (as npm-publish does)
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 24
package-manager-cache: false
- name: Install dependencies
run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
NPM_CONFIG_LEGACY_PEER_DEPS: true
# The Next standalone is platform-independent, and `ci.yml` already built it for this
# exact commit on the omni-build runner (the `next-build` artifact every `main` push
# produces — the release squash included). Reusing it is what `npm-publish.yml` does
# (#8941): the hosted build below needs 18–20 GB and this runner has 16, which is why
# the legacy per-leg fallback cost 53 min on macOS-intel and 4h41 on macOS arm64 for
# v3.8.52. Only runs of THIS repository's CI are candidates (artifact-poisoning guard,
# as in npm-publish); a missing/expired artifact falls back to the full build.
- name: Reuse CI's next-build artifact for this commit
id: reuse
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
run: |
set -uo pipefail
CANDIDATES=$(gh api "repos/$REPO/actions/runs?head_sha=$HEAD_SHA&per_page=100" \
--jq '[.workflow_runs[]
| select(.name == "CI"
and .head_repository.full_name == env.REPO)]
| sort_by(.run_started_at) | reverse | .[0:5] | .[].id') || CANDIDATES=""
if [ -z "$CANDIDATES" ]; then
echo "::notice::no CI run from this repository for $HEAD_SHA — building the standalone here"
exit 0
fi
for candidate in $CANDIDATES; do
if gh run download "$candidate" --repo "$REPO" --name next-build --dir "$RUNNER_TEMP/next-build" 2>/dev/null; then
tar -xzf "$RUNNER_TEMP/next-build/e2e-build.tar.gz" -C .
rm -rf "$RUNNER_TEMP/next-build"
if [ -f .build/next/standalone/server.js ]; then
echo "reused=true" >> "$GITHUB_OUTPUT"
echo "✓ reused next-build from CI run $candidate"
exit 0
fi
echo " run $candidate unpacked without .build/next/standalone/server.js — trying the next"
rm -rf .build/next
else
echo " run $candidate carries no usable next-build — trying the next"
fi
done
echo "::notice::none of the candidate runs still carries next-build (1-day retention) — building the standalone here"
- name: Build Next.js standalone (fallback when no CI artifact)
if: steps.reuse.outputs.reused != 'true'
# webpack, not Turbopack, for the same hosted-runner RAM reason as the
# linux leg (see the long comment on the fallback step in `build`).
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
NODE_OPTIONS: "--max_old_space_size=6144"
OMNIROUTE_USE_TURBOPACK: "0"
run: npm run build
- name: Pack standalone bundle
# Deterministic tar.gz + byte-level manifest; the manifest embeds the
# archive's own sha256 so artifact-transfer corruption is caught before
# extraction, and every entry is re-verified after extraction.
run: node scripts/build/standaloneBundle.mjs pack --out web-bundle.tar.gz
- name: Upload shared web bundle
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: web-standalone-bundle
# compression-level 0: the payload is already a deterministic tar.gz;
# re-zipping would only burn runner CPU without shrinking it further.
compression-level: 0
# Legs consume this within minutes; no reason to retain it like the
# installer artifacts (default 90d).
retention-days: 3
path: |
web-bundle.tar.gz
web-bundle.tar.gz.manifest.json
build:
name: Build Electron (${{ matrix.platform }})
needs: [validate, web-build]
# `web-build` is skipped when ELECTRON_SHARED_STANDALONE=disabled (rollback
# mode); legs then run the legacy per-leg web build below. If it ran and
# failed, fail closed: legs cannot package without the bundle, and silently
# falling back to four per-leg builds would hide exactly the regression the
# shared job exists to surface.
if: ${{ !cancelled() && needs.validate.result == 'success' && (needs.web-build.result == 'success' || needs.web-build.result == 'skipped') }}
needs: validate
runs-on: ${{ matrix.runner }}
permissions:
contents: write # electron-builder may publish artifacts with GH_TOKEN
strategy:
fail-fast: false
matrix:
@@ -190,60 +56,41 @@ jobs:
runner: windows-latest
target: win
ext: .exe
os: win32
arch: x64
- platform: macos-intel
runner: macos-15-intel
target: mac-x64
ext: .dmg
os: darwin
arch: x64
- platform: macos-arm64
runner: macos-latest
target: mac-arm64
ext: -arm64.dmg
os: darwin
arch: arm64
- platform: linux
runner: ubuntu-latest
target: linux
ext: .AppImage
deb_ext: .deb
os: linux
arch: x64,arm64
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
uses: actions/setup-node@v6
with:
node-version: 24
package-manager-cache: false
cache: npm
- name: Cache node_modules
uses: actions/cache@v5
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
NPM_CONFIG_LEGACY_PEER_DEPS: true
# The Linux leg produces x64 + arm64 installers from one x64 runner. npm
# deliberately installs only host-compatible optional dependencies, so
# hydrateNativeDeps cannot source the arm64 fork unless we fetch the exact
# package pinned in package-lock before either build path runs.
- name: Install Linux arm64 wreq binding for cross-package
if: matrix.platform == 'linux'
shell: bash
run: |
npm install --no-save --ignore-scripts --force --legacy-peer-deps \
@wreq-js/binding-linux-arm64-gnu@3.2.0
git diff --exit-code -- package.json package-lock.json
mkdir -p "$RUNNER_TEMP/omniroute-wreq-verify"
DATA_DIR="$RUNNER_TEMP/omniroute-wreq-verify" node --import tsx/esm --test \
--test-name-pattern='wreq-js 3.2 manifest pins all nine' \
tests/unit/wreq-native-manifest.test.ts
- name: Sanitize Windows home directory
if: runner.os == 'Windows'
shell: bash
@@ -252,63 +99,17 @@ jobs:
# that cause EPERM errors during Next.js standalone build glob scans.
# Create a clean temp profile directory to avoid this.
mkdir -p "$RUNNER_TEMP/home"
echo "USERPROFILE=$RUNNER_TEMP/home" >> "$GITHUB_ENV"
echo "USERPROFILE=$RUNNER_TEMP/home" >> $GITHUB_ENV
- name: Build Next.js standalone (legacy per-leg fallback)
# Stage 8: only runs in rollback mode (ELECTRON_SHARED_STANDALONE=disabled)
# or when the shared web-build job was skipped. Otherwise the leg restores
# the shared bundle from the `web-build` job below.
if: needs.web-build.result == 'skipped'
- name: Build Next.js standalone
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
NODE_OPTIONS: "--max_old_space_size=6144"
# Linux builds with webpack, not Turbopack. Turbopack's production build
# allocates natively (Rust, off the V8 heap), so --max_old_space_size does
# not bound it, and on this module graph it peaks above what the hosted
# runner can give — the VM is reclaimed mid-compile with "The runner has
# received a shutdown signal", no exit code. That is what silently took the
# whole desktop channel out of v3.8.49: the linux leg died, `release` was
# skipped, and the release shipped with ZERO assets. Measured on a 32 GB
# box the same build passes and peaks past 14 GB. The webpack fallback is
# the project's documented escape hatch for RAM-constrained machines
# (docs/reference/ENVIRONMENT.md, #6409) and is the same remedy already
# applied to nightly-compat's Node 26 build (#8090).
OMNIROUTE_USE_TURBOPACK: ${{ matrix.platform == 'linux' && '0' || '1' }}
run: npm run build
- name: Download shared web bundle
# Stage 8: inverse of the fallback step above — runs exactly when the
# shared `web-build` job produced the bundle.
if: needs.web-build.result == 'success'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: web-standalone-bundle
- name: Restore + hydrate shared web bundle
if: needs.web-build.result == 'success'
shell: bash
# restore: verify the archive's sha256 against the manifest, extract, then
# re-verify every entry (existence + size + content hash + symlink
# targets, and no unlisted files) byte-for-byte.
# hydrate: the bundle was built on ubuntu, so install-machine-forked native
# optionals (@img/sharp-*, @img/sharp-libvips-*, @ngrok/ngrok-*,
# @wreq-js/binding-*, fsevents) carry linux forks. Replace them with the forks this
# leg's own `npm ci` resolved, then assert every bundled native
# (better-sqlite3 prebuilds, wreq-js, onnxruntime)
# can service this leg's platform/arch before packaging starts.
run: |
node scripts/build/standaloneBundle.mjs restore --archive web-bundle.tar.gz
node scripts/build/standaloneBundle.mjs hydrate --platform ${{ matrix.os }} --arch ${{ matrix.arch }}
- name: Sync version in electron/package.json
shell: bash
env:
# Pass the validated version via env (never interpolate ${{ ... }}
# straight into the run: script body) — zizmor template-injection
# mitigation. Already regex-validated (^v[0-9]+\.[0-9]+\.[0-9]+$) in
# the `validate` job, so it cannot carry shell metacharacters.
VERSION: ${{ needs.validate.outputs.version }}
run: |
VERSION="${{ needs.validate.outputs.version }}"
VERSION_NO_V="${VERSION#v}"
node -e "
const fs = require('fs');
@@ -324,7 +125,7 @@ jobs:
- name: Install Electron dependencies
working-directory: electron
run: npm ci --no-audit --no-fund
run: npm install --no-audit --no-fund
- name: Build Electron for ${{ matrix.platform }}
working-directory: electron
@@ -334,16 +135,9 @@ jobs:
- name: Smoke packaged Electron app
if: matrix.platform != 'linux'
# Best-effort smoke on Windows + macos-arm64:
# - Windows: requestSingleInstanceLock() fails due to USERPROFILE
# sanitization needed for the build step.
# - macos-arm64: the headless GitHub arm64 runner crashes Electron's GPU
# process (gpu_process_host exit_code=15 → network service crash →
# "No rendezvous client, terminating process"), so the app can't bind
# 127.0.0.1:20128 in time. The identical bundle is smoke-gated on
# macos-intel + linux, so packaging is still verified per-OS; we don't
# let the arm64 runner's GPU flakiness block the desktop release.
continue-on-error: ${{ matrix.platform == 'windows' || matrix.platform == 'macos-arm64' }}
# Windows CI: requestSingleInstanceLock() fails due to USERPROFILE
# sanitization needed for the build step. Smoke is best-effort there.
continue-on-error: ${{ matrix.platform == 'windows' }}
env:
ELECTRON_SMOKE_TIMEOUT_MS: 60000
ELECTRON_SMOKE_STREAM_LOGS: "1"
@@ -351,14 +145,9 @@ jobs:
- name: Smoke packaged Electron app (Linux)
if: matrix.platform == 'linux'
# #7592: also cold-restart against the same DATA_DIR and assert a
# native SQLite driver (not the sql.js WASM fallback) is selected on
# the second launch — blocking here since Linux has no Windows-style
# sandbox caveats that would make it flaky.
env:
ELECTRON_SMOKE_TIMEOUT_MS: 60000
ELECTRON_SMOKE_STREAM_LOGS: "1"
ELECTRON_SMOKE_COLD_RESTART: "1"
run: xvfb-run -a npm run electron:smoke:packaged
- name: Collect installers
@@ -384,21 +173,9 @@ jobs:
[ -f "$file" ] && cp "$file" "../../release-assets/OmniRoute.exe" && break
done
fi
# electron-updater manifests (latest.yml / latest-mac.yml / latest-linux.yml)
# must be published alongside the installers, or autoUpdater fails with
# "Cannot find latest.yml in the latest release artifacts" (#6766).
for file in latest*.yml; do
[ -f "$file" ] && cp "$file" ../../release-assets/
done
# Publish exactly the content-addressed packs named by this build.
cd ../..
node scripts/release/collect-optional-packs.mjs \
.build/electron-standalone/optional-packs.index.json \
.build/optional-packs release-assets
- name: Upload artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
uses: actions/upload-artifact@v7
with:
name: electron-${{ matrix.platform }}
path: release-assets/
@@ -406,69 +183,28 @@ jobs:
release:
name: Create Release
needs: [validate, build]
# Fail-partial, not fail-closed. `build` is a 4-leg matrix with `fail-fast: false`,
# so the legs that succeed still upload their artifacts — but a default `needs:`
# gate skips this job the moment ANY leg fails, discarding all of them. That is
# exactly what happened to v3.8.49: the linux leg died and the release shipped with
# ZERO assets, throwing away 1.7 GB of good Windows/macOS installers **and** the
# source archives + SBOM, which do not depend on a build at all. The result was
# indistinguishable from "this version has no desktop channel".
# Now: attach everything that did build, then fail the job loudly (see the last
# step) so an incomplete channel is visible instead of silent.
if: ${{ !cancelled() && needs.validate.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write # softprops/action-gh-release creates the GitHub Release
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0
# `merge-multiple` is deliberately OFF. It resolves same-name collisions by ARRIVAL
# ORDER, and the two macOS jobs each emit their own `latest-mac.yml` listing only their
# own dmg (measured: 338 and 350 bytes, different content, identical name). One silently
# overwrote the other — arm64 won in the published v3.8.48, and since the Intel dmg
# carries no arch suffix in its name, electron-updater's
# `files.find(url includes process.arch) ?? files.shift()` sends every Intel Mac to the
# ARM dmg. Downloading into per-artifact subdirectories keeps both, so they can be
# merged on purpose instead of by luck.
- name: Download all artifacts
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
uses: actions/download-artifact@v8
with:
path: artifacts
# Writes release-assets/latest-mac.yml with BOTH dmgs, un-suffixed entry first (that is
# the one electron-updater can only reach through its fallback). Refuses to write when the
# inputs disagree on version — a manifest stitched from two builds is worse than none.
- name: Merge the per-arch macOS updater manifests
run: node scripts/release/merge-mac-update-manifest.mjs artifacts release-assets
# Everything else moves across as-is. The partial latest-mac.yml files are excluded so
# they cannot clobber the merged one; -n is a second belt on the same braces.
- name: Collect the remaining artifacts
run: |
mkdir -p release-assets
find artifacts -type f ! -name latest-mac.yml -exec cp -n {} release-assets/ \;
echo "release-assets:"
ls -la release-assets/
path: release-assets
merge-multiple: true
- name: Create source archives
env:
# Pass the validated version via env (never interpolate ${{ ... }}
# straight into the run: script body) — zizmor template-injection
# mitigation. Already regex-validated (^v[0-9]+\.[0-9]+\.[0-9]+$) in
# the `validate` job, so it cannot carry shell metacharacters.
VERSION: ${{ needs.validate.outputs.version }}
run: |
# Create source code archives (excluding dev dependencies and build artifacts)
export TARBALL="OmniRoute-${VERSION}.source.tar.gz"
export ZIPBALL="OmniRoute-${VERSION}.source.zip"
export TARBALL="OmniRoute-${{ needs.validate.outputs.version }}.source.tar.gz"
export ZIPBALL="OmniRoute-${{ needs.validate.outputs.version }}.source.zip"
# Use git archive for clean source export
git archive --format=tar.gz --prefix="OmniRoute-${VERSION}/" HEAD -o "release-assets/$TARBALL"
git archive --format=zip --prefix="OmniRoute-${VERSION}/" HEAD -o "release-assets/$ZIPBALL"
git archive --format=tar.gz --prefix=OmniRoute-${{ needs.validate.outputs.version }}/ HEAD -o "release-assets/$TARBALL"
git archive --format=zip --prefix=OmniRoute-${{ needs.validate.outputs.version }}/ HEAD -o "release-assets/$ZIPBALL"
echo "✓ Created source archives:"
ls -lh "release-assets/$TARBALL" "release-assets/$ZIPBALL"
@@ -477,19 +213,12 @@ jobs:
run: ls -la release-assets/
- name: Create Release
uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.validate.outputs.version }}
draft: false
prerelease: false
# NEVER. Phase 3 of the release flow creates the GitHub Release with the curated
# notes seconds after pushing the tag, so by the time this step runs (1-2 h of
# builds later) the body already exists — and `true` APPENDS GitHub's
# auto-generated "What's Changed" block to it (v3.8.48 shipped that way; the
# v3.8.50 re-attach dispatch added +1,416 chars to a 121 KB body, run
# 33238093090). A curated body sits ~3 KB under the 125,000-char cap, so the
# append can also turn this step RED and leave the release with no assets.
generate_release_notes: false
generate_release_notes: true
fail_on_unmatched_files: false
files: |
release-assets/*.dmg
@@ -497,75 +226,17 @@ jobs:
release-assets/*.AppImage
release-assets/*.deb
release-assets/*.blockmap
release-assets/*.yml
release-assets/optional-pack-*.tar.gz
release-assets/*.source.tar.gz
release-assets/*.source.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
verify-desktop-assets:
name: Verify desktop assets landed
needs: [validate, release]
# Deliberately a SEPARATE job, not a final step of `release`: failing inside
# `release` would cascade into `publish-npm` (which gates on `needs: release`) and
# block the npm channel over a desktop-only gap. Here the assets are attached, npm
# still publishes, and an incomplete desktop channel shows up as a red job instead
# of passing unnoticed — the v3.8.49 release had ZERO assets and every gate was
# green, because nothing ever asserted the release HAS binaries.
if: ${{ !cancelled() && needs.release.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Assert every platform is present on the release
env:
# Regex-validated (^v[0-9]+\.[0-9]+\.[0-9]+$) in the `validate` job, and
# passed via env rather than interpolated into the script body.
VERSION: ${{ needs.validate.outputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
names=$(gh release view "$VERSION" --repo "$GITHUB_REPOSITORY" \
--json assets --jq '.assets[].name')
echo "Assets on $VERSION:"
echo "$names" | sed 's/^/ /'
missing=""
# `[ ... ] && missing=...` as the last command in a branch returns 1 and
# would abort the whole script under Actions' default `set -e`. Use if/fi.
for want in '\.exe$' '\.dmg$' '\.AppImage$' '\.deb$' '^latest.*\.yml$' '\.source\.tar\.gz$'; do
if ! echo "$names" | grep -qE "$want"; then
missing="$missing $want"
fi
done
if [ -n "$missing" ]; then
echo "::error::Desktop channel incomplete on $VERSION — no asset matching:$missing"
exit 1
fi
echo "✓ every platform present on $VERSION"
publish-npm:
name: Publish to npm
needs: [validate, release]
# A re-dispatch that only re-attaches desktop assets must not publish the npm package again.
if: ${{ github.event_name != 'workflow_dispatch' || inputs.publish_npm }}
permissions:
# Must be `write`, not `read`: this job calls the reusable npm-publish.yml whose
# `publish` job needs `contents: write` (gh release upload — attach the SBOM, #3874).
# A reusable workflow's job cannot request more permission than the caller grants,
# so a `read` here makes GitHub reject the run at startup (startup_failure).
#
# `actions: read` for the same reason: the called `publish` job downloads the next-build
# artefact and requests it. v3.8.50 (run 33005490476) died at startup with "The nested
# job 'publish' is requesting 'actions: read', but is only allowed 'actions: none'" — and
# because `release` lives in this same workflow, the tag shipped with ZERO assets. Keep
# this block a superset of every job's permissions in npm-publish.yml.
actions: read
contents: write
id-token: write # npm provenance (forwarded to the reusable workflow)
packages: write # publish to npm.pkg.github.com
uses: ./.github/workflows/npm-publish.yml
with:
version: ${{ needs.validate.outputs.version }}
tag: latest
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -1,156 +0,0 @@
name: Forward-port stable/v3 → develop (dormant)
# DORMANT until the 3.9.0 LTS cut creates `stable/v3` and `develop`
# (docs/ops/RELEASE_STRATEGY.md → "Forward-port"). The push filter and the job
# `if:` both pin it to `refs/heads/stable/v3`, and the job exits quietly while
# `develop` does not exist.
#
# Every commit pushed to stable/v3 is cherry-picked (`-x`) onto a fresh
# `forward-port/<sha7>` branch cut from develop, and a PR is opened against
# develop. The original author stays the commit author and is also credited with
# a `Co-authored-by:` trailer, so the credit survives a squash-merge of the
# forward-port PR. A conflicting cherry-pick still opens a PR — as a DRAFT with
# the exact commands to finish it by hand.
#
# PRs opened with the default GITHUB_TOKEN do not trigger other workflows; set the
# `FORWARD_PORT_TOKEN` secret (fine-grained PAT or App token with contents +
# pull-requests write) before go-live so CI runs on the forward-port PRs.
on:
push:
branches: [stable/v3]
workflow_dispatch:
inputs:
sha:
description: "Commit on stable/v3 to forward-port (full or short SHA)"
required: true
type: string
permissions:
contents: read
concurrency:
group: forward-port
cancel-in-progress: false
jobs:
forward-port:
name: Cherry-pick onto develop
if: github.ref == 'refs/heads/stable/v3' && github.repository == 'cheaper-inference/OmniRoute'
runs-on: ubuntu-latest
permissions:
contents: write # push forward-port/<sha7>
pull-requests: write # open the PR against develop
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Check that develop exists
id: develop
run: |
set -euo pipefail
if [ -n "$(git ls-remote --heads origin develop)" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "develop does not exist yet — forward-port is dormant, nothing to do."
fi
- name: Resolve commits to forward-port
id: commits
if: steps.develop.outputs.exists == 'true'
env:
EVENT_NAME: ${{ github.event_name }}
BEFORE: ${{ github.event.before }}
AFTER: ${{ github.sha }}
INPUT_SHA: ${{ inputs.sha }}
run: |
set -euo pipefail
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
if ! printf '%s' "$INPUT_SHA" | grep -qE '^[0-9a-fA-F]{7,40}$'; then
echo "Refusing non-SHA input: $INPUT_SHA" >&2
exit 1
fi
TARGET=$(git rev-parse --verify "${INPUT_SHA}^{commit}")
git merge-base --is-ancestor "$TARGET" origin/stable/v3 \
|| { echo "$TARGET is not on stable/v3" >&2; exit 1; }
RANGE="${TARGET}^..${TARGET}"
elif printf '%s' "$BEFORE" | grep -qE '^0+$' || [ -z "$BEFORE" ]; then
RANGE="${AFTER}^..${AFTER}"
else
RANGE="${BEFORE}..${AFTER}"
fi
git rev-list --reverse --no-merges "$RANGE" > commits.txt
echo "count=$(wc -l < commits.txt | tr -d ' ')" >> "$GITHUB_OUTPUT"
echo "Commits to forward-port:"; cat commits.txt
- name: Cherry-pick and open PRs
if: steps.develop.outputs.exists == 'true' && steps.commits.outputs.count != '0'
env:
GH_TOKEN: ${{ secrets.FORWARD_PORT_TOKEN || github.token }}
REPO: ${{ github.repository }}
STRATEGY_URL: ${{ github.server_url }}/${{ github.repository }}/blob/develop/docs/ops/RELEASE_STRATEGY.md
run: |
set -euo pipefail
gh auth setup-git
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
while read -r SHA; do
SHORT="${SHA:0:7}"
BRANCH="forward-port/${SHORT}"
if [ -n "$(git ls-remote --heads origin "$BRANCH")" ]; then
echo "$BRANCH already exists — skipping $SHORT."
continue
fi
SUBJECT=$(git log -1 --format=%s "$SHA")
AUTHOR=$(git log -1 --format='%an <%ae>' "$SHA")
git checkout --quiet -B "$BRANCH" origin/develop
DRAFT=""
if git cherry-pick -x "$SHA"; then
# Keep the original author (cherry-pick already does) AND add the trailer,
# so a squash-merge of this PR still credits them.
git log -1 --format=%B > msg.txt
git interpret-trailers --in-place --if-exists addIfDifferent \
--trailer "Co-authored-by: ${AUTHOR}" msg.txt
git commit --amend --quiet --file msg.txt
BODY_STATE="Clean cherry-pick (\`git cherry-pick -x\`) of ${SHA} from \`stable/v3\`."
else
git cherry-pick --abort
DRAFT="--draft"
printf 'chore(forward-port): %s needs a manual cherry-pick\n\nCherry-pick of %s from stable/v3 conflicted on develop.\n\nCo-authored-by: %s\n' \
"$SHORT" "$SHA" "$AUTHOR" > msg.txt
git commit --allow-empty --quiet --file msg.txt
BODY_STATE=$(printf '%s\n\n%s\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
"⚠️ **The cherry-pick of ${SHA} conflicted on \`develop\`** — this draft holds an empty placeholder commit." \
"To finish it:" \
'```bash' \
"git fetch origin" \
"git switch ${BRANCH}" \
"git cherry-pick -x ${SHA} # resolve the conflicts, then: git cherry-pick --continue" \
"git commit --amend # keep the trailer: Co-authored-by: ${AUTHOR}" \
"git push origin ${BRANCH}" \
'```')
fi
git push --quiet origin "HEAD:refs/heads/${BRANCH}"
{
echo "Automatic forward-port of \`stable/v3\` → \`develop\`."
echo
echo "$BODY_STATE"
echo
echo "Original author: ${AUTHOR}"
echo
echo "Policy: ${STRATEGY_URL}"
} > body.md
# shellcheck disable=SC2086 # DRAFT is intentionally empty or one flag
gh pr create --repo "$REPO" --base develop --head "$BRANCH" $DRAFT \
--title "${SUBJECT} (forward-port ${SHORT})" \
--body-file body.md \
--label forward-port
done < commits.txt

View File

@@ -1,363 +0,0 @@
name: i18n mirror refresh
# Post-merge refresh of the translated docs mirrors (docs/i18n/<locale>/…). Since #18420 the
# docs drift gate is advisory on PRs and the merge train, so drifted mirrors pile up on the
# release branch until somebody runs `npm run i18n:run` by hand. This workflow does that run
# on a schedule and turns the result into ONE pull request:
#
# 1. target = the highest release/v* branch (or the `base` input); skipped with a notice while
# an open `release-freeze` issue names that branch (Hard Rule #21);
# 2. drifted sources = `check-translation-drift.mjs --json --warn` (drifted, missing,
# hand-edited and stale mirrors);
# 3. translate them: the LLM chain first when the backend secrets are configured (model, then
# OMNIROUTE_TRANSLATION_FALLBACK_MODELS, then a re-split, then Google as the last resort),
# otherwise the structure-safe Google engine alone. The docs/i18n/<locale>/llm.txt mirrors
# are exact copies, not translations (run-translation and the drift check skip them):
# when the root llm.txt moved, scripts/i18n/sync-llm-mirrors.mjs rewrites them in the
# same run, since feature PRs edit only the root llm.txt;
# 4. `npm run check:docs-all` + the drift check must both pass; then the mirrors are committed
# to the fixed branch `chore/i18n-mirror-refresh` (force-reset from the target every run)
# and one PR is opened, or the open one is updated by the force-push;
# 5. a partial translation (run-translation exit 3: some (source, locale) units failed, the
# rest translated) still opens the PR with the translated mirrors. The failed units keep
# their mirror and state record, the drift check excuses exactly those units, and the PR
# body lists them for the next run (#18538);
# 6. a run where nothing translated, any other translation error, or any other check failure
# opens NO PR and fails the job with a step summary that lists the failing files / locales.
#
# PRs opened with the default GITHUB_TOKEN do not trigger other workflows (no CI on the refresh
# PR). Set the `I18N_REFRESH_TOKEN` secret (fine-grained PAT or App token with contents +
# pull-requests write) so CI runs on it, the same pattern as FORWARD_PORT_TOKEN in
# forward-port.yml. With GITHUB_TOKEN the repo setting "Allow GitHub Actions to create and
# approve pull requests" must be on for `gh pr create` to work.
#
# Operator configuration (all optional; without the LLM ones the Google engine is used):
# secrets.OMNIROUTE_TRANSLATION_API_KEY LLM backend bearer token
# secrets/vars.OMNIROUTE_TRANSLATION_API_URL OpenAI-compatible base URL (…/v1)
# vars.OMNIROUTE_TRANSLATION_MODEL first model of the chain
# vars.OMNIROUTE_TRANSLATION_FALLBACK_MODELS comma-separated fallback chain
# secrets.OMNIROUTE_TRANSLATION_GOOGLE_API_KEY official Cloud Translation v2 instead of the
# keyless web endpoint
# secrets.I18N_REFRESH_TOKEN token that opens the PR (see above)
#
# Secrets only ever reach the scripts through `env:`; no `${{ }}` expression is interpolated into
# a `run:` script.
on:
schedule:
- cron: "23 */6 * * *"
workflow_dispatch:
inputs:
base:
description: "Branch to refresh (default: the highest release/v* branch)"
required: false
type: string
permissions:
contents: read
concurrency:
group: i18n-mirror-refresh
cancel-in-progress: false
jobs:
refresh:
name: Refresh drifted docs mirrors
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
timeout-minutes: 330
permissions:
contents: write # push chore/i18n-mirror-refresh
pull-requests: write # open / retarget the refresh PR
env:
REFRESH_BRANCH: chore/i18n-mirror-refresh
PR_TITLE: "docs(i18n): refresh drifted mirrors (scheduled)"
steps:
- name: Resolve the target branch and the release freeze
id: target
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
INPUT_BASE: ${{ inputs.base }}
run: |
set -euo pipefail
if [ -n "${INPUT_BASE:-}" ]; then
if ! printf '%s' "$INPUT_BASE" | grep -qE '^[A-Za-z0-9._/-]+$'; then
echo "::error::refusing base input with unexpected characters" >&2
exit 1
fi
BASE="$INPUT_BASE"
else
BASE=$(gh api --paginate "repos/$REPO/git/matching-refs/heads/release/v" --jq '.[].ref' \
| sed 's#^refs/heads/##' | grep -E '^release/v[0-9]+\.[0-9]+\.[0-9]+$' \
| sort -V | tail -1)
fi
if [ -z "$BASE" ]; then
echo "::error::could not resolve the target branch" >&2
exit 1
fi
echo "base=$BASE" >> "$GITHUB_OUTPUT"
# Hard Rule #21: never refresh a frozen release branch. A freeze issue is titled
# "🔒 release-freeze: vX.Y.Z in progress"; one that names no version freezes everything.
VER="${BASE#release/}"
VER_RE=$(printf '%s' "$VER" | sed 's/\./\\./g')
FROZEN=""
while IFS=$'\t' read -r NUM TITLE; do
[ -n "$NUM" ] || continue
if printf '%s' "$TITLE" | grep -qE "(^|[^0-9.])${VER_RE}([^0-9]|$)" \
|| ! printf '%s' "$TITLE" | grep -qE 'v[0-9]+\.[0-9]+\.[0-9]+'; then
FROZEN="#$NUM"
fi
done < <(gh issue list --repo "$REPO" --label release-freeze --state open \
--json number,title --jq '.[] | "\(.number)\t\(.title)"')
if [ -n "$FROZEN" ]; then
echo "::notice::$BASE is under release-freeze ($FROZEN) — skipping the mirror refresh."
echo "Skipped: \`$BASE\` is under release-freeze ($FROZEN)." >> "$GITHUB_STEP_SUMMARY"
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
echo "Target branch: \`$BASE\`" >> "$GITHUB_STEP_SUMMARY"
fi
- name: Checkout the target branch
if: steps.target.outputs.skip == 'false'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.target.outputs.base }}
fetch-depth: 1
persist-credentials: false
- name: Find the drifted sources
id: drift
if: steps.target.outputs.skip == 'false'
run: |
set -euo pipefail
node scripts/i18n/check-translation-drift.mjs --json --warn > "$RUNNER_TEMP/drift-before.json"
# every source with a drifted / missing / hand-edited / stale mirror, as repo-relative paths
FILES=$(DRIFT_JSON="$RUNNER_TEMP/drift-before.json" node -e '
const r = JSON.parse(require("fs").readFileSync(process.env.DRIFT_JSON, "utf8"));
const keys = ["driftedSources", "missingTargets", "driftedTargets", "staleTargets"];
const rels = keys.flatMap((k) => r[k] ?? [])
.map((x) => x.rel).filter(Boolean);
process.stdout.write([...new Set(rels)].sort().join(","));
')
# llm.txt mirrors are exact copies of the root llm.txt (not in the drift report):
# count the ones the sync would rewrite, without writing.
LLM_STALE=$(node --input-type=module -e '
import { syncLlmMirrors } from "./scripts/i18n/sync-llm-mirrors.mjs";
const r = await syncLlmMirrors({ dryRun: true });
process.stdout.write(String(r.updated));
')
if [ "$LLM_STALE" -gt 0 ]; then
echo "llm=true" >> "$GITHUB_OUTPUT"
echo "Stale llm.txt mirrors: $LLM_STALE" >> "$GITHUB_STEP_SUMMARY"
else
echo "llm=false" >> "$GITHUB_OUTPUT"
fi
if [ -z "$FILES" ]; then
echo "files=" >> "$GITHUB_OUTPUT"
else
echo "Drifted sources: \`${FILES//,/\`, \`}\`" >> "$GITHUB_STEP_SUMMARY"
echo "files=$FILES" >> "$GITHUB_OUTPUT"
fi
if [ -z "$FILES" ] && [ "$LLM_STALE" -eq 0 ]; then
echo "No drifted mirrors — nothing to refresh." >> "$GITHUB_STEP_SUMMARY"
echo "refresh=false" >> "$GITHUB_OUTPUT"
else
echo "refresh=true" >> "$GITHUB_OUTPUT"
fi
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
if: steps.drift.outputs.refresh == 'true'
with:
package-manager-cache: false
node-version: "24"
- uses: ./.github/actions/npm-ci-retry
if: steps.drift.outputs.refresh == 'true'
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Translate the drifted mirrors
id: translate
if: steps.drift.outputs.files != ''
env:
FILES: ${{ steps.drift.outputs.files }}
OMNIROUTE_TRANSLATION_API_KEY: ${{ secrets.OMNIROUTE_TRANSLATION_API_KEY }}
OMNIROUTE_TRANSLATION_API_URL: ${{ secrets.OMNIROUTE_TRANSLATION_API_URL || vars.OMNIROUTE_TRANSLATION_API_URL }}
OMNIROUTE_TRANSLATION_MODEL: ${{ vars.OMNIROUTE_TRANSLATION_MODEL }}
OMNIROUTE_TRANSLATION_FALLBACK_MODELS: ${{ vars.OMNIROUTE_TRANSLATION_FALLBACK_MODELS }}
OMNIROUTE_TRANSLATION_GOOGLE_API_KEY: ${{ secrets.OMNIROUTE_TRANSLATION_GOOGLE_API_KEY }}
run: |
set -uo pipefail
if [ -n "$OMNIROUTE_TRANSLATION_API_KEY" ] && [ -n "$OMNIROUTE_TRANSLATION_API_URL" ] \
&& [ -n "$OMNIROUTE_TRANSLATION_MODEL" ]; then
ENGINE=llm
else
ENGINE=google
if [ -n "$OMNIROUTE_TRANSLATION_API_KEY" ] || [ -n "$OMNIROUTE_TRANSLATION_API_URL" ]; then
echo "::warning::LLM backend partially configured (API key, API URL and vars.OMNIROUTE_TRANSLATION_MODEL are all required) — using Google."
fi
fi
export OMNIROUTE_TRANSLATION_ENGINE="$ENGINE"
export OMNIROUTE_TRANSLATION_GOOGLE_FALLBACK=1
echo "engine=$ENGINE" >> "$GITHUB_OUTPUT"
echo "Engine: \`$ENGINE\`" >> "$GITHUB_STEP_SUMMARY"
# The default `bash -e` would end the step on a non-zero pipeline before RC is read, so
# catch the status here (pipefail makes it the translator's exit code).
RC=0
node scripts/i18n/run-translation.mjs --files="$FILES" \
--failures-json="$RUNNER_TEMP/translate-failures.json" 2>&1 \
| tee "$RUNNER_TEMP/translate.log" || RC=$?
if [ "$RC" -eq 3 ]; then
# Partial: the translated units are written and recorded, the failed ones are untouched.
echo "partial=true" >> "$GITHUB_OUTPUT"
{
echo "### Partial translation (exit 3): failed locales left as they were"
echo
echo '```'
grep -E '^ - .+ \[[^]]+\]: ' "$RUNNER_TEMP/translate.log" | head -100 || true
grep -E 'summary: translated=' "$RUNNER_TEMP/translate.log" | tail -1 || true
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
elif [ "$RC" -ne 0 ]; then
{
echo "### Translation failed (exit $RC) — no PR opened"
echo
echo '```'
grep -E '^ - .+ \[[^]]+\]: ' "$RUNNER_TEMP/translate.log" | head -100 || true
grep -E 'summary: translated=' "$RUNNER_TEMP/translate.log" | tail -1 || true
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
exit "$RC"
fi
- name: Sync the llm.txt mirrors
if: steps.drift.outputs.llm == 'true'
run: node scripts/i18n/sync-llm-mirrors.mjs
- name: Check the refreshed mirrors
if: steps.drift.outputs.refresh == 'true'
run: |
set -uo pipefail
FAILED=0
# Derived files are refreshed at release (plan 2026-11-13): sources only, base drift excused.
OMNIROUTE_GATE_MODE="pr" npm run check:docs-all 2>&1 | tee "$RUNNER_TEMP/docs-all.log"
DOCS_RC=${PIPESTATUS[0]}
node scripts/i18n/check-translation-drift.mjs --json --warn > "$RUNNER_TEMP/drift-after.json"
# Drift left by the failed units of a partial run is excused; any other drift blocks.
if ! BLOCKING=$(DRIFT_JSON="$RUNNER_TEMP/drift-after.json" \
FAILURES_JSON="$RUNNER_TEMP/translate-failures.json" node --input-type=module -e '
import { existsSync, readFileSync } from "node:fs";
import { blockingDrift } from "./scripts/i18n/run-translation.mjs";
const read = (p) => JSON.parse(readFileSync(p, "utf8"));
const run = existsSync(process.env.FAILURES_JSON) ? read(process.env.FAILURES_JSON) : {};
const left = blockingDrift(read(process.env.DRIFT_JSON), run.failures ?? [], run.translatedUnits ?? []);
for (const x of left) console.log(x.kind + ": " + x.rel + (x.locale ? " [" + x.locale + "]" : ""));
'); then
echo "::error::could not evaluate the drift report"
exit 1
fi
if [ "$DOCS_RC" -ne 0 ]; then
FAILED=1
{
echo "### \`npm run check:docs-all\` failed (exit $DOCS_RC) — no PR opened"
echo
echo '```'
grep -E 'docs/i18n/|FAIL|✗|✖|ERROR' "$RUNNER_TEMP/docs-all.log" | head -100 || true
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
fi
if [ -n "$BLOCKING" ]; then
FAILED=1
{
echo "### Drift check still reports drift — no PR opened"
echo
echo '```'
printf '%s\n' "$BLOCKING" | head -100
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
fi
exit "$FAILED"
- name: Commit and open or update the refresh PR
if: steps.drift.outputs.refresh == 'true'
env:
GH_TOKEN: ${{ secrets.I18N_REFRESH_TOKEN || github.token }}
REPO: ${{ github.repository }}
BASE: ${{ steps.target.outputs.base }}
ENGINE: ${{ steps.translate.outputs.engine }}
PARTIAL: ${{ steps.translate.outputs.partial }}
FILES: ${{ steps.drift.outputs.files }}
LLM: ${{ steps.drift.outputs.llm }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
SOURCES="$FILES"
if [ "${LLM:-}" = "true" ]; then SOURCES="${SOURCES:+$SOURCES,}llm.txt"; fi
git add -A docs/i18n .i18n-state.json
if git diff --cached --quiet; then
echo "Translation produced no change — nothing to commit." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
COUNT=$(git diff --cached --name-only -- docs/i18n | wc -l | tr -d ' ')
FAILED_UNITS=""
if [ "${PARTIAL:-}" = "true" ]; then
FAILED_UNITS=$(FAILURES_JSON="$RUNNER_TEMP/translate-failures.json" node -e '
const r = JSON.parse(require("fs").readFileSync(process.env.FAILURES_JSON, "utf8"));
const one = (e) => String(e ?? "").replace(/\s+/g, " ").replace(/`/g, "\x27").slice(0, 200);
for (const f of r.failures) console.log("- `" + f.rel + "` [" + f.locale + "]: " + one(f.error));
')
fi
NOTE=""
[ -z "$FAILED_UNITS" ] || NOTE=" $(printf '%s\n' "$FAILED_UNITS" | wc -l | tr -d ' ') unit(s) failed and were left as they were."
# CI bot commit: the bot identity is the author, no Co-Authored-By trailer.
git -c user.name="github-actions[bot]" \
-c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit --quiet -m "$PR_TITLE" \
-m "Engine: ${ENGINE:-none}. Sources: ${SOURCES//,/, }. ${COUNT} mirror file(s).${NOTE}" \
-m "Run: ${RUN_URL}"
gh auth setup-git
# Fixed branch, reset from the target on every run: the open PR always shows exactly
# one refresh commit on top of the current target.
git push --force --quiet origin "HEAD:refs/heads/${REFRESH_BRANCH}"
{
echo "Automatic refresh of the translated docs mirrors, opened by the \`i18n-mirror-refresh\` workflow (${RUN_URL})."
echo
echo "- Target: \`${BASE}\`"
echo "- Engine: \`${ENGINE}\` (LLM chain first, Google as the last resort; \`google\` when no LLM backend is configured)"
echo "- Drifted sources: \`${SOURCES//,/\`, \`}\`"
echo "- Mirror files changed: ${COUNT}"
echo
echo "\`npm run check:docs-all\` and \`check-translation-drift.mjs\` passed on the refreshed tree before this PR was opened."
if [ -n "$FAILED_UNITS" ]; then
echo
echo "Partial run: these (source, locale) units failed to translate. Their mirrors and \`.i18n-state.json\` records are unchanged, so they still show as stale or drifted and the next run retries them. The drift check excused only these units:"
echo
printf '%s\n' "$FAILED_UNITS"
fi
echo
echo "The branch \`${REFRESH_BRANCH}\` is force-reset from the target on every run, so a later run replaces this commit."
echo "PRs opened with the default \`GITHUB_TOKEN\` do not trigger other workflows; set the \`I18N_REFRESH_TOKEN\` secret so CI runs here."
} > "$RUNNER_TEMP/pr-body.md"
PR=$(gh pr list --repo "$REPO" --head "$REFRESH_BRANCH" --state open \
--json number,baseRefName --jq '.[0] | select(.) | "\(.number) \(.baseRefName)"')
if [ -z "$PR" ]; then
URL=$(gh pr create --repo "$REPO" --base "$BASE" --head "$REFRESH_BRANCH" \
--title "$PR_TITLE" --body-file "$RUNNER_TEMP/pr-body.md")
echo "Opened $URL" >> "$GITHUB_STEP_SUMMARY"
else
NUM="${PR%% *}"
OLD_BASE="${PR#* }"
if [ "$OLD_BASE" != "$BASE" ]; then
gh pr edit "$NUM" --repo "$REPO" --base "$BASE"
NEW_BASE=$(gh pr view "$NUM" --repo "$REPO" --json baseRefName --jq .baseRefName)
[ "$NEW_BASE" = "$BASE" ] || { echo "::error::retarget of #$NUM to $BASE did not apply"; exit 1; }
fi
# The force-push already updated the PR; a comment (not a body edit) records the run.
gh pr comment "$NUM" --repo "$REPO" --body-file "$RUNNER_TEMP/pr-body.md"
echo "Updated #$NUM" >> "$GITHUB_STEP_SUMMARY"
fi

View File

@@ -1,134 +0,0 @@
name: Lock released branch
# Two responsibilities (defense in depth — Hard Rule #18 enforcement):
#
# 1. `on: release: published` — when a GitHub Release publishes tag v3.X.Y,
# apply branch protection (lock_branch + enforce_admins) to release/v3.X.Y
# so no further commits can land on a shipped version. To reopen later:
# gh api -X DELETE repos/<owner>/<repo>/branches/release/<tag>/protection
#
# 2. `on: push: branches: ['release/v*']` — verify that no push lands on a
# release/* branch whose matching tag already exists. This is the preventive
# guard: if the lock didn't apply (workflow bug, missing PAT, race), this
# job FAILS the push run so the operator gets paged immediately.
#
# `permissions:` cannot grant the `Administration` scope to GITHUB_TOKEN — that
# scope only exists on PATs. Set BRANCH_LOCK_TOKEN as a repo secret pointing to
# a PAT/fine-grained token with `Administration: read & write`. Without it, the
# lock step will fail loudly (which is what we want — silent failure caused the
# v3.8.3 incident on 2026-05-26 where 6 commits landed post-release).
on:
release:
types: [published]
push:
branches:
- "release/v*"
workflow_dispatch:
inputs:
tag:
description: "Tag of the released version (e.g. v3.8.2)"
required: true
type: string
permissions:
contents: read
# One run per ref at a time. The push guard below is a 5-second tag lookup whose
# verdict is identical for every push on the same branch, yet without a concurrency
# group each of the ~10 pushes/hour on the active release branch queued its own
# hosted run (20 queued on 2026-10-17 against the account's concurrent-job limit).
# The newest push supersedes the older ones; a `release` event carries its own ref.
concurrency:
group: lock-released-${{ github.ref }}
cancel-in-progress: true
jobs:
# ─────────────────────────────────────────────────────────────────────────
# Job 1 — Lock the release branch when a Release is published.
# ─────────────────────────────────────────────────────────────────────────
lock-branch:
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Lock release/<tag> branch
env:
# Administration scope is required to PUT branch protection. Default
# GITHUB_TOKEN cannot do this — operator must provision BRANCH_LOCK_TOKEN.
GH_TOKEN: ${{ secrets.BRANCH_LOCK_TOKEN }}
TAG: ${{ github.event.release.tag_name || inputs.tag }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
if [ -z "${GH_TOKEN}" ]; then
echo "::error::BRANCH_LOCK_TOKEN secret is not set. Create a PAT with Administration:write and add it as repo secret."
exit 1
fi
if [ -z "${TAG}" ]; then
echo "::error::No tag provided; cannot determine release branch."
exit 1
fi
BRANCH="release/${TAG}"
echo "Target branch: ${BRANCH} (repo: ${REPO})"
if ! gh api "repos/${REPO}/branches/${BRANCH}" >/dev/null 2>&1; then
echo "::warning::Branch ${BRANCH} not found — nothing to lock."
exit 0
fi
echo "Applying lock_branch protection to ${BRANCH}..."
gh api -X PUT "repos/${REPO}/branches/${BRANCH}/protection" --input - <<'JSON'
{
"required_status_checks": null,
"enforce_admins": true,
"required_pull_request_reviews": null,
"restrictions": null,
"lock_branch": true,
"allow_force_pushes": false,
"allow_deletions": false
}
JSON
LOCKED=$(gh api "repos/${REPO}/branches/${BRANCH}/protection" \
--jq '.lock_branch.enabled')
if [ "${LOCKED}" != "true" ]; then
echo "::error::Failed to confirm lock on ${BRANCH} (lock_branch=${LOCKED})."
exit 1
fi
echo "✅ ${BRANCH} is now locked (read-only)."
# ─────────────────────────────────────────────────────────────────────────
# Job 2 — Preventive guard: fail if a push lands on release/vX.Y.Z whose
# tag already exists. This catches the case where the lock didn't apply
# (PAT missing, race window, workflow bug) and pages the operator.
# ─────────────────────────────────────────────────────────────────────────
guard-no-push-after-release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Reject push if matching release tag exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
REF: ${{ github.ref_name }}
run: |
set -euo pipefail
# Extract version from ref: release/v3.8.3 -> v3.8.3
if [[ ! "${REF}" =~ ^release/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "Ref ${REF} does not match release/vX.Y.Z — nothing to guard."
exit 0
fi
TAG="${BASH_REMATCH[1]}"
echo "Checking if tag ${TAG} already exists on ${REPO}..."
if gh api "repos/${REPO}/git/refs/tags/${TAG}" >/dev/null 2>&1; then
echo "::error::Hard Rule #18 violation — push to ${REF} but tag ${TAG} is already released."
echo "::error::Hotfixes for a released version must go on a NEW branch: release/v$(echo "${TAG#v}" | awk -F. '{$3=$3+1; print $1"."$2"."$3}' OFS=.)"
echo "::error::To undo this push: revert the offending commits, or contact an admin to lock the branch if it wasn't already."
exit 1
fi
echo "✅ No release tag for ${TAG} yet — push is OK."

View File

@@ -1,65 +0,0 @@
name: Mutation Redundancy (disableBail, on-demand)
# One-off measurement to UNBLOCK R1 (test-redundancy prune). The nightly mutation run
# (nightly-mutation.yml) bails on the first kill, so `killedBy` lists only the FIRST
# killer — 🟠 redundant is understated and 🟢 unique overstated (see the caveat in
# scripts/quality/mutation-radiography.mjs). This workflow re-runs the SAME combo +
# chatCore leaf batches with stryker.disablebail.mjs (disableBail:true, incremental:false)
# so `killedBy` lists EVERY killer. Feed the uploaded reports to
# `node scripts/quality/mutation-radiography.mjs --candidates mutation-nobail-*/mutation.json`
# to get the accurate R1 prune-candidate list (🔴 empty ∪ 🟠 redundant) for human review.
#
# Batches mirror the nightly's leaf decomposition (d/e/f/g/h/i) rather than 2 mega-batches:
# disableBail is MORE expensive than bail (it never stops early), and Stryker only writes
# mutation.json on a SUCCESSFUL finish — a batch cancelled at the cap produces NO data — so
# smaller batches each fit the 300min headroom and run in parallel. auth/accountFallback and
# the security quartet are out of scope: R1 targets the combo/chatCore leaves.
on:
workflow_dispatch:
permissions:
contents: read
jobs:
stryker-nobail:
name: Stryker disableBail (batch ${{ matrix.batch.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
batch:
- name: d
mutate: "open-sse/services/combo/comboStructure.ts,open-sse/services/combo/autoStrategy.ts,open-sse/services/combo/validateQuality.ts"
- name: e
mutate: "open-sse/services/combo/shadowRouting.ts,open-sse/services/combo/targetSorters.ts,open-sse/services/combo/comboPredicates.ts,open-sse/services/combo/rrState.ts,open-sse/services/combo/comboData.ts"
- name: f
mutate: "open-sse/services/combo/quotaScoring.ts,open-sse/services/combo/quotaStrategies.ts"
- name: g
mutate: "open-sse/handlers/chatCore/comboContextCache.ts,open-sse/handlers/chatCore/idempotency.ts,open-sse/handlers/chatCore/passthroughHelpers.ts,open-sse/handlers/chatCore/responseHeaders.ts,open-sse/handlers/chatCore/sanitization.ts,open-sse/handlers/chatCore/upstreamTimeouts.ts"
- name: h
mutate: "open-sse/handlers/chatCore/headers.ts,open-sse/handlers/chatCore/logTruncation.ts,open-sse/handlers/chatCore/memoryExtraction.ts,open-sse/handlers/chatCore/nonStreamingSse.ts,open-sse/handlers/chatCore/passthroughToolNames.ts,open-sse/handlers/chatCore/executorHelpers.ts"
- name: i
mutate: "open-sse/handlers/chatCore/telemetryHelpers.ts,open-sse/handlers/chatCore/memorySkillsInjection.ts,open-sse/handlers/chatCore/semanticCache.ts"
timeout-minutes: 300
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Run Stryker (disableBail)
env:
BATCH_MUTATE: ${{ matrix.batch.mutate }}
run: npx stryker run --config-file stryker.disablebail.mjs --mutate "$BATCH_MUTATE"
- name: Upload mutation report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: mutation-nobail-${{ matrix.batch.name }}
path: reports/mutation/
if-no-files-found: warn
retention-days: 14

View File

@@ -1,116 +0,0 @@
name: Nightly basePath build
# Proves that a build under OMNIROUTE_BASE_PATH ships no root-absolute /brand/ asset and still
# bundles the fonts (tests/unit/build-basepath-brand.test.ts). The ci.yml Build job compiles
# without a basePath, so this needs a second full `next build`. That is too slow for every PR
# (#19620), so it runs once a day against the tip of the active release branch.
#
# GitHub starts `schedule` and `workflow_dispatch` only from the copy of this file on the default
# branch, so the first run happens after the release that carries it reaches main.
on:
schedule:
- cron: "31 2 * * *" # 02:31 UTC daily, a slot no other workflow uses
workflow_dispatch:
inputs:
branch:
description: "Branch to validate (default: highest release/vX.Y.Z)"
required: false
type: string
permissions:
contents: read
concurrency:
group: nightly-basepath-build
cancel-in-progress: true
jobs:
resolve-branch:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Resolve active release branch
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
target: ${{ steps.branch.outputs.target }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Resolve active release branch
id: branch
env:
INPUT_BRANCH: ${{ github.event.inputs.branch }}
run: |
set -euo pipefail
# Exact release/vX.Y.Z only: a suffixed branch (release/v3.9.0-rc1) would sort above
# the active release and leave it untested.
CANONICAL='^release/v[0-9]+\.[0-9]+\.[0-9]+$'
if [ -n "${INPUT_BRANCH:-}" ]; then
TARGET="$INPUT_BRANCH"
else
TARGET=$(git for-each-ref --format='%(refname:short)' 'refs/remotes/origin/release/v*' \
| sed 's#^origin/##' \
| { grep -E "$CANONICAL" || true; } \
| sort -t/ -k2 -V \
| tail -1)
fi
if ! [[ "$TARGET" =~ $CANONICAL ]]; then
echo "Refusing non-canonical branch name: $TARGET"
exit 1
fi
echo "target=$TARGET" >> "$GITHUB_OUTPUT"
basepath-build:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Build with basePath
needs: resolve-branch
# Hosted, with webpack: the 16 GB runners cannot hold a Turbopack build of this tree, and the
# single omni-build slot stays free for release builds (see the ci.yml Build job).
runs-on: ubuntu-latest
# The test caps the build at 40 min. The rest covers checkout, install and the scan.
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.resolve-branch.outputs.target }}
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
package-manager-cache: false
- uses: ./.github/actions/npm-ci-retry
with:
cache: "false"
- name: Build under a basePath and scan the output
run: node --import tsx/esm --test tests/unit/build-basepath-brand.test.ts
env:
RUN_BUILD_TESTS: "1"
OMNIROUTE_USE_TURBOPACK: "0"
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
report:
name: Open / update tracking issue on failure
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ !cancelled() && (needs.resolve-branch.result == 'failure' || needs.basepath-build.result == 'failure') && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
needs: [resolve-branch, basepath-build]
permissions:
issues: write
steps:
- name: Open or update issue
env:
GH_TOKEN: ${{ github.token }}
TARGET: ${{ needs.resolve-branch.outputs.target }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
TITLE="🌙 nightly-basepath-build: basePath build failed"
EXISTING=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open --search "$TITLE in:title" --json number --jq '.[0].number')
BODY="Nightly basePath build failed on \`${TARGET:-unresolved branch}\`: $RUN_URL. Check the build log first. An assertion failure lists the output files that reference /brand/ without the basePath."
if [ -n "$EXISTING" ]; then
gh issue comment "$EXISTING" --repo "$GITHUB_REPOSITORY" --body "$BODY"
else
gh issue create --repo "$GITHUB_REPOSITORY" --title "$TITLE" --body "$BODY"
fi

View File

@@ -1,141 +0,0 @@
name: Nightly Node Compat
# Plano mestre testes+CI (Eixo D2, aprovado 2026-07-04): as matrizes de compatibilidade
# Node 24/26 custavam ~28% de CADA run do CI pesado (2 execuções completas da suíte por
# sync da release-PR) para pegar uma classe de quebra que raramente nasce num PR típico.
# Elas rodam aqui 1×/dia contra o tip da release ativa (mesmo alvo do nightly-release-green)
# e continuam obrigatórias no gate de release via workflow_dispatch do ci.yml se preciso.
# fail-fast desligado: numa quebra queremos saber TODAS as versões afetadas de uma vez.
on:
schedule:
- cron: "47 6 * * *" # 06:47 UTC diário — slot distinto dos demais nightlies
workflow_dispatch:
inputs:
branch:
description: "Branch to validate (default: highest release/vX.Y.Z)"
required: false
type: string
permissions:
contents: read
concurrency:
group: nightly-compat
cancel-in-progress: true
jobs:
resolve-branch:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Resolve active release branch
runs-on: ubuntu-latest
outputs:
target: ${{ steps.branch.outputs.target }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- name: Resolve active release branch
id: branch
env:
INPUT_BRANCH: ${{ github.event.inputs.branch }}
run: |
set -euo pipefail
if [ -n "${INPUT_BRANCH:-}" ]; then
TARGET="$INPUT_BRANCH"
else
TARGET=$(git for-each-ref --format='%(refname:short)' 'refs/remotes/origin/release/v*' \
| sed 's#origin/##' \
| sort -t/ -k2 -V \
| tail -1)
fi
case "$TARGET" in
release/v[0-9]*.[0-9]*.[0-9]*) ;;
*) echo "Refusing non-canonical branch name: $TARGET"; exit 1 ;;
esac
echo "target=$TARGET" >> "$GITHUB_OUTPUT"
compat-build-26:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Node 26 Compatibility Build
runs-on: ubuntu-latest
timeout-minutes: 25
needs: resolve-branch
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.resolve-branch.outputs.target }}
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "26"
cache: npm
- uses: ./.github/actions/npm-ci-retry
# #8090 — this is the ONLY Node 26 build in the whole CI matrix (ci.yml pins
# CI_NODE_VERSION=24). It failed every nightly with the runner-reclaimed
# signature ("The runner has received a shutdown signal" / "The operation was
# canceled", no exit code) always at the same Turbopack compile phase — a
# classic OOM kill on the memory-constrained ubuntu-latest runner. Turbopack's
# native (Rust, off-V8-heap) allocation is NOT bounded by --max-old-space-size
# and peaks far higher than webpack on this large module graph (#6409), and is
# heavier still under Node 26. Use the documented webpack fallback here: it still
# validates that the app *builds* on Node 26 (the point of this compat job) at a
# much lower memory peak. Turbopack-on-Node-24 stays covered by ci.yml's build
# job. See docs/reference/ENVIRONMENT.md (OMNIROUTE_USE_TURBOPACK) and #6409.
- run: npm run build
env:
OMNIROUTE_USE_TURBOPACK: "0"
compat-tests:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Node ${{ matrix.node }} Compat Tests (${{ matrix.shard }}/4)
runs-on: ubuntu-latest
timeout-minutes: 25
needs: resolve-branch
strategy:
fail-fast: false
matrix:
node: [24, 26]
shard: [1, 2, 3, 4]
env:
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-nightly-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
TEST_SHARD: ${{ matrix.shard }}/4
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.resolve-branch.outputs.target }}
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ matrix.node }}
cache: npm
- uses: ./.github/actions/npm-ci-retry
- run: npm run check:node-runtime
- run: npm run test:unit:ci:shard
report:
name: Open / update tracking issue on failure
runs-on: ubuntu-latest
if: ${{ (!cancelled() && (needs.compat-tests.result == 'failure' || needs.compat-build-26.result == 'failure')) && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
needs: [resolve-branch, compat-build-26, compat-tests]
permissions:
issues: write
steps:
- name: Open or update issue
env:
GH_TOKEN: ${{ github.token }}
TARGET: ${{ needs.resolve-branch.outputs.target }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
TITLE="🌙 nightly-compat: Node 24/26 failures on $TARGET"
EXISTING=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open --search "$TITLE in:title" --json number --jq '.[0].number')
BODY="Nightly Node-compat run failed on \`$TARGET\`: $RUN_URL — triage which Node version/shard broke (fail-fast off, all versions reported)."
if [ -n "$EXISTING" ]; then
gh issue comment "$EXISTING" --repo "$GITHUB_REPOSITORY" --body "$BODY"
else
gh issue create --repo "$GITHUB_REPOSITORY" --title "$TITLE" --body "$BODY"
fi

View File

@@ -1,246 +0,0 @@
name: Nightly derived refresh
# Plan "derived numbers and texts resolved only at release" (2026-11-13). A feature PR never
# writes a value that depends on the state of its base — provider / migration / MCP-tool counts,
# the version claims, the README SVG numbers, the facts snapshot (docs/reference/
# derived-facts.json). `npm run release:refresh-derived` recomputes all of them in one pass; the
# release runs it, and between releases this workflow runs it once a day on the highest
# release/vX.Y.Z and keeps ONE pull request open with the result, so the docs never fall more
# than a day behind the code. The counts gate lets this PR edit managed numbers because
# `chore/derived-*` is a writer branch (scripts/check/lib/derivedClaimsDiff.mjs).
#
# It never merges, and it skips a branch under release-freeze (Hard Rule #21): during a release
# the captain runs the refresh in the release itself.
#
# Branch chore/derived-refresh belongs to this robot, the same mechanism as the UI Kit upstream
# watch (scripts/ci/ui-kit-sync-pr.sh): every run rebuilds it as ONE commit on top of the release
# tip and pushes with --force-with-lease pinned to the SHA it read, so a commit pushed after that
# read is never overwritten; and an open PR whose branch tip was pushed by someone else (a hand
# fix) is left alone until it is merged or closed.
#
# PR token: DERIVED_REFRESH_PR_TOKEN when set (fine-grained token on this repository, Contents
# and Pull requests: write), else I18N_REFRESH_TOKEN — the robot token the i18n mirror refresh
# already opens its PR with (same scopes, same purpose; owner decision 2026-11-13). This repository
# does not let GITHUB_TOKEN create PRs, and a branch pushed or a PR opened with GITHUB_TOKEN
# does not trigger CI, so the refresh PR would sit without checks. With neither secret the branch
# is still pushed (with GITHUB_TOKEN) and the run summary says to open the PR by hand.
#
# Secrets and event values reach the scripts only through `env:`.
on:
schedule:
- cron: "37 1 * * *" # 01:37 UTC daily, a slot no other workflow uses
workflow_dispatch:
permissions:
contents: read
concurrency:
group: nightly-derived-refresh
cancel-in-progress: false
jobs:
refresh:
name: Refresh derived numbers on the active release branch
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: write # push chore/derived-refresh when no PR token is configured
pull-requests: write # find, update and retarget the refresh PR
issues: read # release-freeze and base-red lookups
env:
REFRESH_BRANCH: chore/derived-refresh
BOT_NAME: github-actions[bot]
BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
steps:
- name: Resolve the active release branch and the release freeze
id: base
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
BASE=$(gh api "repos/$GITHUB_REPOSITORY/branches" --paginate --jq '.[].name' \
| grep -E '^release/v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)
[ -n "$BASE" ] || { echo "no release/vX.Y.Z branch" >&2; exit 1; }
# A freeze issue is titled "🔒 release-freeze: vX.Y.Z in progress"; v3.8.5 must not
# match v3.8.52, and a freeze that names no version freezes everything.
VER_RE=$(printf '%s' "${BASE#release/}" | sed 's/\./\\./g')
# A checked assignment: a failed lookup fails the step. Fed through `< <(gh ...)`, the
# failure was invisible to set -e, the loop read EOF and the run went on as not frozen.
FREEZES=$(gh issue list --repo "$GITHUB_REPOSITORY" --label release-freeze --state open \
--json number,title --jq '.[] | "\(.number)\t\(.title)"')
FROZEN=""
while IFS=$'\t' read -r NUM TITLE; do
[ -n "$NUM" ] || continue
if printf '%s' "$TITLE" | grep -qE "(^|[^0-9.])${VER_RE}([^0-9]|$)" \
|| ! printf '%s' "$TITLE" | grep -qE 'v[0-9]+\.[0-9]+\.[0-9]+'; then
FROZEN="#$NUM"
fi
done <<< "$FREEZES"
RED=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "Release branch not green: $BASE in:title" --json number --jq '.[0].number // empty')
{
echo "branch=$BASE"
echo "skip=$([ -n "$FROZEN" ] && echo true || echo false)"
echo "red=$RED"
} >> "$GITHUB_OUTPUT"
if [ -n "$FROZEN" ]; then
echo "::notice::$BASE is under release-freeze ($FROZEN) — the release refreshes it."
echo "Skipped: \`$BASE\` is under release-freeze ($FROZEN)." >> "$GITHUB_STEP_SUMMARY"
else
echo "Target branch: \`$BASE\` (base-red: ${RED:-none})" >> "$GITHUB_STEP_SUMMARY"
fi
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: steps.base.outputs.skip == 'false'
with:
ref: ${{ steps.base.outputs.branch }}
fetch-depth: 1
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
if: steps.base.outputs.skip == 'false'
with:
package-manager-cache: false
node-version: "24"
- uses: ./.github/actions/npm-ci-retry
if: steps.base.outputs.skip == 'false'
with:
cache: false
# UI keys added or rewritten since the last release are translated in the same run: the
# refresh never writes __MISSING__ markers without a backend (they fail
# i18n-vi-completeness and the ratio gate on the base). Same engine rule as
# i18n-mirror-refresh.yml: the LLM chain when it is fully configured, else the
# structure-safe Google engine, which needs no endpoint and runs on a hosted runner.
- name: Refresh derived numbers
if: steps.base.outputs.skip == 'false'
env:
OMNIROUTE_TRANSLATION_API_KEY: ${{ secrets.OMNIROUTE_TRANSLATION_API_KEY }}
OMNIROUTE_TRANSLATION_API_URL: ${{ secrets.OMNIROUTE_TRANSLATION_API_URL || vars.OMNIROUTE_TRANSLATION_API_URL }}
OMNIROUTE_TRANSLATION_MODEL: ${{ vars.OMNIROUTE_TRANSLATION_MODEL }}
OMNIROUTE_TRANSLATION_FALLBACK_MODELS: ${{ vars.OMNIROUTE_TRANSLATION_FALLBACK_MODELS }}
OMNIROUTE_TRANSLATION_GOOGLE_API_KEY: ${{ secrets.OMNIROUTE_TRANSLATION_GOOGLE_API_KEY }}
run: |
set -euo pipefail
if [ -n "$OMNIROUTE_TRANSLATION_API_KEY" ] && [ -n "$OMNIROUTE_TRANSLATION_API_URL" ] \
&& [ -n "$OMNIROUTE_TRANSLATION_MODEL" ]; then
export OMNIROUTE_TRANSLATION_ENGINE="llm"
else
export OMNIROUTE_TRANSLATION_ENGINE="google"
fi
export OMNIROUTE_TRANSLATION_GOOGLE_FALLBACK="1"
echo "Translation engine: \`$OMNIROUTE_TRANSLATION_ENGINE\`" >> "$GITHUB_STEP_SUMMARY"
npm run release:refresh-derived -- --profile=nightly
- name: Commit, push and open or update the refresh PR
if: steps.base.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.DERIVED_REFRESH_PR_TOKEN || secrets.I18N_REFRESH_TOKEN || github.token }}
HAS_PR_TOKEN: ${{ secrets.DERIVED_REFRESH_PR_TOKEN != '' || secrets.I18N_REFRESH_TOKEN != '' }}
BASE: ${{ steps.base.outputs.branch }}
BASE_RED_ISSUE: ${{ steps.base.outputs.red }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
TITLE="chore(docs): refresh derived numbers on ${BASE}"
# The fetched tip is the robot's own only when the bot both authored AND committed it:
# `git commit --amend --no-edit` on the bot commit keeps the bot as author but records
# the maintainer as committer, and that hand fix must be neither closed nor overwritten.
robot_tip() {
[ "$(git log -1 --format='%ae %ce' FETCH_HEAD)" = "$BOT_EMAIL $BOT_EMAIL" ]
}
git add -A
if git diff --cached --quiet; then
echo "Every derived number on \`$BASE\` already matches the live code." >> "$GITHUB_STEP_SUMMARY"
# A refresh PR left open from an earlier run now carries values the base no longer
# needs (the code moved back, or the release refreshed itself): close it so it cannot
# be merged by mistake. A tip pushed by someone else is only reported.
STALE=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$REFRESH_BRANCH" --state open \
--json number --jq '.[0].number // empty')
if [ -n "$STALE" ]; then
git fetch -q --depth=1 origin "$REFRESH_BRANCH"
if robot_tip; then
gh pr close "$STALE" --repo "$GITHUB_REPOSITORY" \
--comment "Closed by the nightly derived refresh: \`$BASE\` already matches the live code (${RUN_URL})." > /dev/null
echo "Closed the stale refresh PR #$STALE." >> "$GITHUB_STEP_SUMMARY"
else
echo "Refresh PR #$STALE is no longer needed but has commits pushed by hand; left open." >> "$GITHUB_STEP_SUMMARY"
fi
fi
exit 0
fi
CHANGED=$(git diff --cached --name-only)
COUNT=$(printf '%s\n' "$CHANGED" | wc -l | tr -d ' ')
gh auth setup-git
OPEN_PR=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$REFRESH_BRANCH" --state open \
--json number,baseRefName --jq '.[0] | select(.) | "\(.number) \(.baseRefName)"')
REMOTE_SHA=$(git ls-remote --heads origin "$REFRESH_BRANCH" | cut -f1)
if [ -n "$OPEN_PR" ] && [ -n "$REMOTE_SHA" ]; then
git fetch -q --depth=1 origin "$REFRESH_BRANCH"
if ! robot_tip; then
echo "PR #${OPEN_PR%% *} has commits pushed by hand; not overwriting them." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
fi
# CI bot commit: the bot identity is the author, no Co-Authored-By trailer.
git switch -q -c "$REFRESH_BRANCH"
git -c user.name="$BOT_NAME" -c user.email="$BOT_EMAIL" commit -q -m "$TITLE" \
-m "npm run release:refresh-derived -- --profile=nightly on ${BASE}: ${COUNT} file(s)." \
-m "Run: ${RUN_URL}"
# One commit on top of the release tip, every run. The lease refuses to overwrite a
# commit somebody pushed to the branch after REMOTE_SHA was read.
git push -q --force-with-lease="${REFRESH_BRANCH}:${REMOTE_SHA}" origin "HEAD:refs/heads/${REFRESH_BRANCH}"
if [ "$HAS_PR_TOKEN" != "true" ]; then
{
echo "\`$REFRESH_BRANCH\` is pushed with ${COUNT} refreshed file(s), but no PR was opened:"
echo "neither \`DERIVED_REFRESH_PR_TOKEN\` nor \`I18N_REFRESH_TOKEN\` is set. Open it from that branch against \`$BASE\`."
} >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
{
if [ -n "${BASE_RED_ISSUE:-}" ]; then printf '⚠️ base-red inherited: #%s\n\n' "$BASE_RED_ISSUE"; fi
echo "## Summary"
echo
echo "Nightly refresh of the derived numbers on \`$BASE\`: \`npm run release:refresh-derived -- --profile=nightly\` recomputed the provider, migration and MCP-tool counts, the version claims, the README SVG numbers and the facts snapshot from the live code (${RUN_URL})."
echo
echo "Feature PRs no longer write these values; this PR (and the release itself) does. The branch \`$REFRESH_BRANCH\` is rebuilt from \`$BASE\` on every run, so a later run replaces this commit."
echo
echo "## Files (${COUNT})"
echo
# shellcheck disable=SC2016 # the backticks are Markdown code spans, not substitutions
printf '%s\n' "$CHANGED" | head -200 | sed 's/^/- `/; s/$/`/'
echo
echo "## Before merge"
echo
echo "- [ ] CI is green, or every red check is inherited from the base."
echo "- [ ] The diff only touches derived numbers (no prose rewrites)."
# Agent-instruction surfaces are never merged without the owner's explicit approval
# (AGENTS.md → Review focus), even when the diff is digits only.
if printf '%s\n' "$CHANGED" | grep -qE '(^|/)(AGENTS|CLAUDE|GEMINI)\.md$|(^|/)llm\.txt$|^skills/.*/SKILL\.md$'; then
echo "- [ ] **Agent-instruction surface touched** (AGENTS.md / llm.txt / SKILL.md): needs the owner's explicit approval before merge."
fi
} > "$RUNNER_TEMP/pr-body.md"
if [ -z "$OPEN_PR" ]; then
URL=$(gh pr create --repo "$GITHUB_REPOSITORY" --base "$BASE" --head "$REFRESH_BRANCH" \
--title "$TITLE" --body-file "$RUNNER_TEMP/pr-body.md")
echo "Opened $URL" >> "$GITHUB_STEP_SUMMARY"
else
NUM="${OPEN_PR%% *}"
OLD_BASE="${OPEN_PR#* }"
gh pr edit "$NUM" --repo "$GITHUB_REPOSITORY" --base "$BASE" --title "$TITLE" \
--body-file "$RUNNER_TEMP/pr-body.md" > /dev/null
if [ "$OLD_BASE" != "$BASE" ]; then
# `gh pr edit --base` can fail silently: verify the retarget (Hard Rule #21).
NEW_BASE=$(gh pr view "$NUM" --repo "$GITHUB_REPOSITORY" --json baseRefName --jq .baseRefName)
[ "$NEW_BASE" = "$BASE" ] || { echo "::error::retarget of #$NUM to $BASE did not apply"; exit 1; }
fi
echo "Updated #$NUM" >> "$GITHUB_STEP_SUMMARY"
fi

View File

@@ -1,173 +0,0 @@
name: Nightly LLM Security
on:
schedule:
- cron: "53 5 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
promptfoo-guard:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: promptfoo — injection guard (block mode, no secret)
# #11965: this job runs a backend-only `next build`; the hosted 7 GB runner cannot build
# release/v3.8.51 (VM shutdown ~7 min in), so it targets the box's light pool (`omni-light`:
# two listeners, jobs ≤ ~6 GB). Falls back to hosted when USE_VPS_RUNNER is off.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with: { node-version: "24", cache: npm }
# Fresh runtime state per run (same contract as nightly-schemathesis.yml). The
# omni-light runner keeps a persistent $HOME, so the server used to boot on
# $HOME/.omniroute, where the database left by older nights sat at migration 134
# while the tip ships 200+: the mass-migration guard (#3416, threshold 50) refused
# to migrate it, the catalog warm-up hit `no such table: model_capability_overrides`
# and the health wait failed every night (no verdict since 2026-08-27). A DATA_DIR
# under $RUNNER_TEMP is a new database every run, so every migration applies and
# nothing on the box is touched. Auto-backups stay off: one pre-migration backup
# per boot had piled up 1.6 GB under the runner's home.
- name: Prepare isolated runtime state
id: runtime
run: |
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-llm-security.XXXXXX")
mkdir "$data_dir/plugins"
{
echo "DATA_DIR=$data_dir"
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
} >> "$GITHUB_ENV"
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build CLI bundle
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
OMNIROUTE_USE_TURBOPACK: "0"
run: npm run build:cli
# Own port: this box also hosts the deployed server (the a11y job's
# "20128 is already used" nights prove it). A test server that dies on
# EADDRINUSE must NOT let the eval fall through to whatever else answers
# on the port — a block-mode validation against a server running WITHOUT
# block mode validates the wrong deployment and can only ever pass.
- name: Start OmniRoute (block mode)
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
PORT: "21778"
INJECTION_GUARD_MODE: block
DISABLE_SQLITE_AUTO_BACKUP: "true"
run: |
node dist/server.js > server.log 2>&1 &
echo $! > server.pid
for i in $(seq 1 60); do
if curl -sf http://localhost:21778/api/monitoring/health >/dev/null; then echo up; exit 0; fi
sleep 2
done
echo "::error::Test server did not come up on 21778 in 120s — see server.log. Refusing to run the guard eval against an unknown target."
tail -40 server.log || true
exit 1
# Pin the CLI to the lockfile version and execute outside the checkout so
# npx cannot select a conflicting local dependency tree (#17017).
# 0.125.1 still treats object.error as a scheduler failure (#10866); the
# config requires HTTP 400 and serializes the complete JSON body before
# assertions inspect SECURITY_001. The offline HTTP fixture verifies both
# accepted blocks and rejected wrong-code/status responses.
- name: promptfoo guard-validation
working-directory: ${{ runner.temp }}
run: npx --yes promptfoo@0.125.1 eval -c "$GITHUB_WORKSPACE/promptfooconfig.yaml" --no-cache
env:
OMNIROUTE_URL: http://localhost:21778
OMNIROUTE_API_KEY: not-needed-blocked-before-upstream
- name: Stop server
if: always()
run: kill "$(cat server.pid)" || true
garak:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: garak probes (skip without provider secret)
# #11965: this job runs a backend-only `next build`; the hosted 7 GB runner cannot build
# release/v3.8.51 (VM shutdown ~7 min in), so it targets the box's light pool (`omni-light`:
# two listeners, jobs ≤ ~6 GB). Falls back to hosted when USE_VPS_RUNNER is off.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
# NOTE: the `secrets` context is NOT available in a job-level `if:` — referencing
# it there makes GitHub reject the file on push (startup_failure on every push).
# Map the secret into a job-level env and gate each step on a presence check, so
# the job stays green and simply skips the probes when the secret is absent.
env:
PROMPTFOO_PROVIDER_KEY: ${{ secrets.PROMPTFOO_PROVIDER_KEY }}
steps:
- name: Gate on provider secret
id: gate
run: |
if [ -n "$PROMPTFOO_PROVIDER_KEY" ]; then
echo "run=true" >> "$GITHUB_OUTPUT"
else
echo "run=false" >> "$GITHUB_OUTPUT"
echo "::notice::PROMPTFOO_PROVIDER_KEY not set — skipping garak probes (advisory)."
fi
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
if: steps.gate.outputs.run == 'true'
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
if: steps.gate.outputs.run == 'true'
with: { node-version: "24", cache: npm }
# Same isolation as the promptfoo job above: a fresh DATA_DIR per run, never the
# runner's persistent $HOME/.omniroute (stale schema → migration guard → no boot).
- name: Prepare isolated runtime state
id: runtime
if: steps.gate.outputs.run == 'true'
run: |
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-llm-security.XXXXXX")
mkdir "$data_dir/plugins"
{
echo "DATA_DIR=$data_dir"
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
} >> "$GITHUB_ENV"
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
if: steps.gate.outputs.run == 'true'
- name: Build CLI bundle
if: steps.gate.outputs.run == 'true'
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
OMNIROUTE_USE_TURBOPACK: "0"
run: npm run build:cli
# Same contract as the promptfoo job above: dedicated port, and the
# health wait must fail the job instead of letting garak probe whatever
# else listens on the default port.
- name: Start OmniRoute
if: steps.gate.outputs.run == 'true'
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
PORT: "21779"
DISABLE_SQLITE_AUTO_BACKUP: "true"
run: |
node dist/server.js > server.log 2>&1 &
echo $! > server.pid
for i in $(seq 1 60); do
if curl -sf http://localhost:21779/api/monitoring/health >/dev/null; then echo up; exit 0; fi
sleep 2
done
echo "::error::Test server did not come up on 21779 in 120s — see server.log."
tail -40 server.log || true
exit 1
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
if: steps.gate.outputs.run == 'true'
with: { python-version: "3.12" }
- run: pip install garak
if: steps.gate.outputs.run == 'true'
- name: garak limited probes
if: steps.gate.outputs.run == 'true'
env:
OPENAI_API_KEY: ${{ secrets.PROMPTFOO_PROVIDER_KEY }}
OPENAI_BASE_URL: http://localhost:21779/v1
run: garak --model_type openai --model_name gpt-4o-mini --probes promptinject,dan,leakreplay --report_prefix garak-omniroute || true
- name: Stop server
if: always() && steps.gate.outputs.run == 'true'
run: kill "$(cat server.pid)" || true

View File

@@ -1,166 +0,0 @@
name: Nightly Mutation
on:
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
stryker:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Stryker mutation (batch ${{ matrix.batch.name }} — advisory)
runs-on: ubuntu-latest
# Mutation testing is expensive. History of the budget:
# - Full 8-module set TIMED OUT at the 180min cap (run 27705123780 = exactly 180min).
# The two god-files chatCore.ts/combo.ts dominated ~2/3 of the mutants and were
# removed from stryker.conf.mjs `mutate`.
# - The remaining 6 modules in 3 batches: auth.ts and accountFallback.ts are large; the
# a (auth+publicCreds) and b (accountFallback+error) batches still ran near the 180min
# cap (the perTest dry-run over ~130 covering test files is itself costly), so the two
# big modules are now ISOLATED into their own batches (a=auth, b=accountFallback).
# - Onda 3 / Fase 9 T5 re-add: combo.ts was split into 11 leaves; the 8 well-covered
# combo/* leaves are back in `mutate` (covered by the 24 combo-*.test.ts), grouped into
# 2 batches (d=heavy, e=light). After #4204 (D7b) merged, the reset-aware quota pair
# quotaScoring/quotaStrategies was added as batch f. A covering-test audit then added the
# 6 chatCore/* leaves with direct unit coverage as batch g. A follow-up then wrote dedicated
# unit tests for 6 more leaves and added them as batch h. A final follow-up added dedicated
# tests (no mock.module — fetch-override + crafted inputs + temp-DATA_DIR) for telemetryHelpers
# + memorySkillsInjection + semanticCache (its cache-HIT block now has a setCachedResponse
# fixture) as batch i — ALL 15/15 chatCore leaves are now mutated. See
# the comment above MUTATE in stryker.conf.mjs.
# 9 PARALLEL batches, each overriding the mutate set via `--mutate` (Stryker 9 CLI:
# `-m, --mutate <comma-list>`; the conf's `mutate[]` remains the local-run default/union).
# - Cold-seeding budget (per-batch `timeout-minutes: ${{ matrix.batch.timeout || 180 }}`):
# a COLD run must COMPLETE once to write stryker-incremental.json (Stryker writes it only on
# a successful finish); a job cancelled at the cap writes nothing, so the next run is cold
# again — an infinite never-seeds loop. actions/cache is also branch-scoped, so each branch
# (incl. release) must seed its OWN cache via a run with enough headroom. Measured cold runs
# Measured cold totals (run 27801802713, extrapolated from the % at the 180/350 cancel point):
# auth ~375min (2301 mutants — EXCEEDS the 360min job max even isolated), accountFallback
# ~358min (1441), the c security quartet ~348min (1163), d ~197min (1316), g=142, h=132, e=66,
# f=45, i=33. The widely-covered modules blow the budget because the tap-runner re-runs every
# covering test file per mutant (a perTest fixed cost over ~138 test files, times thousands of
# mutants). A flat timeout bump cannot rescue auth (>360min max) — so the three over-budget
# batches are SPLIT so each half fits: auth->a1/a2 and accountFallback->b1/b2 by mutation range
# (`file:startLine-endLine`), the c quartet->c1/c2 by module pair. Splitting also seeds each
# sub-batch's own incremental cache, after which nightlies re-test only changed mutants.
# Full coverage every night in parallel; wall-clock = the slowest batch's cold run until seeded.
# Runs at stryker concurrency=4 with per-process DATA_DIR isolation
# (tests/_setup/isolateDataDir.ts) — see the concurrency comment in stryker.conf.mjs.
strategy:
fail-fast: false
matrix:
batch:
# Per-batch `timeout` (minutes) tiers the cold-seeding budget by measured cost; batches
# without the key default to 180. Cold-run profiling (run 27801802713) showed the
# widely-covered modules need FAR more than the 180 cap because the tap-runner re-runs every
# covering test file per mutant: auth ~375min (2301 mutants, EXCEEDS the 360min GitHub job
# max even isolated), accountFallback ~358min, the c security quartet ~348min — none fit a
# single job. So auth/accountFallback are split by MUTATION RANGE (`file:startLine-endLine`,
# ~half the mutants each) into a1/a2, b1/b2; the c quartet is split by MODULE pair into
# c1/c2. d (3 combo modules, ~197min) stays whole. Split-heavy batches get 300min headroom
# for their cold seeding run; once each batch completes once and writes
# stryker-incremental.json, later runs re-test only changed mutants and finish far faster.
# g/h (142/132min cold) keep a 240 buffer; e/f/i (33-66min) keep the 180 default.
- name: a1
mutate: "src/sse/services/auth.ts:1-1109"
timeout: 300
- name: a2
mutate: "src/sse/services/auth.ts:1110-2218"
timeout: 300
- name: b1
mutate: "open-sse/services/accountFallback.ts:1-863"
timeout: 300
- name: b2
mutate: "open-sse/services/accountFallback.ts:864-1726"
timeout: 300
- name: c1
mutate: "src/server/authz/routeGuard.ts,src/shared/utils/circuitBreaker.ts"
timeout: 300
- name: c2
mutate: "open-sse/utils/error.ts,open-sse/utils/publicCreds.ts"
timeout: 300
- name: d
mutate: "open-sse/services/combo/comboStructure.ts,open-sse/services/combo/autoStrategy.ts,open-sse/services/combo/validateQuality.ts"
timeout: 300
- name: e
mutate: "open-sse/services/combo/shadowRouting.ts,open-sse/services/combo/targetSorters.ts,open-sse/services/combo/comboPredicates.ts,open-sse/services/combo/rrState.ts,open-sse/services/combo/comboData.ts"
- name: f
mutate: "open-sse/services/combo/quotaScoring.ts,open-sse/services/combo/quotaStrategies.ts"
- name: g
mutate: "open-sse/handlers/chatCore/comboContextCache.ts,open-sse/handlers/chatCore/idempotency.ts,open-sse/handlers/chatCore/passthroughHelpers.ts,open-sse/handlers/chatCore/responseHeaders.ts,open-sse/handlers/chatCore/sanitization.ts,open-sse/handlers/chatCore/upstreamTimeouts.ts"
timeout: 240
- name: h
mutate: "open-sse/handlers/chatCore/headers.ts,open-sse/handlers/chatCore/logTruncation.ts,open-sse/handlers/chatCore/memoryExtraction.ts,open-sse/handlers/chatCore/nonStreamingSse.ts,open-sse/handlers/chatCore/passthroughToolNames.ts,open-sse/handlers/chatCore/executorHelpers.ts"
timeout: 240
- name: i
mutate: "open-sse/handlers/chatCore/telemetryHelpers.ts,open-sse/handlers/chatCore/memorySkillsInjection.ts,open-sse/handlers/chatCore/semanticCache.ts"
# Per-batch budget: split-heavy batches (a1/a2/b1/b2/c1/c2/d) override to 300min, g/h to 240min;
# the rest default to 180min. `matrix.batch.timeout` is null for batches without the key -> `|| 180`.
# NOTE: a1+a2 both mutate auth.ts (disjoint line ranges) and b1+b2 both mutate accountFallback.ts;
# when merging the per-batch mutation.json for radiography/scores, same-file mutants from sibling
# ranges must be UNIONED (scripts/check/check-mutation-ratchet.mjs::measureMutationScores and
# scripts/quality/mutation-radiography.mjs both merge per file).
timeout-minutes: ${{ matrix.batch.timeout || 180 }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Restore Stryker incremental cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: reports/mutation/stryker-incremental.json
key: stryker-incremental-${{ matrix.batch.name }}-${{ github.run_id }}
restore-keys: stryker-incremental-${{ matrix.batch.name }}-
- name: Run Stryker (advisory)
id: stryker
continue-on-error: true
env:
BATCH_MUTATE: ${{ matrix.batch.mutate }}
run: npx stryker run --mutate "$BATCH_MUTATE"
- name: Upload mutation report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: mutation-report-${{ matrix.batch.name }}
path: reports/mutation/
if-no-files-found: warn
retention-days: 14
# Aggregation gate (T3): each split batch emits a PARTIAL view of a mutated file
# (auth.ts lives in a1+a2, accountFallback in b1+b2), so a PER-BATCH ratchet would
# only ever see half a file vs the whole-file baseline. This job runs AFTER every
# batch, downloads all reports, and ratchets the MERGED per-module scores
# (check-mutation-ratchet UNIONS same-file mutants across reports) against the
# dedicatedGate `mutationScore.*` floors in quality-baseline.json (seeded ~2pt below
# the first full measurement). Blocking: a module dropping below its floor fails the
# run. Missing reports (e.g. an artifact-upload flake) are skipped, never failed.
mutation-ratchet:
name: Mutation score ratchet (blocking)
needs: stryker
if: ${{ always() && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
- name: Download all mutation reports
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
pattern: mutation-report-*
path: reports/all
- name: Ratchet merged per-module mutation scores
run: node scripts/check/check-mutation-ratchet.mjs reports/all/*/mutation.json --ratchet

View File

@@ -1,38 +0,0 @@
name: Nightly Property Discovery
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
property-random-seed:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: fast-check random seed (high runs)
id: prop
run: FC_SEED=random FC_NUM_RUNS=2000 npm run test:property
- name: Open issue on failure
if: failure()
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
script: |
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Nightly property-test failure (Fase 8 B)",
body: "fast-check found a counterexample with a random seed. Check the run logs for the reproducible seed + minimal case, then add it as a fixture.\n\nRun: " + context.serverUrl + "/" + context.repo.owner + "/" + context.repo.repo + "/actions/runs/" + context.runId,
labels: ["quality-gate-finding"],
});

View File

@@ -1,913 +0,0 @@
name: Release-Green (continuous)
# Continuous validation: artifacts, issue state and job exit must agree.
#
# WHY: the full gate (ci.yml) only runs on the release PR (PR → main), so reds
# accrue silently on release/** and explode — in layers — at release time. This
# workflow reproduces the release-equivalent validation on the release branch and,
# when there are HARD failures, opens/updates a single tracking issue.
#
# WS5.1 (v3.8.49 quality plan) — two modes:
# push to release/v* (code paths) → --quick (fast HARD gates, ~5-8min). Catches the
# captain's direct pushes (sync-back — the one ungated write path) AND the merged
# COMBINATION right after every PR merge, attributing the offending push range in
# the issue. Base-red MTTD drops from ≤24h to ≤~15min after the offending push.
# schedule → full --with-build --full-ci (the deep sweep incl. build+suites): 3×/day for
# the release branch, 1×/day (05:23) for main, whose SHA only moves on a release.
#
# It is NOT a required status check and never touches a contributor PR — it only
# reports. Ratchet drift (eslint warnings / cognitive-complexity / file-size) is
# expected mid-cycle and is reported but never raises the alarm on its own; only
# real defects (typecheck / lint errors / unit / vitest / db-rules / public-creds /
# package-artifact) flip the issue open.
on:
push:
branches: ["release/v*", "main"]
paths:
- "src/**"
- "open-sse/**"
- "bin/**"
- "electron/**"
- "scripts/**"
- "tests/**"
- "config/**"
- ".github/workflows/**"
- ".github/actions/**"
- "package.json"
- "package-lock.json"
- "tsconfig*.json"
schedule:
- cron: "23 5 * * *" # full sweep — off-peak, distinct from other nightlies
- cron: "23 12 * * *" # full sweep — midday (WS5.1: 3×/day instead of 1×); release only
- cron: "23 18 * * *" # full sweep — evening; release only (main-green runs at 05:23 only)
workflow_dispatch:
inputs:
branch:
description: "Release branch to validate (default: highest release/vX.Y.Z)"
required: false
type: string
permissions:
contents: read
issues: write
concurrency:
# push storms during merge campaigns collapse to the newest commit per branch;
# scheduled full sweeps keep their own single lane. A started run is never cancelled:
# with cancel-in-progress on push, ~10 pushes/hour cancelled 97 of 100 push runs in a
# day (2026-10-18) after 2-18 min of work each, so the per-merge verdict almost never
# landed. GitHub keeps one running + one pending run per group, and a newer push still
# replaces the pending one, so the storm still collapses — without throwing work away.
group: release-green-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: false
env:
OMNIROUTE_SKIP_SYSTEM_TRUST: "1"
jobs:
# Schedule/dispatch only: the commit the hosted suites and the slot validation share.
# Resolved once so a push landing mid-sweep cannot split the lanes across two commits.
resolve-target:
name: Resolve sweep target
if: ${{ github.event_name != 'push' && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
target: ${{ steps.resolve.outputs.target }}
sha: ${{ steps.resolve.outputs.sha }}
node-version: ${{ steps.runtime.outputs.node-version }}
steps:
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
id: runtime
with:
node-version: "24"
package-manager-cache: false
- name: Resolve the active release branch and its tip
id: resolve
env:
GH_TOKEN: ${{ github.token }}
INPUT_BRANCH: ${{ github.event.inputs.branch }}
run: |
set -euo pipefail
if [ -n "${INPUT_BRANCH:-}" ]; then
TARGET="$INPUT_BRANCH"
else
TARGET=$(gh api "repos/$GITHUB_REPOSITORY/branches?per_page=100" --paginate \
--jq '.[].name' | grep -E '^release/v[0-9]+\.[0-9]+\.[0-9]+$' | sort -t/ -k2 -V | tail -1)
fi
if ! printf '%s' "$TARGET" | grep -qE '^release/v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Refusing non-canonical branch name: $TARGET"; exit 1
fi
SHA=$(gh api "repos/$GITHUB_REPOSITORY/branches/$TARGET" --jq '.commit.sha')
if ! printf '%s' "$SHA" | grep -qE '^[0-9a-f]{40}$'; then echo "No tip for $TARGET"; exit 1; fi
echo "target=$TARGET" >> "$GITHUB_OUTPUT"
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
echo "Sweep target: $TARGET @ $SHA"
# The full sweep's unit, integration and vitest lanes, on hosted runners with ci.yml's own
# shards and commands. On the 8-core omni-release slot they took ~4h15 per sweep and failed
# timing tests on CPU starvation (2026-10-19/20); hosted, a shard takes ~13 min. The shard
# counts must match ci.yml (tests/unit/validate-release-green.test.ts pins it).
suites:
name: Hosted suite (${{ matrix.name }})
needs: resolve-target
if: ${{ github.event_name != 'push' && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- { name: unit-1, script: "test:unit:ci:shard", shard: "1/8" }
- { name: unit-2, script: "test:unit:ci:shard", shard: "2/8" }
- { name: unit-3, script: "test:unit:ci:shard", shard: "3/8" }
- { name: unit-4, script: "test:unit:ci:shard", shard: "4/8" }
- { name: unit-5, script: "test:unit:ci:shard", shard: "5/8" }
- { name: unit-6, script: "test:unit:ci:shard", shard: "6/8" }
- { name: unit-7, script: "test:unit:ci:shard", shard: "7/8" }
- { name: unit-8, script: "test:unit:ci:shard", shard: "8/8" }
- { name: integration-1, script: "test:integration:ci", shard: "1/2" }
- { name: integration-2, script: "test:integration:ci", shard: "2/2" }
- { name: vitest, script: "test:vitest", shard: "" }
env:
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-nightly-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
# Same gate mode as the observer's own HARD gates (withHardGateMode in
# validate-release-green.mjs): these results feed its verdict through --suites-from.
# Release-mode assertions (e.g. locale key parity) belong to the release cut.
OMNIROUTE_GATE_MODE: "pr"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.resolve-target.outputs.sha }}
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ needs.resolve-target.outputs.node-version }}
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Run the suite and record its result
env:
NAME: ${{ matrix.name }}
SUITE: ${{ matrix.script }}
TEST_SHARD: ${{ matrix.shard }}
NODE_OPTIONS: --max-old-space-size=8192
run: |
set +e
if [[ "$NAME" == integration-* ]]; then
# as ci.yml's test-integration job
export DATA_DIR="/tmp/omniroute-ci-${NAME#integration-}"
export INITIAL_PASSWORD=ci-test-password-for-integration
fi
(
if [ "$NAME" = "vitest" ]; then
npm run test:vitest && npm run test:vitest:ui
else
npm run "$SUITE"
fi
) 2>&1 | tee suite.log
code=${PIPESTATUS[0]}
node scripts/ci/release-green-suite.mjs "$NAME" "$code" suite.log suite-results \
"$GITHUB_WORKFLOW_SHA" "$SUITE" "$TEST_SHARD" || exit "$?"
exit "$code"
- name: Upload the suite result
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: release-green-suite-${{ github.run_attempt }}-${{ matrix.name }}
path: suite-results/
if-no-files-found: ignore
retention-days: 7
release-green:
name: Validate active release branch
# On a push, only run for release/* pushes — a push to main is handled by the
# main-green job below. Schedule/dispatch always run (they validate the highest release).
# On push the two jobs above are skipped; !cancelled() keeps this job from being skipped
# with them, and on schedule/dispatch it still reports when a suite job failed.
needs: [resolve-target, suites]
if: ${{ !cancelled() && (github.event_name != 'push' || startsWith(github.ref_name, 'release/')) && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
# Dynamic runner: with USE_VPS_RUNNER=true (release window / on-demand pre-flight)
# this runs on the dedicated VPS runner — clean env (no operator OMNIROUTE_API_KEY,
# no local noauth CLIs => zero machine-specific false positives) and no contention.
# Nightly cron normally finds the var false (VM off) and falls back to hosted.
# Own slot (docs/ops/RUNNER_BOX.md): `omni-release` is omniroute-113-6 only, so the
# validation no longer queues on the single `omni-build` slot (the 2026-10-18 05:29
# sweep waited 6 h for it). That slot is capped at 24 GB, so the validation's build
# runs on webpack (~14-16 GB); Turbopack fidelity stays with ci.yml's Build on
# `omni-build` and with the npm publish.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-release"]')) || 'ubuntu-latest' }}
env:
OMNIROUTE_USE_TURBOPACK: "0"
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-nightly-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- name: Resolve active release branch
id: branch
env:
INPUT_BRANCH: ${{ github.event.inputs.branch }}
EVENT_NAME: ${{ github.event_name }}
PUSHED_REF: ${{ github.ref_name }}
SWEEP_TARGET: ${{ needs.resolve-target.outputs.target }}
run: |
set -euo pipefail
if [ -n "${SWEEP_TARGET:-}" ]; then
# schedule/dispatch: the branch the hosted suites tested
TARGET="$SWEEP_TARGET"
elif [ -n "${INPUT_BRANCH:-}" ]; then
TARGET="$INPUT_BRANCH"
elif [ "$EVENT_NAME" = "push" ]; then
# validate exactly what was pushed, not the highest branch
TARGET="$PUSHED_REF"
else
# highest release/vX.Y.Z by semver among remote branches
TARGET=$(git for-each-ref --format='%(refname:short)' 'refs/remotes/origin/release/v*' \
| sed 's#origin/##' \
| sort -t/ -k2 -V \
| tail -1)
fi
if [ -z "$TARGET" ]; then echo "No release/v* branch found"; exit 1; fi
# Strict format guard — reject anything that isn't release/vX.Y.Z (blocks
# ref/command injection via the workflow_dispatch input).
if ! printf '%s' "$TARGET" | grep -qE '^release/v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Refusing non-canonical branch name: $TARGET"; exit 1
fi
echo "target=$TARGET" >> "$GITHUB_OUTPUT"
echo "Active release branch: $TARGET"
- name: Checkout the release branch
env:
TARGET: ${{ steps.branch.outputs.target }}
EVENT_NAME: ${{ github.event_name }}
PUSH_SHA: ${{ github.sha }}
SWEEP_SHA: ${{ needs.resolve-target.outputs.sha }}
run: |
set -euo pipefail
if [ "$EVENT_NAME" = "push" ]; then
git checkout --detach "$PUSH_SHA"
elif [ -n "${SWEEP_SHA:-}" ]; then
# the exact commit the hosted suites tested
git checkout --detach "$SWEEP_SHA"
else
git checkout --detach "origin/$TARGET"
fi
git log -1 --oneline
- name: Record validated revision
id: revision
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ needs.resolve-target.outputs.node-version || '24' }}
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Collect the hosted suite results
if: github.event_name != 'push'
continue-on-error: true
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
# A partial re-run cannot reuse receipts from an earlier attempt;
# rerun all suite jobs for a new complete observation of the same tip.
pattern: release-green-suite-${{ github.run_attempt }}-*
path: suite-results
merge-multiple: true
# Use the immutable workflow revision, not the target checkout (which may
# predate these installers). Quick requires the workflow pair; full also
# requires security scanners.
- name: Prepare pinned quality scanners
id: workflow_scanners
env:
WORKFLOW_SHA: ${{ github.workflow_sha }}
EVENT_NAME: ${{ github.event_name }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
installers=$(mktemp -d "${RUNNER_TEMP:?}/quality-scanners-installers.XXXXXX")
git show "${WORKFLOW_SHA}:scripts/ci/install-workflow-scanners.sh" > "$installers/install-workflow-scanners.sh"
if [ "$EVENT_NAME" = "push" ]; then
bash "$installers/install-workflow-scanners.sh"
else
git show "${WORKFLOW_SHA}:scripts/ci/install-quality-scanners.sh" > "$installers/install-quality-scanners.sh"
bash "$installers/install-quality-scanners.sh"
fi
- name: Release-green validation (full)
id: validate
env:
EVENT_NAME: ${{ github.event_name }}
VALIDATED_SHA: ${{ steps.revision.outputs.sha }}
run: |
set +e
# --hermetic: scrub live-test trigger vars (self-hosted runner may carry
# operator env; hosted ignores the unknown flag before #6300 lands).
# push → --quick: fast HARD gates only (~5-8min), per-merge signal.
# schedule/dispatch → --with-build --full-ci: ALSO run every static gate from
# ci.yml's gate jobs (lint, quality-gate, quality-extended, docs-sync-strict,
# pr-test-policy) + build + full suites. PRs into release/** only get the
# fast-gates, so these accrue silently and explode in layers on the release PR
# (v3.8.46: 11 static base-reds leaked).
if [ "$EVENT_NAME" = "push" ]; then
MODE="--quick"
else
# unit/integration/vitest ran in the hosted `suites` jobs; a missing result fails
mkdir -p suite-results
MODE="--with-build --full-ci --suites-from suite-results"
fi
echo "[release-green] mode: $MODE (event: $EVENT_NAME)"
# MODE is an intentional flag list, so word-splitting is wanted here
# shellcheck disable=SC2086
node scripts/quality/validate-release-green.mjs --json --hermetic $MODE \
--suites-workflow-sha "$GITHUB_WORKFLOW_SHA" \
1> release-green.json 2> release-green.log
validation_exit=$?
node scripts/ci/release-green-result.mjs release-green.json "$validation_exit" "$VALIDATED_SHA" "$EVENT_NAME" >> release-green.log
echo "------- report -------"
cat release-green.log
- name: Open / update tracking issue on HARD failure
if: steps.validate.outputs.exit != '0'
env:
GH_TOKEN: ${{ github.token }}
TARGET: ${{ steps.branch.outputs.target }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
EVENT_NAME: ${{ github.event_name }}
BEFORE_SHA: ${{ github.event.before }}
AFTER_SHA: ${{ github.event.after }}
run: |
set -euo pipefail
TITLE="🔴 Release branch not green: ${TARGET}"
{
echo "The **release-green** validation found HARD failures on \`${TARGET}\`."
echo "The required validation failed or its evidence was incomplete. Compare the"
echo "signature on the exact base before attributing a defect to a contributor."
echo ""
echo "**Run:** ${RUN_URL} (mode: ${EVENT_NAME})"
# This is an observed range, not proof of causality. Compare with the base.
if [ "$EVENT_NAME" = "push" ] && [ -n "${BEFORE_SHA:-}" ] && \
git cat-file -e "$BEFORE_SHA" 2>/dev/null; then
echo ""
echo "**Observed push range** (\`${BEFORE_SHA:0:9}..${AFTER_SHA:0:9}\`):"
echo '```'
git log --no-decorate --oneline "${BEFORE_SHA}..${AFTER_SHA}" | head -20
echo '```'
fi
echo ""
echo '```'
if grep -q '──────── verdict ────────' release-green.log; then
sed -n '/──────── verdict ────────/,$p' release-green.log
else
tail -40 release-green.log
fi
echo '```'
echo ""
echo "_Ratchet drift (eslint warnings / cognitive-complexity / file-size) listed above is expected mid-cycle and is rebaselined at release — it is NOT a contributor concern and did not, on its own, open this issue._"
} > issue-body.md
EXISTING=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "in:title $TITLE" --json number --jq '.[0].number' 2>/dev/null || echo "")
if [ -n "$EXISTING" ]; then
gh issue comment "$EXISTING" --repo "$GITHUB_REPOSITORY" --body-file issue-body.md
echo "Updated existing issue #$EXISTING"
else
gh issue create --repo "$GITHUB_REPOSITORY" --title "$TITLE" --label base-red --body-file issue-body.md
fi
- name: Close tracking issue when the branch is green again
if: steps.validate.outputs.exit == '0' && github.event_name != 'push'
env:
GH_TOKEN: ${{ github.token }}
TARGET: ${{ steps.branch.outputs.target }}
VALIDATED_SHA: ${{ steps.revision.outputs.sha }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
CURRENT_SHA=$(git ls-remote origin "refs/heads/$TARGET" | cut -f1)
if [ "$CURRENT_SHA" != "$VALIDATED_SHA" ]; then
echo "Branch advanced; retaining the tracking issue."
exit 0
fi
# The open/update step above is the UPWARD half of the loop; without this
# step a stale "not green" issue outlives the fix and every base-green check
# (`AGENTS.md` → "Base-green check") keeps stamping new PRs as base-red inherited.
TITLE="🔴 Release branch not green: ${TARGET}"
EXISTING=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "in:title $TITLE" --json number --jq '.[0].number' 2>/dev/null || echo "")
if [ -n "$EXISTING" ]; then
gh issue close "$EXISTING" --repo "$GITHUB_REPOSITORY" --reason completed \
--comment "✅ \`${TARGET}\` is release-green again at \`${VALIDATED_SHA}\` — ${RUN_URL}. Auto-closed after full validation of the current branch."
echo "Closed issue #$EXISTING"
fi
# Best-effort: the verdict above is already recorded (issue open/closed,
# step summary). The artifact upload has raced job teardown on the shared
# runner three runs in a row (403 "job is completed" after the job was
# done), turning a finished verdict into a red run — a false base-red
# that every PR gate reads. Never let the upload outvote the verdict.
- name: Upload report artifact
if: always()
continue-on-error: true
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: release-green-report
path: |
release-green.json
release-green.log
suite-results/
_artifacts/release-green/
if-no-files-found: error
retention-days: 14
- name: Enforce validation verdict
if: always()
env:
VALIDATION_EXIT: ${{ steps.validate.outputs.exit }}
VALIDATED_SHA: ${{ steps.revision.outputs.sha }}
EVENT_NAME: ${{ github.event_name }}
run: node scripts/ci/release-green-result.mjs release-green.json "$VALIDATION_EXIT" "$VALIDATED_SHA" "$EVENT_NAME"
# main's own sweep target, resolved once so the hosted suites and the slot validation
# cannot split across two commits. Same 05:23-only schedule as main-green.
resolve-main:
name: Resolve main sweep target
if: ${{ github.event_name != 'push' && (github.event_name != 'schedule' || (github.repository == 'cheaper-inference/OmniRoute' && github.event.schedule == '23 5 * * *')) }}
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
sha: ${{ steps.resolve.outputs.sha }}
steps:
- name: Resolve the main tip
id: resolve
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
SHA=$(gh api "repos/$GITHUB_REPOSITORY/branches/main" --jq '.commit.sha')
if ! printf '%s' "$SHA" | grep -qE '^[0-9a-f]{40}$'; then echo "No tip for main"; exit 1; fi
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
# Same reasons as `suites`: the 8-core root slot cannot run these lanes meaningfully.
# The matrix must match main's ci.yml shard counts; a mismatch fails closed as missing receipts.
main-suites:
name: Hosted main suite (${{ matrix.name }})
needs: [resolve-target, resolve-main]
if: ${{ github.event_name != 'push' && (github.event_name != 'schedule' || (github.repository == 'cheaper-inference/OmniRoute' && github.event.schedule == '23 5 * * *')) }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- { name: unit-1, script: "test:unit:ci:shard", shard: "1/8" }
- { name: unit-2, script: "test:unit:ci:shard", shard: "2/8" }
- { name: unit-3, script: "test:unit:ci:shard", shard: "3/8" }
- { name: unit-4, script: "test:unit:ci:shard", shard: "4/8" }
- { name: unit-5, script: "test:unit:ci:shard", shard: "5/8" }
- { name: unit-6, script: "test:unit:ci:shard", shard: "6/8" }
- { name: unit-7, script: "test:unit:ci:shard", shard: "7/8" }
- { name: unit-8, script: "test:unit:ci:shard", shard: "8/8" }
- { name: integration-1, script: "test:integration:ci", shard: "1/2" }
- { name: integration-2, script: "test:integration:ci", shard: "2/2" }
- { name: vitest, script: "test:vitest", shard: "" }
env:
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-nightly-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
# Same gate mode as the observer's own HARD gates (withHardGateMode in
# validate-release-green.mjs): these results feed its verdict through --suites-from.
# Release-mode assertions (e.g. locale key parity) belong to the release cut.
OMNIROUTE_GATE_MODE: "pr"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.resolve-main.outputs.sha }}
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ needs.resolve-target.outputs.node-version }}
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Run the suite and record its result
env:
NAME: ${{ matrix.name }}
SUITE: ${{ matrix.script }}
TEST_SHARD: ${{ matrix.shard }}
NODE_OPTIONS: --max-old-space-size=8192
run: |
set +e
if [[ "$NAME" == integration-* ]]; then
# as ci.yml's test-integration job
export DATA_DIR="/tmp/omniroute-ci-${NAME#integration-}"
export INITIAL_PASSWORD=ci-test-password-for-integration
fi
(
if [ "$NAME" = "vitest" ]; then
npm run test:vitest && npm run test:vitest:ui
else
npm run "$SUITE"
fi
) 2>&1 | tee suite.log
code=${PIPESTATUS[0]}
node scripts/ci/release-green-suite.mjs "$NAME" "$code" suite.log suite-results \
"$GITHUB_WORKFLOW_SHA" "$SUITE" "$TEST_SHARD" || exit "$?"
exit "$code"
- name: Upload the suite result
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: main-green-suite-${{ github.run_attempt }}-${{ matrix.name }}
path: suite-results/
if-no-files-found: ignore
retention-days: 7
# Companion arm for `main`. Under the parallel-cycle model, main only receives merged
# work at the release squash — so a gate/infra fix that lands only on release leaves
# main red the whole cycle, and repo-wide gates (CodeQL alert count, ratchet baselines)
# turn EVERY PR into main red on a check unrelated to its diff. This detects that and
# opens a "🔴 main not green" tracking issue. The PREVENTION is the companion-PR reflex
# (Hard Rule #21 area / _shared/merge-gates.md §8); this is the automated backstop.
main-green:
name: Validate main branch
# On a push, only run for a push to main — a push to release/* is handled by
# release-green above. Dispatch always runs. On schedule, only the 05:23 cron sweeps
# main: main's SHA only moves on a release or hotfix, so the midday and evening sweeps
# re-validated the same commit and held the single `omni-release` slot for ~2 h each
# (2026-10-19: 08:04–10:01 right after the 2 h20 release sweep, while a `--quick` push
# run waited ~4 h in the group). The release branch keeps all three sweeps.
# On push the three jobs above are skipped; !cancelled() keeps this job from being skipped
# with them, and on schedule/dispatch it still reports when a suite job failed.
needs: [resolve-target, resolve-main, main-suites]
if: ${{ !cancelled() && (github.event_name != 'push' || github.ref_name == 'main') && (github.event_name != 'schedule' || (github.repository == 'cheaper-inference/OmniRoute' && github.event.schedule == '23 5 * * *')) }}
# Own slot (docs/ops/RUNNER_BOX.md): `omni-release` is omniroute-113-6 only, so the
# validation no longer queues on the single `omni-build` slot (the 2026-10-18 05:29
# sweep waited 6 h for it). That slot is capped at 24 GB, so the validation's build
# runs on webpack (~14-16 GB); Turbopack fidelity stays with ci.yml's Build on
# `omni-build` and with the npm publish.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-release"]')) || 'ubuntu-latest' }}
env:
OMNIROUTE_USE_TURBOPACK: "0"
JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-nightly-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.event_name == 'push' && github.sha || needs.resolve-main.outputs.sha || 'main' }}
fetch-depth: 0
persist-credentials: false
- name: Record validated revision
id: revision
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
# hostedSuiteIdentity compares nodeVersion exactly, so match the hosted suites' runtime.
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ needs.resolve-target.outputs.node-version || '24' }}
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Collect the hosted suite results
if: github.event_name != 'push'
continue-on-error: true
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
# A partial re-run cannot reuse receipts from an earlier attempt;
# rerun all suite jobs for a new complete observation of the same tip.
pattern: main-green-suite-${{ github.run_attempt }}-*
path: suite-results
merge-multiple: true
# main can predate the installers: materialize both from the workflow SHA.
- name: Prepare pinned quality scanners
id: workflow_scanners
env:
WORKFLOW_SHA: ${{ github.workflow_sha }}
EVENT_NAME: ${{ github.event_name }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
installers=$(mktemp -d "${RUNNER_TEMP:?}/quality-scanners-installers.XXXXXX")
git show "${WORKFLOW_SHA}:scripts/ci/install-workflow-scanners.sh" > "$installers/install-workflow-scanners.sh"
if [ "$EVENT_NAME" = "push" ]; then
bash "$installers/install-workflow-scanners.sh"
else
git show "${WORKFLOW_SHA}:scripts/ci/install-quality-scanners.sh" > "$installers/install-quality-scanners.sh"
bash "$installers/install-quality-scanners.sh"
fi
- name: Main-green validation
id: validate
env:
EVENT_NAME: ${{ github.event_name }}
VALIDATED_SHA: ${{ steps.revision.outputs.sha }}
run: |
set +e
# push (a merge into main) → --quick fast HARD gates; schedule/dispatch → full sweep.
if [ "$EVENT_NAME" = "push" ]; then
MODE="--quick"
else
# unit/integration/vitest ran in the hosted `main-suites` jobs; a missing result fails
mkdir -p suite-results
MODE="--with-build --full-ci --suites-from suite-results"
fi
echo "[main-green] mode: $MODE (event: $EVENT_NAME)"
# MODE is an intentional flag list, so word-splitting is wanted here
# shellcheck disable=SC2086
node scripts/quality/validate-release-green.mjs --json --hermetic $MODE \
--suites-workflow-sha "$GITHUB_WORKFLOW_SHA" \
1> main-green.json 2> main-green.log
validation_exit=$?
node scripts/ci/release-green-result.mjs main-green.json "$validation_exit" "$VALIDATED_SHA" "$EVENT_NAME" >> main-green.log
echo "------- report -------"
cat main-green.log
- name: Open / update tracking issue on HARD failure
if: steps.validate.outputs.exit != '0'
env:
GH_TOKEN: ${{ github.token }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
EVENT_NAME: ${{ github.event_name }}
run: |
set -euo pipefail
TITLE="🔴 main branch not green"
{
echo "The **main-green** validation found HARD failures on \`main\`."
echo ""
echo "Because \`main\` only receives merged work at the release squash, a gate/infra"
echo "fix that landed only on the release branch leaves \`main\` broken for the whole"
echo "cycle — and repo-wide gates (CodeQL alert count, ratchet baselines) then turn"
echo "**every open PR into main** red on a check unrelated to its diff. The fix is a"
echo "companion PR \`--base main\` carrying the release-side fix (see"
echo "\`_shared/merge-gates.md\` §8), NOT chasing each contributor PR."
echo ""
echo "**Run:** ${RUN_URL} (mode: ${EVENT_NAME})"
echo ""
echo '```'
if grep -q '──────── verdict ────────' main-green.log; then
sed -n '/──────── verdict ────────/,$p' main-green.log
else
tail -40 main-green.log
fi
echo '```'
echo ""
echo "_Ratchet drift (eslint warnings / cognitive-complexity / file-size) is expected mid-cycle and did NOT, on its own, open this issue._"
} > issue-body.md
EXISTING=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "in:title $TITLE" --json number --jq '.[0].number' 2>/dev/null || echo "")
if [ -n "$EXISTING" ]; then
gh issue comment "$EXISTING" --repo "$GITHUB_REPOSITORY" --body-file issue-body.md
echo "Updated existing issue #$EXISTING"
else
gh issue create --repo "$GITHUB_REPOSITORY" --title "$TITLE" --label base-red --body-file issue-body.md
fi
- name: Close tracking issue when the branch is green again
if: steps.validate.outputs.exit == '0' && github.event_name != 'push'
env:
GH_TOKEN: ${{ github.token }}
VALIDATED_SHA: ${{ steps.revision.outputs.sha }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
CURRENT_SHA=$(git ls-remote origin refs/heads/main | cut -f1)
if [ "$CURRENT_SHA" != "$VALIDATED_SHA" ]; then
echo "Branch advanced; retaining the tracking issue."
exit 0
fi
# The open/update step above is the UPWARD half of the loop; without this
# step a stale "not green" issue outlives the fix and every base-green check
# (`AGENTS.md` → "Base-green check") keeps stamping new PRs as base-red inherited.
TITLE="🔴 main branch not green"
EXISTING=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "in:title $TITLE" --json number --jq '.[0].number' 2>/dev/null || echo "")
if [ -n "$EXISTING" ]; then
gh issue close "$EXISTING" --repo "$GITHUB_REPOSITORY" --reason completed \
--comment "✅ \`main\` is main-green again at \`${VALIDATED_SHA}\` — ${RUN_URL}. Auto-closed after full validation of the current branch."
echo "Closed issue #$EXISTING"
fi
# Same best-effort contract as the release-green report upload above.
- name: Upload report artifact
if: always()
continue-on-error: true
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: main-green-report
path: |
main-green.json
main-green.log
_artifacts/release-green/
if-no-files-found: error
retention-days: 14
- name: Enforce validation verdict
if: always()
env:
VALIDATION_EXIT: ${{ steps.validate.outputs.exit }}
VALIDATED_SHA: ${{ steps.revision.outputs.sha }}
EVENT_NAME: ${{ github.event_name }}
run: node scripts/ci/release-green-result.mjs main-green.json "$VALIDATION_EXIT" "$VALIDATED_SHA" "$EVENT_NAME"
# ── Banking lane (#8584) ──────────────────────────────────────────────────
# The ratchet is asymmetric: RAISING a cap is a ten-second manual JSON edit made
# under merge pressure, LOWERING one requires someone to run `--update` and commit
# — which no workflow does. Grep `.github/workflows/` for `--update`: only
# wiki-sync.yml (unrelated) and ci.yml's check-quality-ratchet.mjs --require-tighten
# (a different script, a different metric). So a cap outlives the code that earned
# it and every completed decomposition silently becomes a growth allowance for
# whoever touches the file next. Measured on 2026-07-25: 18 frozen files already at
# or under the 800-line new-file cap, up to 132x (schemas.ts, 19 lines / 2523 cap),
# and 31 unfulfilled "tighten via --update next cycle" notes honoured exactly once
# (-1 unit) in six weeks.
#
# This job closes that loop by making the DOWNWARD direction as automatic as the
# upward one is easy. It measures the active release branch, runs the shrink-only
# `--update` paths, and opens ONE always-current PR with the result. It never
# pushes to release/* — a human still merges, so a bad measurement cannot land
# unreviewed. verify-ratchet-bank.mjs is the hard guarantee that the automation can
# only ever write in the shrink direction; if anything was raised, added, or a
# rebaseline note was touched, the job aborts and opens nothing.
#
# Schedule/dispatch only, deliberately NOT on push: banking has no latency
# requirement (a shrink banked within 8h is fine) and a per-merge run would rebuild
# the PR branch repeatedly during merge campaigns while paying for a full ESLint
# walk each time. Detection stays on push (release-green above); banking is batched.
bank-ratchet-shrinks:
name: Bank ratchet shrinks
if: ${{ github.event_name != 'push' && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Resolve active release branch
id: branch
env:
INPUT_BRANCH: ${{ github.event.inputs.branch }}
run: |
set -euo pipefail
if [ -n "${INPUT_BRANCH:-}" ]; then
TARGET="$INPUT_BRANCH"
else
TARGET=$(git for-each-ref --format='%(refname:short)' 'refs/remotes/origin/release/v*' \
| sed 's#origin/##' \
| sort -t/ -k2 -V \
| tail -1)
fi
if [ -z "$TARGET" ]; then echo "No release/v* branch found"; exit 1; fi
# Same strict guard as the validation job — blocks ref/command injection
# through the workflow_dispatch input.
if ! printf '%s' "$TARGET" | grep -qE '^release/v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Refusing non-canonical branch name: $TARGET"; exit 1
fi
echo "target=$TARGET" >> "$GITHUB_OUTPUT"
echo "bank_branch=chore/bank-ratchet-${TARGET#release/}" >> "$GITHUB_OUTPUT"
- name: Checkout the release branch
env:
TARGET: ${{ steps.branch.outputs.target }}
run: |
set -euo pipefail
git checkout "$TARGET"
git log -1 --oneline
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Ratchet the baselines down
run: |
# Both --update paths are shrink-only by construction (file-size writes only
# on `improvements`, complexity-ratchets only when `.improved`), and both exit
# non-zero while the branch is over baseline — which is exactly when there is
# nothing to bank. Their exit code is not the signal; the verifier below is.
# Velocity phase (quality-baseline.json `_policy`, relax-baselines.mjs): the caps
# were raised on purpose, so banking the measured shrink would silently undo the
# 20% headroom every night. Pause the downward ratchet until the phase closes.
if node -e 'process.exit(require("./config/quality/quality-baseline.json")._policy?.phase === "velocity" ? 0 : 1)'; then
echo "Velocity phase active — ratchet banking paused (see docs/architecture/QUALITY_GATES.md → Velocity phase)."
exit 0
fi
set +e
node scripts/check/check-file-size.mjs --update
node scripts/check/check-complexity-ratchets.mjs --update
exit 0
- name: Verify the write only went downward
id: verify
run: |
set -euo pipefail
# Exits 1 if ANYTHING was raised/added or a rebaseline note was touched.
# `set -e` then aborts the job before a commit exists — no PR is opened.
node scripts/quality/verify-ratchet-bank.mjs > bank-summary.md
if [ -n "$(git status --porcelain config/quality/)" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "Nothing to bank — baselines already match the code."
fi
- name: Open / update the banking PR
if: steps.verify.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
TARGET: ${{ steps.branch.outputs.target }}
BANK_BRANCH: ${{ steps.branch.outputs.bank_branch }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$BANK_BRANCH"
git add config/quality/
git commit -m "chore(quality): bank ratchet shrinks measured on ${TARGET}"
git push --force origin "$BANK_BRANCH"
{
echo "Automated banking of quality-ratchet **shrinks** already present in"
echo "\`${TARGET}\` — the downward half of the ratchet, which nothing else runs (#8584)."
echo ""
echo "Produced by \`check:file-size --update\` + \`check:complexity-ratchets --update\`,"
echo "then verified by \`scripts/quality/verify-ratchet-bank.mjs\`: **nothing was raised,"
echo "nothing was added, no rebaseline note was touched** — the job aborts without"
echo "opening a PR if any of those is violated."
echo ""
echo "No product code changes. Merging retires growth allowances that the code no"
echo "longer needs; not merging leaves them available to whoever edits those files next."
echo ""
cat bank-summary.md
echo ""
echo "**Run:** ${RUN_URL}"
} > pr-body.md
EXISTING=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$BANK_BRANCH" \
--state open --json number --jq '.[0].number' 2>/dev/null || echo "")
if [ -n "$EXISTING" ]; then
gh pr edit "$EXISTING" --repo "$GITHUB_REPOSITORY" --body-file pr-body.md
echo "Updated existing PR #$EXISTING"
else
gh pr create --repo "$GITHUB_REPOSITORY" --base "$TARGET" --head "$BANK_BRANCH" \
--title "chore(quality): bank ratchet shrinks (${TARGET})" --body-file pr-body.md
fi
# ── Baseline headroom (velocity phase, 2026-08-30 → v4.0) ──────────────────────
# The ratchets only speak when a baseline is crossed. With every baseline loosened by
# 20% (scripts/quality/relax-baselines.mjs) the question is how fast the budget is
# being consumed — this job measures each gate the way CI does and publishes the
# headroom table in the run summary and retained artifacts. Keep recurring reports
# out of the issue queue; the existing quality gates still enforce their budgets.
baseline-headroom:
name: Baseline headroom
if: ${{ github.event_name != 'push' && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
timeout-minutes: 60
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 1
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Measure headroom on ${{ github.ref_name }}
run: |
set -euo pipefail
node scripts/quality/baseline-headroom.mjs \
--json reports/quality/headroom.json --md reports/quality/headroom.md
cat reports/quality/headroom.md >> "$GITHUB_STEP_SUMMARY"
- name: Upload headroom report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: baseline-headroom-${{ github.run_id }}
path: reports/quality/headroom.*
retention-days: 90

View File

@@ -1,245 +0,0 @@
name: Nightly Resilience
on:
schedule:
- cron: "41 4 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
heap:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Heap-growth gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- run: npm run test:heap
chaos:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Resilience chaos (fault injection)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- run: npm run test:chaos
k6-soak:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: k6 load/soak
# #11965: this job runs a backend-only `next build`; the hosted 7 GB runner cannot build
# release/v3.8.51 (VM shutdown ~7 min in), so it targets the box's light pool (`omni-light`:
# two listeners, jobs ≤ ~6 GB). Falls back to hosted when USE_VPS_RUNNER is off.
# #16853: on hosted it died in `npm run build:cli` 8 nights out of 8 ("The runner has
# received a shutdown signal").
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
# Fresh runtime state per run (same contract as nightly-llm-security.yml). The
# omni-light runner keeps a persistent $HOME, so a server booted without DATA_DIR
# lands on $HOME/.omniroute, where a database left by older runs can sit far behind
# the tip's migrations: the mass-migration guard (#3416) refuses to migrate it and
# the server never becomes healthy. A DATA_DIR under $RUNNER_TEMP is a new database
# every run, so every migration applies and nothing on the box is touched.
- name: Prepare isolated runtime state
id: runtime
run: |
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-k6-soak.XXXXXX")
mkdir "$data_dir/plugins"
{
echo "DATA_DIR=$data_dir"
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
} >> "$GITHUB_ENV"
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build CLI bundle
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
OMNIROUTE_USE_TURBOPACK: "0"
run: npm run build:cli
# Own port: this box also hosts the deployed server on 20128. A test server that
# dies on EADDRINUSE must NOT let the soak fall through to whatever else answers
# there, and a soak against nothing must not go green — the health wait fails the
# job (same contract as nightly-llm-security.yml). Auto-backups stay off: one
# pre-migration backup per boot piles up under the runner's home.
- name: Start OmniRoute (background)
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
PORT: "21776"
DISABLE_SQLITE_AUTO_BACKUP: "true"
run: |
node dist/server.js > server.log 2>&1 &
echo $! > server.pid
for i in $(seq 1 60); do
if curl -sf http://localhost:21776/api/monitoring/health >/dev/null; then echo "server up"; exit 0; fi
sleep 2
done
echo "::error::Test server did not come up on 21776 in 120s — see server.log. Refusing to run the soak against an unknown target."
tail -40 server.log || true
exit 1
- name: Install k6
uses: grafana/setup-k6-action@43b9fc21641a76002687994433dd586f56e791b1 # v1
- name: Run k6 soak
run: k6 run tests/load/k6-soak.js
env:
BASE_URL: http://localhost:21776
SOAK_DURATION: "3m"
SOAK_VUS: "10"
- name: Stop server
if: always()
run: kill "$(cat server.pid)" || true
a11y-build:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: A11y build (production artefact, omni-build)
# #16853: the a11y suite needs a production build of the FULL dashboard, and that build
# does not fit the light pool the a11y job runs on (Turbopack reaches ~40 GB RSS on the
# `.113`, #16169; webpack needs a >= 10 GB V8 heap for this tree). Build it once on the
# build pool — same runner class and Turbopack policy as ci.yml's `build` job — and hand
# the artefact to the a11y job, which only boots it. Falls back to hosted (webpack) when
# the VPS build runner is off, like ci.yml.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true') && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
timeout-minutes: 60
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
DISABLE_SQLITE_AUTO_BACKUP: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
cache: npm
# Page-data collection imports server modules that open the database: keep it in a
# fresh DATA_DIR, never the self-hosted runner's persistent $HOME (same contract as
# the k6 job above and nightly-llm-security.yml).
- name: Prepare isolated runtime state
run: |
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-a11y-build.XXXXXX")
mkdir "$data_dir/plugins"
{
echo "DATA_DIR=$data_dir"
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
} >> "$GITHUB_ENV"
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build Next.js (production)
run: npm run build
env:
OMNIROUTE_USE_TURBOPACK: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true') && '1' || '0' }}
# Same archive contract as ci.yml's build -> test-e2e hand-off: tar keeps the paths
# relative to the checkout (.build/next/...), the build cache stays out.
- name: Archive the build for the a11y job
run: |
tar -czf "$RUNNER_TEMP/a11y-build.tar.gz" \
--exclude='.build/next/cache' \
.build/next
- name: Upload the build for the a11y job
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: a11y-next-build
path: ${{ runner.temp }}/a11y-build.tar.gz
retention-days: 1
a11y:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: A11y axe (nightly, freeze-and-alert)
needs: a11y-build
# Boots the production build made by `a11y-build` (no self-build here: #16853) and runs
# the axe suite against it. Hosted, always: on the light pool the 1.2 GB artefact took
# 1,416 s to download and the 30-minute timeout cancelled the job before axe ran (run
# 39156364797, 2026-10-18), after it had already queued 80 min behind lint-guard jobs.
# Hosted runners pull the same class of artefact in seconds (the per-PR E2E shards), a
# standalone server fits them, and a fresh VM has no port or $HOME left by other jobs.
# REQUIRE_AXE=1 makes the suite run the real axe analysis (the 4 page tests are gated to
# nightly so per-PR e2e stays fast) and makes the meta-test fail loudly if
# @axe-core/playwright ever goes missing.
runs-on: ubuntu-latest
timeout-minutes: 30
env:
JWT_SECRET: ci-test-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-test-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
REQUIRE_AXE: "1"
# Own a port the rest of the box cannot steal. This job ran on the default
# 20128 and failed 9 of 10 nights two ways: "http://localhost:20128/
# api/monitoring/health is already used" when the deployed server (or a
# concurrent runner job) answered first (runs 35688196787, 35562389397),
# and a 900 s webServer timeout under listener contention (run
# 35819784314). DASHBOARD_PORT drives playwright.config's readiness URL,
# PORT drives the server the webServer script boots — both set, same value.
DASHBOARD_PORT: "21777"
PORT: "21777"
# The webServer only boots the downloaded standalone build (same switch the per-PR
# test-e2e shards use), so its window covers a boot, not a build.
OMNIROUTE_PLAYWRIGHT_SKIP_BUILD: "1"
OMNIROUTE_PLAYWRIGHT_WEB_SERVER_TIMEOUT: "600000"
# Send the server's stdout to the job log: the 2026-10-18 failure was a 30-minute
# silent wait because Playwright discards webServer stdout by default.
OMNIROUTE_PLAYWRIGHT_WEB_SERVER_STDOUT: "pipe"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
cache: npm
# The server this job boots must not open the runner's persistent $HOME/.omniroute:
# a database left there by older runs sits behind the tip's migrations and the
# mass-migration guard (#3416) keeps the server from ever becoming healthy.
- name: Prepare isolated runtime state
run: |
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-a11y.XXXXXX")
mkdir "$data_dir/plugins"
{
echo "DATA_DIR=$data_dir"
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
} >> "$GITHUB_ENV"
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Cache Playwright browsers
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: playwright-chromium-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: playwright-chromium-${{ runner.os }}-
- run: npx playwright install --with-deps chromium
- name: Download the production build
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: a11y-next-build
path: next-build-artifact
- name: Extract the production build
run: tar -xzf next-build-artifact/a11y-build.tar.gz
- name: Run axe a11y suite (prebuilt standalone server)
run: npx playwright test tests/e2e/a11y.spec.ts

View File

@@ -1,111 +0,0 @@
name: Nightly Schemathesis
on:
schedule:
- cron: "23 4 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
schemathesis:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Schemathesis — OpenAPI contract fuzz (advisory)
# #11965: this job runs a backend-only `next build`; the hosted 7 GB runner cannot build
# release/v3.8.51 (VM shutdown ~7 min in), so it targets the box's light pool (`omni-light`:
# two listeners, jobs ≤ ~6 GB). Falls back to hosted when USE_VPS_RUNNER is off.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
# 2026-10-17: the webpack backend-only build alone took >25 min on the busy .113 and the
# old 30-minute cap cancelled the job before the probes started (run 38982564979).
timeout-minutes: 120
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with: { node-version: "24", cache: npm }
- name: Prepare isolated runtime state
id: runtime
run: |
data_dir=$(mktemp -d "$RUNNER_TEMP/omniroute-schemathesis.XXXXXX")
mkdir "$data_dir/plugins"
{
echo "DATA_DIR=$data_dir"
echo "OMNIROUTE_PLUGINS_DIR=$data_dir/plugins"
} >> "$GITHUB_ENV"
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Build CLI bundle
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
OMNIROUTE_BUILD_BACKEND_ONLY: "1"
OMNIROUTE_USE_TURBOPACK: "0"
run: npm run build:cli
- name: Start OmniRoute (background)
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
HOSTNAME: "127.0.0.1"
PORT: "21780"
run: |
# A persistent runner can already host another deployment. Never fuzz it.
if (echo > /dev/tcp/127.0.0.1/"$PORT") 2>/dev/null; then
echo "::error::Port $PORT is already occupied; refusing to probe another server."
exit 1
fi
node dist/server.js > server.log 2>&1 &
server_pid=$!
echo "$server_pid" > "$DATA_DIR/server.pid"
for _ in $(seq 1 30); do
if ! kill -0 "$server_pid" 2>/dev/null; then
echo "::error::OmniRoute exited before becoming ready; see server.log."
exit 1
fi
if curl --max-time 2 -sf "http://127.0.0.1:$PORT/api/monitoring/health" >/dev/null && kill -0 "$server_pid" 2>/dev/null; then
echo "server up"
exit 0
fi
sleep 2
done
echo "::error::OmniRoute did not become healthy after 30 attempts; see server.log."
exit 1
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with: { python-version: "3.12" }
- name: Install schemathesis
run: pip install schemathesis
- name: Schemathesis contract fuzz (advisory)
# Advisory gate: never fails the job. `continue-on-error` covers a crash of the
# step itself; `|| true` covers schemathesis exiting non-zero when it finds spec
# violations / upstream 500s — both are expected here (most /v1 endpoints proxy an
# upstream that has no provider configured in CI). The point of the nightly is to
# PROVE the contract is fuzzable and surface regressions, not to gate the build.
continue-on-error: true
run: |
schemathesis run docs/openapi.yaml \
--url http://127.0.0.1:21780 \
--max-examples 20 \
--workers 4 \
--checks all \
--max-response-time 30 \
--request-timeout 30 \
--suppress-health-check all \
--report junit \
--report-junit-path schemathesis-report/junit.xml \
--no-color \
|| true
- name: Stop server
if: always() && steps.runtime.outcome == 'success'
run: |
if [ -n "$DATA_DIR" ] && [ -f "$DATA_DIR/server.pid" ]; then
kill "$(cat "$DATA_DIR/server.pid")" || true
fi
- name: Upload schemathesis report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: schemathesis-report
path: |
schemathesis-report/
server.log
if-no-files-found: warn
retention-days: 14

View File

@@ -1,176 +0,0 @@
name: Nightly v4 build (dormant)
# DORMANT until the 3.9.0 LTS cut creates `develop` (docs/ops/RELEASE_STRATEGY.md →
# channel `nightly`). The first job checks `git ls-remote --heads origin develop`
# and ends the run green and silent while the branch does not exist.
#
# When develop exists: compute `<core>-nightly.<YYYYMMDD>.<sha7>` with
# scripts/release/compute-nightly-version.mjs, build the release bundle, validate
# the pack artifact and keep the tarball as a workflow artifact. Publishing to npm
# under the `nightly` dist-tag happens ONLY when the repository variable
# `NIGHTLY_PUBLISH` is exactly 'true' — and additionally requires npm Trusted
# Publishing to accept this workflow file (npmjs.com → package settings), since
# today it is configured for npm-publish.yml only.
on:
schedule:
- cron: "23 4 * * *" # 04:23 UTC daily
workflow_dispatch:
permissions:
contents: read
concurrency:
group: nightly-v4-build
cancel-in-progress: false
env:
NIGHTLY_NODE_VERSION: "24"
jobs:
detect:
name: Detect develop
# Upstream-only for scheduled runs (check-workflows scheduled-guard).
if: (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute')
runs-on: ubuntu-latest
permissions: {}
outputs:
exists: ${{ steps.develop.outputs.exists }}
steps:
- name: Check that develop exists
id: develop
env:
REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
run: |
set -euo pipefail
if [ -n "$(git ls-remote --heads "$REPO_URL" develop)" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "develop does not exist yet — nightly v4 build is dormant, nothing to do."
fi
build:
name: Build nightly
needs: detect
if: (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') && needs.detect.outputs.exists == 'true'
# Same dynamic-runner rule as npm-publish.yml: a full `next build` outgrew the
# 16 GB hosted runner during v3.8.49. Never runs on pull_request.
runs-on: ${{ vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
permissions:
contents: read
outputs:
version: ${{ steps.version.outputs.version }}
env:
JWT_SECRET: ci-build-secret-with-sufficient-length-for-validation
steps:
- name: Checkout develop
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: develop
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NIGHTLY_NODE_VERSION }}
package-manager-cache: false
- name: Compute nightly version
id: version
run: |
set -euo pipefail
# The schedule's GITHUB_SHA is the default branch, not develop — use HEAD.
HEAD_SHA=$(git rev-parse HEAD)
VERSION=$(node scripts/release/compute-nightly-version.mjs --sha "$HEAD_SHA")
# Defense in depth: the computed version must resolve to the nightly channel.
TAG=$(node scripts/release/dist-tag.mjs --version "$VERSION" --requested auto < /dev/null)
if [ "$TAG" != "nightly" ]; then
echo "Computed $VERSION resolves to dist-tag '$TAG', expected 'nightly'" >&2
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "📦 omniroute@$VERSION (dist-tag=nightly)"
- name: Install dependencies
uses: ./.github/actions/npm-ci-retry
with:
cache: "false" # a publishable artifact never restores node_modules from cache
- name: Stamp the nightly version
env:
VERSION: ${{ steps.version.outputs.version }}
run: npm version "$VERSION" --no-git-tag-version --allow-same-version
- name: Build release bundle
run: npm run build:release
- name: Validate npm package artifact
env:
# The provenance guard checks ancestry against origin/main by default; a
# nightly is cut from develop.
OMNIROUTE_RELEASE_REF: origin/develop
run: npm run check:pack-artifact
- name: Pack the tarball
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
set -euo pipefail
npm pack --ignore-scripts
TARBALL="omniroute-${VERSION}.tgz"
test -f "$TARBALL" || { echo "expected $TARBALL after npm pack" >&2; ls -la ./*.tgz || true; exit 1; }
- name: Upload nightly tarball
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: npm-nightly-tarball
path: omniroute-${{ steps.version.outputs.version }}.tgz
retention-days: 7
if-no-files-found: error
publish:
name: Publish nightly to npm
needs: build
if: (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') && vars.NIGHTLY_PUBLISH == 'true'
runs-on: ubuntu-latest # Trusted Publishing (OIDC) requires a GitHub-hosted runner
permissions:
contents: read
id-token: write # npm provenance + Trusted Publishing
steps:
- name: Download nightly tarball
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: npm-nightly-tarball
path: .
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NIGHTLY_NODE_VERSION }}
registry-url: https://registry.npmjs.org
package-manager-cache: false
- name: Ensure npm supports Trusted Publishing
run: |
set -euo pipefail
if ! node -e "const [a,b]=process.argv[1].split('.').map(Number); process.exit(a>11||(a===11&&b>=15)?0:1)" "$(npm --version)"; then
# Pinned exact version (supply-chain: never float @latest in a publish job).
npm install -g --ignore-scripts npm@11.15.0
fi
npm --version
- name: Publish with --tag nightly
env:
VERSION: ${{ needs.build.outputs.version }}
run: |
set -euo pipefail
case "$VERSION" in
*-nightly.*) ;;
*) echo "Refusing to publish non-nightly version '$VERSION' from the nightly workflow" >&2; exit 1 ;;
esac
TARBALL="omniroute-${VERSION}.tgz"
test -f "$TARBALL" || { echo "tarball $TARBALL did not arrive from the build job" >&2; exit 1; }
npm publish "$TARBALL" --provenance --access public --tag nightly --ignore-scripts
echo "✅ Published omniroute@$VERSION (dist-tag=nightly)"

File diff suppressed because it is too large Load Diff

View File

@@ -1,83 +0,0 @@
name: omni-queue watchdog
# The queue's dead-man switch (docs/ops/OMNI_QUEUE.md). Every 30 minutes it reads each base's
# state file on the omni-queue-state branch and keeps ONE issue,
# "omni-queue: the queue is not making progress", open while one of its signals holds: a base that
# ticks should be visiting (work: in flight, a pause, a stored land-status withdrawal, a labeled
# PR) has saved no state for more than 90 minutes; a managed base that labeled PRs target has no
# state file, and the newest update of those PRs is more than 90 minutes old; a stalled episode's
# dashboard comment has not been posted 30 minutes after it opened; a state file cannot be read
# (not JSON, fails validateState, or its document is for a base the queue does not manage or for a
# base stored in another file); or the queue's config does not load or validate (then nothing else
# is judged, the issue is never closed by that run, and the run fails); it keeps the body up to date, closes the issue once nothing holds, and reopens it
# if something holds again within 24 hours (scripts/merge-queue/watchdog.mjs). A failed read of
# the open labeled PRs or of a state file is not a signal: the run is partial. A partial run may
# still open or reopen the issue for what it did establish, never closes it or rewrites its body,
# and fails, so a read that keeps failing shows as a red run of this workflow. When the listing of
# the state directory or the issue search fails, the run stops, writes nothing and prints one line.
# Time: no state-file fetch starts after 150 s and no write sequence after 210 s (both make the
# run partial); one request is bounded by the watchdog's own client limits (3 attempts of 15 s,
# waits of at most 15 s: 75 s); the script stops the run at 240 s with one error line and exit 1.
# That leaves this job's timeout-minutes about a minute for checkout and setup-node; only when they
# take longer is the run killed before it prints its line.
#
# Deliberately separate from omni-queue.yml, so that it works when the queue's own workflow
# cannot: no App token (a tick that dies minting it, or an uninstalled App, is what it catches),
# no `omni-queue` environment, no secret at all. It runs with this workflow's default token,
# limited to `contents: read` (the state files, the default branch's scripts), `issues: write`
# (its one issue) and `pull-requests: read` (the open PRs carrying the queue label, with their
# base). It never writes the state and never writes to a pull request.
#
# Security posture: no job checks out or runs PR code. The one job checks out the DEFAULT branch
# (sparse: scripts/merge-queue + config/merge-queue only, credentials not persisted) and runs a
# zero-dependency Node script; no npm install. Every action is pinned by commit SHA (the same
# pins as omni-queue.yml).
#
# Kill switch: inert unless the repository variable OMNI_QUEUE_ENABLED is 'true', and only in
# cheaper-inference/OmniRoute (a fork or a sandbox copy never runs it as is).
on:
schedule:
# Every 30 minutes, off the busy :00 / :30 slots.
- cron: "17,47 * * * *"
workflow_dispatch:
permissions: {}
jobs:
watchdog:
name: Watchdog
# The last clause is the scheduled-run guard every scheduled job here carries
# (scripts/check/check-workflows.mjs); the repository clause before it also keeps a manual run
# in this repository only.
if: >-
vars.OMNI_QUEUE_ENABLED == 'true'
&& github.repository == 'cheaper-inference/OmniRoute'
&& (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute')
runs-on: ubuntu-latest
timeout-minutes: 5
# One run at a time: two overlapping runs could each open the issue.
concurrency:
group: omni-queue-watchdog
cancel-in-progress: false
permissions:
contents: read
issues: write
pull-requests: read
steps:
# The default branch's watchdog, never a PR's code.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
sparse-checkout: |
scripts/merge-queue
config/merge-queue
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
package-manager-cache: false
node-version: "24"
- name: Check that queue ticks are completing
env:
GITHUB_TOKEN: ${{ github.token }}
run: node scripts/merge-queue/watchdog.mjs

View File

@@ -1,267 +0,0 @@
name: omni-queue
# OmniRoute's own merge queue (docs/ops/OMNI_QUEUE.md). One idempotent tick composes the next
# batch of approved PRs on top of a release branch, pushes it as a fresh omni-queue/** candidate
# (ci.yml + quality.yml run their full profile there), reads the candidate's checks and lands it
# (or, in shadow mode, records what it would land). State lives on the omni-queue-state branch.
#
# Security posture (also the .zizmor.yml justification for pull_request_target/workflow_run):
# • No job ever checks out or runs PR code. Both jobs check out the DEFAULT branch (sparse:
# scripts/merge-queue + config/merge-queue only) and run zero-dependency Node scripts —
# no npm ci, no third-party install scripts next to the App token. The queue touches PR
# content only as git objects (merge-tree/commit-tree in a scratch bare repository).
# • Which copy of THIS file runs: schedule, workflow_run and pull_request_target use the
# default branch's copy (pull_request_target has done so since 2025-12-08, whatever the PR's
# base); workflow_dispatch uses the dispatched ref. The scripts ALWAYS come from the default
# branch (explicit checkout ref), so nothing works until scripts/merge-queue is there.
# • Public repositories block pull_request_target by default from 2026-12-02 unless an Actions
# policy allows this workflow file (docs/ops/OMNI_QUEUE.md → "Actions event policy"). A
# blocked approval job fails closed: no approval status, so nothing becomes eligible.
# • Writes use a GitHub App installation token minted per job with the minimum permissions
# (the GITHUB_TOKEN cannot be used: refs it pushes do not trigger the candidate's CI).
# • Both jobs run in the `omni-queue` environment, which holds the App's credentials and the
# owner's OMNI_QUEUE_LAND_TOKEN and admits the default branch only, by its exact name: a
# workflow on a candidate branch cannot read them. The App writes omni-queue/land, the status release rulesets
# require, so its private key is the root of trust. The land token reaches the tick only.
# • action=bless (the explicit emergency exit): the tick writes omni-queue/land on ONE commit
# for a hotfix, sync-back or base repair, after checking that both the dispatcher
# (github.actor) and whoever triggered the run (github.triggering_actor, the re-runner of a
# re-run) are in config.approvers; the maintainer then lands it himself.
# • Kill switch: every job is inert unless the repository variable OMNI_QUEUE_ENABLED is
# 'true'. Forks never inherit repository variables.
on:
schedule:
- cron: "*/5 * * * *"
workflow_dispatch:
inputs:
base:
description: "Release branch to act on (default: every managed base with queue work)"
required: false
type: string
action:
description: "tick = one normal tick; pause/resume = toggle a base; dry-run = decide and print, write nothing; bless = write omni-queue/land on one commit (needs base, sha, reason)"
required: false
default: tick
type: choice
options:
- tick
- pause
- resume
- dry-run
- bless
reason:
description: "Free-text reason recorded with pause/resume/bless (required for bless)"
required: false
type: string
sha:
description: "bless only: full 40-hex SHA of the commit that receives omni-queue/land"
required: false
type: string
# A candidate's CI finished: tick right away instead of waiting for the next cron slot.
workflow_run:
workflows: ["CI", "Quality Gates"]
types: [completed]
branches: ["omni-queue/**"]
# Label changes bind/withdraw approvals (job `approval`); the listed actions wake the tick.
# This trigger fires for EVERY pull request, and each job mints an App token: the jobs' `if:`
# keep only the events the queue cares about (see both jobs).
pull_request_target:
types: [labeled, unlabeled, synchronize, closed]
permissions: {}
jobs:
# Binds a label approval to the exact head SHA (commit status omni-queue/approval or
# omni-queue/protected-approval). Deliberately outside the tick's concurrency group: GitHub
# replaces a pending run of a group, and an approval must never be dropped that way. Its own
# group is keyed on PR AND label: two runs for the same label never interleave their label
# re-read and status write (a stale `failure` after a newer `success`), and a pending run can
# only be replaced by a newer event on the same label, whose run re-reads the current labels.
# An unrelated label (skipped by the `if:` below), or the other approval label, has its own
# group and replaces nothing.
# (github.event.number = the PR number of a pull_request_target payload.)
#
# Only the two approval labels start it (`label` and `protectedApprovalLabel` of
# config/merge-queue/config.json). An `if:` cannot read that file, so the names are repeated
# here: rename a label in BOTH places (tests/unit/merge-queue/workflows.test.mjs compares them).
# Only pull requests into a release/v* branch: the queue manages release bases only, and the
# filter keeps the job from minting an App token for every other pull request.
approval:
name: Approval
if: >-
vars.OMNI_QUEUE_ENABLED == 'true'
&& (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute')
&& github.event_name == 'pull_request_target'
&& startsWith(github.event.pull_request.base.ref, 'release/v')
&& (github.event.action == 'labeled' || github.event.action == 'unlabeled')
&& (github.event.label.name == 'omni-queue' || github.event.label.name == 'protected-approved')
runs-on: ubuntu-latest
# Secrets and branch policy of the environment, without a deployment record per run.
environment:
name: omni-queue
deployment: false
timeout-minutes: 5
concurrency:
group: omni-queue-approval-${{ github.event.number }}-${{ github.event.label.name }}
cancel-in-progress: false
permissions:
contents: read
steps:
- name: Mint the omni-queue App token
id: app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ secrets.OMNI_QUEUE_APP_CLIENT_ID }}
private-key: ${{ secrets.OMNI_QUEUE_APP_PRIVATE_KEY }}
permission-contents: read
permission-pull-requests: read
permission-issues: write
permission-statuses: write
# The default branch's orchestrator, never the PR's code.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
sparse-checkout: |
scripts/merge-queue
config/merge-queue
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
package-manager-cache: false
node-version: "24"
- name: Bind the label to the head SHA
env:
OMNI_QUEUE_TOKEN: ${{ steps.app-token.outputs.token }}
run: node scripts/merge-queue/approve.mjs
tick:
name: Tick
needs: approval
# !cancelled() (not always()): the approval job is skipped on every event but an approval
# label change, and an operator who cancels the run mid-incident must stop the tick too.
#
# A pull request event starts a tick only when it can change what the queue does: the
# event's label is an approval label, one of config.json's `blockLabels` or one of its two
# `lanes` labels (hotfix, base repair), the pull request carries the queue label, or a merge
# moved a base. Anything else (a label on, or a push to, a pull request that is not queued)
# starts nothing; the 5-minute cron stays the safety net.
# Same label literals as config/merge-queue/config.json: rename in BOTH places. And only a
# pull request into a release/v* branch, like the approval job: the queue manages release
# bases only, and no App token is minted for any other pull request.
if: >-
!cancelled()
&& vars.OMNI_QUEUE_ENABLED == 'true'
&& (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute')
&& (needs.approval.result == 'success' || needs.approval.result == 'skipped')
&& (github.event_name != 'pull_request_target'
|| (startsWith(github.event.pull_request.base.ref, 'release/v')
&& (github.event.label.name == 'omni-queue'
|| github.event.label.name == 'protected-approved'
|| github.event.label.name == 'hold'
|| github.event.label.name == 'hold-vps'
|| github.event.label.name == 'do-not-merge'
|| github.event.label.name == 'wip'
|| github.event.label.name == 'omni-queue-hotfix'
|| github.event.label.name == 'omni-queue-base-repair'
|| contains(github.event.pull_request.labels.*.name, 'omni-queue')
|| (github.event.action == 'closed' && github.event.pull_request.merged == true))))
runs-on: ubuntu-latest
# Secrets and branch policy of the environment, without a deployment record per run.
environment:
name: omni-queue
deployment: false
timeout-minutes: 30
# ONE writer of queue state at a time, across every base and every trigger. Never cancel a
# running tick (it may be between a push and the state save that records it); GitHub keeps
# at most one pending tick, which is all a level-triggered tick needs.
concurrency:
group: omni-queue-tick
cancel-in-progress: false
permissions:
contents: read
steps:
- name: Mint the omni-queue App token
id: app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ secrets.OMNI_QUEUE_APP_CLIENT_ID }}
private-key: ${{ secrets.OMNI_QUEUE_APP_PRIVATE_KEY }}
permission-contents: write
# GitHub refuses a push by an App token that creates or updates a file under
# .github/workflows/ without this scope. A candidate's merge commits (parent 1 = base)
# and the fast-forward landing carry any workflow change of a batched PR — ci.yml and
# quality.yml change almost daily here — so without it every such batch fails to push.
permission-workflows: write
permission-pull-requests: write
permission-issues: write
# omni-queue/land: on a candidate or the PR heads before a landing, on one commit for a
# bless, and withdrawn (failure) when a landing does not complete.
permission-statuses: write
permission-checks: read
# POST /actions/runs/{id}/rerun-failed-jobs: a red candidate's failed jobs are re-run
# once before a pull request is blamed (config flakyReruns).
permission-actions: write
# The default branch's orchestrator, never the PR's code.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
sparse-checkout: |
scripts/merge-queue
config/merge-queue
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
package-manager-cache: false
node-version: "24"
# The App's bot user (<id>+<slug>[bot] noreply). It authors queue merge commits unless
# config.landing.actor is "owner" (then landing.identity does: tick.createTickDeps).
- name: Resolve the bot identity
id: identity
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
run: |
set -euo pipefail
if [[ ! "$APP_SLUG" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
echo "::error::unexpected App slug"; exit 1
fi
login="${APP_SLUG}[bot]"
id="$(gh api "/users/${login}" --jq .id)"
if [[ ! "$id" =~ ^[0-9]+$ ]]; then
echo "::error::could not resolve the user id of ${login}"; exit 1
fi
{
echo "name=${login}"
echo "email=${id}+${login}@users.noreply.github.com"
} >> "$GITHUB_OUTPUT"
# Inputs travel through env and are assembled into an argv array: no expression is ever
# expanded inside the script body. Scheduled, workflow_run and pull_request_target ticks
# pass no base (the tick discovers the bases with work). The owner's land token is used
# only by the landing itself when config.landing.actor is "owner" (never printed).
# GITHUB_ACTOR and GITHUB_TRIGGERING_ACTOR are the runner's own default variables, named
# here because a bless is checked against both: the original dispatcher, whose inputs a
# re-run keeps, and whoever triggered this run (the re-runner of a re-run).
- name: Run one queue tick
env:
OMNI_QUEUE_TOKEN: ${{ steps.app-token.outputs.token }}
OMNI_QUEUE_LAND_TOKEN: ${{ secrets.OMNI_QUEUE_LAND_TOKEN }}
OMNI_QUEUE_BOT_NAME: ${{ steps.identity.outputs.name }}
OMNI_QUEUE_BOT_EMAIL: ${{ steps.identity.outputs.email }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }}
EVENT_NAME: ${{ github.event_name }}
INPUT_BASE: ${{ inputs.base }}
INPUT_ACTION: ${{ inputs.action }}
INPUT_REASON: ${{ inputs.reason }}
INPUT_SHA: ${{ inputs.sha }}
run: |
set -euo pipefail
args=()
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
if [ -n "${INPUT_BASE:-}" ]; then args+=(--base "$INPUT_BASE"); fi
args+=(--action "${INPUT_ACTION:-tick}")
if [ -n "${INPUT_REASON:-}" ]; then args+=(--reason "$INPUT_REASON"); fi
if [ -n "${INPUT_SHA:-}" ]; then args+=(--sha "$INPUT_SHA"); fi
fi
node scripts/merge-queue/tick.mjs "${args[@]}"

View File

@@ -1,91 +0,0 @@
name: opencode-plugin CI
on:
push:
branches: [main, "release/**"]
paths:
- "@omniroute/opencode-plugin/**"
- "@omniroute/opencode-plugin-v2/**"
- ".github/workflows/opencode-plugin-ci.yml"
pull_request:
branches: [main, "release/**"]
paths:
- "@omniroute/opencode-plugin/**"
- "@omniroute/opencode-plugin-v2/**"
- ".github/workflows/opencode-plugin-ci.yml"
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
working-directory: "@omniroute/opencode-plugin"
jobs:
test:
name: Test (Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ["22.23.4", "24.22.1"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ matrix.node }}
package-manager-cache: false
- run: npm ci --no-audit --no-fund
- run: npm run build
- run: npm test
test-v2:
name: Test v2 (Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ["22.23.4", "24.22.1"]
defaults:
run:
working-directory: "@omniroute/opencode-plugin-v2"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ matrix.node }}
package-manager-cache: false
- run: npm ci --no-audit --no-fund
- run: npm run build
- run: npm test
build:
name: Build
runs-on: ubuntu-latest
needs: [test, test-v2]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24.22.1"
package-manager-cache: false
- name: Build plugin-v2 artifact
working-directory: "@omniroute/opencode-plugin-v2"
run: npm ci --no-audit --no-fund && npm run build
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: opencode-plugin-v2-dist
path: "@omniroute/opencode-plugin-v2/dist"
retention-days: 7

View File

@@ -1,65 +0,0 @@
name: opencode-provider CI
on:
push:
branches: [main, "release/**"]
paths:
- "@omniroute/opencode-provider/**"
- ".github/workflows/opencode-provider-ci.yml"
pull_request:
branches: [main, "release/**"]
paths:
- "@omniroute/opencode-provider/**"
- ".github/workflows/opencode-provider-ci.yml"
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
working-directory: "@omniroute/opencode-provider"
jobs:
test:
name: Test (Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ["22.23.4", "24.22.1"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ matrix.node }}
package-manager-cache: false
- run: npm ci
- run: npm test
build:
name: Build
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24.22.1"
package-manager-cache: false
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: opencode-provider-dist
path: "@omniroute/opencode-provider/dist"
retention-days: 7

View File

@@ -1,252 +0,0 @@
name: Preview artifact (build once)
# PR preview artifact — #8084 slice (a), rehearsed in 3.8.58 (ROADMAP Phase 2).
#
# Builds ONE production-equivalent npm tarball from the exact PR head, validates
# THAT build (check:pack-artifact + check:pack-boot, which installs the packed
# tarball into a clean prefix and boots it with fake secrets on an isolated
# DATA_DIR), records its identity (head SHA + base SHA + lockfile hash +
# platform/arch/node ABI + build policy, scripts/release/artifact-identity.mjs),
# uploads tarball + identity + SHA256SUMS and attests the tarball's provenance.
# The uploaded bytes are what a preview install or a promotion consumes: there is
# no second source build anywhere downstream.
#
# Out of scope on purpose: publishing (nothing here talks to a registry), DB-clone
# migration rehearsal (#8084 reply 3 — its own subsystem) and live provider probes.
#
# Triggers: `workflow_dispatch` with a PR number, or adding the `preview-artifact`
# label to a PR. Fork PRs are never built: the label path checks
# head.repo.full_name in the job `if:`, the dispatch path re-checks it from the API
# before anything is checked out. This runs PR code (same-repository branches
# only), so the build job holds a read-only token and no OIDC permission; the
# OIDC/attestation permissions live in the separate `attest` job, which never
# checks out or executes repository code.
on:
workflow_dispatch:
inputs:
pr_number:
description: "Pull request number to build (same-repository PRs only)"
required: true
type: string
pull_request:
types: [labeled]
permissions:
contents: read # default for every job; each job narrows or extends below
concurrency:
group: preview-artifact-${{ github.event.pull_request.number || inputs.pr_number }}
cancel-in-progress: true
env:
PREVIEW_NODE_VERSION: "24"
jobs:
resolve:
name: Resolve PR head and base
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event.label.name == 'preview-artifact' &&
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read # gh api repos/<repo>/pulls/<N> (head repo, state, SHAs)
outputs:
pr_number: ${{ steps.pr.outputs.pr_number }}
head_sha: ${{ steps.pr.outputs.head_sha }}
base_sha: ${{ steps.pr.outputs.base_sha }}
base_ref: ${{ steps.pr.outputs.base_ref }}
steps:
- name: Resolve the PR and refuse forks
id: pr
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
EVENT_PR: ${{ github.event.pull_request.number }}
INPUT_PR: ${{ inputs.pr_number }}
run: |
set -euo pipefail
PR="${EVENT_PR:-$INPUT_PR}"
if ! printf '%s' "$PR" | grep -qE '^[0-9]+$'; then
echo "::error::pr_number must be a positive integer"
exit 1
fi
DATA=$(gh api "repos/$REPO/pulls/$PR")
HEAD_REPO=$(jq -r '.head.repo.full_name // ""' <<<"$DATA")
STATE=$(jq -r '.state' <<<"$DATA")
HEAD_SHA=$(jq -r '.head.sha' <<<"$DATA")
BASE_REF=$(jq -r '.base.ref' <<<"$DATA")
if [ "$HEAD_REPO" != "$REPO" ]; then
echo "::error::PR #$PR comes from a fork ($HEAD_REPO) — preview artifacts are built for same-repository branches only"
exit 1
fi
if [ "$STATE" != "open" ]; then
echo "::error::PR #$PR is $STATE — preview artifacts are built for open PRs only"
exit 1
fi
# The base SHA recorded in the identity is the base branch tip at build time.
BASE_SHA=$(gh api "repos/$REPO/git/ref/heads/$BASE_REF" --jq '.object.sha')
{
echo "pr_number=$PR"
echo "head_sha=$HEAD_SHA"
echo "base_sha=$BASE_SHA"
echo "base_ref=$BASE_REF"
} >> "$GITHUB_OUTPUT"
echo "PR #$PR head=$HEAD_SHA base=$BASE_REF@$BASE_SHA"
build:
name: Build once, validate, upload
needs: resolve
# Same pool rule as npm-publish.yml: the hosted runner cannot hold `next build`
# for this tree any more (#11946). The fork clause is redundant here (resolve
# already refused forks) and is kept so the expression stays greppable.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && vars.USE_VPS_BUILD_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","omni-build"]') || 'ubuntu-latest' }}
timeout-minutes: 120
permissions:
contents: read # checkout + git fetch refs/pull/<N>/head — read-only, no OIDC
outputs:
artifact_name: ${{ steps.name.outputs.artifact_name }}
env:
# Fake, build-time-only values. No real secret is ever exposed to this job.
JWT_SECRET: preview-artifact-fake-jwt-secret-with-sufficient-length
API_KEY_SECRET: preview-artifact-fake-api-key-secret-0000000000000000
steps:
- name: Checkout the PR head
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.resolve.outputs.head_sha }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.PREVIEW_NODE_VERSION }}
package-manager-cache: false
- name: Install dependencies (npm ci)
uses: ./.github/actions/npm-ci-retry
with:
# A promotable artifact is never built from a cached node_modules.
cache: "false"
- name: Build release bundle
run: npm run build:release
# check:pack-artifact's provenance guard (#10427) needs a ref the stamped head
# is an ancestor of. refs/pull/<N>/head exists in this repository for every PR.
- name: Fetch the PR head ref for the provenance guard
env:
PR_NUMBER: ${{ needs.resolve.outputs.pr_number }}
run: |
git fetch --no-tags --depth=50 origin \
"+refs/pull/$PR_NUMBER/head:refs/remotes/origin/pr-head"
- name: Validate the npm package artifact
env:
OMNIROUTE_RELEASE_REF: origin/pr-head
run: npm run check:pack-artifact
- name: Pack the tarball (the bytes that get uploaded)
id: pack
run: |
set -euo pipefail
OUT_DIR="$RUNNER_TEMP/preview-artifact"
mkdir -p "$OUT_DIR"
FILE=$(npm pack --json --pack-destination "$OUT_DIR" | jq -r '.[0].filename' | tr '/' '-')
test -f "$OUT_DIR/$FILE"
SHA=$(sha256sum "$OUT_DIR/$FILE" | cut -d' ' -f1)
{
echo "dir=$OUT_DIR"
echo "file=$FILE"
echo "sha256=$SHA"
} >> "$GITHUB_OUTPUT"
echo "packed $FILE sha256=$SHA"
# Packs the same tree again, installs it into a clean prefix and boots it with
# fake JWT/API-key secrets on an ephemeral DATA_DIR (the script also forces its
# own isolated values for the spawned server).
- name: Boot-smoke the packed tarball
env:
DATA_DIR: ${{ runner.temp }}/preview-artifact-data
run: npm run check:pack-boot
# Build once: the tree must not have changed while it was being validated, and
# `npm pack` must reproduce the uploaded bytes exactly — otherwise what booted
# and what gets uploaded are not provably the same artifact.
- name: Prove the validated bytes are the uploaded bytes
env:
OUT_DIR: ${{ steps.pack.outputs.dir }}
FILE: ${{ steps.pack.outputs.file }}
EXPECTED_SHA: ${{ steps.pack.outputs.sha256 }}
run: |
set -euo pipefail
RECHECK="$RUNNER_TEMP/preview-artifact-recheck"
mkdir -p "$RECHECK"
npm pack --pack-destination "$RECHECK" >/dev/null
ACTUAL=$(sha256sum "$RECHECK/$FILE" | cut -d' ' -f1)
if [ "$ACTUAL" != "$EXPECTED_SHA" ]; then
echo "::error::re-pack digest $ACTUAL != uploaded $EXPECTED_SHA — the artifact is not reproducible from the validated tree"
exit 1
fi
rm -rf "$RECHECK"
echo "re-pack reproduces $FILE byte for byte"
- name: Record the artifact identity
env:
HEAD_SHA: ${{ needs.resolve.outputs.head_sha }}
BASE_SHA: ${{ needs.resolve.outputs.base_sha }}
OUT_DIR: ${{ steps.pack.outputs.dir }}
FILE: ${{ steps.pack.outputs.file }}
run: |
set -euo pipefail
node scripts/release/artifact-identity.mjs \
--head "$HEAD_SHA" \
--base "$BASE_SHA" \
--lockfile package-lock.json \
--tarball "$OUT_DIR/$FILE" \
--out "$OUT_DIR/artifact-identity.json"
(cd "$OUT_DIR" && sha256sum "$FILE" artifact-identity.json > SHA256SUMS)
- name: Name the workflow artifact
id: name
env:
PR_NUMBER: ${{ needs.resolve.outputs.pr_number }}
HEAD_SHA: ${{ needs.resolve.outputs.head_sha }}
run: echo "artifact_name=preview-artifact-pr${PR_NUMBER}-${HEAD_SHA:0:7}" >> "$GITHUB_OUTPUT"
- name: Upload tarball + identity
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ steps.name.outputs.artifact_name }}
path: ${{ steps.pack.outputs.dir }}
if-no-files-found: error
retention-days: 14
attest:
name: Attest build provenance
needs: build
# GitHub-hosted on purpose: attestation signing uses the job's OIDC token, and
# this job never checks out or runs repository code.
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read # required by attest-build-provenance
id-token: write # Sigstore signing of the provenance statement
attestations: write # store the attestation on this repository
steps:
- name: Download the uploaded artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: ${{ needs.build.outputs.artifact_name }}
path: preview-artifact
- name: Verify checksums
working-directory: preview-artifact
run: sha256sum -c SHA256SUMS
- name: Attest the tarball
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: preview-artifact/*.tgz

View File

@@ -1,631 +0,0 @@
name: Quality Gates
on:
push:
# release/** pushes are covered by the PR run of each change plus Release-Green on the
# merged combination (see ci.yml for the 2026-10-18 measurement); the per-push run here
# only ever queued hosted slots and was cancelled by the next merge.
# omni-queue/** (2026-11-13): omni-queue merge-queue candidates run the full profile, like
# merge_group (see ci.yml).
branches: [main, "omni-queue/**"]
pull_request:
branches: [main, "release/**"]
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, edited]
merge_group:
types: [checks_requested]
workflow_dispatch:
# A description edit on a Mergify queue draft (Mergify writes its queue summary there, and
# the Blacksmith app appends its footer, ~4 edits in the first 30 s) gets its own group and
# skips the matrix: in the shared group it cancelled the candidate's real run, and Mergify
# dequeued the PR on the cancelled checks ("checks interrupted", #18853/#18858 on 2026-11-03).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}${{ (github.event_name == 'pull_request' && github.event.action == 'edited' && github.event.pull_request.user.login == 'mergify[bot]' && startsWith(github.head_ref, 'mergify/merge-queue/') && github.event.pull_request.head.repo.id == github.event.repository.id) && format('-queue-edit-{0}', github.run_id) || '' }}
cancel-in-progress: true
permissions:
contents: read
env:
# CI must never mutate the runner's OS trust store (2026-07-05: a cert-flow
# test installed a fake PEM on a persistent self-hosted runner and broke all
# system TLS). Belt-and-suspenders with tests/_setup/isolateDataDir.ts.
OMNIROUTE_SKIP_SYSTEM_TRUST: "1"
CI_NODE_VERSION: "24"
jobs:
# Same classifier as ci.yml (scripts/quality/classify-pr-changes.mjs) so PR→release
# path filters share existence reasons: code / docs / i18n / workflow.
changes:
name: Change Classification
if: ${{ !(github.event_name == 'pull_request' && github.event.action == 'edited' && github.event.pull_request.user.login == 'mergify[bot]' && startsWith(github.head_ref, 'mergify/merge-queue/') && github.event.pull_request.head.repo.id == github.event.repository.id) }}
runs-on: ubuntu-latest
outputs:
# Match the official Mergify App and both repository IDs from GitHub's
# event. A contributor-controlled branch prefix alone grants no exception.
queueCandidate: >-
${{ github.event_name == 'pull_request' && github.event.pull_request.draft == true &&
github.event.pull_request.user.id == 37929162 &&
github.event.pull_request.user.login == 'mergify[bot]' &&
github.event.pull_request.user.type == 'Bot' &&
startsWith(github.head_ref, 'mergify/merge-queue/') &&
github.event.repository.id > 0 &&
github.event.pull_request.head.repo.id == github.event.repository.id &&
github.event.pull_request.base.repo.id == github.event.repository.id }}
code: ${{ steps.classify.outputs.code }}
docs: ${{ steps.classify.outputs.docs }}
i18n: ${{ steps.classify.outputs.i18n }}
workflow: ${{ steps.classify.outputs.workflow }}
testsOnly: ${{ steps.classify.outputs.testsOnly }}
# Exposure only (one-CI-policy step 1, RFC #8084): no job depends on it yet.
domains: ${{ steps.classify.outputs.domains }}
# omni-queue candidate base (the merge_group.base_sha of a push to omni-queue/**);
# empty on every other event.
candidateBase: ${{ steps.candidate.outputs.BASE_SHA }}
# "self" on an omni-queue base-check candidate (the bare base), "trailer" on a batch.
candidateSource: ${{ steps.candidate.outputs.SOURCE }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
package-manager-cache: false
node-version: ${{ env.CI_NODE_VERSION }}
- name: Validate gate inventory
run: npm run check:gate-manifest
# Same as ci.yml: a new omni-queue/** branch has no usable github.event.before.
- name: Resolve the omni-queue candidate base
id: candidate
if: startsWith(github.ref, 'refs/heads/omni-queue/')
run: node scripts/merge-queue/candidate-base.mjs >> "$GITHUB_OUTPUT"
- name: Validate recurring free catalog evidence
env:
BASE_SHA: ${{ steps.candidate.outputs.BASE_SHA || github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
run: npm run check:free-catalog-evidence
- id: classify
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if [ "$EVENT_NAME" != "pull_request" ]; then
{
echo "code=true"
echo "docs=true"
echo "i18n=true"
echo "workflow=true"
echo "testsOnly=false"
echo "domains=build,catalog,cli,core,db,docs,i18n,provider,routing,tests,ui,workflow"
} >> "$GITHUB_OUTPUT"
exit 0
fi
git diff --name-only "$BASE_SHA" "$HEAD_SHA" > changed-files.txt
node scripts/quality/classify-pr-changes.mjs changed-files.txt >> "$GITHUB_OUTPUT"
# Full build/package/boot authority lives in CI; no permanently skipped duplicate.
# Docs/OpenAPI contract gates only — existence reason is doc accuracy + route refs.
# Split out of fast-gates so pure-docs PRs skip typecheck/unit while still validating docs.
docs-gates:
name: Docs Gates (fast-path)
needs: changes
if: ${{ github.event_name != 'pull_request' || ((github.event.pull_request.draft == false || startsWith(github.head_ref, 'mergify/merge-queue/')) && (needs.changes.outputs.docs == 'true' || needs.changes.outputs.code == 'true')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
# Depth 2: on a pull_request the checkout is GitHub's merge commit, and its first
# parent is the base the PR was merged onto. check:docs-counts (inside check:docs-all)
# runs in `pr` mode on feature PRs and diffs the managed numbers against that base.
fetch-depth: 2
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
package-manager-cache: false
node-version: ${{ env.CI_NODE_VERSION }}
- uses: ./.github/actions/npm-ci-retry
with:
# PR acceleration is not release-candidate provenance.
cache: ${{ github.event_name == 'pull_request' }}
# One walk of src/app/api for openapi-routes + docs-symbols (both still fail independently).
- run: npm run check:api-docs-refs
# Plan 2026-11-13 (derived numbers are written at release): on a feature PR the counts gate
# judges only the managed numbers the PR itself edited (diff against BASE_SHA, or the merge
# commit's first parent when the base moved), never a base that is behind the live code by
# design. Push and dispatch on main or release/v* keep the strict release comparison; a
# dispatch on a feature branch runs in pr mode (no PR to diff: content invariants only).
- name: Docs accuracy (fabricated-docs + i18n mirrors, strict)
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
OMNIROUTE_GATE_MODE: ${{ github.event_name == 'workflow_dispatch' && github.ref_name != 'main' && !startsWith(github.ref_name, 'release/v') && 'pr' || '' }}
run: npm run check:docs-all
fast-gates:
name: Fast Quality Gates
needs: changes
# Code surface only — pure docs/i18n PRs skip this bag (docs-gates covers docs).
if: ${{ github.event_name != 'pull_request' || ((github.event.pull_request.draft == false || startsWith(github.head_ref, 'mergify/merge-queue/')) && needs.changes.outputs.code == 'true') }}
# Dynamic runner (same rule as ci.yml): use the self-hosted VPS pool only when the
# release captain has USE_VPS_RUNNER=true AND this is not a fork PR (own-origin
# branches only — a fork PR must never execute on the LAN runner). Var unset/false
# or a fork PR falls back to ubuntu-latest, so this is inert until the flag flips.
# PINNED to hosted (gap 19). This job carried the USE_VPS_RUNNER expression, and that
# expression was DEAD CONFIGURATION: across 160 quality.yml runs the job never once landed on
# a self-hosted runner — every non-skipped sample is `GitHub Actions NNNN`. The classifier is
# not at fault: in the same window ci.yml's Build demonstrably ran on omniroute-113-7 and
# omniroute-113-6, so self-hosted runs are visible when they happen.
#
# And if it ever HAD fired it would have inherited the measured penalty, because this job's
# first two steps are exactly the bottleneck: actions/setup-node + npm ci took 20m06s on .113
# with 4 concurrent runners versus 16s hosted (npm cache restore saturating the link). Median
# here is 5.6 min hosted across 72 successful runs.
#
# With this pinned, USE_VPS_RUNNER governs ONLY build-like jobs — one variable, one coherent
# purpose. That is what gap 19 asked for; a second variable turned out to be unnecessary.
runs-on: ubuntu-latest
# tsx gates (known-symbols, route-guard-membership) import modules that open
# SQLite on load; provide DB env so a fresh CI DB initializes cleanly.
env:
JWT_SECRET: ci-lint-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-lint-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
package-manager-cache: false
node-version: ${{ env.CI_NODE_VERSION }}
- uses: ./.github/actions/npm-ci-retry
with:
# PR acceleration is not release-candidate provenance.
cache: ${{ github.event_name == 'pull_request' }}
- name: Restore ESLint file cache
if: github.event_name == 'pull_request'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
.eslintcache
.eslintcache-complexity
key: eslint-${{ runner.os }}-${{ hashFiles('eslint.config.mjs', 'eslint.complexity-ratchets.config.mjs', 'config/quality/eslint-suppressions.json', 'package-lock.json') }}
# No restore-keys fallback on purpose (#11600, P-II.1 of the v3.8.50 postmortem): a
# cache built under a different suppressions file / lint config / lockfile reports
# stale per-file verdicts, which is exactly how 215 pre-existing errors stayed
# invisible for a whole cycle. Exact key or a cold full lint (~13 min) — never a
# partial cache from another configuration.
# Other security scanners use the same install as ci.yml quality-extended.
# (gh release download = authenticated, 5000 req/hr; curl to api.github.com
# is rate-limited to 60/hr and silently no-ops when throttled). The blocking
# workflow audit has its own required, verified installation below.
- name: Install security scanners (gitleaks/osv/oasdiff)
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: |
set +e
mkdir -p "$HOME/.local/bin"
# Ratchets compare scanner COUNTS across runs. Pin every auditor: a rule-set
# update must be an explicit PR that re-measures/rebaselines, never a random
# red (or green) caused by whatever "latest" served that morning.
GITLEAKS_VERSION=v8.30.1
OSV_SCANNER_VERSION=v2.3.8
OASDIFF_VERSION=v1.19.1
# gitleaks — pinned linux x64 tarball via gh (authed), extract binary
rm -rf /tmp/gl && mkdir -p /tmp/gl
gh release download "$GITLEAKS_VERSION" --repo gitleaks/gitleaks --pattern '*linux_x64.tar.gz' --dir /tmp/gl
tar -xzf /tmp/gl/*linux_x64.tar.gz -C "$HOME/.local/bin" gitleaks
# osv-scanner — pinned linux amd64 bare binary via gh (authed)
rm -rf /tmp/osv && mkdir -p /tmp/osv
gh release download "$OSV_SCANNER_VERSION" --repo google/osv-scanner --pattern '*linux_amd64' --dir /tmp/osv
install -m 0755 /tmp/osv/*linux_amd64 "$HOME/.local/bin/osv-scanner"
# oasdiff — pinned linux amd64 tarball via gh (authed), extract binary
rm -rf /tmp/oasd && mkdir -p /tmp/oasd
gh release download "$OASDIFF_VERSION" --repo Tufin/oasdiff --pattern '*linux_amd64.tar.gz' --dir /tmp/oasd
tar -xzf /tmp/oasd/*linux_amd64.tar.gz -C "$HOME/.local/bin" oasdiff
# ALWAYS export the bin dir (even if any step above failed)
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
"$HOME/.local/bin/gitleaks" version || true
"$HOME/.local/bin/osv-scanner" --version || true
"$HOME/.local/bin/oasdiff" --version || true
# Required auditors use verified, pinned artifacts in a fresh PATH directory.
# Installation failure is INCOMPLETE, never a skipped or zero-finding audit.
- name: Prepare pinned workflow scanners
env:
GH_TOKEN: ${{ github.token }}
run: bash scripts/ci/install-workflow-scanners.sh
- name: Forgotten sibling tests (advisory)
env:
GITHUB_BASE_SHA: ${{ github.event.pull_request.base.sha || needs.changes.outputs.candidateBase }}
run: |
node scripts/quality/build-test-impact-map.mjs
node scripts/check/check-forgotten-sibling-tests.mjs \
--summary-file forgotten-sibling-tests.md \
--json-file forgotten-sibling-tests.json
cat forgotten-sibling-tests.md >> "$GITHUB_STEP_SUMMARY"
- name: Upload forgotten sibling report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: forgotten-sibling-tests
path: |
forgotten-sibling-tests.md
forgotten-sibling-tests.json
if-no-files-found: ignore
retention-days: 30
# Quality gates (all, non-fail-fast) — #8542: replaces 17 bare check:* steps,
# 6 G0 gates, 4 ratchet gates, and 3 typecheck steps with a single aggregation
# step. Each gate runs in a loop with ::group::; failures are collected and
# reported at the end. set -uo pipefail (NOT set -e) so one failing gate does
# not abort the job and mask every later gate. Release-added gates are folded
# in: open-sse typecheck (#8781) and file-size base-relative mode (#8522).
- name: Quality gates (all, non-fail-fast)
env:
# #8522: base-relative file-size mode on PR events — inherited drift (base
# already over frozen cap) must not red an innocent PR. Unset on
# workflow_dispatch (no PR base) → absolute comparison.
# omni-queue/** candidates: the candidate base, so every base-relative gate below
# judges the batch like a PR (a drifted base must not red every candidate).
PR_BASE_SHA: ${{ github.event.pull_request.base.sha || needs.changes.outputs.candidateBase }}
# Other checks may use this local ref; OpenAPI reads immutable event commits.
BASE_REF: ${{ github.base_ref && format('origin/{0}', github.base_ref) || '' }}
# External-state gates of this loop ("externalState" in
# config/quality/release-green-static-profile.json: the OSV database), advisory on an
# omni-queue candidate only. Empty on every other event: they block as before.
EXTERNAL_STATE_GATES: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/omni-queue/') && 'vuln-ratchet' || '' }}
run: |
set -uo pipefail
gates=(
provider-consistency provider-asset-provenance fetch-targets deps file-size error-helper
migration-numbering public-creds db-rules known-symbols
route-guard-membership test-discovery test-runner-api
mutation-test-coverage any-budget:t11 build-scope pack-policy
complexity-ratchets model-lifecycle
lockfile duplication dead-code type-coverage compression-budget
# #8781: open-sse workspace typecheck gate — the workspace imports @/ which
# escapes to src/ via undeclared path aliases. See check-open-sse-typecheck.mjs.
open-sse-typecheck
# Hard Rule #16 — AI/bot attribution in PR commits, title or body (#14436). Reads the PR
# from GITHUB_EVENT_PATH; no-op on non-PR events. ci.yml only runs on PRs to main.
ai-attribution
)
# Ratchet-mode gates append --ratchet. `cycles` belongs here since #15281
# (69cb18dca8): check-cycles.mjs exits 1 on ANY cycle without --ratchet, and
# the frozen ceiling lives in quality-baseline.json → metrics.cycles — same
# `check:cycles:ratchet` semantics ci.yml runs (base-red #15306). `boundary`
# caps the open-sse → src edge count (measure-boundary.mjs --ratchet, ceiling
# quality-baseline.json → metrics.boundaryOpenSseToSrc) — same as ci.yml lint.
ratchet_gates=(
secrets vuln-ratchet workflows openapi-breaking cycles boundary
)
failed=()
for g in "${gates[@]}"; do
echo "::group::check:$g"
# #8522: file-size is base-relative on PR events (compare against
# max(frozen, base)) so inherited drift doesn't red an innocent PR;
# workflow_dispatch (no PR base) falls back to absolute comparison.
# New-code mode (Clean-as-You-Code, 2026-08-30): complexity-ratchets and
# dead-code compare the PR's files against the merge-base and block only on
# what the PR added; the global totals are advisory on PRs and re-frozen at
# release. See scripts/check/newCodeMode.mjs.
case "$g" in file-size|complexity-ratchets|dead-code) NEW_CODE=1 ;; *) NEW_CODE= ;; esac
if [ -n "$NEW_CODE" ] && [ -n "${PR_BASE_SHA:-}" ]; then
npm run "check:$g" -- --base-ref "$PR_BASE_SHA" || failed+=("$g")
else
npm run "check:$g" || failed+=("$g")
fi
echo "::endgroup::"
done
for g in "${ratchet_gates[@]}"; do
echo "::group::check:$g (ratchet)"
# boundary is base-relative on PR events, like file-size (#8522): the ceiling
# becomes max(baseline ceiling, edges on the PR base), so open-sse → src edges
# other merges added after the seed never red an innocent PR; only edges this
# PR adds block. workflow_dispatch (no PR base) keeps the absolute ceiling.
case "$g" in boundary) BASE_RELATIVE=1 ;; *) BASE_RELATIVE= ;; esac
if [ -n "$BASE_RELATIVE" ] && [ -n "${PR_BASE_SHA:-}" ]; then
npm run "check:$g" -- --ratchet --base-ref "$PR_BASE_SHA" || failed+=("$g")
else
npm run "check:$g" -- --ratchet || failed+=("$g")
fi
echo "::endgroup::"
done
echo "::group::typecheck:core"
npm run typecheck:core || failed+=("typecheck:core")
echo "::endgroup::"
echo "::group::check:dashboard-typecheck"
npm run check:dashboard-typecheck || failed+=("check:dashboard-typecheck")
echo "::endgroup::"
echo "::group::check:build-typecheck"
npm run check:build-typecheck || failed+=("check:build-typecheck")
echo "::endgroup::"
# #10134: TS7 zero-new-diagnostics ratchet — folded into this non-fail-fast
# loop (never a separate blocking step) so an earlier red gate cannot abort
# the job and mask it (#8542 mechanism). PRs and omni-queue candidates only:
# the base-relative comparison needs a base SHA (empty on workflow_dispatch).
if [ -n "${PR_BASE_SHA:-}" ]; then
echo "::group::check:ts7-diagnostics-ratchet"
npm run check:ts7-diagnostics-ratchet -- --base-ref "$PR_BASE_SHA" || failed+=("ts7-diagnostics-ratchet")
echo "::endgroup::"
fi
# A failed gate named in EXTERNAL_STATE_GATES (filled on an omni-queue candidate only)
# is a warning there, not a failed gate.
counted=()
for g in "${failed[@]}"; do
if [[ " ${EXTERNAL_STATE_GATES:-} " == *" $g "* ]]; then
echo "::warning::check:$g failed (external state, advisory on an omni-queue candidate)"
else
counted+=("$g")
fi
done
failed=("${counted[@]}")
if (( ${#failed[@]} )); then
printf '::error::%d gate(s) failed: %s\n' "${#failed[@]}" "${failed[*]}"
exit 1
fi
# WS4.2 (v3.8.49 plan): TypeScript 7 native-compiler SHADOW — advisory only.
# TS7 went GA 2026-07-08 with 8-12x type-check speedups; its Compiler API only
# arrives in 7.1, so typescript-eslint / type-coverage / Stryker stay on 6.x
# (the hybrid is the officially documented pattern). Isolated npx on purpose:
# installing an alias package could collide node_modules/.bin/tsc with 6.x.
# The full result stays advisory while #8484 has a backlog. The blocking
# base-relative ratchet (folded into the non-fail-fast gates step above)
# rejects only diagnostics added by the PR, so existing release debt does
# not block unrelated work.
- name: Typecheck (core) — TS7 native shadow (advisory)
continue-on-error: true
run: |
RC=0
START=$(date +%s)
npm exec --yes --package=typescript@7.0.2 -- tsc --pretty false -p tsconfig.typecheck-core.json || RC=$?
echo "[ts7-shadow] exit=$RC elapsed=$(( $(date +%s) - START ))s — the 6.x step above stays authoritative"
exit $RC
# TIA: build the impact map at runtime (gitignored, ~21MB) and run only the
# unit tests impacted by this PR's changed files. On hub/unmapped changes the
# selector returns __RUN_ALL__ — full-suite authority is ci.yml's `test-unit`
# 8-shard job (test:unit:ci:shard), NOT an unsharded re-run here. Stacking an
# unsharded test:unit:ci on top of it doubled wall time without extra coverage.
# (quality.yml had its own 4-shard `fast-unit` + `fast-vitest` for PR->release from
# 2026-06-23; ci.yml runs on those PRs since #14420 (2026-10-01), so both were an
# exact duplicate — ~62 runner-min and 5 hosted jobs per PR — and were removed.)
#
# BLOCKING for the *impacted subset* (flipped 2026-06-17). Fail-safe full
# coverage remains required via ci.yml `Unit Tests (N/8)` (test-unit).
- name: Impacted unit tests (TIA subset; blocking)
env:
GITHUB_BASE_REF: ${{ github.base_ref }}
# omni-queue/** candidates: select against the batch base, not HEAD~1.
GITHUB_BASE_SHA: ${{ needs.changes.outputs.candidateBase }}
CANDIDATE_SOURCE: ${{ needs.changes.outputs.candidateSource }}
run: |
# omni-queue base-check (the bare base, its own base): a base-relative selection is
# empty, so a test that fails in a red batch's subset could never fail here and the
# queue's base-red comparison (same check, same test) would blame the batch. Run the
# whole unit suite instead.
if [ "${CANDIDATE_SOURCE:-}" = "self" ]; then
echo "__OMNI_QUEUE_BASE_CHECK__" > tia-selection.txt
echo "TIA selection: omni-queue base-check — full unit suite" >> "$GITHUB_STEP_SUMMARY"
RC=0
npm run test:unit:ci || RC=$?
exit $RC
fi
git fetch --no-tags origin "$GITHUB_BASE_REF" || true
# The advisory sibling-test step generates the same map earlier in this job.
[ -f config/quality/test-impact-map.json ] || node scripts/quality/build-test-impact-map.mjs
SEL="$(node scripts/quality/select-impacted-tests.mjs)"
# Shadow evidence (#8084): persist every selection so TIA false negatives can
# be measured against ci.yml test-unit's full-suite verdict across releases BEFORE
# any gate authority moves off ordinary PRs. Artifact uploaded below.
printf '%s\n' "$SEL" > tia-selection.txt
if [ -z "$SEL" ]; then
echo "TIA selection: empty (no source/test changes)" >> "$GITHUB_STEP_SUMMARY"
echo "No source/test changes — skipping unit tests"; exit 0
fi
# CI runners are 4-vCPU; run at --test-concurrency=4 (matching the ci.yml unit
# job) rather than test:unit's local-tuned concurrency=20. Oversubscribing the
# runner makes timing-sensitive tests (db-backup, upstream-timeout, ...) flake,
# which must not happen on a blocking gate. DATA_DIR isolation keeps the parallel
# run race-free regardless of concurrency.
if echo "$SEL" | grep -q "__RUN_ALL__"; then
echo "TIA selection: __RUN_ALL__ (fail-safe) — full-suite authority stays with ci.yml test-unit" >> "$GITHUB_STEP_SUMMARY"
echo "Fail-safe: __RUN_ALL__ — deferring FULL unit suite to ci.yml test-unit (8-shard)."
echo "Not re-running unsharded test:unit:ci here (duplicate of test-unit coverage)."
exit 0
fi
echo "TIA selection: $(grep -c . tia-selection.txt) impacted test file(s) — full suite still runs in ci.yml test-unit (shadow-evidence phase, #8084)" >> "$GITHUB_STEP_SUMMARY"
echo "Running impacted tests:"; echo "$SEL"
mapfile -t FILES <<< "$SEL"
# Loader parity with test:unit:ci:shard (#6787): tests/unit/dashboard/** runs
# under `--import tsx` (CJS transform — required for ESM-only deep imports like
# @lobehub/icons/es/* reached via lobeProviderIcons.ts); everything else under
# `--import tsx/esm`. A single tsx/esm invocation false-reds every dashboard
# module-shape test the impact map selects ("Unexpected token 'export'").
DASH=(); REST=()
for f in "${FILES[@]}"; do
case "$f" in
tests/unit/dashboard/*) DASH+=("$f") ;;
*) REST+=("$f") ;;
esac
done
RC=0
if [ ${#REST[@]} -gt 0 ]; then
node --import tsx/esm --import ./open-sse/utils/setupPolyfill.ts --import ./tests/_setup/isolateDataDir.ts --test --test-force-exit --test-concurrency=4 "${REST[@]}" || RC=$?
fi
if [ ${#DASH[@]} -gt 0 ]; then
node --import tsx --import ./open-sse/utils/setupPolyfill.ts --import ./tests/_setup/isolateDataDir.ts --test --test-force-exit --test-concurrency=4 "${DASH[@]}" || RC=$?
fi
exit $RC
# #8084 shadow evidence: keep the raw selection downloadable so TIA misses can be
# audited against ci.yml test-unit failures on the same commit (gate moves need this data).
- name: Upload TIA selection (shadow evidence)
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: tia-selection
path: tia-selection.txt
if-no-files-found: ignore
retention-days: 30
# ── Pacote 4 (plano mestre testes+CI, aprovado 2026-07-04) ─────────────────────────
# No-new-warnings por PR via ESLint bulk suppressions nativo (>=9.24). O baseline
# config/quality/eslint-suppressions.json congela as violações EXISTENTES por
# arquivo+regra; qualquer warning NOVO aparece e o --max-warnings 0 falha o job — o
# drift de +41/+88 warnings por ciclo passa a morrer no PR que o introduz, em vez de
# ser rebaselinado às cegas na release. Aperto do baseline (na reconciliação da
# release): npx eslint . --prune-suppressions --suppressions-location config/quality/eslint-suppressions.json
#
# Forks use hosted runners and the same required code-quality result. A base-red
# is maintainer work, but must not be reported as a passing candidate.
lint-guard:
name: No new ESLint warnings
needs: changes
if: ${{ github.event_name != 'pull_request' || ((github.event.pull_request.draft == false || startsWith(github.head_ref, 'mergify/merge-queue/')) && needs.changes.outputs.code == 'true') }}
# omni-queue/** candidates contain fork code: never on the self-hosted pool.
runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && github.event_name != 'merge_group' && !startsWith(github.ref, 'refs/heads/omni-queue/') && !startsWith(github.head_ref, 'omni-queue/') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted","omni-light"]')) || 'ubuntu-latest' }}
# 2026-08-30: a cold full lint with the eslint-plugin-react-hooks 7 compiler rules is
# killed on the 7 GB hosted runner without a message (status null → exit 1, the
# JSON never written); the box lints it in ~12 min with the heap below.
# G0 (trilho .50): security-events:read lets the CodeQL ratchet below read open
# code-scanning alerts via `gh api .../code-scanning/alerts` (same as ci.yml's
# quality-gate job). contents: read keeps checkout working.
permissions:
contents: read
security-events: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
package-manager-cache: false
node-version: ${{ env.CI_NODE_VERSION }}
- uses: ./.github/actions/npm-ci-retry
with:
# PR acceleration is not release-candidate provenance.
cache: ${{ github.event_name == 'pull_request' }}
- name: Restore ESLint file cache
if: github.event_name == 'pull_request'
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: |
.eslintcache
.eslintcache-complexity
key: eslint-${{ runner.os }}-${{ hashFiles('eslint.config.mjs', 'eslint.complexity-ratchets.config.mjs', 'config/quality/eslint-suppressions.json', 'package-lock.json') }}
# No restore-keys fallback on purpose (#11600, P-II.1 of the v3.8.50 postmortem): a
# cache built under a different suppressions file / lint config / lockfile reports
# stale per-file verdicts, which is exactly how 215 pre-existing errors stayed
# invisible for a whole cycle. Exact key or a cold full lint (~13 min) — never a
# partial cache from another configuration.
- name: ESLint (baseline congelado — warning novo = vermelho)
# lint:json writes the report; --max-warnings 0 keeps no-new-warnings policy.
run: npm run lint:json -- --max-warnings 0
env:
NODE_OPTIONS: --max-old-space-size=8192
# ── G0 (trilho .50): motor de ratchet também no trilho B ─────────────────────
# This job just wrote .artifacts/eslint-results.json — collect-metrics prefers
# that file, so the ratchet engine lands here at ZERO extra ESLint cost (one
# inventory, two consumers; same reason ci.yml chains lint → quality-gate).
# The coverage-report artifact does not exist on this rail, so both ratchet
# invocations run --allow-missing: coverage.* metrics skip gracefully while
# the deterministic ones (eslint / openapi-coverage / i18n-ui) stay BLOCKING.
# Coverage authority remains on the main rail (ci.yml test-coverage → quality-gate).
- run: npm run quality:collect
- name: Ratchet check (blocking)
run: node scripts/quality/check-quality-ratchet.mjs --allow-missing --summary .artifacts/quality-ratchet.md
- name: Require-tighten (blocking)
run: node scripts/quality/check-quality-ratchet.mjs --allow-missing --require-tighten
# CodeQL alerts ratchet — same semantics as ci.yml quality-gate: exits 1 ONLY
# on a real regression (open alerts > baseline in quality-baseline.json);
# a measurement failure (gh/auth/api) self-skips with exit 0. External state (the
# repository's open alerts): advisory on an omni-queue candidate, like ci.yml.
- name: CodeQL alerts ratchet (blocking)
run: npm run check:codeql-ratchet
continue-on-error: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/omni-queue/') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Append ratchet summary
if: always()
run: cat .artifacts/quality-ratchet.md >> "$GITHUB_STEP_SUMMARY" || true
# Merge-integrity: pega no PR os dois vazamentos crônicos de merge que hoje só
# explodem na release-PR. (1) CHANGELOG-eat — o auto-resolve do merge come
# bullets vizinhos/seções inteiras (incidente #6193, 2026-07-05: 212 linhas /
# 130 bullets); o checkout de PR é refs/pull/N/merge, então comparar contra a
# base detecta o eat ANTES do merge. (2) SKILL.md gerado stale vs o catálogo de
# agent-skills (#6186 mergeou um id de catálogo sem rodar o gerador → 8 reds de
# integration invisíveis até a release).
#
# Merge integrity is required regardless of who owns the PR branch.
merge-integrity:
name: Merge integrity (changelog + generated skills)
# Always on non-draft PRs — CHANGELOG/skills can break on docs-only merges too.
if: ${{ github.event_name != 'pull_request' || (github.event.pull_request.draft == false || startsWith(github.head_ref, 'mergify/merge-queue/')) }}
runs-on: ubuntu-latest
env:
JWT_SECRET: ci-lint-secret-with-sufficient-length-for-validation
API_KEY_SECRET: ci-lint-api-key-secret-long
DISABLE_SQLITE_AUTO_BACKUP: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
package-manager-cache: false
node-version: ${{ env.CI_NODE_VERSION }}
- uses: ./.github/actions/npm-ci-retry
with:
# PR acceleration is not release-candidate provenance.
cache: ${{ github.event_name == 'pull_request' }}
# omni-queue/** candidates compare against their batch base (no `needs: changes` here:
# this job must keep running on a queue-draft edit run).
- name: Resolve the omni-queue candidate base
id: candidate
if: startsWith(github.ref, 'refs/heads/omni-queue/')
run: node scripts/merge-queue/candidate-base.mjs >> "$GITHUB_OUTPUT"
- name: CHANGELOG integrity (nenhum bullet da base pode sumir no merge-result)
env:
CHANGELOG_BASE_REF: ${{ steps.candidate.outputs.BASE_SHA }}
run: npm run check:changelog-integrity
- name: Agent-skills generator sync (SKILL.md gerado ≡ catálogo)
run: npm run check:agent-skills-sync
admission-verdict:
# Only requested candidates receive the required check name. An ordinary draft
# deliberately skips its producer jobs and must not create a failed admission.
# Classifier failures still reach the gate; queue metadata edits keep their own name.
name: ${{ (github.event_name == 'pull_request' && github.event.action == 'edited' && github.event.pull_request.user.login == 'mergify[bot]' && startsWith(github.head_ref, 'mergify/merge-queue/') && github.event.pull_request.head.repo.id == github.event.repository.id) && 'Gate / Quality (queue-draft edit)' || (github.event_name != 'pull_request' || github.event.pull_request.draft == false || needs.changes.outputs.queueCandidate == 'true' || needs.changes.result != 'success') && 'Gate / Quality' || 'Admission not requested / Quality' }}
if: ${{ always() && !(github.event_name == 'pull_request' && github.event.action == 'edited' && github.event.pull_request.user.login == 'mergify[bot]' && startsWith(github.head_ref, 'mergify/merge-queue/') && github.event.pull_request.head.repo.id == github.event.repository.id) && (github.event_name != 'pull_request' || github.event.pull_request.draft == false || needs.changes.outputs.queueCandidate == 'true' || needs.changes.result != 'success') }}
runs-on: ubuntu-latest
timeout-minutes: 5
needs:
- changes
- docs-gates
- fast-gates
- lint-guard
- merge-integrity
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
package-manager-cache: false
node-version: ${{ env.CI_NODE_VERSION }}
- name: Evaluate exact-candidate admission
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: node scripts/quality/admission-verdict.mjs quality
- name: Retain admission receipt
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: quality-admission-${{ github.run_id }}-${{ github.run_attempt }}
path: .artifacts/quality-admission.json
if-no-files-found: error
retention-days: 14

View File

@@ -1,73 +0,0 @@
# Publica o export estável do catálogo consumido pelo OmniRoute Radar numa URL
# fixa (asset de release `radar-export-latest`), para o servidor privado do Radar
# (1 GB RAM, nunca clona/builda o OmniRoute) baixá-lo via `RADAR_EXPORT_URL` em
# vez de depender do snapshot gravado no deploy. Fonte: scripts/release/radar-export.mjs.
#
# A URL estável resultante (definir em RADAR_EXPORT_URL no .env do radar-server):
# https://github.com/cheaper-inference/OmniRoute/releases/download/radar-export-latest/export-omniroute.json
name: Radar Export
on:
workflow_dispatch: # o operador pode publicar sob demanda (de qualquer ref)
push:
# `main` e a release ativa (default branch) publicam no mesmo asset estável: o
# radar-server só consome o asset, então um merge de catálogo na release que ficasse
# à espera do cron semanal deixava o feed até 7 dias atrás do README (2026-09-14: a
# linha da Together removida em d6e62ae só saiu do feed com dispatch manual).
branches: [main, "release/**"]
paths:
- open-sse/config/freeModelCatalog.data.ts
- open-sse/config/freeModelCatalog.ts
- open-sse/config/providerRegistry.ts
- open-sse/config/providers/**
- scripts/release/radar-export.mjs
- .github/workflows/radar-export.yml
schedule:
# Diário 03:17 UTC — antes do `radar-feed.timer` do servidor (04:23 UTC), para o ciclo
# do dia já enxergar o export do dia; também mantém geradoEm/proveniência frescos.
- cron: "17 3 * * *"
permissions:
contents: read
concurrency:
group: radar-export-${{ github.ref }}
cancel-in-progress: true
env:
CI_NODE_VERSION: "24"
jobs:
publish-export:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
runs-on: ubuntu-latest
permissions:
contents: write # gh release upload — clobra o asset estável do export
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false # publish usa GH_TOKEN via gh release, não a credencial do checkout
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: ${{ env.CI_NODE_VERSION }}
cache: npm
- run: npm ci
env:
ONNXRUNTIME_NODE_INSTALL: "skip"
- name: Generate catalog export with provenance
run: node --import tsx/esm scripts/release/radar-export.mjs "$RUNNER_TEMP/export-omniroute.json"
- name: Publish to the stable release asset
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG="radar-export-latest"
# Cria o release estável na primeira vez; nas seguintes só re-anexa o asset.
if ! gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--title "Radar catalog export (rolling)" \
--notes "Export estável do catálogo OmniRoute para o Radar. Atualizado automaticamente; NÃO é um release de versão do produto." \
--latest=false
fi
gh release upload "$TAG" "$RUNNER_TEMP/export-omniroute.json" --repo "$GITHUB_REPOSITORY" --clobber

View File

@@ -1,44 +0,0 @@
name: Release acceptance
on:
push:
branches: ["release/v*"]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-acceptance-${{ github.ref }}
cancel-in-progress: false
jobs:
acceptance:
name: Release acceptance
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version-file: ".node-version"
cache: npm
- uses: ./.github/actions/npm-ci-retry
with:
cache: "false"
- name: Emit shadow acceptance report
run: |
node scripts/quality/validate-release-acceptance.mjs \
--plan tests/fixtures/release-acceptance/plan-lint.json \
--manifests tests/fixtures/release-acceptance/shadow-manifests \
--out release-acceptance-report.json
continue-on-error: true
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: release-acceptance-report
path: release-acceptance-report.json
if-no-files-found: ignore
retention-days: 30

View File

@@ -1,52 +0,0 @@
name: OpenSSF Scorecard
on:
branch_protection_rule:
schedule:
- cron: "27 7 * * 1"
push:
# Scorecard only accepts the DEFAULT branch — here the active release/vX.Y.Z,
# not `main`. The job below guards on it so a push to any other branch skips.
branches: ["main", "release/**"]
permissions: read-all
# One analysis per ref at a time. The `push` trigger fires on every push to the active
# release branch (~10/hour) and the job guard below only skips INSIDE the run, so each
# push still queued a hosted run (20 queued on 2026-10-17 against the account's
# concurrent-job limit). Scorecard scores repository posture, not the commit: the
# newest push supersedes the older ones and the weekly schedule keeps its own ref.
concurrency:
group: scorecard-${{ github.ref }}
cancel-in-progress: true
jobs:
analysis:
if: ${{ (github.event_name != 'push' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) && (github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute') }}
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# security-events: write removed — Scorecard findings are advisory and no longer
# uploaded to the code-scanning Security tab (they are supply-chain/posture scores,
# not code vulnerabilities, and drowned out real CodeQL alerts). The run still
# produces the OpenSSF badge (publish_results) and a downloadable SARIF artifact.
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Run analysis
uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0
with:
results_file: results.sarif
results_format: sarif
publish_results: true
- name: Upload artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: SARIF file
path: results.sarif
retention-days: 5

View File

@@ -1,35 +0,0 @@
name: semgrep
on:
pull_request:
branches: ["main", "release/**"]
push:
branches: ["main"]
permissions:
contents: read
# Cancel superseded PR runs (same rule as quality.yml). No paths filter on purpose:
# p/secrets must keep scanning docs-only diffs too — credentials leak in .md files.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
semgrep:
runs-on: ubuntu-latest
container:
image: semgrep/semgrep@sha256:3db5c7af55eb1f512eac0abf0ab69a97b52c74b5e9a27314c221aee1a78d7ab2 # latest resolved 2026-10-25
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run semgrep (advisory)
continue-on-error: true
run: |
semgrep scan --config p/owasp-top-ten --config p/secrets \
--sarif --output semgrep.sarif --metrics off || true
python -c "import json; d=json.load(open('semgrep.sarif')); print('semgrepFindings=%d' % len(d['runs'][0]['results']))" || echo "semgrepFindings=SKIP"
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: semgrep-sarif
path: semgrep.sarif
retention-days: 14

View File

@@ -1,61 +0,0 @@
name: Quarantined Tests (debt, not admission)
on:
schedule:
- cron: "17 5 * * *"
workflow_dispatch:
permissions:
contents: read
issues: read
concurrency:
group: quarantine-${{ github.ref }}
cancel-in-progress: false
jobs:
quarantine:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version-file: .node-version
cache: npm
- uses: ./.github/actions/npm-ci-retry
- name: Read current tracking issue states
id: inventory
env:
GH_TOKEN: ${{ github.token }}
run: |
node --input-type=module <<'JS'
import { readFileSync, mkdirSync, writeFileSync, appendFileSync } from 'node:fs';
import { execFileSync } from 'node:child_process';
const inventory = JSON.parse(readFileSync('config/quality/vitest-exclusions.json', 'utf8'));
const states = {};
for (const issue of new Set(inventory.excluded.map(entry => entry.issue))) {
if (!/^#[1-9]\d*$/.test(issue)) throw new Error('Invalid issue reference');
const value = JSON.parse(execFileSync('gh', ['api', `repos/${process.env.GITHUB_REPOSITORY}/issues/${issue.slice(1)}`], { encoding: 'utf8' }));
states[issue] = value.state;
}
mkdirSync('.artifacts/quarantine', { recursive: true });
writeFileSync('.artifacts/quarantine/issue-states.json', JSON.stringify(states, null, 2));
appendFileSync(process.env.GITHUB_OUTPUT, `count=${inventory.excluded.length}\n`);
JS
- name: Validate inventory lifetime and tracker
run: node scripts/check/check-vitest-exclusions.mjs --issue-states .artifacts/quarantine/issue-states.json
- name: Execute quarantined tests
if: ${{ !cancelled() && steps.inventory.outputs.count != '' && steps.inventory.outputs.count != '0' }}
run: npx --no-install vitest run --config vitest.quarantine.config.ts --reporter=default --reporter=json --outputFile.json=.artifacts/quarantine/results.json
- name: Preserve measured failures and issue evidence
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: quarantine-${{ github.sha }}-${{ github.run_attempt }}
path: .artifacts/quarantine/
if-no-files-found: error
retention-days: 14

View File

@@ -1,200 +0,0 @@
name: UI Kit upstream watch
# The CI UI Kit is a vendored snapshot (packages/ui-kit, pinned in UPSTREAM.md), so nothing tells
# the team when Keak ships a new release: 0.0.66 sat in the tree while 0.0.76 was out. Once a day
# this compares the pinned version with the newest `v*` tag upstream. While we are behind it keeps
# ONE sync PR open against the highest release/vX.Y.Z branch (scripts/ci/ui-kit-sync-pr.sh). It
# never merges: every kit release still needs a visual check on the local VPS. When no PR can be
# opened (frozen release, no PR token, a maintainer closed it) ONE tracking issue says what to do.
#
# Secrets:
# UI_KIT_READ_TOKEN read-only token for the private keak-ai/cheaper-inference-ui-kit. When the
# check can't read upstream it reports "unknown": the run stays green but
# warns, and keeps ONE issue open until a later run can read upstream again.
# UI_KIT_SYNC_PR_TOKEN fine-grained token on this repository (Contents and Pull requests: write).
# This repository doesn't let GITHUB_TOKEN create PRs, and a PR it opened
# wouldn't trigger CI. Without this token only the branch is pushed.
on:
schedule:
- cron: "17 9 * * *" # daily 09:17 UTC
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ui-kit-upstream-watch
cancel-in-progress: true
jobs:
watch:
if: ${{ github.event_name != 'schedule' || github.repository == 'cheaper-inference/OmniRoute' }}
name: Compare the pinned kit with the latest upstream release
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write # push chore/ui-kit-sync-latest
issues: write # the tracking issues
pull-requests: write # read the sync PR's state; opening it uses UI_KIT_SYNC_PR_TOKEN
steps:
- name: Resolve the target release branch
id: base
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
BASE=$(gh api "repos/$GITHUB_REPOSITORY/branches" --paginate --jq '.[].name' \
| grep -E '^release/v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -1)
[ -n "$BASE" ] || { echo "no release/vX.Y.Z branch" >&2; exit 1; }
FREEZES=$(gh issue list --repo "$GITHUB_REPOSITORY" --label release-freeze --state open \
--json title --jq '.[].title')
# Titles read "release-freeze: v3.8.52 in progress"; v3.8.5 must not match v3.8.52.
VERSION="${BASE#release/}"
if printf '%s\n' "$FREEZES" | grep -qE "release-freeze: ${VERSION//./\\.}([^0-9.]|$)"; then
FROZEN=true
else
FROZEN=false
fi
RED=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "Release branch not green: $BASE in:title" --json number --jq '.[0].number // empty')
{
echo "branch=$BASE"
echo "frozen=$FROZEN"
echo "red=$RED"
} >> "$GITHUB_OUTPUT"
echo "target $BASE (frozen=$FROZEN, base-red=${RED:-none})"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.base.outputs.branch }}
persist-credentials: false
- name: Check upstream
id: check
env:
UI_KIT_READ_TOKEN: ${{ secrets.UI_KIT_READ_TOKEN }}
run: |
set -euo pipefail
node scripts/check/check-ui-kit-upstream.mjs --json > ui-kit-upstream.json
cat ui-kit-upstream.json
echo "state=$(node -p "require('./ui-kit-upstream.json').state")" >> "$GITHUB_OUTPUT"
- name: Warn about and track an unreadable upstream
env:
GH_TOKEN: ${{ github.token }}
STATE: ${{ steps.check.outputs.state }}
run: |
set -euo pipefail
if [ "$STATE" = "unknown" ]; then
DETAIL=$(node -p "require('./ui-kit-upstream.json').detail")
echo "::warning title=UI Kit upstream watch::$DETAIL"
echo "**UI Kit upstream watch:** state is \`unknown\`, so new kit releases aren't being tracked. $DETAIL" >> "$GITHUB_STEP_SUMMARY"
fi
# Triage may prefix an issue title ("fix: ..."), so match the end of the title. `in:title`
# is a looser phrase search, so it can't decide this on its own. No `|| echo ""` here: a
# failed lookup has to fail the step, not look like "no issue open" and open a duplicate.
NO_TOKEN_TITLE="UI Kit upstream watch can't run: UI_KIT_READ_TOKEN isn't set"
UNREADABLE_TITLE="UI Kit upstream watch can't read upstream"
OPEN=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "in:title \"UI Kit upstream watch can't\"" --limit 100 --json number,title \
| jq -r --arg a "$NO_TOKEN_TITLE" --arg b "$UNREADABLE_TITLE" \
'.[] | select((.title | endswith($a)) or (.title | endswith($b))) | .number')
if [ "$STATE" != "unknown" ]; then
for NUMBER in $OPEN; do
gh issue close "$NUMBER" --repo "$GITHUB_REPOSITORY" --reason completed \
--comment "The watch can read upstream again (state: $STATE)."
done
elif [ -n "$OPEN" ]; then
echo "Already tracked in: $(echo "$OPEN" | sed 's/^/#/' | paste -sd ' ' -)" >> "$GITHUB_STEP_SUMMARY"
else
REASON=$(node -p "require('./ui-kit-upstream.json').reason")
REPO=$(node -p "require('./ui-kit-upstream.json').repo")
# Only a token that really is unset gets the title that says so.
TITLE="$UNREADABLE_TITLE"
if [ "$REASON" = "no-token" ]; then TITLE="$NO_TOKEN_TITLE"; fi
{
echo "$DETAIL"
echo
echo "Until this is fixed, nothing opens when \`$REPO\` gets a new release. \`npm run check:ui-kit-upstream\` still works locally with your git credentials."
echo
echo "The watch needs a read-only token for that repo in the \`UI_KIT_READ_TOKEN\` secret. This issue closes itself on the next run that can read upstream."
echo
echo "Run: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
} > access-body.md
gh issue create --repo "$GITHUB_REPOSITORY" --title "$TITLE" --body-file access-body.md
fi
- name: Open or update the sync PR
id: sync
if: ${{ steps.check.outputs.state == 'behind' && steps.base.outputs.frozen == 'false' }}
env:
GH_TOKEN: ${{ secrets.UI_KIT_SYNC_PR_TOKEN || github.token }}
HAS_PR_TOKEN: ${{ secrets.UI_KIT_SYNC_PR_TOKEN != '' }}
KIT_TOKEN: ${{ secrets.UI_KIT_READ_TOKEN }}
BASE: ${{ steps.base.outputs.branch }}
BASE_RED_ISSUE: ${{ steps.base.outputs.red }}
run: |
set -euo pipefail
gh auth setup-git
REPO="$GITHUB_REPOSITORY"
LATEST_VERSION=$(node -p "require('./ui-kit-upstream.json').latest.version")
LATEST_COMMIT=$(node -p "require('./ui-kit-upstream.json').latest.commit")
PINNED_COMMIT=$(node -p "require('./ui-kit-upstream.json').pinned.commit")
export REPO LATEST_VERSION LATEST_COMMIT PINNED_COMMIT
scripts/ci/ui-kit-sync-pr.sh
- name: Open, update or close the tracking issue
# Not on an empty state: a failed check says nothing about the pin, so it can't close the issue.
if: ${{ !cancelled() && (steps.check.outputs.state == 'behind' || steps.check.outputs.state == 'up-to-date') }}
env:
GH_TOKEN: ${{ github.token }}
STATE: ${{ steps.check.outputs.state }}
FROZEN: ${{ steps.base.outputs.frozen }}
BASE: ${{ steps.base.outputs.branch }}
DECISION: ${{ steps.sync.outputs.decision }}
BRANCH: ${{ steps.sync.outputs.branch }}
PR_URL: ${{ steps.sync.outputs.pr_url }}
run: |
set -euo pipefail
TITLE="UI kit: a newer upstream release is available"
# Triage may prefix an issue title, so match the end of it, as the step above does.
EXISTING=$(gh issue list --repo "$GITHUB_REPOSITORY" --state open \
--search "in:title \"$TITLE\"" --limit 100 --json number,title \
| jq -r --arg title "$TITLE" '[.[] | select(.title | endswith($title))][0].number // empty')
if [ "$STATE" = "behind" ] && [ -z "$PR_URL" ]; then
PINNED=$(node -p "require('./ui-kit-upstream.json').pinned.version")
LATEST=$(node -p "require('./ui-kit-upstream.json').latest.version")
{
echo "The vendored kit is pinned at \`$PINNED\`; upstream released \`v$LATEST\`."
echo
if [ "$FROZEN" = "true" ]; then
echo "No sync PR was opened because \`$BASE\` is frozen."
elif [ "$DECISION" = "branch-only" ]; then
echo "\`$BRANCH\` is pushed with the sync, but no PR was opened: the \`UI_KIT_SYNC_PR_TOKEN\` secret isn't set. Open it from that branch against \`$BASE\`."
elif [ "$DECISION" = "hand-edited" ]; then
echo "The open sync PR on \`$BRANCH\` has commits pushed by hand, so the watch won't overwrite them with this release. Update that PR, or close it to let the watch open a new one."
elif [ "$DECISION" = "declined" ]; then
echo "The sync PR for this version was closed without merging, so it stays closed until a newer release."
else
echo "The sync step didn't finish; see $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID."
fi
echo
echo "To sync by hand from the main checkout:"
echo
echo '```'
echo 'git -C _references/cheaper-inference-ui-kit fetch --tags'
echo 'scripts/dev/sync-ui-kit.sh latest'
echo '```'
echo
echo "Then run the kit guards (\`tests/unit/*kit*\`, \`design-kit-bridge\`, \`ui-kit-snapshot-gate\`) and the dashboard typecheck."
} > body.md
# Edited in place: this runs daily, so a comment per run would only be noise.
if [ -n "$EXISTING" ]; then
gh issue edit "$EXISTING" --repo "$GITHUB_REPOSITORY" --body-file body.md
else
gh issue create --repo "$GITHUB_REPOSITORY" --title "$TITLE" --body-file body.md
fi
elif [ -n "$EXISTING" ]; then
if [ -n "$PR_URL" ]; then
COMMENT="The sync is now tracked in $PR_URL."
else
COMMENT="The pinned kit matches the latest upstream release."
fi
gh issue close "$EXISTING" --repo "$GITHUB_REPOSITORY" --reason completed --comment "$COMMENT"
fi

View File

@@ -1,53 +0,0 @@
name: Validate stable/v3 PR (dormant)
# DORMANT until the 3.9.0 LTS cut creates `stable/v3` (docs/ops/RELEASE_STRATEGY.md).
# The `branches:` filter means this never triggers while that branch does not exist.
#
# `stable/v3` only takes LTS-safe changes: a Conventional title starting with
# fix / docs / chore(i18n) / feat(providers), or anything the maintainer marks
# with the `lts` label. Everything else belongs on `develop` (v4).
#
# `pull_request` (not `pull_request_target`): nothing is checked out and no code
# from the PR runs — the title and labels arrive through env, never inlined into
# the script (zizmor template-injection).
on:
pull_request:
branches: [stable/v3]
types: [opened, edited, synchronize, reopened, labeled, unlabeled]
permissions:
contents: read
concurrency:
group: validate-stable-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
validate:
name: LTS scope (stable/v3)
if: github.base_ref == 'stable/v3'
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Check title scope or lts label
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
run: |
set -euo pipefail
STRATEGY="docs/ops/RELEASE_STRATEGY.md"
case ",${PR_LABELS}," in
*,lts,*)
echo "✅ label 'lts' present — accepted for stable/v3."
exit 0
;;
esac
if printf '%s' "$PR_TITLE" | grep -qE '^((fix|docs)(\([A-Za-z0-9._/-]+\))?|chore\(i18n\)|feat\(providers\))!?: .+'; then
echo "✅ title scope accepted for stable/v3."
exit 0
fi
{
echo "::error title=Not an LTS change::stable/v3 only accepts fix:, docs:, chore(i18n): or feat(providers): titles, or a PR labelled 'lts'. Retarget this PR to develop, or ask a maintainer for the 'lts' label. See ${STRATEGY}."
}
exit 1

View File

@@ -1,71 +0,0 @@
name: Wiki Sync
# Keeps the GitHub wiki in sync with docs/ on every release that lands on main.
# The wiki has no native generator and historically drifts (it sat at "212+ providers /
# 14 strategies / 37 MCP tools" while code was at 226 / 15 / 87, and new docs like
# SUPPLY_CHAIN never appeared). This runs scripts/docs/sync-wiki.mjs, which:
# - ADDS any docs/ page missing from the wiki (curated; internal reports excluded),
# - syncs the four cover-page counts on Home.md.
# It does NOT overwrite existing wiki pages by default: several docs sources still carry
# stale counts (e.g. ARCHITECTURE.md says "177 providers" while the wiki cover is 226),
# so blind overwrite would regress the wiki. Full content parity (--update-existing) is
# gated on regenerating those sources first.
on:
push:
branches: [main]
paths:
- "docs/**"
- "README.md"
- "AGENTS.md"
- "src/shared/constants/routingStrategies.ts"
- "config/i18n.json"
- "open-sse/mcp-server/server.ts"
- "scripts/docs/sync-wiki.mjs"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: wiki-sync
cancel-in-progress: false
jobs:
sync-wiki:
name: Sync wiki with docs
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: "24"
- name: Clone wiki
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
run: |
git clone "https://x-access-token:${GH_TOKEN}@github.com/${REPO}.wiki.git" wiki
- name: Sync wiki (add missing pages + cover counts)
run: node scripts/docs/sync-wiki.mjs --wiki-dir wiki
- name: Commit & push if changed
run: |
cd wiki
if [ -n "$(git status --porcelain)" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "docs(wiki): auto-sync pages + cover counts with docs"
git push
echo "Wiki updated."
else
echo "Wiki already in sync — nothing to push."
fi

274
.gitignore vendored
View File

@@ -1,67 +1,44 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# project-specific directories
/output/
.slim/deepwork/
.omnivscodeagent/
omnirouteCloud/
omnirouteSite/
_cache/
_ideia/
_mono_repo/
_references/
_tasks/
.agents/**
.claude/**
.gemini/**
.code-forge/**
.config/**
.data/**
.logs/**
.tests/**
.coverage/**
/coverage/
.dist/**
.next/**
.build/**
.out/**
# Stryker mutation testing — ephemeral sandbox + generated reports (never commit)
.stryker-tmp/
reports/mutation/
stryker-output-*.json
# Memory Bank and Cursor rules (local-only AI agent context)
memory-bank/
.cursor/rules/core.mdc
.cursor/rules/memory-bank.mdc
# Claude Code local state — runtime files only; shared commands at .claude/commands/ are tracked
.claude/scheduled_tasks.lock
.claude/scheduled_tasks/
.claude/sessions/
.claude/state.json
.claude/settings.local.json
# Root-level underscore-prefixed directories (private/draft — never commit)
/_*/
/_*
# Draft features documentation (internal only)
docs/new-features/
# dependencies
node_modules/
# Also ignore a root node_modules SYMLINK (worktree setups symlink it from the main
# checkout). The trailing-slash pattern above only matches a directory, so without this
# a symlink named node_modules could be staged by `git add -A` and committed.
/node_modules
*.map
.DS_Store
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
.data/
.next-playwright/
# Serena AI assistant config (local-only tool, not project code)
.serena/
# testing
coverage/
coverage**
# next.js
.next/
/out/
# production
/build
/app
cloud/*
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
@@ -71,15 +48,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed)
.env*
# Local gitleaks artifacts (do not commit)
gitleaks-local.json
!.env.example
!.env.selfhost.example
!.env.homolog.example
!.env.devin-bridge.example
# Provider API keys (never commit)
*.api-key
.nvidia-api-key
# vercel
.vercel
@@ -89,10 +58,9 @@ gitleaks-local.json
next-env.d.ts
# data and logs
/data/
data/
.data/
logs/*
test_output.log
# analysis directories (generated, not tracked)
.analysis/
@@ -100,6 +68,45 @@ antigravity-manager-analysis/
.sisyphus/
.plans/
# docs (allow specific tracked files)
docs/*
!docs/ARCHITECTURE.md
!docs/CODEBASE_DOCUMENTATION.md
!docs/CONTRIBUTING.md
!docs/USER_GUIDE.md
!docs/API_REFERENCE.md
!docs/TROUBLESHOOTING.md
!docs/EXECUTION_CONTEXT_PROVIDER_SYNC.md
!docs/TASK_NEBIUS_BACKEND_ENABLEMENT.md
!docs/frontend-backend-provider-gap-report.md
!docs/openapi.yaml
!docs/RELEASE_CHECKLIST.md
!docs/PLANO-IMPLANTACAO.md
!docs/TASKS.md
!docs/FASE-*.md
!docs/adr/
!docs/cli-tools/
!docs/planning/
!docs/improvement-plans/
!docs/api/
!docs/VM_DEPLOYMENT_GUIDE.md
!docs/FEATURES.md
!docs/screenshots/
!docs/i18n/
!docs/i18n/**
!docs/features/
!docs/features/**
!docs/A2A-SERVER.md
!docs/AUTO-COMBO.md
!docs/MCP-SERVER.md
!docs/CLI-TOOLS.md
!docs/COVERAGE_PLAN.md
!docs/ENVIRONMENT.md
!docs/UNINSTALL.md
!docs/I18N.md
!docs/FLY_IO_DEPLOYMENT_GUIDE.md
# open-sse tests
open-sse/test/*
@@ -107,11 +114,10 @@ open-sse/test/*
.github/instructions/codacy.instructions.md
# Playwright
.playwright-mcp/
test-results/
playwright-report/
blob-report/
/cloud/
cloud/
.tmp/
# Security Analysis (standalone project with own git)
@@ -122,26 +128,18 @@ clipr/
app.log
*.tgz
.gh-discussions.json
deploy.sh
docker-compose.minimal.yml
# Docker Compose override (local-only, never commit)
docker-compose.override.yml
# Backup directories
app.__qa_backup/
.app-build-backup-*/
backup/
# Build intermediates (.build/) and shippable standalone (dist/).
# These are fully reproducible from source; never committed.
# Layer 1: Next.js now writes to .build/next (was .next); assembled bundle → dist/
# (Previously /app/ was the standalone output; renamed to /dist/ in Layer 1.)
/.build/
/dist/
/.next/
# Production standalone build (created by scripts/prepublish.mjs)
# Conflicts with Next.js App Router detection in dev (root app/ shadows src/app/)
# npm publish still includes it via package.json "files" field
/app/
# Electron
# Electron (subproject dependency lock and build artifacts)
electron/package-lock.json
electron/dist-electron/
electron/node_modules/
icon.iconset/
@@ -154,6 +152,9 @@ vscode-extension/
*.sqlite-wal
*.sqlite-journal
# Compiled npm-package build artifact (not source, should not be in git)
/app
# IDEA
.idea/
@@ -162,22 +163,17 @@ vscode-extension/
# Empty/dangling files
typescript
/MAX
# Gemini Antigravity agent data
.gemini/
# Superpowers plans/specs (internal tooling, not project code)
docs/superpowers/
# Superpowers visual-companion brainstorm mockups (ephemeral)
.superpowers/
# TIA test-impact map — generated at runtime in CI (build-test-impact-map.mjs), never committed (~21MB)
config/quality/test-impact-map.json
# GitNexus local index
.gitnexus
.worktrees
bin/omniroute.mjs
# Consistent with .dockerignore / .npmignore
.omc/
@@ -186,121 +182,3 @@ bun.lock
# Private environment variables for .http-client
http-client.private.env.json
# Note: _ideia/ (feature-triage drafts) is fully covered by the /_*/ rule above
# and kept as a separate local-only git repo. Never committed to OmniRoute.
# i18n audit artifact (generated by scripts/i18n/audit-dashboard-pages.mjs)
scripts/i18n/_audit.json
scripts/i18n/_pending-keys.json
# Private workflow / skill / command implementations
# These contain proprietary multi-phase logic and should not be committed
.agents/workflows/implement-features-ag.md
.agents/workflows/port-upstream-features-ag.md
.agents/workflows/port-upstream-issues-ag.md
.agents/skills/implement-features/
.claude/commands/implement-features-cc.md
.claude/commands/port-upstream-features-cc.md
.claude/commands/port-upstream-issues-cc.md
.claude/worktrees/
.codegraph/
# Test executable shims belong in the OS temporary directory, not the repository root
/.fakebin-*/
# Fumadocs generated source
.source/
# AI agent local settings and configs
.agents/
.antigravitycli/
/.claude/
# PR Reviews and local feedback files
pr_reviews*.json
/review/
#hidden local data directories (never commit)
.local-data/
.data-dev/
/.junie/
# internal setup prompts with personal credentials — never commit
CODEX-SETUP-PROMPT.md
# Quality ratchet — métricas efêmeras (baseline commitado em config/quality/; métricas não)
config/quality/quality-metrics.json
# Electron desktop build output unpacked into the repo root.
# `electron-builder` (squirrel-windows target) unpacks the packaged app — the
# entire Chromium runtime, ~24k files — directly into the repository root.
# Every rule below is ROOT-ANCHORED (leading `/`) on purpose: a bare `locales/`
# or `resources/` would also swallow tracked sources such as the CLI
# translations in `bin/cli/locales/*.json`.
/OmniRoute.exe
/Uninstall OmniRoute.exe
/uninstallerIcon.ico
/locales/
/resources/
/*.pak
/*.dll
/icudtl.dat
/snapshot_blob.bin
/v8_context_snapshot.bin
/vk_swiftshader_icd.json
/LICENSE.electron.txt
/LICENSES.chromium.html
# Runtime logs (diretório local, nunca versionado)
/logs/
-home-diegosouzapw-dev-automações-bots-yt-downloader-20260504 .txt
-home-diegosouzapw-dev-automações-bots-yt-downloader-20260410 .txt
docs/prompts/AGENT-OWNERSHIP-PROTOCOL.omniroute.md
docs/prompts/AGENT-OWNERSHIP-PROTOCOL.md
docs/prompts/AGENT-OWNERSHIP-PROTOCOL.omniroute-mim.md
docs/prompts/AGENT-OWNERSHIP-PROTOCOL.omniroute-mid.md
omniroute.md
# mise configuration
mise.toml
_artifacts/ # release-green artifacts
.claude-flow/
# ESLint file cache (npm run lint --cache / complexity ratchets)
.eslintcache
.eslintcache-complexity
/.eslintcache-*
# CI/local quality artifacts (eslint-results.json, quality-ratchet.md, etc.)
.artifacts/
/perf-audit*.md
/quality-ratchet/
# Homologation E2E suite (npm run homolog) — real-environment credentials + report output
.env.homolog
tests/homolog/.auth/
tests/homolog/ui/.auth/
homolog-report/
docker-compose.yml.bak
# _tasks e um repo git SEPARADO (ver AGENTS.md). A linha _tasks/ (com barra) NAO
# ignora um SYMLINK chamado _tasks; /_tasks (ancorado) cobre arquivo/symlink/dir na raiz
# e impede que um git add -A recapture o symlink (incidente 2026-08-08).
/_tasks
# CLI local cache/state
.playwright-cli
# Ad-hoc test sandboxes (never tracked — may contain local DBs)
/.sandbox/
.aider*
# check:install-upgrade work trees (~12 GB, disposable)
/.install-upgrade/
# run-translation.mjs writes the state atomically via a per-process temp file
/.i18n-state.json.*.tmp
# Scoped tsc incremental state written by the typecheck gates (typecheck:core / open-sse / api)
.tsbuildinfo-*

View File

@@ -1,107 +0,0 @@
# .gitleaks.toml — Configuração do gitleaks para OmniRoute
# Task 7.18 — PLANO-QUALITY-GATES-FASE7.md
#
# Estende as regras padrão do gitleaks com allowlists específicas do projeto.
#
# INSTRUÇÕES para allowlists:
# Findings legítimos (fixtures de teste, creds OAuth públicas já cobertas pelo
# check-public-creds.mjs, valores de exemplo em docs) devem ser registrados abaixo
# em [[allowlist]] com um comentário explicativo obrigatório.
#
# NÃO adicione uma entrada de allowlist sem justificativa. Cada entrada é revisada
# a cada release (stale-enforcement). Regra: se o finding é um valor real que o
# sistema usa em produção, é um verdadeiro positivo — não allowliste, corrija.
#
# Referência: docs/security/PUBLIC_CREDS.md (credenciais OAuth públicas conhecidas)
# CLAUDE.md Hard Rule #11 (resolvePublicCred obrigatório)
# Herdar TODAS as regras padrão do gitleaks. ATENÇÃO: um config customizado
# SEM [extend].useDefault = true (e sem [[rules]] próprias) resulta em ZERO
# regras — o gitleaks SUBSTITUI o ruleset padrão pelo arquivo, não o estende
# automaticamente. Sem esta seção, `gitleaks --config .gitleaks.toml` nunca
# detecta nada (todo finding vira 0), tornando o gate inerte. Com useDefault,
# a allowlist abaixo é aplicada POR CIMA das ~170 regras padrão.
[extend]
useDefault = true
# Para desabilitar uma regra específica, usar:
# [[rules]]
# id = "rule-id"
# [rules.allowlist]
# description = "..."
# ---------------------------------------------------------------------------
# Allowlist global do projeto
# Entradas aqui são ignoradas em TODAS as varreduras.
# ---------------------------------------------------------------------------
[allowlist]
description = "OmniRoute project-level allowlist — fixtures, test vectors, public OAuth creds"
# Paths a ignorar completamente (node_modules, builds, etc.)
paths = [
'''node_modules''',
'''\.next''',
'''dist''',
'''\.git''',
'''coverage''',
'''\.nyc_output''',
]
# Commits específicos a ignorar (ex: commit que introduziu fixtures de teste)
# commits = []
# Regexes de stopwords — linhas que contêm estes padrões são ignoradas.
# Usar apenas para falsos positivos comprovados com justificativa abaixo.
# stopwords = []
# Regexes de targets (paths de arquivos) que podem ser allowlistados por regra.
# Ver [[allowlist]] por-regra abaixo para granularidade.
# ---------------------------------------------------------------------------
# Allowlist por-regra (adicionar conforme necessário durante o stale review)
# ---------------------------------------------------------------------------
#
# Exemplo (REMOVER / SUBSTITUIR por entradas reais quando necessário):
#
# [[rules]]
# # Allowlistar fixtures de teste que contêm tokens OAuth de exemplo/inválidos
# # Adicionado: 2026-06-13 | Revisar em: v3.9.0 | Justificativa: valores não-reais de teste
# id = "github-fine-grained-pat"
# [rules.allowlist]
# description = "Test fixture PATs — valores sintéticos, não funcionais"
# paths = [
# '''tests/fixtures/''',
# '''tests/unit/''',
# ]
#
[[rules]]
# Falsos-positivos comprovados do generic-api-key — zerados em 2026-07-13 (WS6/D3,
# plano v3.8.49). Revisar em v3.9.0. Nenhum é credencial: dois são NOMES DE CAMPO
# de métricas de latência; o terceiro é o valor PÚBLICO de um beta header da API
# da Anthropic (documentado publicamente, não é segredo).
id = "generic-api-key"
[rules.allowlist]
description = "Field names + public Anthropic beta-header value (não são segredos)"
regexes = [
'''latencyP\d{2}Ms''',
'''interleaved-thinking-2025-05-14''',
# v3.8.49 pre-flight (2026-07-28). Nenhum dos dois e credencial:
# - chave de localStorage do banner de patrocinio (#8723; #10200 bumpou v1->v2,
# generalizado para -v\d+ no round 3 de base-reds #9985), so um identificador de UI;
# - x-api-key PUBLICO do Firefly web (documentado em open-sse/utils/publicCreds.ts:207);
# as duas ocorrencias sinalizadas estao em COMENTARIOS JSDoc, o runtime le de resolvePublicCred().
'''omniroute-kimi-sponsor-banner-dismissed-v\d+''',
# CheaperInference sponsor banner localStorage key (upstream #11196 /
# eb5797370). Same UI-identifier pattern as the kimi banner above, not a
# credential; the generic-api-key rule flags the long hyphenated string.
'''omniroute-cheaperinference-sponsor-banner-dismissed-v\d+''',
'''SunbreakWebUI1''',
# Uzbek dashboard catalog (#13727, src/i18n/messages/uz.json `outputTokenDesc`):
# "Yakunlash/javob tokenlari" = "completion/response tokens". The rule reads the
# `...TokenDesc` key as a token assignment and the translated words as its value.
'''Yakunlash/javob''',
# Feature-flag id from #13439 (src/shared/constants/featureFlagDefinitions.ts):
# `key: "PROTECTED_PRIORITY_INFRA_502_ENABLED"` is a flag name, not a credential.
'''PROTECTED_PRIORITY_INFRA_502_ENABLED''',
]

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env sh
# Hard Rule #16 — no AI/bot Co-Authored-By trailers or AI-generation footers in commit metadata.
# Human co-authors stay. Incident record: #14436.
node scripts/check/check-ai-attribution.mjs --message-file "$1"

View File

@@ -1,23 +1,10 @@
#!/usr/bin/env sh
set -eu
if ! command -v npx >/dev/null 2>&1; then
echo "npx not found in PATH — install the project's Node/npm toolchain before committing." >&2
exit 1
echo "⚠️ npx not found in PATH — skipping pre-commit hooks"
echo " Run 'npm run lint && npm run check:any-budget:t11' manually before pushing."
exit 0
fi
# Cheap, deterministic local gates (re-enabled). Slower checks (i18n drift,
# openapi coverage/security-tiers, env-doc sync) run in CI to keep commits fast.
sh scripts/check/check-git-identity.sh
# The stash is shared by every worktree. Never let a local hook stash another
# session's changes, and never download a missing tool during a commit.
npx --no-install lint-staged --no-stash
node scripts/quality/gate-manifest.mjs
# --mode=pr: judge what this commit does; mirrors the base left stale are the translation wave's job
node scripts/check/check-docs-sync.mjs --mode=pr
npx lint-staged
node scripts/check-docs-sync.mjs
npm run check:any-budget:t11
# kit type scale (#19066 block 7): sizes under 12 px and font-bold may only go down
node scripts/check/check-type-scale-ratchet.mjs --ratchet --quiet
node scripts/check/check-tracked-artifacts.mjs
# vendored kit must stay byte-identical to the pinned upstream commit; skips with a warning where the private clone is absent
npm run --silent check:ui-kit-snapshot

View File

@@ -1,15 +1,8 @@
#!/usr/bin/env sh
# .husky/pre-push — intentionally light.
# any-budget + tracked-artifacts already run on pre-commit; re-running them on
# every push only doubles local wall time for the same existence reason (CI still
# enforces both). Keep this hook as a PATH/npm sanity check + reminder.
# Intentionally excludes test:unit / typecheck (slow; covered by CI).
if ! command -v npm >/dev/null 2>&1; then
echo "⚠️ npm not found in PATH — skipping pre-push hooks"
echo " Run 'npm run check:any-budget:t11 && npm run check:tracked-artifacts' manually before pushing."
echo " Run 'npm test' manually before pushing."
exit 0
fi
# No-op success: real local gates live in pre-commit; CI owns the rest.
exit 0
npm run test:unit

File diff suppressed because it is too large Load Diff

View File

@@ -1,40 +0,0 @@
# .mailmap — canonical author identities for git log/shortlog/blame.
#
# Why this file exists: between 2026-08-13 and 2026-08-26 this checkout carried a
# `git config --local` whose user.name was one contributor's ("Xiangzhe" / @xz-dev)
# and whose user.email was ANOTHER contributor's (@backryun). Every commit produced
# on this machine in that window was therefore signed with @backryun's address —
# 237 commits, all in the -0300 timezone, while @backryun's own work commits from
# +0900 and continued normally throughout. The local override was removed on
# 2026-08-26; this file repairs the RECORD without rewriting published history
# (those commits live on release/v3.8.50 and release/v3.8.51, which other sessions
# and open PRs build on — a rewrite would force-push both and orphan the v3.8.50 tag).
#
# Format: Canonical Name <canonical@email> Commit Name <commit@email>
# --- Maintainer: several addresses used over the project's life ---
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> <diegosouza.pw@gmail.com>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> <diegosouza.pw@outlook.com>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> <diegosouzapw@users.noreply.github.com>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Diego Souza <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> <diego.souza.pw@gmail.com>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> <souzamiriamrodrigues790@gmail.com>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> <diego.souza@cdwasolutions.com.br>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> <diegosouzapw@devbox.local>
# --- The misattribution window: name Xiangzhe + @backryun's email, from -0300.
# These are maintainer/session commits, NOT @backryun's contributions.
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Xiangzhe <bakryun0718@proton.me>
diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Xiangzhe <diegosouza.pw@gmail.com>
# --- Xiangzhe (@xz-dev) — a distinct contributor; keep their own work intact ---
Xiangzhe <32761048+xz-dev@users.noreply.github.com> <xz-dev@users.noreply.github.com>
Xiangzhe <32761048+xz-dev@users.noreply.github.com> <xiangzhedev@gmail.com>
# --- @backryun's own alternate addresses (their real work, kept intact) ---
backryun <24198422+backryun@users.noreply.github.com> <bakryun0718@proton.me>
backryun <24198422+backryun@users.noreply.github.com> <backryun@daonlab.local>
backryun <24198422+backryun@users.noreply.github.com> <busan011@ormbiz.co.kr>
backryun <24198422+backryun@users.noreply.github.com> <backryun@users.noreply.github.com>

View File

@@ -1,14 +0,0 @@
{
"_comment": "Advisory markdown lint for docs/ + root *.md. Rules that conflict with the existing doc style (heavy inline HTML, long lines, centered headings) are disabled so the gate stays signal-not-noise. Run: npm run lint:md",
"default": true,
"MD013": false,
"MD033": false,
"MD041": false,
"MD024": { "siblings_only": true },
"MD026": false,
"MD036": false,
"MD040": false,
"MD029": false,
"MD007": { "indent": 2 },
"MD046": false
}

View File

@@ -1,53 +0,0 @@
# Mergify — merge queue RETIRED by the owner's decision of 2026-11-19.
#
# History: the Mergify `release` queue (WS3.4/D5 of the v3.8.49 quality/velocity master plan:
# owner-applied `queue` label, serial squash, checks_timeout 240 min) and the opt-in
# `relay-integration` queue landed release PRs until 2026-11-19 (last Mergify merge: #19538,
# 2026-11-15). Their rules, and the rule that removed the `queue` label after a merge, are in
# git history. Release PRs are now merged by hand under the repository ruleset "Require green
# gates on the active release" (`Gate / CI` + `Gate / Quality`) until omni-queue runs in live
# mode, and through omni-queue after that (docs/ops/OMNI_QUEUE.md).
#
# WHY this file is kept instead of deleted: the Mergify GitHub App is still installed, and
# Mergify documents that "With no Mergify configuration, your queue already ... Merges
# automatically when your required checks pass" once someone comments `@mergifyio queue`
# (docs.mergify.com/merge-queue/setup). The docs do not say what that command does on a config
# without `queue_rules`, so the commands that would merge or rewrite a pull request are
# refused here: each condition list below is `closed` AND `-closed`, which no pull request can
# match. `commands_restrictions` is read whatever Mergify products are enabled
# (docs.mergify.com/configuration/file-format). `refresh` and `dequeue` keep their defaults:
# they neither merge nor push.
#
# Contract: tests/unit/mergify-queue-config.test.ts. Do not add `queue_rules`,
# `merge_protections_settings` or a merging `pull_request_rules` action back: two queues would
# act on the same release PRs.
commands_restrictions:
queue:
conditions:
- closed
- -closed
requeue:
conditions:
- closed
- -closed
rebase:
conditions:
- closed
- -closed
update:
conditions:
- closed
- -closed
squash:
conditions:
- closed
- -closed
backport:
conditions:
- closed
- -closed
copy:
conditions:
- closed
- -closed

View File

@@ -4,24 +4,11 @@ data/
**/db.json
# VS Code extension test runtime (large binary, not needed in npm package)
app/vscode-extension/
**/data/
**/db.json
# Source code (pre-built dist/ is published instead)
#
# NOTA (2026-08-05): as entradas `app/*` foram removidas — o diretorio `app/`
# foi renomeado para `dist/` na Layer 1 e nao existe mais. Elas sugeriam um
# layout que ja nao e o do projeto.
#
# NOTE (#3578 / #3821-review): package.json "files" is the source of truth for what
# ships. It now allowlists the backend source closure the MCP server needs at runtime
# (open-sse/, src/lib, src/server, ...) and OVERRIDES the broad src/ + open-sse/ excludes
# below — npm honors files[] over .npmignore for inclusion. These lines are kept only as
# intent/back-stop: if files[] is ever trimmed back to specific paths, they must NOT be
# allowed to re-hide the MCP closure (that would silently reintroduce the --mcp
# ERR_MODULE_NOT_FOUND #3578 fixed). The closure gate in
# tests/unit/mcp-published-files-closure-3578.test.ts asserts the real `npm pack` output
# in both directions (closure present + zero test files), catching such a regression.
# Source code (pre-built app/ is published instead)
src/
open-sse/
docs/
@@ -31,17 +18,6 @@ images/
logs/
scripts/
# Co-located tests must never ship even when their parent dir is allowlisted by files[].
# (Primary guard is the "!**/*.test.*" negations in package.json files[]; this is defense
# in depth for any nested dir the allowlist pulls in.)
**/__tests__/
**/*.test.ts
**/*.test.tsx
**/*.test.js
**/*.test.mjs
**/*.spec.ts
**/*.spec.tsx
# Config/dev files
*.md
!README.md
@@ -52,6 +28,8 @@ scripts/
.vscode/
.agents/
.env*
app/.env
app/.env*
eslint.config.mjs
prettier.config.mjs
postcss.config.mjs
@@ -74,8 +52,8 @@ AGENTS.md
bun.lock
# Build artifacts (pre-built goes inside app/)
/.next/
/node_modules/
.next/
node_modules/
# Ignore large binary files and other build directories
*.tgz
@@ -83,6 +61,8 @@ bun.lock
*.deb
*.rpm
electron/
app/electron/
app/vscode-extension/
# Subprojects
clipr/
@@ -92,12 +72,12 @@ vscode-extension/
# Root-level underscore-prefixed directories (private/draft — never publish)
/_*/
app/_*/
app/coverage/
app/logs/
app/tests/
# Consistent with .gitignore and .dockerignore
.claude/
.fakebin-*
.eslintcache*
_tasks/
.DS_Store
.idea/
.config/
@@ -120,4 +100,3 @@ test-results/
playwright-report/
blob-report/
coverage/
@omniroute/

19
.npmrc
View File

@@ -2,22 +2,3 @@
# Keeping peer auto-install disabled prevents npm from pulling @lobehub/ui/mermaid
# back into the tree and reopening npm audit findings for unused packages.
legacy-peer-deps=true
# Network resilience: enlarge npm's fetch retry budget so a transient registry
# socket reset (ECONNRESET) mid-download retries instead of failing the job.
# npm defaults to only 2 retries with short timeouts; `npm ci` in
# electron-release.yml hit ECONNRESET during v3.8.41 publish. Applies to every
# CI workflow (electron / docker / unit) and local installs.
fetch-retries=5
fetch-retry-factor=4
fetch-retry-mintimeout=20000
fetch-retry-maxtimeout=120000
# onnxruntime-node bundles the CPU binaries (bin/napi-v6/...) inside the npm
# package, but its postinstall still tries to fetch the CUDA 12 binaries from
# NuGet on linux/x64 by default (~300MB). Skipping that keeps local/CI installs
# network-free and prevents npm's optional-dependency chain (@huggingface/
# transformers) from being dropped entirely whenever that download fails —
# which previously left `@huggingface/transformers` missing after `npm install`
# and broke startup with a crash in the transformers loader.
onnxruntime-node-install=skip

250
.omc/project-memory.json Normal file
View File

@@ -0,0 +1,250 @@
{
"version": "1.0.0",
"lastScanned": 1775016362438,
"projectRoot": "/home/openclaw/omniroute-src",
"techStack": {
"languages": [
{
"name": "JavaScript/TypeScript",
"version": ">=18.0.0 <24.0.0",
"confidence": "high",
"markers": ["package.json"]
},
{
"name": "TypeScript",
"version": null,
"confidence": "high",
"markers": ["tsconfig.json"]
}
],
"frameworks": [
{
"name": "express",
"version": "5.2.1",
"category": "backend"
},
{
"name": "next",
"version": "16.0.10",
"category": "fullstack"
},
{
"name": "react",
"version": "19.2.4",
"category": "frontend"
},
{
"name": "react-dom",
"version": "19.2.4",
"category": "frontend"
},
{
"name": "@playwright/test",
"version": "1.58.2",
"category": "testing"
},
{
"name": "vitest",
"version": "4.0.18",
"category": "testing"
}
],
"packageManager": "npm",
"runtime": "Node.js 18.0.024.0.0"
},
"build": {
"buildCommand": "npm run build",
"testCommand": "npm test",
"lintCommand": "npm run lint",
"devCommand": "npm run dev",
"scripts": {
"dev": "node scripts/run-next.mjs dev",
"build": "node scripts/build-next-isolated.mjs",
"build:cli": "node scripts/prepublish.mjs",
"start": "node scripts/run-next.mjs start",
"lint": "eslint .",
"electron:dev": "concurrently \"npm run dev\" \"wait-on http://localhost:20128 && cd electron && npm run dev\"",
"electron:build": "npm run build && cd electron && npm run build",
"electron:build:win": "npm run build && cd electron && npm run build:win",
"electron:build:mac": "npm run build && cd electron && npm run build:mac",
"electron:build:linux": "npm run build && cd electron && npm run build:linux",
"test": "node --import tsx/esm --test tests/unit/*.test.mjs",
"test:unit": "node --import tsx/esm --test tests/unit/*.test.mjs",
"test:plan3": "node --import tsx/esm --test tests/unit/plan3-p0.test.mjs",
"test:fixes": "node --import tsx/esm --test tests/unit/fixes-p1.test.mjs",
"test:security": "node --import tsx/esm --test tests/unit/security-fase01.test.mjs",
"check:cycles": "node scripts/check-cycles.mjs",
"check:route-validation:t06": "node scripts/check-route-validation.mjs",
"check:any-budget:t11": "node scripts/check-t11-any-budget.mjs",
"check:docs-sync": "node scripts/check-docs-sync.mjs",
"typecheck:core": "tsc --pretty false -p tsconfig.typecheck-core.json",
"typecheck:noimplicit:core": "tsc --pretty false -p tsconfig.typecheck-noimplicit-core.json",
"test:integration": "node --import tsx/esm --test tests/integration/*.test.mjs",
"test:e2e": "node scripts/run-playwright-tests.mjs test tests/e2e/*.spec.ts",
"test:protocols:e2e": "node scripts/run-protocol-clients-tests.mjs",
"test:vitest": "vitest run open-sse/mcp-server/__tests__/*.test.ts open-sse/services/autoCombo/__tests__/*.test.ts",
"test:ecosystem": "node scripts/run-ecosystem-tests.mjs",
"test:coverage": "c8 --exclude=tests/** --exclude=**/*.test.* --reporter=text-summary --reporter=html --reporter=json-summary --reporter=lcov --check-coverage --statements 55 --lines 55 --functions 55 --branches 60 node --import tsx/esm --test tests/unit/*.test.mjs",
"test:coverage:legacy": "c8 --exclude=open-sse --check-coverage --lines 50 --functions 50 --branches 50 node --import tsx/esm --test tests/unit/*.test.mjs",
"coverage:report": "c8 report --exclude=tests/** --exclude=**/*.test.* --reporter=text --reporter=text-summary --reporter=html --reporter=json-summary --reporter=lcov",
"coverage:report:legacy": "c8 report --exclude=open-sse --reporter=text --reporter=text-summary",
"test:all": "npm run test:unit && npm run test:vitest && npm run test:ecosystem && npm run test:e2e",
"check": "npm run lint && npm run test",
"prepublishOnly": "npm run build:cli",
"postinstall": "node scripts/postinstall.mjs",
"prepare": "husky",
"system-info": "node scripts/system-info.mjs"
}
},
"conventions": {
"namingStyle": "camelCase",
"importStyle": null,
"testPattern": null,
"fileOrganization": null
},
"structure": {
"isMonorepo": true,
"workspaces": ["open-sse"],
"mainDirectories": ["bin", "docs", "public", "scripts", "src", "tests"],
"gitBranches": {
"defaultBranch": "main",
"branchingStrategy": null
}
},
"customNotes": [],
"directoryMap": {
"bin": {
"path": "bin",
"purpose": "Executable scripts",
"fileCount": 3,
"lastAccessed": 1775016362426,
"keyFiles": ["mcp-server.mjs", "omniroute.mjs", "reset-password.mjs"]
},
"docs": {
"path": "docs",
"purpose": "Documentation",
"fileCount": 14,
"lastAccessed": 1775016362426,
"keyFiles": [
"A2A-SERVER.md",
"API_REFERENCE.md",
"ARCHITECTURE.md",
"AUTO-COMBO.md",
"CLI-TOOLS.md"
]
},
"electron": {
"path": "electron",
"purpose": null,
"fileCount": 5,
"lastAccessed": 1775016362431,
"keyFiles": ["README.md", "main.js", "package.json", "preload.js", "types.d.ts"]
},
"images": {
"path": "images",
"purpose": null,
"fileCount": 1,
"lastAccessed": 1775016362434,
"keyFiles": ["omniroute.png"]
},
"logs": {
"path": "logs",
"purpose": null,
"fileCount": 3,
"lastAccessed": 1775016362434,
"keyFiles": ["build_clean_tools.log", "build_debug.log", "build_force_clean.log"]
},
"open-sse": {
"path": "open-sse",
"purpose": null,
"fileCount": 5,
"lastAccessed": 1775016362434,
"keyFiles": ["index.ts", "package.json", "tsconfig.json", "types.d.ts"]
},
"public": {
"path": "public",
"purpose": "Public files",
"fileCount": 3,
"lastAccessed": 1775016362435,
"keyFiles": ["apple-touch-icon.svg", "favicon.svg", "icon-192.svg"]
},
"scripts": {
"path": "scripts",
"purpose": "Build/utility scripts",
"fileCount": 23,
"lastAccessed": 1775016362435,
"keyFiles": [
"bootstrap-env.mjs",
"build-next-isolated.mjs",
"check-cycles.mjs",
"check-docs-sync.mjs",
"check-route-validation.mjs"
]
},
"src": {
"path": "src",
"purpose": "Source code",
"fileCount": 4,
"lastAccessed": 1775016362435,
"keyFiles": ["instrumentation-node.ts", "instrumentation.ts", "proxy.ts", "server-init.ts"]
},
"tests": {
"path": "tests",
"purpose": "Test files",
"fileCount": 0,
"lastAccessed": 1775016362435,
"keyFiles": []
},
"electron/assets": {
"path": "electron/assets",
"purpose": "Static assets",
"fileCount": 4,
"lastAccessed": 1775016362436,
"keyFiles": ["icon.icns", "icon.ico", "icon.png"]
},
"open-sse/config": {
"path": "open-sse/config",
"purpose": "Configuration files",
"fileCount": 17,
"lastAccessed": 1775016362436,
"keyFiles": ["audioRegistry.ts", "cliFingerprints.ts", "codexInstructions.ts"]
},
"open-sse/services": {
"path": "open-sse/services",
"purpose": "Business logic services",
"fileCount": 35,
"lastAccessed": 1775016362437,
"keyFiles": ["accountFallback.ts", "accountSelector.ts", "apiKeyRotator.ts"]
},
"src/app": {
"path": "src/app",
"purpose": "Application code",
"fileCount": 7,
"lastAccessed": 1775016362438,
"keyFiles": ["error.tsx", "global-error.tsx", "globals.css"]
},
"src/lib": {
"path": "src/lib",
"purpose": "Library code",
"fileCount": 30,
"lastAccessed": 1775016362438,
"keyFiles": ["apiBridgeServer.ts", "apiKeyExposure.ts", "cacheControlSettings.ts"]
},
"src/middleware": {
"path": "src/middleware",
"purpose": "Middleware",
"fileCount": 1,
"lastAccessed": 1775016362438,
"keyFiles": ["promptInjectionGuard.ts"]
},
"src/models": {
"path": "src/models",
"purpose": "Data models",
"fileCount": 1,
"lastAccessed": 1775016362438,
"keyFiles": ["index.ts"]
}
},
"hotPaths": [],
"userDirectives": []
}

View File

@@ -0,0 +1,8 @@
{
"session_id": "53c002c3-36a6-47c3-a52d-a8f756c264eb",
"ended_at": "2026-04-01T04:06:04.924Z",
"reason": "prompt_input_exit",
"agents_spawned": 0,
"agents_completed": 0,
"modes_used": []
}

View File

@@ -1,37 +0,0 @@
# wasm-bindgen glue + embedded WASM_BASE64. Prettier rewrites the generated JS
# (quotes, wrapping) on any touch of this file; format tinycmsDomMocks.ts instead.
open-sse/executors/tinycmsSigner.ts
# Long reference tables are manually aligned; formatting the whole file causes noisy diffs.
docs/reference/ENVIRONMENT.md
# Generated by `npm run gen:provider-reference`; the generator aligns the tables and
# is their formatter of record. Without this, lint-staged reformats the file whenever
# it is staged and the next generator run reverts it — a diff ping-pong.
docs/reference/PROVIDER_REFERENCE.md
# Dense auto-generated free-tier budget rows (one object per line) — prettier multi-line expand blows past file-size cap 800.
open-sse/config/freeModelCatalog.data.ts
# Generated by scripts/skills/generate-agent-skills.mjs; the generator is their
# formatter of record and check:agent-skills-sync diffs its output byte-for-byte.
# Prettier reformats the frontmatter (blank line after ---), which makes the gate
# fail on any skill that happens to pass through lint-staged.
skills/*/SKILL.md
skills/*/references/*.md
# check:changelog-integrity compares release bullets against the base as exact
# strings. Prettier normalizes markdown emphasis inside them (*from* -> _from_)
# and re-wraps table rows, so any PR that stages CHANGELOG.md would "lose" base
# bullets and turn the merge-integrity job red. The changelog is generated and
# reconciled by scripts/release/*, which are its formatter of record.
CHANGELOG.md
docs/i18n/*/CHANGELOG.md
# Helm templates are Go text/template, not YAML: `{{- if ... }}` at the start of
# a line is a parse error for Prettier's YAML parser. Helm itself is the
# formatter of record here — `helm lint` and `helm template` validate them.
deploy/helm/*/templates/
# packages/ui-kit/ — vendored snapshot of the CI UI Kit; synced verbatim by scripts/dev/sync-ui-kit.sh, formatted upstream.
packages/ui-kit/src/**

View File

@@ -1,22 +0,0 @@
[
{
"name": "CLI entry (omniroute.mjs)",
"path": "bin/omniroute.mjs",
"limit": "15 KB"
},
{
"name": "MCP server entry (mcp-server.mjs)",
"path": "bin/mcp-server.mjs",
"limit": "5 KB"
},
{
"name": "Node runtime support (nodeRuntimeSupport.mjs)",
"path": "bin/nodeRuntimeSupport.mjs",
"limit": "8 KB"
},
{
"name": "Reset password entry (reset-password.mjs)",
"path": "bin/reset-password.mjs",
"limit": "6 KB"
}
]

View File

@@ -1,28 +0,0 @@
# .trivyignore — accepted-risk suppressions for the container image scan
#
# Policy (see docs/security/SUPPLY_CHAIN.md):
# - The Trivy steps in .github/workflows/docker-publish.yml run with
# `ignore-unfixed: true`, so vulnerabilities WITHOUT a published fix are
# already excluded from both the blocking CRITICAL gate and the advisory
# Security-tab upload. You do NOT need an entry here for an unfixable
# base-image OS CVE — it will not be reported.
# - This file is the single auditable home for the rare case where a *fixable*
# CVE must be temporarily accepted (e.g. the upstream fix is not yet in the
# pinned base tag, or the affected package/binary is provably unreachable
# from the proxy request surface and rebuilding now is not justified).
#
# Format — one CVE id per line, each with a justification comment and, where
# possible, an expiry, e.g.:
# # CVE-XXXX-YYYY — <why accepted>; revisit on next base-image bump (YYYY-MM-DD)
# CVE-XXXX-YYYY
#
# Keep this list SHORT and reviewed every release. Prefer fixing (rebuild on a
# patched base / bump the dep) over suppressing. Stale entries are debt.
# CVE-2026-118764 (minimatch 10.2.5, fix 11.0.1) and CVE-2026-118773 (glob 13.0.6, fix 14.0.2)
# live in the npm bundled in the image, and npm 12.2.1 (latest) still declares the
# vulnerable lines. Medium; OmniRoute calls npm with fixed subcommands, so request input
# does not reach npm as a glob. An overlay would cross majors outside npm's ranges.
# Accepted by the maintainer (#18765); revisit when npm ships the fixed lines (2026-12-02).
CVE-2026-118764
CVE-2026-118773

View File

@@ -1,15 +0,0 @@
# Advisory prose lint for OmniRoute docs (Vale — https://vale.sh).
# Warning-first: surfaces vague language, passive voice, and terminology drift without
# blocking CI. The Microsoft style is pulled by the CI step (vale sync / vale-action).
# Project terms live in the OmniRoute vocabulary so they never read as misspellings.
StylesPath = .vale/styles
MinAlertLevel = warning
Packages = Microsoft
Vocab = OmniRoute
[*.md]
BasedOnStyles = Vale, Microsoft
# Code-heavy reference docs and auto-generated catalogs are noisy under prose rules.
[docs/reference/PROVIDER_REFERENCE.md]
BasedOnStyles = Vale

View File

@@ -1,50 +0,0 @@
OmniRoute
combo
combos
[Cc]ombo
[Aa]uto-[Cc]ombo
MCP
A2A
ACP
RTK
Caveman
Troglodita
Qdrant
FTS5
SQLite
LowDB
OAuth
PKCE
SSE
JSON-RPC
LKGP
P2C
Antigravity
Codex
Kiro
Qoder
Pollinations
LongCat
Cerebras
DeepSeek
Groq
Cline
OpenCode
Termux
Electron
Fumadocs
Notion
Obsidian
WebDAV
IPv4
IPv6
SOCKS5
loopback
backoff
changelog
i18n
locale
locales
roadmap
[Ww]ildcard
upstream

123
.vscode/settings.json vendored
View File

@@ -1,5 +1,4 @@
{
"workbench.sideBar.location": "left",
"css.lint.unknownAtRules": "ignore",
"sonarlint.rules": {
"css:S4662": {
@@ -18,125 +17,5 @@
"level": "off"
}
},
"git.ignoreLimitWarning": true,
// ─── Git: não adicionar os ~44 repos aninhados (9 worktrees + _references/* +
// _mono_repo/* + _ideia/_tasks/.agents) ao Source Control. Era a causa do
// "validando muito": um git status + watcher por repo. Só o repo raiz fica. ───
"git.autoRepositoryDetection": false,
"git.repositoryScanMaxDepth": 0,
"git.detectSubmodules": false,
"git.autofetch": false,
"git.autorefresh": true,
// ─── Performance: não seguir o symlink de node_modules criado pelas worktrees ───
// As worktrees em .worktrees/ apontam node_modules para o checkout principal;
// sem isto a busca atravessa o symlink mesmo com node_modules excluído.
"search.followSymlinks": false,
// ─── TypeScript server (monorepo grande: ~6,6k arquivos rastreados, Next.js 16) ───
"typescript.tsserver.maxTsServerMemory": 4096,
"typescript.disableAutomaticTypeAcquisition": true,
"typescript.tsc.autoDetect": "off",
"npm.autoDetect": "off",
// O tsserver tem o próprio watcher (independente de files.watcherExclude).
// excludeDirectories evita que ele vigie as árvores pesadas.
"typescript.tsserver.watchOptions": {
"excludeDirectories": [
"**/node_modules",
"**/.next",
"**/.build",
"**/dist",
"**/coverage",
"**/.worktrees",
"**/.claude/worktrees",
"**/electron",
"**/_references",
"**/_mono_repo",
"**/_tasks"
]
},
// Para esconder os diretórios gerados da árvore do Explorer, descomente:
// (MANTIDO comentado — o dono precisa ver _references/_mono_repo/_tasks na árvore.
// A performance é resolvida por watcherExclude + search.exclude + tsserver, sem
// precisar escondê-los do Explorer.)
// "files.exclude": {
// "**/.worktrees": true,
// "**/coverage": true,
// "**/dist": true,
// "**/.build": true,
// "**/.next": true,
// "**/_references": true,
// "**/_mono_repo": true,
// "**/_tasks": true,
// "**/omniroute-*.tgz": true
// },
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/.next/**": true,
"**/.build/**": true,
"**/dist/**": true,
"**/build/**": true,
"**/out/**": true,
"**/coverage/**": true,
"**/.coverage/**": true,
"**/.nyc_output/**": true,
"**/.cache/**": true,
"**/.turbo/**": true,
"**/.swc/**": true,
"**/.stryker-tmp/**": true,
"**/stryker-output-*/**": true,
"**/playwright-report/**": true,
"**/test-results/**": true,
"**/.worktrees/**": true,
"**/.claude/worktrees/**": true,
"**/electron/**": true,
"**/_references/**": true,
"**/_mono_repo/**": true,
"**/_tasks/**": true,
"**/logs/**": true,
"**/*.tgz": true,
"**/*.tsbuildinfo": true,
"**/OmniRoute-*/**": true,
"**/*-merge-*/**": true,
"**/*-worktree-*/**": true,
"**/*-issues-*/**": true,
"**/*-reorg*/**": true
},
"search.exclude": {
"**/node_modules": true,
"**/.next": true,
"**/.build": true,
"**/dist": true,
"**/build": true,
"**/out": true,
"**/coverage": true,
"**/.coverage": true,
"**/.nyc_output": true,
"**/.cache": true,
"**/.turbo": true,
"**/.swc": true,
"**/.stryker-tmp": true,
"**/stryker-output-*": true,
"**/playwright-report": true,
"**/test-results": true,
"**/.worktrees": true,
"**/.claude/worktrees": true,
"**/electron": true,
"**/_references": true,
"**/_mono_repo": true,
"**/_tasks": true,
"**/logs": true,
"**/*.tgz": true,
"**/*.tsbuildinfo": true,
"**/package-lock.json": true,
"**/OmniRoute-*": true,
"**/*-merge-*": true,
"**/*-worktree-*": true,
"**/*-issues-*": true,
"**/*-reorg*": true
}
"git.ignoreLimitWarning": true
}

View File

@@ -1,91 +0,0 @@
# .zizmor.yml — zizmor security audit configuration
# https://github.com/woodruffw/zizmor
#
# zizmor audits GitHub Actions workflows for security anti-patterns:
# • Unpinned third-party actions (supply-chain risk)
# • Script injection via ${{ github.* }} in run: steps
# • pull_request_target misuse (allows untrusted code to reach secrets)
# • Excessive permissions / overly broad GITHUB_TOKEN scopes
# • Cache poisoning via actions/cache with unguarded keys
# • … 20+ additional audits
#
# MOTIVATION (2026-03 incident): the trivy-action/LiteLLM supply-chain attack
# exploited exactly the kind of pull_request_target misconfiguration that zizmor
# detects statically. OmniRoute's npm/Docker/Electron publish workflows are high-
# value targets that warrant proactive audit.
#
# BASELINE STRATEGY: this file starts with an EMPTY ignores list. As zizmor is
# first run against the existing workflows, findings will be reviewed:
# • True positives → fix the workflow (preferred)
# • Accepted risk → add an entry below with a justification comment
# This enforces the same stale-enforcement discipline as other allowlists in
# this project: every ignore requires human sign-off and is subject to review
# at each release cycle.
#
# RATCHET: zizmorFindings metric in quality-baseline.json (direction: down)
# starts advisory; current baseline is frozen at first green run; new findings
# must be remediated or explicitly ignored here.
# ── Global settings ──────────────────────────────────────────────────────────
# Uncomment to pin to a specific minimum severity level.
# min-severity: low # low | medium | high | critical (default: low = all)
# ── Per-rule ignores ─────────────────────────────────────────────────────────
# zizmor ≥1.0 replaced the old top-level `ignores:` list with a `rules:` map
# keyed by audit id. Per-rule config lives under `rules.<audit-id>.ignore`,
# where each entry is `filename` or `filename:line` (line optional, column
# further-optional). See: https://docs.zizmor.sh/configuration/
#
# Format:
# rules:
# <zizmor-audit-id>: # e.g. "unpinned-uses", "template-injection"
# ignore:
# - <workflow-filename> # ignore this audit across the file
# - <workflow-filename>:<line> # or scope to a specific line
#
# Example (do not uncomment without real justification):
#
# rules:
# unpinned-uses:
# # actions/checkout@v6 is pinned at the major-version tag intentionally:
# # GitHub-managed first-party action; SHA pinning buys little against a
# # GitHub-side compromise and adds significant maintenance burden.
# ignore:
# - ci.yml
# Every entry below is an explicit, justified ignore (same stale-review
# discipline as the other allowlists in this project). New ignores require a
# per-rule entry with a justification comment.
rules:
dangerous-triggers:
# workflow_run only starts the deploy after a successful push/release/dispatch
# in this repository on main, release/v*, or version refs (deploy-vps.yml `if:`).
# The privileged job neither checks out that run's code nor downloads its
# artifacts. workflow_dispatch and DEPLOY_ENABLED remain operator controls.
# Keep this one event-specific exception under release review.
#
# omni-queue.yml (the omni-queue merge queue) uses `pull_request_target`
# (labeled/unlabeled/synchronize/closed) and `workflow_run` (CI / Quality Gates
# completed on omni-queue/**) only to bind label approvals and to wake its tick.
# Not exploitable:
# • No checkout of PR code, ever: both jobs check out the DEFAULT branch
# (sparse: scripts/merge-queue + config/merge-queue, persist-credentials:
# false) and run zero-dependency Node scripts (no npm ci). PR content is
# handled only as git objects and through the REST API.
# • No expression is expanded inside a `run:` body; event data and dispatch
# inputs reach the scripts through `env:` only.
# • Writes use a GitHub App installation token minted per job with minimum
# permissions (approval: statuses/issues write; tick: contents, workflows,
# pull-requests, issues, statuses write + checks/actions read — workflows
# write only because GitHub refuses an App push of a commit that touches
# .github/workflows/**, which a batched PR's merge commit may carry;
# statuses write for the omni-queue/land status release rulesets require).
# • The App key and the owner's OMNI_QUEUE_LAND_TOKEN live in the
# `omni-queue` environment (default branch only, by its exact name); both
# jobs run in it and only for pull requests into release/v*; the land
# token reaches the tick step only.
# • Kill switch: every job requires vars.OMNI_QUEUE_ENABLED == 'true'.
# Accepted risk, re-review at the next release cycle (added 2026-11-13).
ignore:
- deploy-vps.yml
- omni-queue.yml

View File

@@ -1,4 +0,0 @@
node_modules
dist
*.log
.DS_Store

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2026 OmniRoute contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,191 +0,0 @@
# @omniroute/opencode-plugin-v2
OpenCode v2 plugin (`define({ id, setup })`, Promise API) that publishes the live OmniRoute catalog — models from `/v1/models`, combos from `/api/combos` (least-common-denominator join), enrichment (names + pricing), and usable-provider filtering — into the v2 `catalog.transform`, with `key` + `env` auth via `integration.transform`.
Companion to `@omniroute/opencode-plugin` (OpenCode v1, same repo). The two packages are independent: this one carries its own catalog-mapping logic and the v1 plugin is left untouched.
## Install
```sh
npm install @omniroute/opencode-plugin-v2
```
`opencode.json`:
```json
{
"plugins": [
{
"package": "@omniroute/opencode-plugin-v2",
"options": {
"providerId": "omniroute",
"baseURL": "http://localhost:20128"
}
}
]
}
```
### Local `file://` install
OpenCode resolves a local plugin **directory** by probing the subpaths
`server.*` / `index.*` (then `tui`, `rpc`) at the package root — it never
reads `package.json` `main`/`exports`. A folder exposing only `dist/` is
therefore silently skipped (no `loading plugin`, no error).
This package ships a root `server.js` re-exporting `./dist/index.js` for
exactly that probe, so pointing OpenCode at a local checkout works:
```json
{
"plugins": [
{
"package": "file:///path/to/OmniRoute/@omniroute/opencode-plugin-v2",
"options": {
"providerId": "omniroute",
"baseURL": "http://localhost:20128"
}
}
]
}
```
Prerequisites when targeting a folder: run `npm run build` first (the root
`server.js` re-exports `./dist/index.js`), and keep the folder's root
`server.js` — `dist/` alone is not resolvable by the host.
## Credentials
The plugin needs a gateway key to read the catalog, and looks for one in this
order:
1. **The credential you connected in OpenCode.** The plugin registers an
integration, so `opencode auth` (or the Connect action in the model picker)
can store a key for it. Nothing is written to `opencode.json` — this is the
recommended route.
2. **`apiKey` in the plugin options**, when you want a per-project override.
Remember that this puts the key in a config file you may be committing.
3. **`OMNIROUTE_API_KEY` in the environment.**
If none of the three yields a key, the catalog is empty and the plugin says so
once at startup rather than leaving you with a silent empty model list.
### The management token is a different key
Combos, provider health and enrichment (display names, pricing, free-tier
budgets) come from the gateway's `/api/*` endpoints, which most deployments
gate behind a **management** token rather than the inference key. Set it
explicitly:
```json
"options": {
"baseURL": "http://localhost:20128",
"managementReadToken": "<management read token>"
}
```
The token can also come from the `OMNIROUTE_MANAGEMENT_API_KEY` environment
variable (the option wins when both are set). Resolution order:
`managementReadToken` option, then `OMNIROUTE_MANAGEMENT_API_KEY`, then the
`apiKey` fallback.
Left unset, `managementReadToken` falls back to `apiKey` for backwards
compatibility, and the plugin warns once at startup that the fallback is
active. When a gateway rejects that fallback, the catalog still
publishes — but with raw model ids instead of display names, no canonical
alias dedupe, no pricing and no combos. The plugin warns once per endpoint
when this happens, naming the endpoint and the consequence, so the degraded
catalog is never a mystery. Environment variables must reach the opencode
server process: when the host runs as a service, export the key where the
server reads it, not only in the shell that runs `opencode models`.
## Options
| Key | Default | Notes |
| --------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `providerId` | `"omniroute"` | Provider id and integration id; models publish under `<providerId>/...` |
| `baseURL` | required | OmniRoute gateway root (no `/v1` suffix needed) |
| `apiKey` | connected credential, then `OMNIROUTE_API_KEY` | Chat key for `/v1/*` — see [Credentials](#credentials) |
| `managementReadToken` | option, then `OMNIROUTE_MANAGEMENT_API_KEY`, then `apiKey` | Management key for `/api/*` (combos, providers, enrichment) — usually **not** the same key |
| `displayName` | `"OmniRoute"` | Provider display name |
| `timeoutMs` | `10000` | Per-endpoint fetch timeout |
| `modelCacheTtlMs` | `300000` | Catalog cache TTL and background refresh period (minimum 60000 ms): the served catalog follows the gateway within this window, with no service restart; disk snapshot warms cold starts |
| `timeouts` | per-endpoint override | `{ models, combos, enrichment }` in ms; falls back to `timeoutMs` (`autoCombos` still parses but is ignored — the virtual-entries route is no longer requested) |
| `enrichment` | `true` | Fetch names + pricing (`/api/pricing*`, `/api/free-tier/summary`) |
| `providerTag` | `true` | Toggle the trailing editor parenthesis: `Provider - Model (Editor)`. The provider (the route that serves the model: Openrouter, Opencode-go, Nvidia for `nvidia/...` ids) is always shown; the editor (who made the model: MoonshotAI, Meta, DeepSeek) appears only in the parenthesis. Example: `Openrouter - MoonshotAI: Kimi K 3.1 Pro` -> `Openrouter - Kimi K 3.1 Pro (MoonshotAI)`. The parenthesis is omitted when the editor shares the provider's name. Set `false` to drop it. |
| `geminiSanitization` | `true` | Strip `$schema`/`additionalProperties` from tool schemas sent to Gemini models (`$ref` tools are forwarded untouched) |
| `usableOnly` | `false` | Filter to healthy provisioned providers (`/api/providers`) |
| `combosSource` | `"api"` | Combo source. `"api"` reads `/api/combos` and publishes a combo only when every member passes the filters; `"models"` skips that request and publishes the combo rows `/v1/models` serves. Any preset, `usableOnly`, `providersAllow` or visible/hidden list keeps `"api"` |
| `freeOnly` / `toolsOnly` / `visionOnly` | `false` / `false` / `false` | Filter to free-tier / tool-calling / image-input models; combos with a filtered member are dropped, never partial. Presets filter the pool before the default view ranks it, and a combo publishes only when every resolved member passes (dropped when a member fails or none resolves) |
| `freeSignals` | `["declared"]` | Extra signals that admit a model under `freeOnly`: `priced`, `named`, `provider-named` (see below) |
| `freeProviders` | none | Provider prefixes counted as free by `provider-named` |
| `showcasePerOwner` | `10` | Default-view entries kept per provider |
| `freshPerOwner` | `10` | Default-view fresh entries kept per provider |
| `freshWindowDays` | `90` | Freshness window in days for the fresh branch |
| `usageMemory` | `true` | Restore statically dropped entries named by 30-day usage analytics (needs a management token; inert without one) |
| `visibleModels` / `hiddenModels` | `[]` | Exact (`cc/keep-me`), suffix (`keep-me`), or branch (`prefix/*`) entries ; deny wins ; `"*"` publishes the full catalog and skips narrowing |
| `providersAllow` | `[]` | Provider allowlist by flat name, or branch claim (`prefix/*`) for exhaustive mode ; a branch claim names a branch, a flat entry names a provider prefix |
| `combos` | `true` | Set to `false` to hide every combo (no `/api/combos` request, no combo rows from `/v1/models`) ; models are unchanged |
| `apiFormat.allowAnthropic` | `false` | Route allowlisted ids to the Anthropic API block |
| `apiFormat.anthropicModels` | `[]` | Full model ids routed to Anthropic |
| `apiFormat.anthropicPrefixes` | v1 defaults | Deprecated, warns once — prefer `anthropicModels` |
| `logLevel` / `startupDebug` | `warn` / `false` | Logger verbosity |
`toolsOnly` is off by default, so the full catalog is published. Set
`toolsOnly: true` to hide models without tool calling from the host picker —
useful for agent sessions that call tools on almost every turn. It does not cap
the catalog size, and a very large catalog can still slow the host picker (see
[opencode#47615](https://github.com/anomalyco/opencode/issues/47615)).
Usage memory is on by default. Without a management token it stays inert
(a startup notice is logged) and nothing is restored — the picker stays filtered.
`"*"` publishes the full catalog and ignores showcase and fresh narrowing.
A visible branch keeps a combo when any member is in the branch ; `hiddenModels` removes the same combo the same way. Combos are filtered by members, not by combo id.
A visible entry pins its branch : the whole branch is published, including rows the default view would drop (retired rows, rows past the fresh and showcase caps) ; capability filters and `usableOnly` still apply.
## Inferred free models
`freeOnly` keeps the models the free-tier catalog classifies. That list can lag what the gateway serves, so `freeSignals` lets you opt into a few weaker signals. The default stays `["declared"]`; nothing changes unless you set it. Models admitted by an inferred signal are labelled `(free, inferred)`.
| Signal | Admits a model when |
| ---------------- | ----------------------------------------------------------------------------------------------- |
| `priced` | the pricing table lists `input` and `output` at `0` for its `<provider>/<model>` id |
| `named` | its id ends in `-free` or `:free` and the pricing table holds no price for it (any price field) |
| `provider-named` | its provider prefix ends in `-free`, or is listed in `freeProviders` |
```json
{ "freeOnly": true, "freeSignals": ["declared", "priced", "named"] }
```
What the signals do not do:
- A declared classification always wins. `one-time-initial` and `discontinued` entries are never promoted, and any price field other than zero (`input`, `output`, `cacheRead`, `cacheWrite`) vetoes every inferred signal.
- Bare ids (no provider prefix) are never inferred, and a price stored under a bare id is ignored.
- Router entries (an `auto` or `auto-*` segment after the provider prefix) carry a placeholder zero price, so `priced` skips them. Routers whose price depends on the routed target (`pareto-code`, `bodybuilder`) are not recognised and may be admitted by `priced`, `named` or `provider-named`.
- `freeProviders` matches the provider prefix as served or its alias/canonical twin, case-insensitively.
- With `provider-named` on, no overlay is needed, so the empty-overlay warning is not issued; with the other signals it still is when the overlay is fully empty.
- A zero price can also mean a trial credit or a quota the pricing table does not model. Treat `(free, inferred)` as "looks free", not as a contract.
## Tool calling on Gemini models
Gemini answers `400 INVALID_ARGUMENT` — for the whole request, not just the
offending tool — when a tool declaration carries `$schema` or
`additionalProperties`. Anything that emits standard JSON Schema therefore
breaks tool calling as soon as the chain routes to Gemini.
The plugin strips those keywords from tool schemas bound for a Gemini model of
this provider, and leaves every other request untouched. A tool carrying a
`$ref` is forwarded untouched instead of stripped: removing the reference
would widen the schema to "accept anything". Set
`"geminiSanitization": false` to turn it off.
## Migrating from the v1 plugin
The v2 plugin publishes provider id `X` bare. The v1 plugin published `opencode-X` (native-adapter gate). Sessions pinned to `opencode-X/...` must re-select the model under `X/...`.
## License
MIT

View File

@@ -1,9 +0,0 @@
# Release process — `@omniroute/opencode-plugin-v2`
## Publishing
One package, no ordering: bump `@omniroute/opencode-plugin-v2` (`npm version patch`) and publish it. The plugin carries its own copy of the mapping logic, so a release never has to be coordinated with another package.
## Migration note (`opencode-X` → `X`)
The v1 plugin published provider id `opencode-X` (native-adapter gate). The v2 plugin publishes `X` bare. Sessions pinned to `opencode-X/...` resolve `ModelUnavailableError` — users must re-select the model under `X/...`.

File diff suppressed because it is too large Load Diff

View File

@@ -1,72 +0,0 @@
{
"name": "@omniroute/opencode-plugin-v2",
"version": "0.1.0",
"description": "OmniRoute OpenCode plugin (v2 Promise API): catalog transform with models, combos, enrichment, and naming.",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"files": [
"dist",
"server.js",
"README.md",
"LICENSE"
],
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",
"test": "node --import tsx/esm --test tests/*.test.ts",
"prepublishOnly": "npm run clean && npm run build && npm test"
},
"dependencies": {
"zod": "^4.6.7"
},
"devDependencies": {
"@opencode/plugin": "2.1.4",
"@types/node": "^22.19.19",
"tsup": "^8.5.1",
"tsx": "^4.22.3",
"typescript": "^5.9.3"
},
"engines": {
"node": ">=22.22.3"
},
"license": "MIT",
"author": "OmniRoute contributors",
"repository": {
"type": "git",
"url": "https://github.com/cheaper-inference/OmniRoute.git",
"directory": "@omniroute/opencode-plugin-v2"
},
"homepage": "https://github.com/cheaper-inference/OmniRoute/tree/main/%40omniroute/opencode-plugin-v2#readme",
"bugs": {
"url": "https://github.com/cheaper-inference/OmniRoute/issues"
},
"keywords": [
"omniroute",
"opencode",
"opencode-plugin",
"opencode-v2",
"ai-sdk",
"openai-compatible",
"provider",
"catalog",
"combos",
"gemini"
],
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"@opencode/plugin": ">=2.0.12 <3"
},
"overrides": {
"esbuild": "^0.28.1",
"zod": "$zod"
}
}

Some files were not shown because too many files have changed in this diff Show More