ci: keep needs rebase labels current - #1460
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 440f9af56f
ℹ️ 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".
| PENDING_CHECK_STATES = {"EXPECTED", "IN_PROGRESS", "PENDING", "QUEUED", "REQUESTED", "WAITING"} | ||
| UNMERGEABLE_STATES = {"DIRTY", "BLOCKED"} | ||
| NEEDS_REBASE_STATES = {"CONFLICTING", "DIRTY"} | ||
| NO_REBASE_STATES = {"BLOCKED", "CLEAN"} |
There was a problem hiding this comment.
Remove stale rebase labels for mergeable statuses
When a PR keeps a stale needs rebase label and GitHub reports UNSTABLE or HAS_HOOKS, this table makes needs_rebase_label_target() preserve the label even though GitHub documents those merge-state values as mergeable/non-conflict states, and the owning spec requires removing the label for known non-conflicts; the scheduled sync can therefore continue advertising a false rebase blocker until the PR reaches CLEAN. Include those mergeable statuses here or derive removal from the mergeable field instead. GitHub docs
Useful? React with 👍 / 👎.
| The Codex label synchronization script MUST add `needs rebase` when GitHub | ||
| reports a confirmed merge conflict, MUST remove it when GitHub reports a known | ||
| non-conflict state, and MUST preserve its current value when merge state is | ||
| ambiguous. It MUST NOT infer a conflict from the pull request merely being | ||
| behind the base branch. |
There was a problem hiding this comment.
Add the required OpenSpec change artifact
This commit changes scheduled GitHub label-sync behavior and updates the main spec directly, but it does not add or update a matching openspec/changes/<slug>/ proposal/tasks/spec delta for the behavior change; this repo treats OpenSpec changes as a hard readiness gate for behavior and operator-contract changes, so the PR would be blocked even though code and tests were added. Add the change artifact for the needs-rebase sync behavior before marking this ready.
Useful? React with 👍 / 👎.
Summary
needs rebaselabel in the scheduled Codex label workflowDIRTYorCONFLICTINGmerge statesBEHIND,BLOCKED,HAS_HOOKS, andUNSTABLEUNKNOWNAPI writes
Why
The label was maintained manually, so it could remain stale after a conflict
was resolved. Base-branch lag alone is not proof that a pull request needs
conflict repair, while
BLOCKEDcommonly represents review or status policy.The existing 15-minute synchronizer already owns recurring label freshness, so
the rebase label now follows the same path.
Validation
uv run pytest tests/unit/test_sync_codex_ok_labels.py -q— 42 passeduv run ruff check .github/scripts/sync_codex_ok_labels.py tests/unit/test_sync_codex_ok_labels.pyopenspec validate sync-needs-rebase-label --strictopenspec validate --specs --strict— 47 specs passed