feat: add corpus quality gates to GitHub Action - #16
Conversation
PR Summary by QodoAdd corpus quality regression gates to the composite GitHub Action
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1. Wrong manifest diff enabled
|
| export CODEX_PLUGIN_DOCTOR_ACTION_MARKDOWN="${{ inputs.markdown }}" | ||
| export CODEX_PLUGIN_DOCTOR_ACTION_SARIF="${{ inputs.sarif }}" | ||
| export CODEX_PLUGIN_DOCTOR_ACTION_CORPUS="${{ inputs.corpus }}" | ||
| export CODEX_PLUGIN_DOCTOR_ACTION_CORPUS_METRICS="$([[ -n "$CORPUS_METRICS_MANIFEST_INPUT" ]] && echo true || echo false)" |
There was a problem hiding this comment.
1. Wrong manifest diff enabled 🐞 Bug ≡ Correctness
In action.yml, CODEX_PLUGIN_DOCTOR_ACTION_CORPUS_METRICS_DIFF is derived solely from corpus-metrics-baseline being non-empty, even when corpus-metrics-manifest is missing (a configuration the script rejects and skips). This causes codex-plugin-doctor-action-manifest.json to advertise corpusMetricsDiff.enabled=true with a path to a report that will not be generated, which can break downstream steps that rely on the manifest to discover existing artifacts.
Agent Prompt
### Issue description
`CODEX_PLUGIN_DOCTOR_ACTION_CORPUS_METRICS_DIFF` is exported as `true` whenever `corpus-metrics-baseline` is non-empty, even in invalid configurations where the script skips running metrics/diff (e.g., baseline provided without manifest). This makes the generated `codex-plugin-doctor-action-manifest.json` inaccurate.
### Issue Context
The action explicitly treats `corpus-metrics-baseline` (and regression gating) as requiring `corpus-metrics-manifest`, but the manifest “enabled” flags are computed later from inputs alone.
### Fix Focus Areas
- action.yml[262-283]
- action.yml[331-332]
- action.yml[345-376]
### Suggested fix
Introduce explicit booleans (e.g., `corpus_metrics_enabled`, `corpus_metrics_diff_enabled`) initialized to `false` and set them to `true` only in the branches where the corresponding `run_doctor` call is actually scheduled (attempted). Export `CODEX_PLUGIN_DOCTOR_ACTION_CORPUS_METRICS*` from these booleans rather than from raw input presence.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| else | ||
| run_doctor "corpus metrics" doctor corpus metrics --manifest "$CORPUS_METRICS_MANIFEST_INPUT" --json --output "$corpus_metrics_path" | ||
|
|
||
| if [[ -n "$CORPUS_METRICS_BASELINE_INPUT" && -f "$corpus_metrics_path" ]]; then |
There was a problem hiding this comment.
2. Baseline file not validated 🐞 Bug ☼ Reliability
The action runs doctor corpus metrics diff whenever corpus-metrics-baseline is non-empty, but it does not verify that the baseline path exists before invoking the CLI. This turns a simple configuration/path problem into a runtime CLI failure with less targeted messaging, and it’s avoidable in the action script.
Agent Prompt
### Issue description
The regression diff block checks that the newly generated `after` report exists, but does not validate that `CORPUS_METRICS_BASELINE_INPUT` points to an existing file before calling `codex-plugin-doctor doctor corpus metrics diff`.
### Issue Context
This is inside the new corpus quality gates section in the composite action.
### Fix Focus Areas
- action.yml[273-281]
### Suggested fix
Before building `corpus_metrics_diff_args`, add a baseline existence check, e.g.:
- If `[[ ! -f "$CORPUS_METRICS_BASELINE_INPUT" ]]`, print a clear message (baseline missing/unreadable) and `record_status 2`, then skip diff.
- Otherwise proceed with the current diff invocation.
This keeps misconfiguration failures deterministic and easier to diagnose.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 973968527a
ℹ️ 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_doctor "corpus metrics" doctor corpus metrics --manifest "$CORPUS_METRICS_MANIFEST_INPUT" --json --output "$corpus_metrics_path" | ||
|
|
||
| if [[ -n "$CORPUS_METRICS_BASELINE_INPUT" && -f "$corpus_metrics_path" ]]; then | ||
| corpus_metrics_diff_args=(doctor corpus metrics diff --before "$CORPUS_METRICS_BASELINE_INPUT" --after "$corpus_metrics_path" --json --output "$corpus_metrics_diff_path") |
There was a problem hiding this comment.
Guard against overwriting the baseline metrics report
When a workflow downloads the retained baseline artifact into the same output-dir and sets corpus-metrics-baseline to $report_dir/corpus-metrics.json (the default generated report name), this command overwrites the previous report before the diff is constructed, so line 274 compares the freshly written current report to itself and --fail-on-regression can never detect a regression. Please reject identical resolved before/after paths or write the current metrics report to a separate temporary path before diffing.
Useful? React with 👍 / 👎.
Summary
Verification