Skip to content

Require explicit contributor agreement acceptance on pull requests - #2181

Merged
asim merged 2 commits into
mainfrom
enforce-contributor-agreement
Nov 17, 2026
Merged

asim merged 2 commits into
mainfrom
enforce-contributor-agreement

Conversation

@asim

@asim asim commented Nov 17, 2026

Copy link
Copy Markdown
Member

Adds Mu CLA v1.0 and a trusted workflow publishing the cla status on the actual PR head. Each PR author, commit author and resolvable co-author must post the exact acceptance sentence for the agreement digest, PR number and head SHA. New commits require fresh acceptance. No maintainer allowlist; bots cannot accept for humans; unresolved identities and incomplete API results fail closed.

The workflow handles PR updates and comment creation/edit/deletion. It checks out only the default branch, never executes PR code with a write token, uses no PAT, and grants only read permissions plus statuses:write. It records acceptance links in the run summary. This is prospective contribution permission and does not activate the separate runtime licence proposal in #2180 or clear historical contributions.

Validation: 13 local unit/integration tests passed, including stale head/agreement/PR, third-party acceptance, co-author ID mismatch, unresolved authors, bot-only PRs, deleted acceptance, pagination, status transitions and a head-change race. git diff --check passed. Gate tests are included in normal CI.

Activation: merge the workflow, allow pull_request_target in the Actions event policy if needed, and require the cla status from GitHub Actions for main with PRs required and no bypass/direct pushes. The GitHub connector has no administration writes; the browser is signed out. Repository rulesets currently return an empty list. Branch protection has NOT been enabled and live end-to-end enforcement has NOT been verified. The new trusted workflow cannot run from the PR's untrusted head before bootstrap merge.

Contributors must accept personally; this PR does not fabricate an acceptance for its author. Maintainers must still review ownership, employer authority and third-party code; the status verifies recorded acceptance, not legal title.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T11:23:11.388972Z 194b586 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d2e7133f1

ℹ️ 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".

Comment thread .github/scripts/cla.py
Comment on lines +99 to +101
def status(state, description):
api.request(f'{prefix}/statuses/{head}', dict(state=state, context=CONTEXT,
description=description[:140], target_url=target))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent one PR's acceptance from satisfying another PR's gate

When two open PRs share the same head SHA, their CLA results overwrite each other because both publish the same cla context on that commit. GitHub commit statuses apply to every PR involving the commit, not to an individual PR. For example, two branches or forks can open PRs at the same SHA; after one PR fails for missing acceptance, a successful verification on the other makes both appear green, although the acceptance sentence explicitly covers only the other PR number. Per-PR workflow concurrency does not prevent this. Before publishing success, verify acceptance for every applicable open PR sharing that head, or change the enforcement design so a success cannot authorize a different PR.

Useful? React with 👍 / 👎.

asim commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

Addressed the shared-head status bypass in 194b586. The gate now enumerates every open PR sharing the head SHA, independently verifies each PR's contributors and acceptance comments, and refuses success if the shared-PR population changes during verification. Runs are serialized repository-wide; closing a PR also rechecks peers. Added regression scenarios for an unsigned peer, both peers signed, and a second PR appearing during evaluation. All 13 test methods (including expanded integration scenarios) pass; git diff --check passes.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 194b586d2c

ℹ️ 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".

Comment thread .github/workflows/cla.yml
Comment on lines +12 to +14
concurrency:
group: cla-repository
cancel-in-progress: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve verification events across different PR heads

When one verification is running, deleting acceptance on an already-green PR A queues another run; a subsequent event on PR B can cancel A's pending run. GitHub's concurrency documentation confirms that pending runs are replaced by default even with cancel-in-progress: false. Since cla.py checks only the triggering PR's current head and its peers, B's run never invalidates A's existing successful status when their heads differ. This leaves A mergeable without acceptance indefinitely. Preserve queued verification work or make each surviving run reconcile all affected heads rather than only its triggering head.

Useful? React with 👍 / 👎.

Comment thread .github/scripts/cla.py
Comment on lines +93 to +94
pr = api.request(f'{prefix}/pulls/{number}')
head = pr['head']['sha']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Recheck former shared heads when a PR moves

If signed PR A and unsigned PR B share head H, verification correctly marks H as failed. However, when B pushes a new commit, its synchronize run fetches only B's new head and never reevaluates H. A consequently retains the shared failure despite now being the only PR at H and having all required acceptance. The closing-PR trigger handles departure by closure, but not departure by a head update. Reevaluate the previous head's remaining peers as well as the current head on synchronize events.

Useful? React with 👍 / 👎.

@asim
asim merged commit 5f2285b into main Nov 17, 2026
2 checks passed
@asim asim mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant