feat(workflows): scope README regen and enforce reviewer ordering#452
Conversation
|
Warning Review limit reached
More reviews will be available in 23 minutes and 27 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces changes to the label governance policy, updates documentation regarding orphan-label cleanup, and refactors the label synchronization and meta agent scripts. The updates allow specifying allowed extra labels during synchronization and processing explicit file lists in the meta agent. The review feedback highlights two robustness issues in scripts/agents/meta.agent.js: first, missing files in the explicit file list can cause the script to crash with an ENOENT error; second, CLI argument parsing for the --files flag can mistakenly consume subsequent flags (like --verbose) as file paths if no value is provided.
| const files = | ||
| Array.isArray(explicitFiles) && explicitFiles.length > 0 | ||
| ? explicitFiles | ||
| : globSync(pattern, { | ||
| cwd: process.cwd(), | ||
| ignore: ["node_modules/**", ".git/**", "**/node_modules/**"], | ||
| }); |
There was a problem hiding this comment.
If any of the explicitly provided file paths in explicitFiles do not exist (e.g., due to a typo or a deleted file in a pull request), fs.readFileSync will throw an ENOENT error and crash the entire script. Since processAllMarkdownFiles does not catch errors per file, this prevents any other files from being processed.
Filtering explicitFiles to only include existing files (and logging a warning for missing ones) prevents fatal crashes and improves the robustness of the workflow.
const files =
Array.isArray(explicitFiles) && explicitFiles.length > 0
? explicitFiles.filter((f) => {
const exists = fs.existsSync(f);
if (!exists) {
console.warn('[meta-agent] Warning: Explicit file not found: ' + f);
}
return exists;
})
: globSync(pattern, {
cwd: process.cwd(),
ignore: ['node_modules/**', '.git/**', '**/node_modules/**'],
});| const filesArgIndex = process.argv.findIndex((arg) => arg === "--files"); | ||
| const fileList = | ||
| filesArgIndex > -1 && process.argv[filesArgIndex + 1] | ||
| ? process.argv[filesArgIndex + 1] | ||
| .split(",") | ||
| .map((f) => f.trim()) | ||
| .filter(Boolean) | ||
| : []; |
There was a problem hiding this comment.
If the --files flag is passed without a value or is immediately followed by another flag (e.g., node meta.agent.js --files --verbose), the current argument parsing logic will treat the next flag (e.g., --verbose) as the comma-separated list of files. This will cause the script to attempt to process --verbose as a file path and crash.
Adding a check to ensure the next argument does not start with - prevents flags from being incorrectly parsed as file names.
| const filesArgIndex = process.argv.findIndex((arg) => arg === "--files"); | |
| const fileList = | |
| filesArgIndex > -1 && process.argv[filesArgIndex + 1] | |
| ? process.argv[filesArgIndex + 1] | |
| .split(",") | |
| .map((f) => f.trim()) | |
| .filter(Boolean) | |
| : []; | |
| const filesArgIndex = process.argv.findIndex((arg) => arg === '--files'); | |
| const nextArg = filesArgIndex > -1 ? process.argv[filesArgIndex + 1] : undefined; | |
| const fileList = | |
| nextArg && !nextArg.startsWith('-') | |
| ? nextArg | |
| .split(',') | |
| .map((f) => f.trim()) | |
| .filter(Boolean) | |
| : []; |
🔍 Reviewer Summary for PR #452CI Status: ✅ Recommendations
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afd4c4ed5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| run: | | ||
| git config user.name "lightspeed-bot" | ||
| git config user.email "ops@lightspeedwp.agency" | ||
| git add -A |
There was a problem hiding this comment.
Restrict README commit to README paths
On push events where this workflow finds any impacted README, meta.agent.js --files ... still rewrites .github/metrics/meta-metrics.json with a fresh timestamp on every run, even when the README content is unchanged. Because this step stages the whole worktree with git add -A, the workflow will create noisy chore(readme) commits containing metrics or any other incidental generated files instead of only README updates; stage only the resolved README paths or suppress metrics for this workflow.
Useful? React with 👍 / 👎.
Summary
#67)#69)#95)Changes
#67README regeneration scope/concurrency.github/workflows/readme-regen.ymlmeta.agent --filesreadme-regen-${{ github.ref }}.github/workflows/meta.ymlMETA_SKIP_README=truefor meta-agent run to avoid duplicate/conflicting README writesscripts/agents/meta.agent.js--filessupport for targeted processingMETA_SKIP_READMEhandling#69CodeRabbit-before-reviewer enforcement.github/workflows/reviewer.ymlcoderabbit-gatejob that waits forCodeRabbitstatus context success on PR head SHA#95orphan-label policy disposition.github/label-governance-policy.ymlnever_delete_labelsscripts/agents/includes/label-sync.jsAllowed extracountdocs/ISSUE_LABELS.mdValidation
npx eslint scripts/agents/meta.agent.js scripts/agents/includes/label-sync.jsnpx markdownlint-cli2 docs/ISSUE_LABELS.mdnpx spectral lint .github/workflows/reviewer.yml .github/workflows/readme-regen.yml .github/workflows/meta.yml --ruleset .spectral-workflows.cjsnode scripts/validation/validate-labeling-configs.cjsnode scripts/validation/validate-workflows.jsLinks