Skip to content

feat(agent): enforce repository contribution rules in PR drafting and submission flow - #78

Open
dangzitou with Copilot wants to merge 4 commits into
mainfrom
copilot/feat-agent-use-pr-templates
Open

feat(agent): enforce repository contribution rules in PR drafting and submission flow#78
dangzitou with Copilot wants to merge 4 commits into
mainfrom
copilot/feat-agent-use-pr-templates

Conversation

Copilot AI commented Jun 20, 2026

Copy link
Copy Markdown

OpenMeta previously generated PR metadata from its own defaults, which could produce technically valid but repository-noncompliant PRs. This change adds a contribution-rules pass so PR draft content and submission behavior align with repository-specific templates and contribution constraints.

  • Repository rules detection in workspace prep

    • Added structured RepositoryContributionRules to workspace context.
    • Detects and parses common policy sources (e.g., CONTRIBUTING.md, PR templates, CODEOWNERS-related and release/commit policy docs).
    • Extracts normalized constraints: checklist items, title/commit/branch conventions, issue-linking/release-note/validation requirements, and prior-discussion signals.
  • Rule-aware PR draft generation

    • Extended PR drafting prompt with Repository Contribution Rules context.
    • LLM now receives detected rule files, hard requirements, and PR template content to shape title/body/checklist output.
  • Rule-aware contribution PR publication

    • ContributionPrService now consumes detected rules to influence:
      • branch naming prefix selection
      • commit message style (conventional vs neutral fallback)
      • PR body composition with template + generated draft + required issue/release metadata
    • Maintains existing behavior when no repository rules are detected.
  • Submission safety gate for strong constraints

    • Added a pre-submit guard that blocks real PR opening when strong repository constraints are unsatisfied (e.g., prior maintainer discussion required, blocking validation required but failing).
    • Falls back to artifact-only flow and records explicit reasons in run warnings/UI path.
  • Traceability in generated artifacts

    • Contribution dossier now includes a dedicated Repository Contribution Rules section showing detected files and parsed constraints for run transparency.
const unsatisfiedContributionRules = this.evaluateUnsatisfiedContributionRules(
  input.workspace,
  hasBlockingValidationFailures,
);
if (unsatisfiedContributionRules.length > 0) {
  // keep artifact flow, skip real PR creation
  return { changedFiles: input.changedFiles, validationResults: input.validationResults };
}

Copilot AI changed the title [WIP] Use repository PR templates and contributing rules before draft PR creation feat(agent): enforce repository contribution rules in PR drafting and submission flow Jun 20, 2026
Copilot AI requested a review from dangzitou June 20, 2026 12:19
@dangzitou

Copy link
Copy Markdown
Collaborator

I re-audited this draft. It is currently conflicting with main, and both Ubuntu and Windows CI are failing, so it is not ready for maintainer review. The feature direction (feeding repository contribution rules into PR drafting) is still relevant, but this branch needs a fresh rebase and a focused pass over the failing validation before it can be marked ready. I’m leaving it as draft rather than asking maintainers to resolve the conflict.

@dangzitou
dangzitou force-pushed the copilot/feat-agent-use-pr-templates branch from bf2dd79 to 8586581 Compare August 30, 2026 14:55
@dangzitou

Copy link
Copy Markdown
Collaborator

Rebased onto current main and resolved the conflicts while preserving both the existing permission-policy flow and this PR's repository-contribution-rules checks. The branch now includes the contribution-rule context in PR prompts, validates required repository constraints before submission, and keeps the existing policy gate intact.

Local validation: Biome check --linter-enabled=false passes for all 159 files; tsgo --noEmit passes after resolving the repository's transitive Octokit type package; the Bun-based test/build commands could not run because Bun is not installed in this environment. GitHub CI has been kicked off by the force-push; I'm leaving the PR as draft until it reports clean.

@dangzitou

Copy link
Copy Markdown
Collaborator

The rebased branch is mergeable and Ubuntu CI passes. Windows CI still fails in the existing skill bundle rendering > export works from the packed CLI with runtime-resolved skill assets test (spawnSync npm.cmd EINVAL); this is unchanged from the latest main CI run (base e27b24b) and is outside this PR's contribution-rule changes. No safe PR-scoped code change was made for that pre-existing platform failure. The PR remains draft pending maintainer direction.

@dangzitou
dangzitou marked this pull request as ready for review August 30, 2026 15:09
@dangzitou

Copy link
Copy Markdown
Collaborator

The branch is rebased and Ubuntu CI passes; the remaining Windows failure is pre-existing on main (npm.cmd EINVAL in the skill-bundle packaging test). I have marked the PR ready for maintainer review.

@NianJiuZst
NianJiuZst self-requested a review August 30, 2026 15:10

@NianJiuZst NianJiuZst left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved by @NianJiuZst

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.

3 participants