Skip to content

feat: AI tools ignore GitHub repo conventions - PR templates, CONTRIBUTING.md not auto-discovered #31899#31927

Closed
biisal wants to merge 2 commits into
anomalyco:devfrom
biisal:pr-push-ins
Closed

feat: AI tools ignore GitHub repo conventions - PR templates, CONTRIBUTING.md not auto-discovered #31899#31927
biisal wants to merge 2 commits into
anomalyco:devfrom
biisal:pr-push-ins

Conversation

@biisal

@biisal biisal commented Jun 11, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #31899

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR fixes the issue where pull request templates and contributing guidelines are ignored during instruction file discovery, and ensures system prompts direct the agent to check and follow them.

The Issue

  • The list of discovered instruction files was hardcoded to ["AGENTS.md", "CLAUDE.md", "CONTEXT.md"], excluding files like .github/pull_request_template.md and CONTRIBUTING.md.
  • The discovery loop in systemPaths() broke early after finding a single instruction file type (e.g., if AGENTS.md was found, it skipped looking for CLAUDE.md, CONTRIBUTING.md, etc.).
  • The system prompts lacked guidelines directing the agent to read and follow repository pull request templates, contributing guidelines, or to respect bot response deadlines.

Changes Made

  • Discovery list expansion: Added CONTRIBUTING.md and common PR template paths (.github/pull_request_template.md, .github/PULL_REQUEST_TEMPLATE.md, pull_request_template.md, PULL_REQUEST_TEMPLATE.md) to instructionFiles in instruction.ts.

  • Search loop correction: Removed the break from the project-level loop in systemPaths(). Instead of stopping after the first matched file type, it now scans for all configured files. To prevent stacking duplicate rules from ancestor directories, it only adds matches[0] (the closest file instance of each type).

  • Multi-file resolution: Updated Instruction.find to return string[] (all matching instruction files in a folder) and modified resolve to iterate and attach all resolved paths.

  • Prompt updates: Added instructions to default.txt and anthropic.txt
    prompting the model to check templates/guidelines before creating PRs, and to prioritize resolving bot-flagged issues within any response deadlines (e.g., a 2-hour edit window).

  • Testing: Added unit tests to instruction.test.ts to verify that find and resolve work with multiple concurrent instruction files.

How did you verify your code works?

1. Automated Unit Tests

Added and ran unit tests in instruction.test.ts to verify the new multi-file resolution behaviors:

  • find returns all existing instruction files in the directory: Confirmed find returns a list of all existing files in a single folder (e.g. AGENTS.md and CONTRIBUTING.md).
  • resolve returns multiple instruction files from subdirectory: Confirmed that reading a file in a subdirectory correctly resolves and attaches multiple parent instruction files.
  • loads multiple project instruction files when both exist: Verified that systemPaths and system successfully load both project AGENTS.md and CONTRIBUTING.md into the startup prompt context.
cd packages/opencode
bun test test/session/instruction.test.ts

Result: All 12 tests passed successfully.

2. Regression Testing

Ran the full session test suite to ensure the signature change to find and the updated loop structure didn't introduce any regressions:

cd packages/opencode
bun test test/session/

Result: All 364 tests passed successfully.

3. Typechecking

Ran compiler verification inside the package directory:

cd packages/opencode
bun typecheck

Result: Completed successfully with no errors.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • "How did you verify your code works?" section is empty. Please explain how you tested.
  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 11, 2026
@github-actions github-actions Bot closed this Jun 11, 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.

[BUG] AI tools ignore GitHub repo conventions - PR templates, CONTRIBUTING.md not auto-discovered

1 participant