Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c6773bf
chore(codex): bootstrap PR for issue #1407
github-actions[bot] Feb 9, 2026
acf118d
Add maxAgeSeconds parsing and timestamp precedence
Feb 9, 2026
68a54eb
chore: sync template scripts
github-actions[bot] Feb 9, 2026
f2495c2
Add minimatch glob filtering for connector paths
Feb 9, 2026
e827702
chore: sync template scripts
github-actions[bot] Feb 9, 2026
d14e74b
fix: remove file: dependency from scripts/package.json to fix npm ins…
stranske Feb 9, 2026
0df9f5e
chore(codex-keepalive): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
821e0d4
refactor: drop custom glob converter
Feb 9, 2026
e4d9b99
chore: sync template scripts
github-actions[bot] Feb 9, 2026
46b71de
refactor: use minimatch module for globs
Feb 9, 2026
aed0a0a
chore: sync template scripts
github-actions[bot] Feb 9, 2026
c5d8e30
Add connector glob and dismissal flow tests
Feb 9, 2026
88335d1
fix: resolve CI failures
codex Feb 9, 2026
f3c0828
fix: resolve CI failures
Feb 9, 2026
701dee6
test: expand connector exclusion coverage
Feb 9, 2026
71e03d2
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
a630156
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
7af304f
Add connector path filtering helpers
Feb 9, 2026
512b357
chore: sync template scripts
github-actions[bot] Feb 9, 2026
ebfa56b
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
dc2bb5d
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
f7e44fc
chore(autofix): formatting/lint
github-actions[bot] Feb 9, 2026
8896516
test: cover glob include patterns in connector filtering
Feb 9, 2026
b26dbfb
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
ad71cef
chore(autofix): formatting/lint
github-actions[bot] Feb 9, 2026
4b80b89
chore(codex-keepalive): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
c186b38
chore(autofix): formatting/lint
github-actions[bot] Feb 9, 2026
c51ea19
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
741db84
fix: resolve CI failures
Feb 9, 2026
1162743
chore: sync template scripts
github-actions[bot] Feb 9, 2026
dc2a0e0
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
e89b388
Add end-to-end dismissal test for .agents comments
Feb 9, 2026
2d0fedf
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
9cdccb0
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
5eab08a
chore(codex-autofix): apply updates (PR #1409)
github-actions[bot] Feb 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 206 additions & 0 deletions .github/scripts/__tests__/bot-comment-dismiss.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,76 @@ describe('bot-comment-dismiss', () => {
assert.deepStrictEqual(deleted, [7]);
});

it('runs end-to-end dismissal flow and leaves no remaining .agents comments', async () => {
const comments = [
{
id: 71,
path: '.agents/issue-71-ledger.yml',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:10.000Z',
dismissed: false,
},
{
id: 72,
path: '.agents/notes.md',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:10.000Z',
dismissed: false,
},
{
id: 73,
path: 'src/app.js',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:10.000Z',
dismissed: false,
},
];

const github = {
rest: {
pulls: {
listReviewComments: async () => ({
data: comments.filter((comment) => !comment.dismissed),
}),
deleteReviewComment: async ({ comment_id }) => {
const match = comments.find((comment) => comment.id === comment_id);
if (match) {
match.dismissed = true;
}
},
},
},
};

const originalFetch = globalThis.fetch;
globalThis.fetch = async () => {
throw new Error('Network access disabled during test');
};

try {
const result = await autoDismissReviewComments({
github,
owner: 'octo',
repo: 'repo',
pullNumber: 123,
ignoredPaths: ['.agents/**'],
botAuthors: ['copilot[bot]'],
maxAgeSeconds: 60,
now: Date.parse('2026-02-08T12:00:20.000Z'),
});

const remainingAgents = comments.filter(
(comment) => comment.path.startsWith('.agents/') && !comment.dismissed
);

assert.deepStrictEqual(result.dismissable.map((item) => item.id), [71, 72]);
assert.deepStrictEqual(remainingAgents, []);
assert.strictEqual(comments.find((comment) => comment.id === 73).dismissed, false);
} finally {
globalThis.fetch = originalFetch;
}
});

it('tracks failures when dismissal fails', async () => {
const github = {
rest: {
Expand All @@ -257,4 +327,140 @@ describe('bot-comment-dismiss', () => {
assert.equal(result.failed.length, 1);
assert.equal(result.failed[0].id, 99);
});

it('dismisses all ignored-path comments and leaves no .agents comments behind', async () => {
const originalFetch = globalThis.fetch;
globalThis.fetch = () => {
throw new Error('Network disabled in test');
};

const comments = [
{
id: 70,
path: '.agents/issue-70-ledger.yml',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:10.000Z',
},
{
id: 71,
path: '.agents/issue-71-ledger.yml',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:12.000Z',
},
{
id: 72,
path: 'src/app.js',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:10.000Z',
},
];

const github = {
rest: {
pulls: {
listReviewComments: async () => ({ data: comments.slice() }),
deleteReviewComment: async ({ comment_id }) => {
const index = comments.findIndex((comment) => comment.id === comment_id);
if (index !== -1) {
comments.splice(index, 1);
}
},
},
},
};

try {
await autoDismissReviewComments({
github,
owner: 'octo',
repo: 'repo',
pullNumber: 123,
ignoredPaths: ['.agents/**'],
botAuthors: ['copilot[bot]'],
maxAgeSeconds: 60,
now: Date.parse('2026-02-08T12:00:30.000Z'),
});

const remaining = await github.rest.pulls.listReviewComments();
const remainingAgents = remaining.data.filter((comment) => comment.path.startsWith('.agents/'));

assert.strictEqual(remainingAgents.length, 0);
assert.deepStrictEqual(
remaining.data.map((comment) => comment.id).sort((a, b) => a - b),
[72]
);
} finally {
if (originalFetch === undefined) {
delete globalThis.fetch;
} else {
globalThis.fetch = originalFetch;
}
}
});

it('dismisses all ignored-path comments without network access', async () => {
const https = require('node:https');
const originalRequest = https.request;
https.request = () => {
throw new Error('Network disabled in test');
};

const deleted = [];
const comments = [
{
id: 201,
path: '.agents/issue-201-ledger.yml',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:05.000Z',
},
{
id: 202,
path: 'src/app.ts',
user: { login: 'copilot[bot]' },
created_at: '2026-02-08T12:00:05.000Z',
},
{
id: 203,
path: '.agents/issue-203-ledger.yml',
user: { login: 'coderabbitai[bot]' },
created_at: '2026-02-08T12:00:05.000Z',
},
];
const github = {
rest: {
pulls: {
listReviewComments: async () => ({ data: comments }),
deleteReviewComment: async ({ comment_id }) => {
deleted.push(comment_id);
},
},
},
};

try {
const result = await autoDismissReviewComments({
github,
owner: 'octo',
repo: 'repo',
pullNumber: 123,
ignoredPaths: ['.agents/**'],
botAuthors: ['copilot[bot]', 'coderabbitai[bot]'],
maxAgeSeconds: 60,
now: Date.parse('2026-02-08T12:00:30.000Z'),
});

assert.deepStrictEqual(result.dismissable, [
{ id: 201, path: '.agents/issue-201-ledger.yml', author: 'copilot[bot]' },
{ id: 203, path: '.agents/issue-203-ledger.yml', author: 'coderabbitai[bot]' },
]);
assert.deepStrictEqual(deleted, [201, 203]);

const remainingIgnored = comments.filter(
(comment) => comment.path.startsWith('.agents/') && !deleted.includes(comment.id)
);
assert.deepStrictEqual(remainingIgnored, []);
} finally {
https.request = originalRequest;
}
});
});
66 changes: 66 additions & 0 deletions .github/scripts/__tests__/connector-exclusion-smoke.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,70 @@ describe('connector-exclusion-smoke', () => {
]);
assert.deepStrictEqual(result.kept, ['src/index.js']);
});

it('excludes .agents paths even when include patterns are broad', () => {
const input = [
'.agents/issue-test-ledger.yml',
'src/app.ts'
];

const result = filterPaths(input, { PR_CONTEXT_INCLUDE_PATTERNS: '**/*' });

assert.deepStrictEqual(result.ignored, ['.agents/issue-test-ledger.yml']);
assert.deepStrictEqual(result.kept, ['src/app.ts']);
});

it('filters a repo-style file list before downstream processing', () => {
const input = [
'.agents/issue-test-ledger.yml',
'src/app.ts',
'src/other.ts'
];

const result = filterPaths(input);

assert.deepStrictEqual(result.kept, ['src/app.ts', 'src/other.ts']);
assert.deepStrictEqual(result.ignored, ['.agents/issue-test-ledger.yml']);
});

it('respects minimatch semantics for include patterns', () => {
const input = [
'src/a.ts',
'src/b.ts',
'src/c.ts',
'.agents/issue-1234-ledger.yml'
];

const result = filterPaths(input, { PR_CONTEXT_INCLUDE_PATTERNS: 'src/[ab].ts' });

assert.deepStrictEqual(result.kept, ['src/a.ts', 'src/b.ts']);
assert.deepStrictEqual(result.ignored, ['src/c.ts', '.agents/issue-1234-ledger.yml']);
});

it('supports brace expansion include patterns', () => {
const input = [
'src/app.ts',
'src/view.tsx',
'src/app.js',
'.agents/issue-1234-ledger.yml'
];

const result = filterPaths(input, { PR_CONTEXT_INCLUDE_PATTERNS: 'src/*.{ts,tsx}' });

assert.deepStrictEqual(result.kept, ['src/app.ts', 'src/view.tsx']);
assert.deepStrictEqual(result.ignored, ['src/app.js', '.agents/issue-1234-ledger.yml']);
});

it('supports escaped metacharacters in include patterns', () => {
const input = [
'docs/[draft].md',
'docs/draft.md',
'.agents/issue-1234-ledger.yml'
];

const result = filterPaths(input, { PR_CONTEXT_INCLUDE_PATTERNS: 'docs/\\[draft\\].md' });

assert.deepStrictEqual(result.kept, ['docs/[draft].md']);
assert.deepStrictEqual(result.ignored, ['docs/draft.md', '.agents/issue-1234-ledger.yml']);
});
});
Loading
Loading