Fix .agents/** exclusion: enforce connector filtering and per-comment dismissal
Why
PR #1387 addressed issue #1385, but verification returned CONCERNS because .agents/** is not fully excluded from bot review comment generation and the dismissal workflow/script integration is incomplete. This follow-up issue closes the remaining gaps by (1) enforcing .agents/** filtering at the point where review comments are created, and (2) ensuring the reusable bot comment handler dismisses only the individual comments on ignored paths (with correct pattern matching, age filtering, and structured logging), while keeping the diff tightly scoped.
Source
Tasks
Connector Configuration
Dismissal Script Enhancement
Per-Comment Dismissal Logic
Structured Logging
Scope Cleanup
Deferred Tasks (Requires Human)
The following tasks require modification of protected workflow files and must be completed by a maintainer with appropriate permissions:
Implementation guide for workflow changes:
# In .github/workflows/agents-bot-comment-handler.yml
# Replace inline dismissal blocks with:
- name: Dismiss ignored path comments
run: |
node .github/scripts/bot-comment-dismiss.js \
--maxAgeSeconds=${{ inputs.maxAgeSeconds }} \
--ignoredPaths=".agents/**" \
--pr=${{ github.event.pull_request.number }}
Acceptance Criteria
Connector Filtering
Script Integration
Pattern Matching
Per-Comment Dismissal
Logging
End-to-End Validation
Scope Control
Implementation Notes
Connector Filtering
- Add
.agents/** (or equivalent supported pattern) to the connector's ignored-paths configuration
- Ensure the ignore filter is applied at the review comment generation file-selection step (not only PR context gathering)
- The filter must run before comment payloads are constructed or any review/comment creation is attempted
- Add/extend connector unit tests to stub the changed-files list and assert
.agents/** is excluded while normal source files remain included
Dismissal Script Wiring
- Ensure
maxAgeSeconds is explicitly accepted as a command-line argument or environment variable in the script
- The script must use it to filter eligible comment dismissals by
created_at
Matching + Per-Comment Dismissal Behavior
- Implement ignored path matching using proper glob/regex matching supported by the script's dependencies (e.g., minimatch) rather than string prefix checks
- Dismiss only the individual review comment(s) whose
path matches the ignored patterns
- Do not dismiss entire reviews, and do not dismiss non-ignored comments in mixed reviews
- Add tests for:
- glob matching correctness for
.agents/** (including nested paths and negative cases)
- age window behavior via
maxAgeSeconds
- mixed-path reviews to ensure only targeted comment IDs are dismissed
- structured logging:
formatDismissLog() invoked once per dismissal and includes bot login + exact file path
Scope Control
- Revert/remove unrelated changes from the prior attempt (evaluation tweaks, caching, dependency bumps, etc.)
- The follow-up PR should only touch:
chatgpt-codex-connector/**
.github/scripts/bot-comment-dismiss.js
- plus directly-related test files only
Background (previous attempt context)
- Reliance on guidance text in
copilot-instructions.md for Copilot exclusion failed because textual guidance does not enforce configuration and does not prevent Copilot from generating review comments. Implement an enforced connector filter and/or a fallback auto-dismiss mechanism so any comments produced are removed quickly.
- Not wiring
bot-comment-dismiss.js into the workflow failed because, although the script exists, it wasn't integrated into the reusable bot comment handler. Ensure the workflow calls the script and uses maxAgeSeconds to dismiss individual review comments with proper logging.
Fix .agents/** exclusion: enforce connector filtering and per-comment dismissal
Why
PR #1387 addressed issue #1385, but verification returned CONCERNS because
.agents/**is not fully excluded from bot review comment generation and the dismissal workflow/script integration is incomplete. This follow-up issue closes the remaining gaps by (1) enforcing.agents/**filtering at the point where review comments are created, and (2) ensuring the reusable bot comment handler dismisses only the individual comments on ignored paths (with correct pattern matching, age filtering, and structured logging), while keeping the diff tightly scoped.Source
Tasks
Connector Configuration
.agents/**pattern to the connector's ignored_paths configuration file or settings object.agents/**files are excluded from the file selection resultsDismissal Script Enhancement
bot-comment-dismiss.js.agents/a/b/c.yml.agents/correctlyPer-Comment Dismissal Logic
Structured Logging
formatDismissLog()for every dismissalScope Cleanup
Deferred Tasks (Requires Human)
The following tasks require modification of protected workflow files and must be completed by a maintainer with appropriate permissions:
.github/workflows/agents-bot-comment-handler.ymlbot-comment-dismiss.jsscript using nodeImplementation guide for workflow changes:
Acceptance Criteria
Connector Filtering
.agents/(e.g.,.agents/**or equivalent supported pattern).agents/issue-test-ledger.ymlandsrc/app.ts, the connector's file-selection logic returnssrc/app.tsand excludes.agents/issue-test-ledger.ymlScript Integration
.github/scripts/bot-comment-dismiss.jsacceptsmaxAgeSecondsas an explicit input argumentmaxAgeSecondsis provided, the dismissal logic only dismisses individual review comments whosecreated_attimestamp is newer thannow - maxAgeSecondsmaxAgeSecondsfiltering is activePattern Matching
.agents/(e.g.,.agents/**matches.agents/a/b/c.yml).agents/nested/deep/file.ymlmatches.agents/**patternsrc/agents/file.tsdoes NOT match.agents/**patternPer-Comment Dismissal
.agents/issue-test-ledger.ymland one on a non-ignored pathsrc/app.ts—the script dismisses only the ignored-path commentLogging
formatDismissLog()End-to-End Validation
.agents/issue-test-ledger.yml, the dismissal script successfully dismisses all matching review comments when invoked.agents/**paths returns zero results after script executionScope Control
chatgpt-codex-connector/related to ignored_paths filtering, (2).github/scripts/bot-comment-dismiss.js, and (3) test files with names matching**/test/**/ignore*or**/test/**/dismiss*Implementation Notes
Connector Filtering
.agents/**(or equivalent supported pattern) to the connector's ignored-paths configuration.agents/**is excluded while normal source files remain includedDismissal Script Wiring
maxAgeSecondsis explicitly accepted as a command-line argument or environment variable in the scriptcreated_atMatching + Per-Comment Dismissal Behavior
pathmatches the ignored patterns.agents/**(including nested paths and negative cases)maxAgeSecondsformatDismissLog()invoked once per dismissal and includes bot login + exact file pathScope Control
chatgpt-codex-connector/**.github/scripts/bot-comment-dismiss.jsBackground (previous attempt context)
copilot-instructions.mdfor Copilot exclusion failed because textual guidance does not enforce configuration and does not prevent Copilot from generating review comments. Implement an enforced connector filter and/or a fallback auto-dismiss mechanism so any comments produced are removed quickly.bot-comment-dismiss.jsinto the workflow failed because, although the script exists, it wasn't integrated into the reusable bot comment handler. Ensure the workflow calls the script and usesmaxAgeSecondsto dismiss individual review comments with proper logging.